eZPublish  3.8
eZURLAlias Class Reference

Handles URL aliases in eZ publish. More...

+ Inheritance diagram for eZURLAlias:
+ Collaboration diagram for eZURLAlias:

Public Member Functions

 asArray ()
 
 cacheInfo ()
 
 cacheInfoDirectories (&$wildcardCacheDir, &$wildcardCacheFile, &$wildcardCachePath, &$wildcardKeys)
 
 cleanup ()
 
 cleanupForwardingURLs ($oldURL)
 
 cleanupWildcards ($baseURL)
 
 convertToAlias ($urlElement, $defaultValue=false)
 
createForForwarding ($forwardURL)
 
 createWildcardMatches ()
 
 definition ()
 
 expireWildcards ()
 
 eZURLAlias ($row)
 
forwardURL ()
 
isWildcardExpired ($timestamp)
 
 store ()
 
 updateForwardID ($newForwardID, $oldForwardID)
 
- Public Member Functions inherited from eZPersistentObject
attribute ($attr, $noFunction=false)
 
 attributes ()
 
 conditionText (&$conditions)
 
conditionTextByRow (&$conditions, &$row)
 
 definition ()
 
escapeArray (&$array)
 
 eZPersistentObject ($row)
 
 fetchObject (&$def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
 
 fetchObjectList (&$def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null)
 
 fill (&$row)
 
 getShortAttributeName (&$db, &$def, $attrName)
 
 handleRows (&$rows, $class_name, $asObject)
 
 hasAttribute ($attr)
 
 hasDirtyData ()
 
 newObjectOrder (&$def, $orderField, $conditions)
 
 remove ($conditions=null, $extraConditions=null)
 
 removeObject (&$def, $conditions=null, $extraConditions=null)
 
 reorderObject (&$def, $orderField, $conditions, $down=true)
 
 setAttribute ($attr, $val)
 
 setHasDirtyData ($hasDirtyData)
 
 store ($fieldFilters=null)
 
 swapRow ($table, &$keys, &$order_id, &$rows, $id1, $id2)
 
 sync ($fieldFilters=null)
 
 updateObjectList ($parameters)
 

Static Public Member Functions

 cleanURL ($url)
 
 convertPathToAlias ($pathURL)
 
 create ($sourceURL, $destinationURL, $isInternal=true, $forwardToID=false, $isWildcard=EZ_URLALIAS_WILDCARD_TYPE_NONE)
 
 fetch ($id, $asObject=true)
 
 fetchByDestinationURL ($url, $isInternal=true, $asObject=true)
 
 fetchByOffset ($offset, $limit, $asObject=true)
 
 fetchBySourceURL ($url, $isInternal=true, $asObject=true, $noForwardID=true)
 
 fetchWildcards ($asObject=true)
 
totalCount ()
 
 translate (&$uri, $reverse=false)
 
translateByWildcard (&$uri, $reverse=false)
 
 updateChildAliases ($newPathString, $oldPathString)
 

Detailed Description

Handles URL aliases in eZ publish.

URL aliases are different names for existing URLs in eZ publish. Using URL aliases allows for having better looking urls on the webpage as well as having fixed URLs pointing to various locations.

This class handles storing, fetching, moving and subtree updates on eZ publish URL aliases.

Creating a new alias is done by using the create() function and passing the correct parameters. Fetching an url can either be done with it's ID using fetch() or by it's URL string by using fetchBySourceURL. To fetch the original URL you must use the translate() function.

Member Function Documentation

eZURLAlias::asArray ( )
Returns
the url alias object as an associative array with all the attribute values.
eZURLAlias::cacheInfo ( )
Returns
array with information on the wildcard cache.

The array containst the following keys

  • dir - The directory for the cache
  • file - The filename for the cache
  • path - The entire path (including filename) for the cache
  • keys - Array with key values which is used to uniquely identify the cache

Referenced by cacheInfoDirectories(), and translateByWildcard().

eZURLAlias::cacheInfoDirectories ( $wildcardCacheDir,
$wildcardCacheFile,
$wildcardCachePath,
$wildcardKeys 
)

Sets the various cache information to the parameters.

See Also
cacheInfo

Referenced by createWildcardMatches().

eZURLAlias::cleanup ( )

Removes this url alias as well as all other aliases that relate to it, for instance forwarding aliases.

Note
If you want to remove just this alias you must use remove()
eZURLAlias::cleanupForwardingURLs (   $oldURL)

Removes forwarding urls where source_url match $oldURL.

Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Referenced by eZContentObjectTreeNode\updateSubTreePath(), and eZContentObjectTreeNode\updateURLAlias().

eZURLAlias::cleanupWildcards (   $baseURL)

Removes all wildcards that matches the base URL $baseURL.

Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Referenced by eZContentObjectTreeNode\updateSubTreePath(), and eZContentObjectTreeNode\updateURLAlias().

eZURLAlias::cleanURL (   $url)
static

Makes sure the URL $url does not contain leading and trailing slashes (/).

Returns
the clean URL

Referenced by create(), fetchByDestinationURL(), fetchBySourceURL(), eZHTTPHeader\headerOverrideArray(), store(), translate(), and translateByWildcard().

eZURLAlias::convertPathToAlias (   $pathURL)
static

Converts the path $pathURL into a new alias path with limited characters. For more information on the conversion see convertToAlias().

Note
each element in the path (separated by / (slash) ) is converted separately.
Returns
the converted path

Referenced by eZWebDAVContentServer\fetchNodeByTranslation(), and eZWebDAVContentServer\fetchParentNodeByTranslation().

eZURLAlias::convertToAlias (   $urlElement,
  $defaultValue = false 
)
eZURLAlias::create (   $sourceURL,
  $destinationURL,
  $isInternal = true,
  $forwardToID = false,
  $isWildcard = EZ_URLALIAS_WILDCARD_TYPE_NONE 
)
static

Creates a new URL alias with the new URL $sourceURL and the original URL $destinationURL

Parameters
$isInternaldecides if the url is internal or not (user created).
Returns
the URL alias object

Referenced by createForForwarding(), eZContentObjectTreeNode\updateSubTreePath(), and eZContentObjectTreeNode\updateURLAlias().

& eZURLAlias::createForForwarding (   $forwardURL)

Creates a new URL alias which will forward the to this URL alias, the url which will be forwarded is $forwardURL. The forwarding URL is usually an old url you want to work with your new and renamed url. The difference between a forwarding and translation is that forwarding will the browser and crawlers that the url is no longer in use and give the new one.

Returns
the URL alias object
eZURLAlias::createWildcardMatches ( )

Goes trough all wildcards in the database and creates the wildcard match cache.

See Also
cacheInfo

Referenced by translateByWildcard().

eZURLAlias::definition ( )
eZURLAlias::expireWildcards ( )

Expires the wildcard cache. This causes the wildcard cache to be regenerated on the next page load.

Referenced by eZContentObjectTreeNode\updateSubTreePath().

eZURLAlias::eZURLAlias (   $row)

Initializes a new URL alias.

Referenced by create().

eZURLAlias::fetch (   $id,
  $asObject = true 
)
static

Fetches the URL alias by ID.

Referenced by forwardURL(), translate(), and translateByWildcard().

eZURLAlias::fetchByDestinationURL (   $url,
  $isInternal = true,
  $asObject = true 
)
static

Fetches the URL alias by destination URL $url.

Parameters
$isInternalboolean which controls whether internal or external urls are fetched.
Returns
the URL alias object or null
eZURLAlias::fetchByOffset (   $offset,
  $limit,
  $asObject = true 
)
static

Fetches non-internal URL alias by offset and limit

eZURLAlias::fetchBySourceURL (   $url,
  $isInternal = true,
  $asObject = true,
  $noForwardID = true 
)
static

Fetches the URL alias by source URL $url.

Parameters
$isInternalboolean which controls whether internal or external urls are fetched.
$noForwardIDboolean which controls whether to only fetch urls without forward id or if forward id it should be ignored.
Returns
the URL alias object or null

Referenced by eZContentObjectTreeNode\remove(), translate(), translateByWildcard(), eZContentObjectTreeNode\updateSubTreePath(), and eZContentObjectTreeNode\updateURLAlias().

eZURLAlias::fetchWildcards (   $asObject = true)
static

Fetches all wildcards from DB.

Referenced by createWildcardMatches().

& eZURLAlias::forwardURL ( )
Returns
the URL alias object this URL alias points to or null if no such URL exists.
& eZURLAlias::isWildcardExpired (   $timestamp)
Returns
true if the wildcard cache is expired.

Referenced by translateByWildcard().

eZURLAlias::store ( )

Generates the md5 for the alias and stores the values.

Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
& eZURLAlias::totalCount ( )
static

Counts the non-internal URL alias

eZURLAlias::translate ( $uri,
  $reverse = false 
)
static

Transforms the URI if there exists an alias for it.

Returns
true is if successful, false otherwise
The eZURLAlias object of the new url is returned if the translation was found, but the resource has moved.

Referenced by eZWebDAVContentServer\fetchNodeByTranslation(), eZWebDAVContentServer\fetchParentNodeByTranslation(), and eZHTTPHeader\headerOverrideArray().

& eZURLAlias::translateByWildcard ( $uri,
  $reverse = false 
)
static

Transforms the URI if there exists an alias for it.

Returns
true is if successful, false otherwise
The eZURLAlias object of the new url is returned if the translation was found, but the resource has moved.
eZURLAlias::updateChildAliases (   $newPathString,
  $oldPathString 
)
static

Makes sure all aliases which are children of the alias $oldPathString is updated to have the correct $newPathString.

Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Referenced by eZContentObjectTreeNode\updateSubTreePath().

eZURLAlias::updateForwardID (   $newForwardID,
  $oldForwardID 
)

Updates all forwards urls that originally points to $oldForwardID to point to correct url $newForardID.

Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Referenced by eZContentObjectTreeNode\updateSubTreePath(), and eZContentObjectTreeNode\updateURLAlias().


The documentation for this class was generated from the following file: