Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
URLHelper Class Reference
Collaboration diagram for URLHelper:
Collaboration graph

Static Public Member Functions

static setBaseURL ($url)
static addLinkParam ($name, $value)
static bindLinkParam ($name, &$var)
static getLinkParams ()
static removeLinkParam ($name)
static getLink ($url= '', $params=NULL)
static getURL ($url= '', $params=NULL)

Detailed Description

The URLHelper class provides several utility functions (as class methods) to ease the transition from using session data to URL parameters.

The most important method is URLHelper::getLink(), which appends a number of additional parameters to a given URL. The parameters can be set using the addLinkParam() or bindLinkParam() methods.

Member Function Documentation

static addLinkParam (   $name,
  $value 
)
static

Add a new link parameter. If a parameter with this name already exists, its value will be replaced with the new one. All link parameters will be included in the link returned by getLink().

Parameters
string$nameparameter name
mixed$valueparameter value

Here is the caller graph for this function:

static bindLinkParam (   $name,
$var 
)
static

Bind a new link parameter to a variable. If a parameter with this name already exists, its value will re replaced with the binding.

This method differs from addLinkParam() in two respects:

  • The bound variable is initialized with the parameter value in the current request.
  • The parameter value is the value of the bound variable at the time getLink() is called.
Parameters
string$nameparameter name
mixed$varvariable to bind

Here is the caller graph for this function:

static getLink (   $url = '',
  $params = NULL 
)
static

Augment the given URL by appending all registered link parameters. Note that for each bound variable, its current value is used. You can use the second parameter to add futher URL parameters to this link without adding them globally. Any parameters included in the argument list take precedence over registered link parameters of the same name. This method is identical to getURL() except that it returns an entity encoded URL suitable for use in HTML attributes.

Parameters
string$urlrelative or absolute URL
array$paramsarray of additional link parameters to add
Returns
string modified URL (entity encoded)

Here is the caller graph for this function:

static getLinkParams ( )
static

Get the list of currently registered link parameters.

Returns
array list of registered link parameters
static getURL (   $url = '',
  $params = NULL 
)
static

Augment the given URL by appending all registered link parameters. Note that for each bound variable, its current value is used. You can use the second parameter to add futher URL parameters to this link without adding them globally. Any parameters included in the argument list take precedence over registered link parameters of the same name.

Parameters
string$urlrelative or absolute URL
array$paramsarray of additional link parameters to add
Returns
string modified URL

Here is the call graph for this function:

Here is the caller graph for this function:

static removeLinkParam (   $name)
static

Remove a link parameter.

Parameters
string$nameparameter name
static setBaseURL (   $url)
static

Set a base URL to be used when resolving relative URLs passed to URLHelper::getLink() and URLHelper::getURL(). Set this to NULL to use no base URL and skip the URL resolving step.

Parameters
string$urlrelative or absolute URL (or NULL)

The documentation for this class was generated from the following file: