[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/net/ -> baserequestgenerator.class.php (sommaire)

\defgroup Net The Net package includes all the classes that are related to network functionality in one way or another.

Poids: 794 lignes (30 kb)
Inclus ou requis:0 fois
Référencé: 3 fois
Nécessite: 0 fichiers

Définit 1 class

BaseRequestGenerator:: (49 méthodes):
  BaseRequestGenerator()
  getSubdomainsEnabled()
  getIncludeBlogId()
  getBaseUrl()
  getScriptName()
  getIndexUrl()
  getAdminUrl()
  getRssUrl()
  getTrackbackUrl()
  getResourceServerUrl()
  getResourcesBaseUrl()
  getUrl()
  addParameter()
  reset()
  getRequest()
  postPermalink()
  postCommentLink()
  postLink()
  postRssLink()
  categoryRssLink()
  userRssLink()
  postCategoryLink()
  categoryLink()
  postUserLink()
  blogLink()
  rssLink()
  replyCommentLink()
  addShowMoreLink()
  postTrackbackLink()
  getArchiveLink()
  postTrackbackStatsLink()
  albumLink()
  parentAlbumLink()
  templatePage()
  resourceLink()
  resourcePreviewLink()
  resourceMediumSizePreviewLink()
  resourceDownloadLink()
  rawResourcePreviewLink()
  rawResourceMediumSizePreviewLink()
  rawResourceDownloadLink()
  setXHTML()
  isXHTML()
  getAtomUniqueId()
  profileLink()
  getTemplateFile()
  getTemplateLocaledFile()
  getCurrentUrl()
  getPageSuffix()


Classe: BaseRequestGenerator  - X-Ref

\ingroup Net

The BaseRequestGenerator class is some sort of proxy class that defines an interface that should be implemented
by classes wishing to provide a new request generator (plus some code that can be reused by all request
generators)

Each request generator defines its own format for its URLs, and by using request generators we can easily
change the format of our URLs without the need to alter our templates (and therefore, without the need to hardcode
URLs in our templates)

You should never create instances of BaseRequestGenerator as it defines no code for most of its methods and
will instead throw exceptions. The correct way of getting a request generator is by using the
RequestGenerator factory or whenever we have a BlogInfo object available, by using the
BlogInfo::getBlogRequestGenerator() method.

BaseRequestGenerator( $blogInfo = null )   X-Ref
Constructor. It initializes certain things such as the base url, checks whether subdomains are
enabled, etc. This method will fetch the values of the following configuration settings:

- base_url: this is the base URL that will be used to generate all other URLs in the system
- subdomains_base_url: if subdomains are enabled, we should also set this URL to something valid. We can
either use {blogname} or {username} to specify whether the URLs should be generated including the
name of the user who owns the blog or the name of the blog.
- include_blog_id_in_url
- script_name: use this setting to rename index.php to something else and still have pLog generate
URLs pointing to the right script.

param: blogInfo A valid BlogInfo object

getSubdomainsEnabled()   X-Ref

return: Returns true if subdomains are enabled

getIncludeBlogId()   X-Ref

returns: true if the blog identifier should be included in the  URL. This setting is only meaningful

getBaseUrl( $useSubdomains = true )   X-Ref
Returns the base URL that has been configured

param: useSubdomains If set to true and subdomains are enabled, it will return the base URL as specified

getScriptName()   X-Ref

return: Returns the name of the script to which for example forms will be submitted. Defaults to

getIndexUrl( $useSubdomains = true )   X-Ref

param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the main index file. This URL is built by querying the current

getAdminUrl( $useSubdomains = true )   X-Ref

param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the admin.php file. This URL is built by querying the current

getRssUrl( $useSubdomains = false )   X-Ref

param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the rss.php file. This URL is built by querying the current

getTrackbackUrl( $useSubdomains = false )   X-Ref

param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the trackback.php file. This URL is built by querying the current

getResourceServerUrl( $useSubdomains = false )   X-Ref

param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the resserver.php file. This URL is built by querying the current

getResourcesBaseUrl()   X-Ref
Returns the base URL to resources


getUrl( $res, $useSubdomains = false )   X-Ref

param: res A valid URL path
param: useSubdomains If set to true and subdomains are enabled, it will use the base URL as specified
return: Returns the URL pointing to the given parameter. This URL is built by querying the current

addParameter( $paramName, $paramValue )   X-Ref
Adds a parameter to the request

param: paramName Name of the parameter
param: paramValue Value given to the parameter

reset()   X-Ref


getRequest()   X-Ref
Returns a string representing the request. Child classes should implement this method in order
to return a meaningful URL.

return: A String object representing the request

postPermalink( $post )   X-Ref
Returns the permalink for a post. Must be implemented by child classes to generate a valid URL.

param: post The Article object
return: The link for the permalink

postCommentLink( $post )   X-Ref
Returns the comment link for a post. Must be implemented by child classes to generate a valid URL.

param: post The Article object
return: The correct string

postLink( $post )   X-Ref
Returns the link for the post. Must be implemented by child classes to generate a valid URL.

param: post The Article object
return: The link for the post

postRssLink( $post )   X-Ref
Returns the link for the post. Must be implemented by child classes to generate a valid URL.

param: post The Article object
return: The link for the post

categoryRssLink( $category, $profile = "", $blogInfo = null )   X-Ref
Returns the url for the rss feed of a category

param: category The ArticleCategory object with information about the category
param: blogInfo A BlogInfo object containing information about the blog.
return: The url pointing to the rss feed of the journal.

userRssLink( $userInfo, $profile = "" )   X-Ref
Returns the url for the rss feed of user posts. All URL generators use the same
format for this for the time being, so we'll keep the method in this base class.

param: category The UserInfo object with information about the category
return: The url pointing to the rss feed of user

postCategoryLink( $post )   X-Ref
Returns the link of a category. Must be implemented by child classes to generate a valid URL.
This method has been deprecated as of pLog 1.0 so please use the method BaseRequestGenerator::categoryLink()
which takes an ArticleCategory object instead of an Article object since this method does not support
posts that have multiple categories.

param: post The post from which we'll fetch the category and then generate the right link.
return: The url pointing to the page with only the posts belonging to that category.

categoryLink( $category )   X-Ref
Returns the link but given a category. Must be implemented by child classes to generate a valid URL.

param: An ArticleCategory object containing the information regarding the category.
return: A string with the correct url pointing to the page that will show only the posts that belong

postUserLink( $user, $category = null )   X-Ref
Returns a link to only the articles of the user. Must be implemented by child classes to generate a valid URL.

param: user The user whose posts we would like to see
param: category Optionally, we can specify an ArticleCategory object
return: A string containing the right url to only the posts of the user.

blogLink( $blogInfo = null )   X-Ref
Returns the url of the host where the blog is running. Must be implemented by child classes to generate a valid URL.

return: Returns the url where the blog is running.

rssLink( $profile = "", $blogInfo = null )   X-Ref
Returns the url where the rss feed is running. Must be implemented by child classes to generate a valid URL.

param: profile The profile whose link we'd like to return (rss090, rss10, rss20 or atom)
param: blogInfo A BlogInfo object containing information about the blog.
return: The url pointing to the rss feed of the journal.

replyCommentLink( $post, $comment )   X-Ref
Returns the url to reply to a given comment. Must be implemented by child classes to generate a valid URL.

param: post An Article object with information about the post
param: commen A UserComment object containing information about the post we'd like to reply to.
return: The right url to reply to this comment.

addShowMoreLink( $post, $maxWords, $linkText )   X-Ref
Manually adds the "show more" link in a post. Must be implemented by child classes to generate a valid URL.

param: post The post we are going to cut.
param: maxWords Amount of words we'd like to allow.
param: linkText Text we are going to show.
return: The modified link.

postTrackbackLink( $post )   X-Ref
Returns the trackback link for a given post. Must be implemented by child classes to generate a valid URL.

param: post The post with the necessary information.
return: A string representing the rdf trackback link.

getArchiveLink( $date )   X-Ref
generates an archive link given a date. Must be implemented by child classes to generate a valid URL.

param: date A String in the format yyyymm
return: A valid archive link

postTrackbackStatsLink( $post )   X-Ref
Returns the link to the page showing the trackback statistics for a given post. Must be implemented by child classes to generate a valid URL.

param: post The post with the information.
return: Returns a string with the valid link.

albumLink( $album = null )   X-Ref
Returns the link to an album. If the parameter is null or zero, then a link to the top level
album will be returned. Must be implemented by child classes to generate a valid URL.

param: album The GalleryAlbum object.

parentAlbumLink( $album )   X-Ref
Given an album, generates a link to its parent. Must be implemented by child classes to generate
a valid URL.

param: album The album

templatePage( $template )   X-Ref
Given the name of a template file, generate the right link to it. Must be implemented by child
classes to generate a valid URL.

param: template
return: A link to the given template file/static page

resourceLink( $resource )   X-Ref
Returns the link to a resource. Must be implemented by child classes to generate a valid URL.

param: album Generates the correct link to fetch a resource

resourcePreviewLink( $resource )   X-Ref
Returns the link to a resource preview

param: album Generates the correct link to fetch a resource preview

resourceMediumSizePreviewLink( $resource )   X-Ref
Returns the link to a resource preview

param: album Generates the correct link to fetch a resource preview

resourceDownloadLink( $resource )   X-Ref
Returns the link to a resource

param: resource Generates the correct link to fetch a resource

rawResourcePreviewLink( $resource )   X-Ref
Returns the link to a resource preview with raw file name, for TinyMCE use only

param: album Generates the correct link to fetch a resource preview

rawResourceMediumSizePreviewLink( $resource )   X-Ref
Returns the link to a resource preview with raw file name, for TinyMCE use only

param: album Generates the correct link to fetch a resource preview

rawResourceDownloadLink( $resource )   X-Ref
Returns the link to a resource with raw file name, for TinyMCE use only

param: resource Generates the correct link to fetch a resource

setXHTML( $enabled = true )   X-Ref
whether we should generate valid xhtml requests or not
(used for example when sending out messages, as some email clients will
go to the wrong url when using xhtml message

param: enable Whether to enable xhtml or not (enabled by default)
return: Always true

isXHTML()   X-Ref
whether xhtml mode is enabled or not

return: True if enabled or false otherwise

getAtomUniqueId( $article )   X-Ref
generates a unique atom id for the entry. This is not as easy
as it sounds, take a look http://diveintomark.org/archives/2004/05/28/howto-atom-id

param: article An Article object
return: A unique atom article id

profileLink($blogInfo = null)   X-Ref
get user profile picture link. It is not necessary for child classes to implement this method.

param: blogInfo

getTemplateFile( $file )   X-Ref
generates the correct path to a file in the template folder, without having to worry
whether the template was installed in /templates/ or in /templates/blog_X/. It is not necessary
for child classes to implement this method.

param: file
return: A string

getTemplateLocaledFile( $file )   X-Ref
generates the correct path to a file in the template folder, without having to worry
whether the template was installed in /templates/ or in /templates/blog_X/
This is locale-aware version.

param: file
return: A string

getCurrentUrl( $category = null, $userInfo = null, $date = null, $page = null )   X-Ref
given the parameters, recalculates the current URL. This method also has support
for paged urls

param: category
param: userInfo
param: date
param: page
return: the current url with its page

getPageSuffix( $page = "" )   X-Ref
Returns the page format for this URL generator

return: A page suffix



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics