PHP Class CampURI

Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Свойство Type Description
$_themePath The theme path storage
$m_article MetaArticle Article object
$m_buildPath string
$m_buildQuery string
$m_buildQueryArray array
$m_config object
$m_errorCode integer Holds the URL process error code; null if no error
$m_fragment string
$m_host string
$m_issue MetaIssue Issue object
$m_language MetaLanguage Language object
$m_objects
$m_parts array The URI parts
$m_password string
$m_path string
$m_port integer
$m_preview boolean True if in preview mode
$m_previewParameters array The list of parameters used in preview mode
$m_publication MetaPublication Publication object
$m_query string
$m_scheme string
$m_section MetaSection Section object
$m_template MetaTemplate Template object
$m_type integer The URI type It can be either: Template Path = 1 Short Names = 2
$m_uri string The URI value
$m_user MetaUser
$m_validURI boolean Whether the URI is valid or not

Méthodes publiques

Méthode Description
GetPreviewParameters ( )
__construct ( string $p_uri = 'SELF' ) Class constructor
__get ( string $p_property ) : boolean Sets an object property
__set ( string $p_property, mixed $p_value ) : boolean Sets an object property
getBase ( ) : string Gets the URI base, it is the scheme, host and (if exists) port.
getBasePath ( ) : string Gets the base plus the path from the current URI.
getCampsiteVector ( ) : array Returns campsite params: language, publication, issue, section, article.
getErrorCode ( ) : integer Returns the URL processing error code
getFragment ( ) : string Gets the fragment part from the current URI.
getHost ( ) : string Gets the host part from the current URI.
getPassword ( ) : string Gets the password part from the current URI.
getPath ( ) : string Gets the path part from the current URI.
getPort ( ) : integer Gets the port part from the current URI.
getQuery ( ) : string Gets the query part from the current URI.
getQueryArray ( array $p_keepParameters = [], array $p_removeParameters = [] ) : array Gets the array containing the query variables.
getQueryVar ( string $p_varName ) : string Gets the given variable from the URI query.
getRelativeBase ( ) : string Gets the relative URI base, it is '//', host and (if exists) port.
getRequestURI ( ) : string Gets the requested URI.
getScheme ( ) : string Gets the scheme part from the current URI.
getTemplate ( $p_templateIdOrName = null )
getThemePath ( )
getURI ( string $p_param = null, boolean $p_preview = false ) : string Returns the URI string based on given URL parameter.
getURIPath ( string $p_param = null, boolean $p_preview = false ) : string Returns the URI path based on given URL parameter.
getURL ( ) : string Gets the URL from the object attributes.
getURLParameters ( string $p_param = null, boolean $p_preview = false ) : string Returns the URI query parameters based on given URL parameter.
getURLType ( ) : integer Gets the URL type.
getUser ( ) : string Returns the user part from the current URI.
isRestrictedParameter ( string $p_parameterName ) : boolean Returns true if the given parameter is restricted and can not be set from outside the URL object.
isSSL ( ) : boolean Returns whether the site is running over SSL or not.
setFragment ( string $p_fragment ) : void Sets the URI fragment.
setHost ( string $p_host ) : void Sets the URI host.
setPassword ( $p_password ) : void Sets the URI password part.
setPath ( string $p_path ) : void Sets the URI path.
setPort ( integer $p_port ) : void Sets the URI port.
setQuery ( $p_query ) : void Gets the query part from the current URI.
setQueryVar ( string $p_varName, string $p_value = null ) : void Sets the given URI query variable.
setScheme ( string $p_scheme ) : void Sets the URI scheme.
setUser ( string $p_user ) : void Sets the URI user part.

Méthodes protégées

Méthode Description
QueryArrayToString ( array $p_queryArray, $p_HTMLEscape = true ) : string Builds a URI query string from the given query array.
addToQuery ( &$p_query, array $p_parameters ) Adds the given parameters to the query array
buildURI ( array &$p_params = [], boolean $p_preview = false ) : void Sets the URI path and query values based on given parameters.
clearParams ( array $parameters )
isValidCache ( ) : boolean Returns the cache valid state
isValidTemplate ( string $p_templateName ) : boolean Returns whether the template name given is a valid template resource.
render ( array $p_parts = [] ) : string Builds a URI string from the given parts.
resetList ( $listIdPrefix )
setURLType ( integer $p_type ) : void Sets the URL type.
validateCache ( boolean $p_valid ) Sets the cache validation for URI rendering

Private Methods

Méthode Description
parse ( string $p_uri ) : boolean Parses the given URI.
processImageOptions ( integer &$p_imageNo, array $p_params ) Process the image options given in the new format: where may be one of: number, ratio, width, height and an integer
processOldImageOptions ( integer &$p_imageNo, array $p_params ) Process the image options given in the old format (for compatibility): [ []] or: [ [width | height ]
readUser ( )

Method Details

GetPreviewParameters() public static méthode

public static GetPreviewParameters ( )

QueryArrayToString() protected static méthode

Builds a URI query string from the given query array.
protected static QueryArrayToString ( array $p_queryArray, $p_HTMLEscape = true ) : string
$p_queryArray array An array of query variables
Résultat string $queryString The generated query string

__construct() public méthode

Class constructor
public __construct ( string $p_uri = 'SELF' )
$p_uri string The full URI string

__get() public méthode

Sets an object property
public __get ( string $p_property ) : boolean
$p_property string
Résultat boolean

__set() public méthode

Sets an object property
public __set ( string $p_property, mixed $p_value ) : boolean
$p_property string
$p_value mixed
Résultat boolean

addToQuery() protected méthode

Adds the given parameters to the query array
protected addToQuery ( &$p_query, array $p_parameters )
$p_parameters array

buildURI() protected méthode

Sets the URI path and query values based on given parameters.
protected buildURI ( array &$p_params = [], boolean $p_preview = false ) : void
$p_params array An array of valid URL parameters
$p_preview boolean If true, will keep the preview parameters in the URL
Résultat void

clearParams() protected méthode

protected clearParams ( array $parameters )
$parameters array

getBase() public méthode

Gets the URI base, it is the scheme, host and (if exists) port.
public getBase ( ) : string
Résultat string $base The URI base

getBasePath() public méthode

Gets the base plus the path from the current URI.
public getBasePath ( ) : string
Résultat string The URI base path

getCampsiteVector() public méthode

Returns campsite params: language, publication, issue, section, article.
public getCampsiteVector ( ) : array
Résultat array

getErrorCode() public méthode

Returns the URL processing error code
public getErrorCode ( ) : integer
Résultat integer

getFragment() public méthode

Gets the fragment part from the current URI.
public getFragment ( ) : string
Résultat string $m_fragment The fragment value

getHost() public méthode

Gets the host part from the current URI.
public getHost ( ) : string
Résultat string $m_host The host value

getPassword() public méthode

Gets the password part from the current URI.
public getPassword ( ) : string
Résultat string $m_password The password value

getPath() public méthode

Gets the path part from the current URI.
public getPath ( ) : string
Résultat string $m_path The path value

getPort() public méthode

Gets the port part from the current URI.
public getPort ( ) : integer
Résultat integer $m_port The port value

getQuery() public méthode

Gets the query part from the current URI.
public getQuery ( ) : string
Résultat string $m_query The query part

getQueryArray() public méthode

Gets the array containing the query variables.
public getQueryArray ( array $p_keepParameters = [], array $p_removeParameters = [] ) : array
$p_keepParameters array
$p_removeParameters array
Résultat array $m_queryArray The array of query vars

getQueryVar() public méthode

Gets the given variable from the URI query.
public getQueryVar ( string $p_varName ) : string
$p_varName string The variable name
Résultat string null on failure, otherwise the variable value

getRelativeBase() public méthode

Gets the relative URI base, it is '//', host and (if exists) port.
public getRelativeBase ( ) : string
Résultat string $relativeBase The relative URI base

getRequestURI() public méthode

Gets the requested URI.
public getRequestURI ( ) : string
Résultat string The requested URI string

getScheme() public méthode

Gets the scheme part from the current URI.
public getScheme ( ) : string
Résultat string $m_scheme The scheme value

getTemplate() public méthode

public getTemplate ( $p_templateIdOrName = null )

getThemePath() public méthode

public getThemePath ( )

getURI() public méthode

Returns the URI string based on given URL parameter.
public getURI ( string $p_param = null, boolean $p_preview = false ) : string
$p_param string The URL parameter
$p_preview boolean If true, will keep the preview parameters in the URL
Résultat string The URI string requested

getURIPath() public méthode

Returns the URI path based on given URL parameter.
public getURIPath ( string $p_param = null, boolean $p_preview = false ) : string
$p_param string The URL parameter
$p_preview boolean If true, will keep the preview parameters in the URL
Résultat string The URI path string requested

getURL() public méthode

Gets the URL from the object attributes.
public getURL ( ) : string
Résultat string $url The full URL

getURLParameters() public méthode

Returns the URI query parameters based on given URL parameter.
public getURLParameters ( string $p_param = null, boolean $p_preview = false ) : string
$p_param string
$p_preview boolean If true, will keep the preview parameters in the URL
Résultat string The URI query string requested

getURLType() public méthode

Gets the URL type.
public getURLType ( ) : integer
Résultat integer

getUser() public méthode

Returns the user part from the current URI.
public getUser ( ) : string
Résultat string The username value

isRestrictedParameter() abstract public méthode

Returns true if the given parameter is restricted and can not be set from outside the URL object.
abstract public isRestrictedParameter ( string $p_parameterName ) : boolean
$p_parameterName string
Résultat boolean

isSSL() public méthode

Returns whether the site is running over SSL or not.
public isSSL ( ) : boolean
Résultat boolean true on success, false on failure

isValidCache() protected méthode

Returns the cache valid state
protected isValidCache ( ) : boolean
Résultat boolean

isValidTemplate() protected méthode

Returns whether the template name given is a valid template resource.
protected isValidTemplate ( string $p_templateName ) : boolean
$p_templateName string The name of the template from the URI path
Résultat boolean true on success, false on failure

render() protected méthode

Builds a URI string from the given parts.
protected render ( array $p_parts = [] ) : string
$p_parts array The array of URI parts
Résultat string $uriString The rendered URI

resetList() protected méthode

protected resetList ( $listIdPrefix )

setFragment() public méthode

Sets the URI fragment.
public setFragment ( string $p_fragment ) : void
$p_fragment string The fragment part
Résultat void

setHost() public méthode

Sets the URI host.
public setHost ( string $p_host ) : void
$p_host string The host name
Résultat void

setPassword() public méthode

Sets the URI password part.
public setPassword ( $p_password ) : void
Résultat void

setPath() public méthode

Sets the URI path.
public setPath ( string $p_path ) : void
$p_path string The path
Résultat void

setPort() public méthode

Sets the URI port.
public setPort ( integer $p_port ) : void
$p_port integer The port number
Résultat void

setQuery() public méthode

Gets the query part from the current URI.
public setQuery ( $p_query ) : void
Résultat void $m_query The query value

setQueryVar() public méthode

Sets the given URI query variable.
public setQueryVar ( string $p_varName, string $p_value = null ) : void
$p_varName string The name of the URI query variable
$p_value string The value for the variable
Résultat void

setScheme() public méthode

Sets the URI scheme.
public setScheme ( string $p_scheme ) : void
$p_scheme string The scheme value
Résultat void

setURLType() protected méthode

Sets the URL type.
protected setURLType ( integer $p_type ) : void
$p_type integer The URL type number
Résultat void

setUser() public méthode

Sets the URI user part.
public setUser ( string $p_user ) : void
$p_user string The user name
Résultat void

validateCache() protected méthode

Sets the cache validation for URI rendering
protected validateCache ( boolean $p_valid )
$p_valid boolean

Property Details

$_themePath protected_oe property

The theme path storage
protected $_themePath

$m_article protected_oe property

Article object
protected MetaArticle $m_article
Résultat MetaArticle

$m_buildPath protected_oe property

protected string $m_buildPath
Résultat string

$m_buildQuery protected_oe property

protected string $m_buildQuery
Résultat string

$m_buildQueryArray protected_oe property

protected array $m_buildQueryArray
Résultat array

$m_config protected_oe property

protected object $m_config
Résultat object

$m_errorCode protected_oe property

Holds the URL process error code; null if no error
protected int $m_errorCode
Résultat integer

$m_fragment protected_oe property

protected string $m_fragment
Résultat string

$m_host protected_oe property

protected string $m_host
Résultat string

$m_issue protected_oe property

Issue object
protected MetaIssue $m_issue
Résultat MetaIssue

$m_language protected_oe property

Language object
protected MetaLanguage $m_language
Résultat MetaLanguage

$m_objects protected_oe static_oe property

protected static $m_objects

$m_parts protected_oe property

The URI parts
protected array $m_parts
Résultat array

$m_password protected_oe property

protected string $m_password
Résultat string

$m_path protected_oe property

protected string $m_path
Résultat string

$m_port protected_oe property

protected int $m_port
Résultat integer

$m_preview protected_oe property

True if in preview mode
protected bool $m_preview
Résultat boolean

$m_previewParameters protected_oe static_oe property

The list of parameters used in preview mode
protected static array $m_previewParameters
Résultat array

$m_publication protected_oe property

Publication object
protected MetaPublication $m_publication
Résultat MetaPublication

$m_query protected_oe property

protected string $m_query
Résultat string

$m_scheme protected_oe property

protected string $m_scheme
Résultat string

$m_section protected_oe property

Section object
protected MetaSection $m_section
Résultat MetaSection

$m_template protected_oe property

Template object
protected MetaTemplate $m_template
Résultat MetaTemplate

$m_type protected_oe property

The URI type It can be either: Template Path = 1 Short Names = 2
protected int $m_type
Résultat integer

$m_uri protected_oe property

The URI value
protected string $m_uri
Résultat string

$m_user protected_oe property

protected MetaUser $m_user
Résultat MetaUser

$m_validURI protected_oe property

Whether the URI is valid or not
protected bool $m_validURI
Résultat boolean