Class to build frontend urls for advandced mod rewrite plugin.

Extends abstract Contenido_UrlBuilder class and implements singleton pattern.

Usage:

cInclude('classes', 'UrlBuilder/Contenido_UrlBuilder_MR.class.php');
$url = 'front_content.php?idart=123';
$mrUrlBuilder = Contenido_UrlBuilder_MR::getInstance();
$mrUrlBuilder->buildUrl(array($url));
$newUrl = $mrUrlBuilder->getUrl();

todo Add handling of absolute paths, standardize handling of fragments
author Murat Purc
package Contenido Backend plugins
subpackage ModRewrite

 Methods

Builds a URL based on defined mod rewrite settings.

buildUrl(array $params, boolean $bUseAbsolutePath) : string

Index keys of $aParams will be used as "a", corresponding values as "1" in this sample.

author Rudi Bieller

Parameters

$params

array

Parameter array, provides only following parameters: $params[0] = 'front_content.php?idart=123...'

$bUseAbsolutePath

boolean

Flag to use absolute path (not used at the moment)

Exceptions

\InvalidArgumentException

Returns

stringNew build url

Return http base path, e.g. http://contenido.org/

getHttpBasePath() : string
Inherited

inherited_from \Contenido_UrlBuilder::getHttpBasePath()

Returns

string

Returns a instance of Contenido_UrlBuilder_MR

getInstance() : \Contenido_UrlBuilder_MR

Return built URL

getUrl() : string
Inherited

access public
author Rudi Bieller
inherited_from \Contenido_UrlBuilder::getUrl()

Returns

string

Set http base path, e.g. http://contenido.org/

setHttpBasePath($sBasePath) : void
Inherited

access public
author Rudi Bieller
inherited_from \Contenido_UrlBuilder::setHttpBasePath()

Parameters

$sBasePath

Constructor, tries to set some member variables.

__construct() 

Builds the SEO-URL by analyzing passed arguments (parameter value pairs)

_buildUrl(array $aParams) : string

Parameters

$aParams

array

Parameter array

Returns

stringNew build pretty url

Loops thru passed parameter array and creates the query part of the URL.

_createUrlQueryPart(array $aArgs) : string

All non Contenido related parameter will be excluded from composition.

Parameters

$aArgs

array

Assoziative parameter array

Returns

stringComposed query part for the URL like '?foo=bar&param=value'

Returns articlename depending on current setting

_getArticleName(array $aPretty, array $aArgs) : string

Parameters

$aPretty

array

Pretty url array

$aArgs

array

Additional arguments

Returns

stringArticlename

Returns client id or name depending on settings.

_getClientParameter(array $aArgs) : mixed

Parameters

$aArgs

array

Additional arguments

Returns

mixedClient id, client name or null

Returns language id or name depending on settings.

_getLanguageParameter(array $aArgs) : mixed

Parameters

$aArgs

array

Additional arguments

Returns

mixedLanguage id, language name or null

Returns composed path of url (normally the category structure)

_getPath(array $aPretty) : string

Parameters

$aPretty

array

Pretty url array

Returns

stringPath

 Properties

 

$sHttpBasePath

$sHttpBasePath : string
Inherited

access protected
desc Holds URL that is used as base for an absolute path, e.g. http://contenido.org/
inherited_from \Contenido_UrlBuilder::$$sHttpBasePath
 

$sUrl

$sUrl : string
Inherited

access protected
desc Holds final value of built URL
inherited_from \Contenido_UrlBuilder::$$sUrl
 

Mod Rewrite configuration

$_aMrCfg : array

 

Is XHTML output?

$_bIsXHTML : bool

 

Is mod rewrite enabled?

$_bMREnabled : bool

 

Self instance

$_instance : \Contenido_UrlBuilder_MR

 

Ampersant used for composing several parameter value pairs

$_sAmp : string