contenido\classes\Url\Contenido_Url.class.php
Description: Frontend URL creation. Works as a wrapper of an UrlBuilder instance.
Requirements:
- Author
- Murat Purc
- Con_php_req
- 5.0
- Copyright
- four for business AG
- License
- http://www.contenido.org/license/LIZENZ.txt
- Link
- http://www.4fb.de
- Link
- {@internal created 2009-09-29 modified 2008-12-23, Murat Purc, added functions buildRedirect(), composeByComponents() and isExternalUrl() and exended flexibility of build() modified 2008-12-26, Murat Purc, added execution of chains 'Contenido.Frontend.PreprocessUrlBuilding' and 'Contenido.Frontend.PostprocessUrlBuilding' to build() modified 2009-01-13, Murat Purc, added new function isIdentifiableFrontContentUrl() for better identification of internal urls modified 2009-10-27, Murat Purc, fixed/modified CEC_Hook, see [#CON-256] modified 2011-05-20, Murat Purc, fixed wrong condition in function parse(), see [#CON-399] $Id$: }}
- Package
- Contenido Backend classes
- Version
- 1.0.0
\Contenido_Url
Properties
Methods


__construct() : void
Constructor of Contenido_Url.
Is not callable from outside.
Gets the UrlBuilder configuration and creates an UrlBuilder instance.


build(mixed $param, boolean $bUseAbsolutePath = false, array $aConfig = array()) : string
Creates a URL to frontend page.
Name | Type | Description |
---|---|---|
$param | mixed | Either url or assoziative array containing parameter: - url: front_content.php?idcat=12&lang=1 - params: array('idcat' => 12, 'lang' => 1) Required values depend on used UrlBuilder, but a must have is 'lang'. |
$bUseAbsolutePath | boolean | Flag to create absolute Urls |
$aConfig | array | If not set, UrlBuilderConfig::getConfig() will be used by the URLBuilder |
Type | Description |
---|---|
string | The Url build by UrlBuilder |


buildRedirect(mixed $param, array $aConfig = array()) : string
Creates a URL used to redirect to frontend page.
Name | Type | Description |
---|---|---|
$param | mixed | Either url or assoziative array containing parameter: - url: front_content.php?idcat=12&lang=1 - params: array('idcat' => 12, 'lang' => 1) Required values depend on used UrlBuilder, but a must have is 'lang'. |
$aConfig | array | If not set, UrlBuilderConfig::getConfig() will be used by the URLBuilder |
Type | Description |
---|---|
string | The redirect Url build by UrlBuilder |


composeByComponents(array $aComponents) : string
Composes a url using passed components array
Name | Type | Description |
---|---|---|
$aComponents | array | Assoziative array created by parse_url() |
Type | Description |
---|---|
string | $sUrl The composed Url |


getUrlBuilder() : \Contenido_UrlBuilder
Returns UrlBuilder instance.
Type | Description |
---|---|
\Contenido_UrlBuilder |


isExternalUrl(string $sUrl) : bool
Checks, if passed url is an external url while performing hostname check
Name | Type | Description |
---|---|---|
$sUrl | string | Url to check |
Type | Description |
---|---|
bool | True if url is a external url, otherwhise false |


isIdentifiableFrontContentUrl(string $sUrl) : bool
Checks, if passed url is an identifiable internal url.
Following urls will be identified as a internal url: - "/", "/?idart=123", "/?idcat=123", ... - "front_content.php", "front_content.php?idart=123", "front_content.php?idcat=123", ... - The path component of an client HTML base path: e. g. "/cms/", "/cms/?idart=123", "/cms/?idcat=123" - Also possible: "/cms/front_content.php", "/cms/front_content.php?idart=123", "/cms/front_content.php?idcat=123" All of them prefixed with protocol and client host (e. g. http://host/) will also be identified as a internal Url.
Other Urls, even internal Urls like /unknown/path/to/some/page.html will not be identified as internal url event if they are real working clean URLs.
Name | Type | Description |
---|---|---|
$sUrl | string | Url to check |
Type | Description |
---|---|
bool | True if url is identifiable internal url, otherwhise false |