An URL container

copyright CONTREXX CMS - COMVATION AG
author Comvation Development Team
access public
version 3.0.0
package contrexx
subpackage core_routing
todo Edit PHP DocBlocks!

 Methods

Initializes $domain and $path.

__construct(string $url) 

Parameters

$url

string

http://example.com/Test

Returns URL without hostname for use in internal links.

__toString() : \Cx\Core\Routing\type

Use $this->toString() for full URL including protocol and hostname

todo this should only return $this->protocol . '://' . $this->host . '/' . $this->path . $this->getParamsForUrl();

Returns

\Cx\Core\Routing\type

Convert array to parameter string.

array2params(array $array) : string
Static
access public

Parameters

$array

array

Returns

string

Url decode passed array (key and value).

decodeParams(array $input) : array
Static
access public

Parameters

$input

array

Returns

array$output

Url encode passed array (key and value).

encodeParams(array $input) : array
Static
access public

Parameters

$input

array

Returns

array$output

Returns the given string with any ampersands ("&") replaced by "&"

encode_amp(string $url) : string
Static

Any "&"s already present in the string won't be changed; no double encoding takes place.

Parameters

$url

string

The URL to be encoded

Returns

stringThe URL with ampersands encoded

fromCapturedRequest()

fromCapturedRequest($request, $pathOffset, $get) 
Static

Parameters

$request

$pathOffset

$get

Returns an Url object pointing to the documentRoot of the website

fromDocumentRoot($arrParameters, int $lang, string $protocol) : \Cx\Core\Routing\Url
Static

Parameters

$arrParameters

$lang

int

(optional) Language to use, default is FRONTEND_LANG_ID

$protocol

string

(optional) The protocol to use

Returns

\Cx\Core\Routing\UrlUrl object for the documentRoot of the website

This returns an Url object for an absolute or relative url or an Url object

fromMagic(mixed $url) : \Cx\Core\Routing\self | \Cx\Core\Routing\Url
Static
author Michael Ritter
todo This method does what the constructor of a clean Url class should do!

Parameters

$url

mixed

Url object or absolute or relative url as string

Returns

\Cx\Core\Routing\self\Cx\Core\Routing\UrlUrl object representing $url

Returns an Url object for module, cmd and lang

fromModuleAndCmd(string $module, string $cmd, int $lang, array $parameters, string $protocol, boolean $returnErrorPageOnError) : \Cx\Core\Routing\Url
Static
todo There could be more than one page using the same module and cmd per lang

Parameters

$module

string

Module name

$cmd

string

(optional) Module command, default is empty string

$lang

int

(optional) Language to use, default is FRONTENT_LANG_ID

$parameters

array

(optional) HTTP GET parameters to append

$protocol

string

(optional) The protocol to use

$returnErrorPageOnError

boolean

(optional) If set to TRUE, this method will return an URL object that point to the error page of Contrexx. Defaults to TRUE.

Returns

\Cx\Core\Routing\UrlUrl object for the supplied module, cmd and lang

Returns an Url object for node and language

fromNode(\Cx\Core\ContentManager\Model\Entity\Node $node, int $lang, array $parameters, string $protocol) : \Cx\Core\Routing\Url
Static

Parameters

$node

\Cx\Core\ContentManager\Model\Entity\Node

Node to get the Url of

$lang

int

(optional) Language to use, default is FRONTENT_LANG_ID

$parameters

array

(optional) HTTP GET parameters to append

$protocol

string

(optional) The protocol to use

Returns

\Cx\Core\Routing\UrlUrl object for the supplied module, cmd and lang

Returns an Url object for node and language

fromNodeId(int $nodeId, int $lang, array $parameters, string $protocol) : \Cx\Core\Routing\Url
Static

Parameters

$nodeId

int

Node id

$lang

int

(optional) Language to use, default is FRONTEND_LANG_ID

$parameters

array

(optional) HTTP GET parameters to append

$protocol

string

(optional) The protocol to use

Returns

\Cx\Core\Routing\UrlUrl object for the supplied module, cmd and lang

Returns the URL object for a page

fromPage(\Cx\Core\ContentManager\Model\Entity\Page $page, array $parameters, string $protocol) : \Cx\Core\Routing\Url
Static
global type $_CONFIG

Parameters

$page

\Cx\Core\ContentManager\Model\Entity\Page

Page to get the URL to

$parameters

array

(optional) HTTP GET parameters to append

$protocol

string

(optional) The protocol to use

Returns

\Cx\Core\Routing\UrlUrl object for the supplied page

Returns the URL object for a page id

fromPageId(int $pageId, array $parameters, string $protocol) : \Cx\Core\Routing\Url
Static

Parameters

$pageId

int

ID of the page you'd like the URL to

$parameters

array

(optional) HTTP GET parameters to append

$protocol

string

(optional) The protocol to use

Returns

\Cx\Core\Routing\UrlUrl object for the supplied page id

fromRequest()

fromRequest() 
Static

getDomain()

getDomain() 

getLangDir()

getLangDir() 

getMode()

getMode() 

getParamArray()

getParamArray() : array
author Michael Ritter

Returns

array

getPath()

getPath() 

getSuggestedParams()

getSuggestedParams() 

getSuggestedTargetPath()

getSuggestedTargetPath() 

getTargetPath()

getTargetPath() 

Whether the routing already treated this url

isRouted() 

Convert parameter string to array.

params2array(string $params) : array
Static
access public

Parameters

$params

string

Returns

array$array

Remove all params from path

removeAllParams() 

setLangDir()

setLangDir($langDir, $page) 

Parameters

$langDir

$page

setMode()

setMode($mode) 

Parameters

$mode

Set a single parameter.

setParam(mixed $key, mixed $value) 
access public

Parameters

$key

mixed

$value

mixed

Set multiple parameters.

setParams(array $params) 
access public

Parameters

$params

array

or string $params

setPath()

setPath($path) 

Parameters

$path

setSuggestedParams()

setSuggestedParams($params) 

Parameters

$params

setSuggestedTargetPath()

setSuggestedTargetPath($path) 

Parameters

$path

setTargetPath()

setTargetPath($path) 

Parameters

$path

sets $this->suggestedParams and $this->suggestedTargetPath

suggest() 

Returns an absolute link

toString(boolean $absolute) : \Cx\Core\Routing\type

Parameters

$absolute

boolean

(optional) set to false to return a relative URL

Returns

\Cx\Core\Routing\type

Add new parameters to path: - Existing parameters (having not an array as value) will be overwritten by the value of the new parameter (having the same key).

addParamsToPath(array $paramsToAdd) 
  • Existing parameters (having an array as value) will be merged with the value of the new parameter.
  • New parameters will simply be added.
access private

Parameters

$paramsToAdd

array

Add all passed parameters which are skin related.

addPassedParams() 
access private

Split parameters from path.

splitParamsFromPath() : array
access private

Returns

array$params

Write parameters to path.

writeParamsToPath(array $params) 
access private

Parameters

$params

array

 Properties

 

$domain : string
 

$langDir : string
 

$mode : string
 

$path : string
 

$protocol : String
todo Implement protocol support (at the moment only http is supported)
 

$state 
 

$suggestedParams : string
 

$suggestedTargetPath : string
 

$targetPath : string

 Constants

 

ROUTED

ROUTED 
 

SUGGESTED

SUGGESTED 
© Copyright 2014 by Comvation AG
Generated on 2014-07-11T08:39:25+02:00.