eZURLAlias Class Reference

Handles URL aliases in eZ publish. More...

Inheritance diagram for eZURLAlias:
eZPersistentObject

List of all members.

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)

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.

Definition at line 57 of file ezurlalias.php.


Member Function Documentation

eZURLAlias::asArray (  ) 
Returns:
the url alias object as an associative array with all the attribute values.

Definition at line 110 of file ezurlalias.php.

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

Definition at line 390 of file ezurlalias.php.

Referenced by cacheInfoDirectories(), and translateByWildcard().

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

Sets the various cache information to the parameters.

See also:
cacheInfo

Definition at line 411 of file ezurlalias.php.

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()

Definition at line 188 of file ezurlalias.php.

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.

Definition at line 270 of file ezurlalias.php.

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.

Definition at line 254 of file ezurlalias.php.

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

Definition at line 845 of file ezurlalias.php.

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

Definition at line 707 of file ezurlalias.php.

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

eZURLAlias::convertToAlias ( urlElement,
defaultValue = false 
)

Definition at line 681 of file ezurlalias.php.

Referenced by convertPathToAlias(), and eZContentObjectTreeNode::pathWithNames().

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:
$isInternal decides if the url is internal or not (user created).
Returns:
the URL alias object

Definition at line 140 of file ezurlalias.php.

Referenced by createForForwarding().

& 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

Definition at line 163 of file ezurlalias.php.

eZURLAlias::createWildcardMatches (  ) 

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

See also:
cacheInfo

Definition at line 424 of file ezurlalias.php.

Referenced by translateByWildcard().

eZURLAlias::definition (  ) 

Reimplemented from eZPersistentObject.

Definition at line 70 of file ezurlalias.php.

Referenced by fetch(), fetchByDestinationURL(), fetchByOffset(), fetchBySourceURL(), and fetchWildcards().

eZURLAlias::expireWildcards (  ) 

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

Definition at line 520 of file ezurlalias.php.

Referenced by eZContentObjectTreeNode::updateSubTreePath().

eZURLAlias::eZURLAlias ( row  ) 

Initializes a new URL alias.

Definition at line 62 of file ezurlalias.php.

Referenced by create().

eZURLAlias::fetch ( id,
asObject = true 
) [static]

Fetches the URL alias by ID.

Definition at line 305 of file ezurlalias.php.

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

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

Fetches the URL alias by destination URL $url.

Parameters:
$isInternal boolean which controls whether internal or external urls are fetched.
Returns:
the URL alias object or null

Definition at line 341 of file ezurlalias.php.

eZURLAlias::fetchByOffset ( offset,
limit,
asObject = true 
) [static]

Fetches non-internal URL alias by offset and limit

Definition at line 357 of file ezurlalias.php.

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

Fetches the URL alias by source URL $url.

Parameters:
$isInternal boolean which controls whether internal or external urls are fetched.
$noForwardID boolean 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

Definition at line 321 of file ezurlalias.php.

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

eZURLAlias::fetchWildcards ( asObject = true  )  [static]

Fetches all wildcards from DB.

Definition at line 371 of file ezurlalias.php.

Referenced by createWildcardMatches().

& eZURLAlias::forwardURL (  ) 
Returns:
the URL alias object this URL alias points to or null if no such URL exists.

Definition at line 124 of file ezurlalias.php.

& eZURLAlias::isWildcardExpired ( timestamp  ) 
Returns:
true if the wildcard cache is expired.

Definition at line 503 of file ezurlalias.php.

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.

Definition at line 175 of file ezurlalias.php.

& eZURLAlias::totalCount (  )  [static]

Counts the non-internal URL alias

Definition at line 656 of file ezurlalias.php.

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.

Definition at line 728 of file ezurlalias.php.

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.

Definition at line 534 of file ezurlalias.php.

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.

Definition at line 206 of file ezurlalias.php.

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.

Definition at line 287 of file ezurlalias.php.

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


The documentation for this class was generated from the following file:
Generated on Mon Jul 12 07:10:32 2010 for eZ publish by  doxygen 1.6.3