Public Member Functions | Static Public Member Functions | Data Fields
Url Class Reference

Url manager. More...

Public Member Functions

 base ()
 
 linkTo ($controller, $action= '', $args= '')
 
 externalLinkTo ($link)
 
 linkToCurrent ()
 
 redirect ($location= '')
 
 jsRedirect ($location= '')
 
 fromTitle ($title, $lowercase=false)
 
 isSSL ()
 
 __toString ()
 

Static Public Member Functions

static getInstance ($url= '', $default_controller= '', $custom_url=array())
 

Data Fields

 $controller = null
 
 $action = null
 
 $config_url = null
 
 $custom = array()
 
 $params = array()
 
 $link = ''
 
 $instance = null
 

Detailed Description

Url manager.

Version
1.1
Author
DinuSV

Routing, redirection methods, url composition and other responsibilities of a url manager.

Member Function Documentation

static getInstance (   $url = '',
  $default_controller = '',
  $custom_url = array() 
)
static

Singleton class

Parameters
$urlstring : the current url
$default_controllerstring : the default controller set in the configuration
$custom_urlarray : custom url
base ( )

Return the base url

Returns
string
linkTo (   $controller,
  $action = '',
  $args = '' 
)

Link to a page

Parameters
$controllerstring : the controller to link to
$actionstring : optional
$argsarray/string : optional, arguments to be added
Returns
Url object
externalLinkTo (   $link)

Link to an external page

Parameters
$linkstring
Returns
Url : current object
linkToCurrent ( )

Link to the current url

Returns
Url object
redirect (   $location = '')

Simple page redirect.

Parameters
$locationstring
jsRedirect (   $location = '')

Redirect using javascript ( can be used if headers are already sent )

Parameters
$locationstring
fromTitle (   $title,
  $lowercase = false 
)

Creates a friendly title url

Parameters
$titlestring : the title
$lowercaseboolean : if true, the title will converted to lowercase
Returns
string : the new title
isSSL ( )

Check if the connection is SSL

Returns
bool
__toString ( )

toString method override

Returns
string

Field Documentation

$controller = null

string : Name of the controller in use

$action = null

string : Method of controller in use

$config_url = null

s

string : Base url set in config file

$custom = array()

array : Custom urls

$params = array()

array : Params set to the current method of the controller

$link = ''

string : Temporary link to link to

$instance = null

Url : Singleton instance