Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
eZURLAliasML Class Reference

Handles URL aliases in eZ Publish. More...

Inheritance diagram for eZURLAliasML:

## Public Member Functions
| __construct ( $row)
| actionURL ()
| setAttribute ( $name, $value)
| store ( $fieldFilters=null)
| getChildren ()
| getPath ( $locale=null, $incomingLanguageList=null)
Public Member Functions inherited from eZPersistentObject
| eZPersistentObject ( $row=null)
| fill ( $row)
| remove ( $conditions=null, $extraConditions=null)
| sync ( $fieldFilters=null)
| attributes ()
| hasAttribute ( $attr)
| attribute ( $attr, $noFunction=false)
| hasDirtyData ()
| setHasDirtyData ( $hasDirtyData)

## Static Public Member Functions
static | definition ()
static | strtolower ( $text)
static | create ( $element, $action, $parentID, $language)
static | removeByAction ( $actionName, $actionValue)
static | removeSingleEntry ( $parentID, $textMD5, $language)
static | storePath ( $path, $action, $languageName=false, $linkID=false, $alwaysAvailable=false, $rootID=false, $cleanupElements=true, $autoAdjustName=false, $reportErrors=true, $aliasRedirects=true)
static | fetchByAction ( $actionName, $actionValue, $maskLanguages=false, $onlyPrioritized=false, $includeRedirections=false)
static | fetchByParentID ( $id, $maskLanguages=false, $onlyPrioritized=false, $includeRedirections=true)
static | fetchPathByActionList ( $actionName, $actionValues, $locale=null)
static | fetchByPath ( $uriString, $glob=false)
static | fetchNodeIDByPath ( $uriString, $glob=false)
static | translate (&$uri, $reverse=false)
static | reverseTranslate (&$uri, $uriString, $internalURIString)
static | getPathPrefix ()
static | removePathPrefixFromURI ($uriString)
static | urlTranslationEnabledByUri (eZURI $uri)
static | findUniqueText ( $parentElementID, $text, $action, $linkCheck=false, $languageID=false)
static | setLangMaskAlwaysAvailable ( $langID, $actionName, $actionValue)
static | choosePrioritizedRow ( $rows)
static | actionToUrl ( $action)
static | urlToAction ( $url)
static | cleanURL ( $url)
static | sanitizeURL ( $url)
static | convertToAlias ( $urlElement, $defaultValue=false)
static | convertToAliasCompat ( $urlElement, $defaultValue=false)
static | convertPathToAlias ( $pathURL)
static | nodeIDFromAction ( $action)
static | getNewID ()
Static Public Member Functions inherited from eZPersistentObject
static | replaceFieldsWithShortNames (eZDBInterface $db, array $fieldDefs, &$fields)
static | count ( $def, $conds=null, $field=null)
static | fetchObject ( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
static | removeObject ( $def, $conditions=null, $extraConditions=null)
static | storeObject ( $obj, $fieldFilters=null)
static | conditionText ( $conditions)
static | conditionTextByRow ( $conditions, $row)
static | fetchObjectList ( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
static | handleRows ( $rows, $class_name, $asObject)
static | swapRow ( $table, $keys, $order_id, $rows, $id1, $id2)
static | newObjectOrder ( $def, $orderField, $conditions)
static | reorderObject ( $def, $orderField, $conditions, $down=true)
static | escapeArray ( $array)
static | updateObjectList ( $parameters)
static | getShortAttributeName ( $db, $def, $attrName)

## Public Attributes
const | LINK_ID_NOT_FOUND = 1
const | LINK_ID_WRONG_ACTION = 2
const | LINK_ALREADY_TAKEN = 3
const | ACTION_INVALID = 51
const | DB_ERROR = 101
| $Path
| $ID
| $Parent
| $Link
| $Text
| $TextMD5
| $LangMask
| $Action
| $ActionType
| $AliasRedirects
| $IsAlias
| $IsOriginal
Public Attributes inherited from eZPersistentObject
| $PersistentDataDirty
| $ID
| $ContentObjectID
| $SectionID
| $OwnerID
| $ClassID
| $Published
| $Modified
| $CurrentVersion
| $Status
| $RemoteID
| $LanguageMask
| $InitialLanguageID
| $NodeID
| $ParentNodeID
| $MainNodeID
| $ContentObjectVersion
| $ContentObjectIsPublished
| $Depth
| $SortField
| $SortOrder
| $Priority
| $ModifiedSubNode
| $PathString
| $PathIdentificationString
| $IsHidden
| $IsInvisible
| $UserID
| $Name
| $Locale
| $Identifier
| $NavigationPartIdentifier
| $SerializedDescriptionList
| $URLAliasName
| $AlwaysAvailable
| $CanTranslate
| $DataInt1
| $DataInt2
| $DataInt3
| $DataInt4
| $DataFloat1
| $DataFloat2
| $DataFloat3
| $DataFloat4
| $DataText1
| $DataText2
| $DataText3
| $DataText4
| $DataText5
| $SerializedDataText
| $Category
| $PolicyID
| $Values
| $Created
| $CurrencyCode
| $ProductCollectionID
| $ItemCount
| $Price
| $IsVATIncluded
| $VATValue
| $DiscountValue
| $Email
| $IsTemporary
| $IsArchived
| $IsActive
| $OrderID
| $ModifierID
| $Code
| $Symbol
| $AutoRateValue
| $CustomRateValue
| $RateFactor
| $Main
| $MementoKey
| $MainKey
| $WorkflowEventPos
| $LanguageID
| $ContentObjectStateGroupID
| $contentobject_attribute_id
| $contentobject_id
| $rating
| $rating_count
| $rating_average

## Static Private Member Functions
static | dbError ( $db)
static | filterRows ( $rows, $onlyPrioritized)
static | languageScore ( $mask)
static | generateSelect ( $table, $i, $len)
static | generateFullSelect ( $table)
static | generateCond ( $table, $prevTable, $i, $langMask, $element)
static | generateGlobCond ( $table, $prevTable, $i, $langMask, $glob)
static | md5 ( $db, $text, $escape=true)

## Static Private Attributes
static | $charset = null

## Additional Inherited Members
Static Protected Member Functions inherited from eZPersistentObject
static | replaceFieldsWithLongNames (eZDBInterface $db, array $fieldDefs, &$fields)

## 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, this performed using methods from eZPersistentObject.

The table used to store path information is designed to keep each element in the path (separated by /) in one row, ie. not the entire path. Each row uses the parent field to say which element is the parent of the current one, a value of 0 means a top-level path element. The system also supports path elemens in multiple languages, each language is stored in separate rows but with the same path element ID, the exception is when the text of multiple languages are the same then they will simply share the same row.

Instead of manipulating path elements directly it is recommended to use one the higher level methods for fetching or storing a path.

For objects the methods getChildren() and getPath() can be used to fetch the child elements and path string.

Typically you will not have a path element object and should use on of these static functions:

- storePath() - Stores a given path with specified action, all parent are created if they don't exist.
- fetchByPath() - Fetch path elements by path string, some wildcard support is also available.
- translate() - Translate requested path string into the internal path.

For more detailed path element handling these static methods are available:

- fetchByAction() - Fetch a path element based on the action.
- fetchByParentID() - Fetch path elements based on parent ID.
- fetchPathByActionList() - Fetch path string based on action values, this is more optimized than getPath().
- setLangMaskAlwaysAvailable() - Updates language mask for path elements based on actions.

Most of these methods have some common arguments, they can be:

- $maskLanguages - If true then only elements which matches the currently prioritized languaes is processed.
- $onlyPrioritized - If true then only the top prioritized language of the elements is considered. Requires $maskLanguages to be set to true.
- $includeRedirections - If true then elements which redirects to this is also processed.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 57 of file ezurlaliasml.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZURLAliasML::__construct | ( |  | $row | ) |

Initializes the object with the $row.

It will try to set each field taken from the database row. Calls fill to do the job. If $row is an integer, it will try to fetch it from the database using it as the unique ID.

Parameters

  int | array | $row |

Reimplemented from eZPersistentObject.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 133 of file ezurlaliasml.php.

## Member Function Documentation

## ◆ actionToUrl()

static eZURLAliasML::actionToUrl | ( |  | $action | ) |
| static

Decodes the action string $action into an internal path string and returns it.

The following actions are supported:

- eznode - argument is node ID, path is 'content/view/full/<nodeID>'
- module - argument is module/view/args, path is the arguments
- nop - a no-op, path is '/'

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2111 of file ezurlaliasml.php.

References eZDebug\writeError().

Referenced by eZPathElement\actionURL(), actionURL(), and translate().

## ◆ actionURL()

eZURLAliasML::actionURL | ( |  | ) |

Converts the action property into a real url which responds to the module/view on the site.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 225 of file ezurlaliasml.php.

References actionToUrl().

## ◆ choosePrioritizedRow()

static eZURLAliasML::choosePrioritizedRow | ( |  | $rows | ) |
| static

Chooses the most prioritized row (based on language) of $rows and returns it.

Parameters

  array | $rows |

Returns
  array|false The most prioritized row, or false if no match was found

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2003 of file ezurlaliasml.php.

References languageScore(), and eZDebug\writeWarning().

Referenced by fetchByPath(), filterRows(), getPath(), eZPathElement\getPath(), eZPathElement\getPathArray(), reverseTranslate(), and translate().

## ◆ cleanURL()

static eZURLAliasML::cleanURL | ( |  | $url | ) |
| static

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

Returns
  the clean URL

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2182 of file ezurlaliasml.php.

Referenced by eZContentObjectTreeNode\checkPath(), fetchByPath(), getPathPrefix(), eZHTTPHeader\headerOverrideArray(), storePath(), eZURLWildcard\translate(), translate(), and eZContentObjectTreeNode\urlAlias().

## ◆ convertPathToAlias()

static eZURLAliasML::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

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2357 of file ezurlaliasml.php.

References convertToAlias().

## ◆ convertToAlias()

static eZURLAliasML::convertToAlias | ( |  | $urlElement,
|  |  | $defaultValue = `false`
| ) |  |
| static

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2292 of file ezurlaliasml.php.

References eZCharTransform\instance().

Referenced by convertPathToAlias(), eZImageAliasHandler\normalizeImageName(), eZContentObjectTreeNode\pathWithNames(), storePath(), and eZContentObjectTreeNode\updateSubTreePath().

## ◆ convertToAliasCompat()

static eZURLAliasML::convertToAliasCompat | ( |  | $urlElement,
|  |  | $defaultValue = `false`
| ) |  |
| static

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2332 of file ezurlaliasml.php.

References eZCharTransform\instance().

Referenced by eZContentObjectTreeNode\updateSubTreePath().

## ◆ create()

static eZURLAliasML::create | ( |  | $element,
|  |  | $action,
|  |  | $parentID,
|  |  | $language
| ) |  |
| static

Creates a new path element with given arguments, MD5 sum is automatically created.

Parameters

  $element | The text string for the path element.
  $action | Action string.
  $parentID | ID of parent path element.
  $language | ID or mask of languages
  $languageName | Name of language(s), comma separated

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 239 of file ezurlaliasml.php.

References md5(), and strtolower().

Referenced by storePath().

## ◆ dbError()

static eZURLAliasML::dbError | ( |  | $db | ) |
| static private

Returns a structure with the current database error.

Note
  This is used by storePath().

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 911 of file ezurlaliasml.php.

Referenced by storePath().

## ◆ definition()

static eZURLAliasML::definition | ( |  | ) |
| static

Returns the definition for the object, the default implementation is to return an empty array. It's upto each inheriting class to return a proper definition array.

The definition array is an associative array consists of these keys:

- fields: an associative array of fields which defines which database field (the key) is to fetched and how they map to object member variables (the value).
- keys: an array of fields which is used for uniquely identifying the object in the table.
- function_attributes: an associative array of attributes which maps to member functions, used for fetching data with functions.
- set_functions: an associative array of attributes which maps to member functions, used for setting data with functions.
- increment_key: the field which is incremented on table inserts.
- class_name: the classname which is used for instantiating new objecs when fetching from the database.
- sort: an associative array which defines the default sorting of lists, the key is the table field while the value is the sorting method which is either 'asc' or 'desc'.
- name: the name of the database table

Example: `public static function definition() { return array( "fields" => array( "id" => "ID", "version" => "Version", "name" => "Name" ), "keys" => array( "id", "version" ), "function_attributes" => array( "current" => "currentVersion", "class_name" => "className" ), "increment_key" => "id", "class_name" => "eZContentClass", "sort" => array( "id" => "asc" ), "name" => "ezcontentclass" ); }`

Returns
  array

Reimplemented from eZPersistentObject.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 143 of file ezurlaliasml.php.

## ◆ fetchByAction()

static eZURLAliasML::fetchByAction | ( |  | $actionName,
|  |  | $actionValue,
|  |  | $maskLanguages = `false`,
|  |  | $onlyPrioritized = `false`,
|  |  | $includeRedirections = `false`
| ) |  |
| static

Fetches real path element(s) which matches the action name $actionName and value $actionValue.

Lets say we have the following elements:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
2 6 0 'spam' 'eznode:55'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
5 5 3 'repairman' 'eznode:42'
6 6 3 'repoman' 'eznode:55'
=== ==== ====== =========== ==========

then we try to fetch a specific action:

$elements = eZURLAliasML::fetchByAction( 'eznode', 5 );
eZURLAliasML\fetchByAction
static fetchByAction( $actionName, $actionValue, $maskLanguages=false, $onlyPrioritized=false, $includeRedirections=false)
Definition: ezurlaliasml.php:967

it would return:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
3 3 0 'bicycle' 'eznode:5'
=== ==== ====== =========== ==========

Now let's try with an element which is redirecting:

$elements = eZURLAliasML::fetchByAction( 'eznode', 10 );

it would return:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
2 6 0 'spam' 'eznode:55'
=== ==== ====== =========== ==========

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 967 of file ezurlaliasml.php.

References eZPersistentObject\count(), filterRows(), eZPersistentObject\handleRows(), eZDB\instance(), eZContentLanguage\languagesSQLFilter(), and eZContentLanguage\maskByLocale().

Referenced by eZContentObjectTreeNode\adjustPathElement(), eZStaticCache\generateNodeListCache(), and eZContentObjectTreeNode\updateSubTreePath().

## ◆ fetchByParentID()

static eZURLAliasML::fetchByParentID | ( |  | $id,
|  |  | $maskLanguages = `false`,
|  |  | $onlyPrioritized = `false`,
|  |  | $includeRedirections = `true`
| ) |  |
| static

Fetches path element(s) which matches the parent ID $id.

Lets say we have the following elements:

=== ==== ====== =========== ========== id link parent text action === ==== ====== =========== ========== 1 1 0 'ham' 'eznode:4' 2 6 0 'spam' 'eznode:55' 3 3 0 'bicycle' 'eznode:5' 4 4 0 'superman' 'nop:' 5 5 3 'repairman' 'eznode:42' 6 6 3 'repoman' 'eznode:55' === ==== ====== =========== ==========

then we try to fetch a specific ID:

eZURLAliasML::fetchByParentID( 0 );
eZURLAliasML\fetchByParentID
static fetchByParentID( $id, $maskLanguages=false, $onlyPrioritized=false, $includeRedirections=true)
Definition: ezurlaliasml.php:1049

it would return (ie. no redirections):

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
=== ==== ====== =========== ==========

Now let's try with an element which is redirecting:

$includeRedirections = true;
eZURLAliasML::fetchByParentID( 0, false, false, $includeRedirections );

it would return:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
2 6 0 'spam' 'eznode:55'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
=== ==== ====== =========== ==========

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1049 of file ezurlaliasml.php.

References filterRows(), eZPersistentObject\handleRows(), eZDB\instance(), and eZContentLanguage\languagesSQLFilter().

Referenced by eZStaticCache\generateCache(), and getChildren().

## ◆ fetchByPath()

static eZURLAliasML::fetchByPath | ( |  | $uriString,
|  |  | $glob = `false`
| ) |  |
| static

Fetches the path element(s) which has the path $uriString. If $glob is set it will use $uriString as the folder to search in and $glob as the starting text to match against.

Lets say we have the following elements:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
2 6 0 'spam' 'eznode:55'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
5 5 3 'repairman' 'eznode:42'
6 6 3 'repoman' 'eznode:55'
=== ==== ====== =========== ==========

Then we try to fetch a specific path:

$elements = eZURLAliasML::fetchByPath( "bicycle/repairman" );
eZURLAliasML\fetchByPath
static fetchByPath( $uriString, $glob=false)
Definition: ezurlaliasml.php:1253

we would get:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
5 5 3 'repairman' 'eznode:42'
=== ==== ====== =========== ==========
$elements = eZURLAliasML::fetchByPath( "bicycle", "rep" ); // bicycle/rep*

we would get:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
5 5 3 'repairman' 'eznode:42'
6 6 3 'repoman' 'eznode:55'
=== ==== ====== =========== ==========

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1253 of file ezurlaliasml.php.

References choosePrioritizedRow(), cleanURL(), eZPersistentObject\count(), generateCond(), generateFullSelect(), generateGlobCond(), generateSelect(), eZPersistentObject\handleRows(), eZDB\instance(), and eZContentLanguage\languagesSQLFilter().

Referenced by fetchNodeIDByPath(), and eZStaticCache\generateCache().

## ◆ fetchNodeIDByPath()

static eZURLAliasML::fetchNodeIDByPath | ( |  | $uriString,
|  |  | $glob = `false`
| ) |  |
| static

The same as 'fetchByPath' but extracting nodeID from action. Only first entry will be processed if 'fetchByPath' returns multiple result(e.g. $glob is wildcard).

Returns
  nodeID on success or `false` otherwise.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1396 of file ezurlaliasml.php.

References eZPersistentObject\count(), fetchByPath(), and nodeIDFromAction().

Referenced by eZTemplateCacheBlock\decodeNodeID().

## ◆ fetchPathByActionList()

static eZURLAliasML::fetchPathByActionList | ( |  | $actionName,
|  |  | $actionValues,
|  |  | $locale = `null`
| ) |  |
| static

Fetches the path string based on the action $actionName and the values $actionValues. The first entry in $actionValues would be the top-most path element in the path the second entry the child of the first path element and so on.

Lets say we have the following elements:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
2 6 0 'spam' 'eznode:55'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
5 5 3 'repairman' 'eznode:42'
6 6 3 'repoman' 'eznode:55'
=== ==== ====== =========== ==========

then we try to fetch a specific ID:

$path = eZURLAliasML::fetchPathByActionList( 'eznode', array( 3, 5 ) );
eZURLAliasML\fetchPathByActionList
static fetchPathByActionList( $actionName, $actionValues, $locale=null)
Definition: ezurlaliasml.php:1103

it would return:

'bicycle/repairman'

Note
  This function is faster than getPath() since it can fetch all elements in one SQL.
  If the fetched elements does not point to each other (parent/id) then null is returned.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1103 of file ezurlaliasml.php.

References eZPersistentObject\attribute(), eZPersistentObject\count(), eZContentLanguage\fetchByLocale(), eZContentObject\fetchByNodeID(), eZDB\instance(), eZContentLanguage\languagesSQLFilter(), eZContentLanguage\prioritizedLanguages(), and eZDebug\writeError().

Referenced by eZContentObjectTreeNode\pathWithNames().

## ◆ filterRows()

static eZURLAliasML::filterRows | ( |  | $rows,
|  |  | $onlyPrioritized
| ) |  |
| static private

Filters the DB rows $rows by selecting the most prioritized row per path element and returns the new row list.

Parameters

  $onlyPrioritized | If false all rows are returned, if true filtering is performed.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2044 of file ezurlaliasml.php.

References choosePrioritizedRow().

Referenced by fetchByAction(), and fetchByParentID().

## ◆ findUniqueText()

static eZURLAliasML::findUniqueText | ( |  | $parentElementID,
|  |  | $text,
|  |  | $action,
|  |  | $linkCheck = `false`,
|  |  | $languageID = `false`
| ) |  |
| static

Checks if the text entry $text is unique on the current level in the URL path. If not the name is adjusted with a number at the end until it becomes unique. The unique text string is returned.

Parameters

  $text | The text element which is to be checked
  $action | The action string which is to be excluded from the check. Set to empty string to disable the exclusion.
  $linkCheck | If true then it will see all existing entries as taken.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1888 of file ezurlaliasml.php.

References eZPersistentObject\count(), eZDB\instance(), and md5().

Referenced by eZContentObjectTreeNode\adjustPathElement().

## ◆ generateCond()

static eZURLAliasML::generateCond | ( |  | $table,
|  |  | $prevTable,
|  |  | $i,
|  |  | $langMask,
|  |  | $element
| ) |  |
| static private

Generates WHERE part of SQL based on table $table, previous table $prevTable, counter $i, language mask $langMask and text $element.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2239 of file ezurlaliasml.php.

References eZDB\instance(), and md5().

Referenced by fetchByPath().

## ◆ generateFullSelect()

static eZURLAliasML::generateFullSelect | ( |  | $table | ) |
| static private

Generates full SELECT part of SQL based on table $table.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2228 of file ezurlaliasml.php.

Referenced by fetchByPath().

## ◆ generateGlobCond()

static eZURLAliasML::generateGlobCond | ( |  | $table,
|  |  | $prevTable,
|  |  | $i,
|  |  | $langMask,
|  |  | $glob
| ) |  |
| static private

Generates WHERE part of SQL for a wildcard match based on table $table, previous table $prevTable, counter $i, language mask $langMask and wildcard text $glob.

Note
  $glob does not contain the wildcard character * but only the beginning of the matching text.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2259 of file ezurlaliasml.php.

References eZDB\instance().

Referenced by fetchByPath().

## ◆ generateSelect()

static eZURLAliasML::generateSelect | ( |  | $table,
|  |  | $i,
|  |  | $len
| ) |  |
| static private

Generates partial SELECT part of SQL based on table $table, counter $i and total length $len.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2210 of file ezurlaliasml.php.

Referenced by fetchByPath().

## ◆ getChildren()

eZURLAliasML::getChildren | ( |  | ) |

Finds all the children of the current element.

For more control over the list use fetchByParentID().

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 369 of file ezurlaliasml.php.

References fetchByParentID().

## ◆ getNewID()

static eZURLAliasML::getNewID | ( |  | ) |
| static

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2406 of file ezurlaliasml.php.

References eZDB\instance().

Referenced by store(), and storePath().

## ◆ getPath()

eZURLAliasML::getPath | ( |  | $locale = `null`,
|  |  | $incomingLanguageList = `null`
| ) |  |

Calculates the full path for the current item and returns it.

Parameters

  $locale | The locale for which a path should be calculated.
  $incomingLanguageList | Array of locale codes representing the prioritized site language list.

Note
  If you know the action values of the path use fetchPathByActionList() instead, it is more optimized.
  The calculated path is cached in $Path.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 383 of file ezurlaliasml.php.

References $Path, choosePrioritizedRow(), eZContentLanguage\clearPrioritizedLanguages(), eZPersistentObject\count(), eZDB\instance(), eZContentLanguage\languagesSQLFilter(), and eZContentLanguage\setPrioritizedLanguages().

## ◆ getPathPrefix()

static eZURLAliasML::getPathPrefix | ( |  | ) |
| static

Returns PathPrefix without leading or trailing slashes if it's configured. Otherwise returns false.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1809 of file ezurlaliasml.php.

References cleanURL().

Referenced by removePathPrefixFromURI(), and translate().

## ◆ languageScore()

static eZURLAliasML::languageScore | ( |  | $mask | ) |
| static private

Calculates the score of the language mask $mask based upon the currently prioritized languages and returns it.

Note
  The higher the value the more the language is prioritized.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2076 of file ezurlaliasml.php.

References eZPersistentObject\count(), and eZContentLanguage\prioritizedLanguages().

Referenced by choosePrioritizedRow().

## ◆ md5()

static eZURLAliasML::md5 | ( |  | $db,
|  |  | $text,
|  |  | $escape = `true`
| ) |  |
| static private

Wraps a database md5 call around the string $text and returns the new SQL for it.

Parameters

  $escape | If true it will lowercase the text and escape it.

Note
  If the database is Oracle and the text is empty the MD5 is computed by PHP and returned.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2395 of file ezurlaliasml.php.

References strtolower().

Referenced by create(), findUniqueText(), generateCond(), setAttribute(), store(), storePath(), and translate().

## ◆ nodeIDFromAction()

static eZURLAliasML::nodeIDFromAction | ( |  | $action | ) |
| static

Grabs nodeID from action string.

Returns
  nodeID on success, `false` otherwise.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2377 of file ezurlaliasml.php.

Referenced by fetchNodeIDByPath().

## ◆ removeByAction()

static eZURLAliasML::removeByAction | ( |  | $actionName,
|  |  | $actionValue
| ) |  |
| static

Removes all path elements which matches the action name $actionName and value $actionValue.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 304 of file ezurlaliasml.php.

References eZDB\instance().

Referenced by eZContentObjectTreeNode\removeThis().

## ◆ removePathPrefixFromURI()

static eZURLAliasML::removePathPrefixFromURI | ( |  | $uriString | ) |
| static

Remove PathPrefix from the URI string, if it's configured and not affected by PathPrefixExclude. Returns the URI string.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1824 of file ezurlaliasml.php.

References getPathPrefix().

Referenced by reverseTranslate().

## ◆ removeSingleEntry()

static eZURLAliasML::removeSingleEntry | ( |  | $parentID,
|  |  | $textMD5,
|  |  | $language
| ) |  |
| static

Removes a URL-Alias which has parent $parentID, MD5 text $textMD5 and language $language. If the entry has only the specified language and there are existing children the entry will be disabled instead of removed. If the entry has other languages other than the one which was specified the language bit is removed.

Parameters

  $parentID | ID of the parent element
  $textMD5 | MD5 of the lowercase version of the text, see eZURLAliasML::strtolower().
  $language | The language entry to remove, can be a string with the locale or a language object (eZContentLanguage).

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 323 of file ezurlaliasml.php.

References eZPersistentObject\count(), eZContentLanguage\fetchByLocale(), and eZDB\instance().

Referenced by eZContentObject\removeTranslation().

## ◆ reverseTranslate()

static eZURLAliasML::reverseTranslate | ( | & | $uri,
|  |  | $uriString,
|  |  | $internalURIString
| ) |  |
| static

Perform reverse translation of uri, that is from system-url to url alias.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1740 of file ezurlaliasml.php.

References choosePrioritizedRow(), eZPersistentObject\count(), eZDB\instance(), eZContentLanguage\languagesSQLFilter(), removePathPrefixFromURI(), urlToAction(), and eZDebug\writeError().

Referenced by translate().

## ◆ sanitizeURL()

static eZURLAliasML::sanitizeURL | ( |  | $url | ) |
| static

Transform a semi-valid url into one that can be stored in the url-alias system. Removes leading/trailing slashes and repeated slashes.

echo eZURLAliasML::sanitizeURL( "" ); // Result ""
echo eZURLAliasML::sanitizeURL( "users//the_dude" ); // Result "users/the_dude"
echo eZURLAliasML::sanitizeURL( "archive/products/" ); // Result "archive/products"
eZURLAliasML\sanitizeURL
static sanitizeURL( $url)
Definition: ezurlaliasml.php:2199

Returns
  the sanitized URL

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2199 of file ezurlaliasml.php.

## ◆ setAttribute()

eZURLAliasML::setAttribute | ( |  | $name,
|  |  | $value
| ) |  |

Overrides the default behaviour to automatically update TextMD5.

Reimplemented from eZPersistentObject.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 252 of file ezurlaliasml.php.

References md5(), and strtolower().

## ◆ setLangMaskAlwaysAvailable()

static eZURLAliasML::setLangMaskAlwaysAvailable | ( |  | $langID,
|  |  | $actionName,
|  |  | $actionValue
| ) |  |
| static

Updates the lang_mask field for path elements which matches action $actionName and value $actionValue. If $langID is false then bit 0 (the always available bit) will be removed, otherwise it will set bit 0 for the chosen language and remove it for other languages.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1951 of file ezurlaliasml.php.

References eZDB\instance(), and eZDebug\writeError().

Referenced by eZContentObject\setAlwaysAvailableLanguageID().

## ◆ store()

eZURLAliasML::store | ( |  | $fieldFilters = `null` | ) |

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.

Reimplemented from eZPersistentObject.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 270 of file ezurlaliasml.php.

References $ID, $Link, getNewID(), md5(), and strtolower().

## ◆ storePath()

static eZURLAliasML::storePath | ( |  | $path,
|  |  | $action,
|  |  | $languageName = `false`,
|  |  | $linkID = `false`,
|  |  | $alwaysAvailable = `false`,
|  |  | $rootID = `false`,
|  |  | $cleanupElements = `true`,
|  |  | $autoAdjustName = `false`,
|  |  | $reportErrors = `true`,
|  |  | $aliasRedirects = `true`
| ) |  |
| static

Stores the full path $path to point to action $action, any missing parents are created as placeholders (ie. nop:).

Returns an array containing the entry 'status' which is the status code, is `true` if all went well, a number otherwise (see class constants). Will contain 'path' for succesful creation or if the path already exists.

Parameters

  $path | String containing full path, leading and trailing slashes are stripped.
  $action | Action string for entry.
  $languageName | The language to use for entry, can be a string (locale code, e.g. 'nor-NO') an eZContentLanguage object or false for the top prioritized language.
  $linkID | Numeric ID for link field, if it is set to false the entry will point to itself. Use this for redirections. Use `true` if you want to create an link/alias which points to a module (ie. no entry in urlalias table).
  $alwaysAvailable | If true the entry will be available in any language.
  $rootID | ID of the parent element to start at, use 0/false for the very top.
  $cleanupElements | If true each element in the path will be cleaned up according to the current URL transformation rules.
  $autoAdjustName | If true it will adjust the name until it is unique in the path. Used together with $linkID.
  $reportErrors | If true it will report found errors using eZDebug, if `false` errors are only return in 'status'.
  $aliasRedirects | If true and an alias is being stored it will redirect (using HTTP 301) to it's destination.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 454 of file ezurlaliasml.php.

References cleanURL(), convertToAlias(), eZPersistentObject\count(), create(), dbError(), eZContentLanguage\fetchByLocale(), getNewID(), eZDB\instance(), LINK_ID_NOT_FOUND, LINK_ID_WRONG_ACTION, md5(), strtolower(), eZContentLanguage\topPriorityLanguage(), and eZDebug\writeError().

Referenced by eZContentObjectTreeNode\updateSubTreePath().

## ◆ strtolower()

static eZURLAliasML::strtolower | ( |  | $text | ) |
| static

Unicode-aware strtolower, performs the conversion by using eZCharTransform

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 200 of file ezurlaliasml.php.

References eZCharTransform\instance(), and eZTextCodec\internalCharset().

Referenced by create(), md5(), setAttribute(), store(), and storePath().

## ◆ translate()

static eZURLAliasML::translate | ( | & | $uri,
|  |  | $reverse = `false`
| ) |  |
| static

Transforms the URI if there exists an alias for it, the new URI is replaced in $uri.

Returns
  `true` is if successful, `false` otherwise
  The string with new url is returned if the translation was found, but the resource has moved.

Lets say we have the following elements:

=== ==== ====== =========== ==========
id link parent text action
=== ==== ====== =========== ==========
1 1 0 'ham' 'eznode:4'
2 6 0 'spam' 'eznode:55'
3 3 0 'bicycle' 'eznode:5'
4 4 0 'superman' 'nop:'
5 5 3 'repairman' 'eznode:42'
6 6 3 'repoman' 'eznode:55'
=== ==== ====== =========== ==========

then we try to translate a path:

$uri = "bicycle/repairman";
$result = eZURLAliasML::translate( $uri );
if ( $result )
{
echo $result, "\n";
echo $uri, "\n";
}
eZURLAliasML\translate
static translate(&$uri, $reverse=false)
Definition: ezurlaliasml.php:1491

we would get:

'1'
'content/view/full/42'

If we then were to try:

$uri = "spam";
$result = eZURLAliasML::translate( $uri );
if ( $result )
{
echo $result, "\n";
echo $uri, "\n";
}

we would get:

'bicycle/repoman'
'error/301'

Trying a non-existing path:

$uri = "spam/a-lot";
$result = eZURLAliasML::translate( $uri );
if ( $result )
{
echo $result, "\n";
echo $uri, "\n";
}

then $result would be empty:

Alterntively we can also do a reverse lookup:

$uri = "content/view/full/55";
$result = eZURLAliasML::translate( $uri, true );
if ( $result )
{
echo $result, "\n";
echo $uri, "\n";
}

we would get:

'1'
'bicycle/repoman'

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1491 of file ezurlaliasml.php.

References actionToUrl(), choosePrioritizedRow(), cleanURL(), eZPersistentObject\count(), getPathPrefix(), eZDB\instance(), eZContentLanguage\languagesSQLFilter(), md5(), reverseTranslate(), and eZURLWildcard\wildcardExists().

Referenced by eZHTTPHeader\headerOverrideArray(), and eZURLWildcard\translate().

## ◆ urlToAction()

static eZURLAliasML::urlToAction | ( |  | $url | ) |
| static

Takes the url string $url and returns the action string for it.

The following path are supported:

- content/view/full/<nodeID> => eznode:<nodeID>

If the url points to an existing module it will return module:<url>

Returns
  false if the action could not be figured out.

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 2161 of file ezurlaliasml.php.

References eZModule\exists().

Referenced by reverseTranslate().

## ◆ urlTranslationEnabledByUri()

static eZURLAliasML::urlTranslationEnabledByUri | ( | eZURI | $uri | ) |
| static

Checks if url translation should be used on the current url.

Parameters

  $uri | The current eZUri object

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 1857 of file ezurlaliasml.php.

References eZURI\element(), and eZURI\isEmpty().

## Member Data Documentation

## ◆ $Action

eZURLAliasML::$Action

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 106 of file ezurlaliasml.php.

## ◆ $ActionType

eZURLAliasML::$ActionType

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 111 of file ezurlaliasml.php.

## ◆ $AliasRedirects

eZURLAliasML::$AliasRedirects

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 116 of file ezurlaliasml.php.

## ◆ $charset

eZURLAliasML::$charset = null
| static private

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 131 of file ezurlaliasml.php.

## ◆ $ID

eZURLAliasML::$ID

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 76 of file ezurlaliasml.php.

Referenced by store().

## ◆ $IsAlias

eZURLAliasML::$IsAlias

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 121 of file ezurlaliasml.php.

## ◆ $IsOriginal

eZURLAliasML::$IsOriginal

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 126 of file ezurlaliasml.php.

## ◆ $LangMask

eZURLAliasML::$LangMask

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 101 of file ezurlaliasml.php.

## ◆ $Link

eZURLAliasML::$Link

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 86 of file ezurlaliasml.php.

Referenced by store().

## ◆ $Parent

eZURLAliasML::$Parent

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 81 of file ezurlaliasml.php.

## ◆ $Path

eZURLAliasML::$Path

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 71 of file ezurlaliasml.php.

Referenced by getPath().

## ◆ $Text

eZURLAliasML::$Text

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 91 of file ezurlaliasml.php.

## ◆ $TextMD5

eZURLAliasML::$TextMD5

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 96 of file ezurlaliasml.php.

## ◆ ACTION_INVALID

const eZURLAliasML::ACTION_INVALID = 51

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 63 of file ezurlaliasml.php.

## ◆ DB_ERROR

const eZURLAliasML::DB_ERROR = 101

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 64 of file ezurlaliasml.php.

## ◆ LINK_ALREADY_TAKEN

const eZURLAliasML::LINK_ALREADY_TAKEN = 3

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 62 of file ezurlaliasml.php.

## ◆ LINK_ID_NOT_FOUND

const eZURLAliasML::LINK_ID_NOT_FOUND = 1

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 60 of file ezurlaliasml.php.

Referenced by storePath().

## ◆ LINK_ID_WRONG_ACTION

const eZURLAliasML::LINK_ID_WRONG_ACTION = 2

Examples
  /web/vh/ezpublish.se7enx.com/doc/api.exponential.earth/src/exponential/kernel/classes/ezurlaliasml.php.

Definition at line 61 of file ezurlaliasml.php.

Referenced by storePath().

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

- ezurlaliasml.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.