contenido\classes\Url\Contenido_Url.class.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

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

Package: Default

Properties

>VPropertyprivate\Contenido_Url $_instance
static
Self instance.
Details
Type
\Contenido_Url
>VPropertyprivate\Contenido_UrlBuilder $_oUrlBuilder
UrlBuilder instance.
>VPropertyprivatestring $_sUrlBuilderName
UrlBuilder name.
Details
Type
string

Methods

methodprivate__construct() : void

Constructor of Contenido_Url.

Is not callable from outside.

Gets the UrlBuilder configuration and creates an UrlBuilder instance.

methodpublicbuild(mixed $param, boolean $bUseAbsolutePath = false, array $aConfig = array()) : string

Creates a URL to frontend page.

Parameters
NameTypeDescription
$parammixed

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'.

$bUseAbsolutePathboolean

Flag to create absolute Urls

$aConfigarray

If not set, UrlBuilderConfig::getConfig() will be used by the URLBuilder

Returns
TypeDescription
stringThe Url build by UrlBuilder
methodpublicbuildRedirect(mixed $param, array $aConfig = array()) : string

Creates a URL used to redirect to frontend page.

Parameters
NameTypeDescription
$parammixed

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'.

$aConfigarray

If not set, UrlBuilderConfig::getConfig() will be used by the URLBuilder

Returns
TypeDescription
stringThe redirect Url build by UrlBuilder
methodpubliccomposeByComponents(array $aComponents) : string

Composes a url using passed components array

Parameters
NameTypeDescription
$aComponentsarray

Assoziative array created by parse_url()

Returns
TypeDescription
string$sUrl The composed Url
methodpublicgetInstance() : \Contenido_Url
static

Returns self instance

Returns
TypeDescription
\Contenido_Url
methodpublicgetUrlBuilder() : \Contenido_UrlBuilder

Returns UrlBuilder instance.

Returns
TypeDescription
\Contenido_UrlBuilder
methodpublicisExternalUrl(string $sUrl) : bool

Checks, if passed url is an external url while performing hostname check

Parameters
NameTypeDescription
$sUrlstring

Url to check

Returns
TypeDescription
boolTrue if url is a external url, otherwhise false
methodpublicisIdentifiableFrontContentUrl(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.

Parameters
NameTypeDescription
$sUrlstring

Url to check

Returns
TypeDescription
boolTrue if url is identifiable internal url, otherwhise false
methodpublicparse(string $sUrl) : array

Splits passed url into its components

Parameters
NameTypeDescription
$sUrlstring

The Url to strip down

Returns
TypeDescription
arrayAssoziative array created by using parse_url() having the key 'params' which includes the parameter value pairs.
Documentation was generated by phpDocumentor 2.0.0a12.