lib/ezutils/classes/ezuri.php

Show: inherited
Table of Contents

File containing the eZURI class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
lib  
Version
4.6.0  

\eZURI

Package: eZHTTP

Provides access to the HTTP uri

The URI can be accessed one element at a time with element() and elements() and can be iterated with increase() and the current index returned with index(). Movin the beginning and end is done with toBeginning() and toEnd(). The base can be retrieved with base() and the elements with elements().

This class also supports the attribute system.

The index starts at 0

Properties

Propertypublicint  $Index= ''

The current index

Details
Type
int
Propertypublicstring  $URI= ''

The original URI string

Details
Type
string
Propertypublicarray  $URIArray= ''

The URI array

Details
Type
array
Propertypublicarray  $UserArray= ''

User defined template variables

Details
Type
array
Propertyprivatestring  $transformURIMode= '"relative"'
static

URI transformation mode used by transformURI().

Default value"relative"Details
Type
string
See
\transformURI()  
See
\getTransformURIMode()  
See
\setTransformURIMode()  

Methods

methodpublic__construct( string $uri ) : void

Initializes with the URI string $uri. The URI string is split on / into an array.

Parameters
Name Type Description
$uri string

the URI to use

methodpublicattribute( string $attr ) : boolean

Get value for an attribute

Parameters
Name Type Description
$attr string
Returns
Type Description
boolean the value for attribute $attr or null if it does not exist.
methodpublicattributes( ) : array

Export all attributes of the object

Returns
Type Description
array the attributes for the object
methodpublicbase( \type $as_text = true ) : string | array

Return the elements before pointer

Parameters
Name Type Description
$as_text \type

return as text or array

Returns
Type Description
string | array the base string or the base elements as an array if $as_text is true.
methodpubliccodecURL( string $url, boolean $encode ) : string
static

Parse URL and encode/decode its path string

Parameters
Name Type Description
$url string

the URL to parse

$encode boolean

tells to encode the URI

Returns
Type Description
string the parsed url
methodpublicconvertFilterString( ) : string

Converts filter string to current locale. When an user types in browser url like: "/content/view/full/2/(namefilter)/a" 'a' letter should be urldecoded and converted from utf-8 to current locale.

Returns
Type Description
string converted string
methodpublicdecodeIRI( string $str ) : string
static

Decodes a path string which is in IRI format and returns the new path in the internal encoding.

More info on IRI here: {@link http://www.w3.org/International/O-URL-and-ident.html}

Parameters
Name Type Description
$str string

the string to decode

Returns
Type Description
string decoded version of $str
methodpublicdecodeURL( string $url ) : string
static

Decodes URL which has path string is in IRI format and returns the new URL with path in the internal encoding.

Parameters
Name Type Description
$url string

url to decode

Returns
Type Description
string the decoded url
methodpublicdropBase( ) : void

Removes all elements below the current index, recreates the URI string and sets index to 0.

methodpublicelement( integer $index = 0, boolean $relative = true ) : string | null

Get element index from uri

Parameters
Name Type Description
$index integer

the index of URI to return

$relative boolean

if index is relative to the internal pointer

Returns
Type Description
string | null the element at $index
methodpublicelements( boolean $as_text = true ) : array | string

Return all URI elements

Parameters
Name Type Description
$as_text boolean

return the elements as string

Returns
Type Description
array | string all elements as string/array depending on $as_text
methodpublicencodeIRI( string $str ) : string
static

Encodes path string in internal encoding to a new string which conforms to the IRI specification.

More info on IRI here: {@link http://www.w3.org/International/O-URL-and-ident.html}

Parameters
Name Type Description
$str string

the IRI to encode

Returns
Type Description
string $str encoded as IRU
methodpublicencodeURL( \type $url ) : string
static

Encodes path string of URL in internal encoding to a new string which conforms to the IRI specification.

Parameters
Name Type Description
$url \type
Returns
Type Description
string the encoded url
methodpublicgetTransformURIMode( ) : string
static

Returns the current mode used for transformURI().

Returns
Type Description
string
Details
See
\transformURI()  
See
\setTransformURIMode()  
methodpublichasAttribute( string $attr ) : boolean

Check if attribute exsits

Parameters
Name Type Description
$attr string

the attrbiute to check if exists

Returns
Type Description
boolean
methodpublicincrease( int $num = 1 ) : void

Moves the index 1 step up or $num if specified.

Parameters
Name Type Description
$num int

number of steps to move pointer

methodpublicindex( ) : int

Return the current position of pointer

Returns
Type Description
int the current pointer position.
methodpublicinstance( false | string $uri = false ) : \eZURI
static

Returns a shared instance of the eZURI class IF $uri is false or the same as current request uri, if not then a new non shared instance is created.

Parameters
Name Type Description
$uri false | string

Shared uri instance if false

Returns
Type Description
\eZURI
methodpublicisEmpty( ) : boolean

Check if there URI is set

Returns
Type Description
boolean true if the URI is empty, ie it's equal to / or empty string.
methodpublicmatchBase( \eZURI $uri ) : boolean

Tries to match the base of $uri against this base and returns the result.

A match is made if all elements of this object match the base elements of the $uri object, this means that $uri's base may be longer than this base but not shorter.

Parameters
Name Type Description
$uri \eZURI

the uri to match against

Returns
Type Description
boolean
methodpublicoriginalURIString( boolean $withLeadingSlash = false ) : string

Return the original URI

the URI will not include the leading / if $withLeadingSlash is true.

Parameters
Name Type Description
$withLeadingSlash boolean

prefix the uri with /

Returns
Type Description
string the URI passed to the object with user parameters (if any).
methodpublicsetTransformURIMode( string $mode ) : void
static

Sets the current mode used for transformURI() to $mode.

Parameters
Name Type Description
$mode string
Details
See
\transformURI()  
See
\getTransformURIMode()  
methodpublicsetURIString( string $uri, boolean $fullInitialize = true ) : void

Sets uri string for instance

Sets the current URI string to $uri, the URI is then split into array elements and index reset to 1.

Parameters
Name Type Description
$uri string
$fullInitialize boolean
methodpublictoBeginning( ) : void

Reset the internal pointer

methodpublictoEnd( ) : void

Moves the index to the end.

methodpublictransformURI( string $href, boolean $ignoreIndexDir = false, string $serverURL = null ) : string
static

Implementation of an 'ezurl' template operator Makes valid eZ Publish urls to use in links

Parameters
Name Type Description
$href string

&$href

$ignoreIndexDir boolean
$serverURL string

full|relative

Returns
Type Description
string the link to use
methodpublicuriString( boolean $withLeadingSlash = false ) : string

Get the uri string

The URI will not include the leading / if $withLeadingSlash is true.

Parameters
Name Type Description
$withLeadingSlash boolean

prefix the uri with /

Returns
Type Description
string the URI passed as to the object
methodpublicuserParameters( ) : array

Get user variables

Returns
Type Description
array all the user defined variables
Documentation was generated by DocBlox 0.18.1.