|
eZ Publish
[4.2]
|
Handles URL alias wildcards in eZ Publish. More...
Inheritance diagram for eZURLWildcard:
Collaboration diagram for eZURLWildcard:Public Member Functions | |
| asArray () | |
| Converts the url wildcard object to an associative array with the attribute names as array keys and the values as array values. | |
| eZURLWildcard ($row) | |
| Initializes a new URL alias persistent object. | |
| store ($fieldFilters=null) | |
| Stores the eZURLWildcard persistent object. | |
Static Public Member Functions | |
| static | cleanup ($baseURL) |
| Removes a wildcard based on a source_url. | |
| static | definition () |
| static | expireCache () |
| Expires the wildcard cache. | |
| static | fetch ($id, $asObject=true) |
| Fetch a wildcard by numerical ID. | |
| static | fetchBySourceURL ($url, $asObject=true) |
| Fetches a wildcard by source url. | |
| static | fetchCacheFile ($filepath) |
| Includes a wildcard cache file and returns its return value This method is used as a callback by eZClusterFileHandler::processFile. | |
| static | fetchList ($offset=false, $limit=false, $asObject=true) |
| Fetches the list of URL wildcards. | |
| static | fetchListCount () |
| Returns the number of wildcards in the database without any filtering. | |
| static | isCacheExpired ($timestamp) |
| Checks if the wildcard cache is expired. | |
| static | removeAll () |
| Removes all the wildcards. | |
| static | removeByIDs ($idList) |
| Removes wildcards based on an ID list. | |
| static | translate (&$uri) |
| Transforms the URI if there exists an alias for it. | |
Public Attributes | |
| const | CACHE_SIGNATURE = 'urlalias-wildcard' |
| const | TYPE_DIRECT = 2 |
| const | TYPE_FORWARD = 1 |
| const | TYPE_NONE = 0 |
| const | WILDCARDS_PER_CACHE_FILE = 100 |
Static Protected Member Functions | |
| static | cacheInfo () |
| Returns an array with information on the wildcard cache The array containst the following keys. | |
| static | cacheInfoDirectories (&$wildcardCacheDir, &$wildcardCacheFile, &$wildcardCachePath, &$wildcardKeys) |
| Sets the various cache information to the parameters. | |
| static | createWildcardsIndex () |
| Create the wildcard cache. | |
| static | expiryTimestamp () |
| Returns the expiry timestamp for wildcard cache from eZExpiryHandler. | |
| static | loadCacheFile ($cacheID= 'index') |
| Loads and returns the cluster handler instance for the requested cache file. | |
| static | matchRegexpCode ($wildcard) |
| Transforms the source-url of a wildcard to a preg_match compatible expression Example: foo/* will be converted to #^foo/(. | |
| static | matchReplaceCode ($wildcard) |
| Converts the destination-url of a wildcard to a preg_replace compatible expression. | |
| static | translateWithCache ($wildcardNum, &$uri, &$wildcardInfo, $matchRegexp) |
| The callback loads appropriate cache file for wildcard $wildcardNum, extracts wildcard info and 'replace' url from cache. | |
| static | wildcardsIndex () |
| Assign function names to input variables. | |
Static Protected Attributes | |
| static | $cacheFiles = array() |
| static | $wildcardsIndex = null |
Handles URL alias wildcards in eZ Publish.
Definition at line 41 of file ezurlwildcard.php.
| eZURLWildcard::asArray | ( | ) |
Converts the url wildcard object to an associative array with the attribute names as array keys and the values as array values.
Definition at line 115 of file ezurlwildcard.php.
| static eZURLWildcard::cacheInfo | ( | ) | [static, protected] |
Returns an array with information on the wildcard cache The array containst the following keys.
Definition at line 382 of file ezurlwildcard.php.
Referenced by cacheInfoDirectories(), and loadCacheFile().
| static eZURLWildcard::cacheInfoDirectories | ( | &$ | wildcardCacheDir, |
| &$ | wildcardCacheFile, | ||
| &$ | wildcardCachePath, | ||
| &$ | wildcardKeys | ||
| ) | [static, protected] |
Sets the various cache information to the parameters.
Definition at line 410 of file ezurlwildcard.php.
Referenced by createWildcardsIndex().
| static eZURLWildcard::cleanup | ( | $ | baseURL | ) | [static] |
Removes a wildcard based on a source_url.
The URL should be provided without the /* prefix: foobar will remove the wildcard with source_url = foobar/*
| string | $baseURL | URL prefix matched against destination_url |
Definition at line 138 of file ezurlwildcard.php.
| static eZURLWildcard::createWildcardsIndex | ( | ) | [static, protected] |
Create the wildcard cache.
The wildcard caches are splitted between several files: 'wildcard_<md5>_index.php': contains regexps for wildcards 'wildcard_<md5>_0.php', 'wildcard_<md5>_1.php', ... 'wildcard_<md5>_N.php': contains cached wildcards. Each file has info about eZURLWildcard::WILDCARDS_PER_CACHE_FILE wildcards.
Definition at line 503 of file ezurlwildcard.php.
Referenced by wildcardsIndex().
| static eZURLWildcard::definition | ( | ) | [static] |
The definition array is an associative array consists of these keys:
asc or desc.Example:
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" ); }
Reimplemented from eZPersistentObject.
Definition at line 84 of file ezurlwildcard.php.
| static eZURLWildcard::expireCache | ( | ) | [static] |
Expires the wildcard cache.
This causes the wildcard cache to be regenerated on the next page load.
Definition at line 424 of file ezurlwildcard.php.
Referenced by cleanup(), and removeAll().
| static eZURLWildcard::expiryTimestamp | ( | ) | [static, protected] |
Returns the expiry timestamp for wildcard cache from eZExpiryHandler.
Definition at line 437 of file ezurlwildcard.php.
| eZURLWildcard::eZURLWildcard | ( | $ | row | ) |
Initializes a new URL alias persistent object.
| array | $row |
Definition at line 79 of file ezurlwildcard.php.
| static eZURLWildcard::fetch | ( | $ | id, |
| $ | asObject = true |
||
| ) | [static] |
Fetch a wildcard by numerical ID.
| int | $id | |
| bool | $asObject |
Definition at line 186 of file ezurlwildcard.php.
| static eZURLWildcard::fetchBySourceURL | ( | $ | url, |
| $ | asObject = true |
||
| ) | [static] |
Fetches a wildcard by source url.
| string | $url | Source URL |
| bool | $asObject |
Definition at line 200 of file ezurlwildcard.php.
| static eZURLWildcard::fetchCacheFile | ( | $ | filepath | ) | [static] |
Includes a wildcard cache file and returns its return value This method is used as a callback by eZClusterFileHandler::processFile.
| string | $filepath |
Definition at line 690 of file ezurlwildcard.php.
| static eZURLWildcard::fetchList | ( | $ | offset = false, |
| $ | limit = false, |
||
| $ | asObject = true |
||
| ) | [static] |
Fetches the list of URL wildcards.
By defaults, fetches all the wildcards
| int | $offset | Offset to limit the list from |
| int | $limit | Limit to the number of fetched items |
| bool | $asObject |
Definition at line 215 of file ezurlwildcard.php.
Referenced by createWildcardsIndex().
| static eZURLWildcard::fetchListCount | ( | ) | [static] |
Returns the number of wildcards in the database without any filtering.
Definition at line 229 of file ezurlwildcard.php.
| static eZURLWildcard::isCacheExpired | ( | $ | timestamp | ) | [static] |
Checks if the wildcard cache is expired.
| int | $timestamp | Timestamp expiry should be checked against |
Definition at line 459 of file ezurlwildcard.php.
| static eZURLWildcard::loadCacheFile | ( | $ | cacheID = 'index' | ) | [static, protected] |
Loads and returns the cluster handler instance for the requested cache file.
The instance will be returned even if the file doesn't exist
| $cacheID | Cache file number. Will load the index if not provided. |
Definition at line 668 of file ezurlwildcard.php.
Referenced by createWildcardsIndex(), translateWithCache(), and wildcardsIndex().
| static eZURLWildcard::matchRegexpCode | ( | $ | wildcard | ) | [static, protected] |
Transforms the source-url of a wildcard to a preg_match compatible expression Example: foo/* will be converted to #^foo/(.
*)$#
| array | $wildcard | wildcard data with a source_url key |
Definition at line 559 of file ezurlwildcard.php.
Referenced by createWildcardsIndex().
| static eZURLWildcard::matchReplaceCode | ( | $ | wildcard | ) | [static, protected] |
Converts the destination-url of a wildcard to a preg_replace compatible expression.
Example: foobar/{1} will be converted to ...
| array | $wildcard | Wildcard array with a destination_url key |
Definition at line 587 of file ezurlwildcard.php.
Referenced by createWildcardsIndex().
| static eZURLWildcard::removeAll | ( | ) | [static] |
| static eZURLWildcard::removeByIDs | ( | $ | idList | ) | [static] |
Removes wildcards based on an ID list.
| array | $idList | array of numerical ID |
Definition at line 163 of file ezurlwildcard.php.
| eZURLWildcard::store | ( | $ | fieldFilters = null | ) |
Stores the eZURLWildcard persistent object.
Reimplemented from eZPersistentObject.
Definition at line 126 of file ezurlwildcard.php.
| static eZURLWildcard::translate | ( | &$ | uri | ) | [static] |
Transforms the URI if there exists an alias for it.
| eZURI | string | $uri |
Definition at line 249 of file ezurlwildcard.php.
| static eZURLWildcard::translateWithCache | ( | $ | wildcardNum, |
| &$ | uri, | ||
| &$ | wildcardInfo, | ||
| $ | matchRegexp | ||
| ) | [static, protected] |
The callback loads appropriate cache file for wildcard $wildcardNum, extracts wildcard info and 'replace' url from cache.
The wildcard number (not a wildcard id) is used here in order to load the appropriate cache file.
If it's needed to fetch wildcard from db, use eZURLWildcard::fetchList with offset = $wildcardNum and $limit = 1.
| int | $wildcardNum | |
| eZURI | string | $uri | |
| mixed | $wildcardInfo | |
| mixed | $matches |
Definition at line 633 of file ezurlwildcard.php.
Referenced by translate().
| static eZURLWildcard::wildcardsIndex | ( | ) | [static, protected] |
Assign function names to input variables.
Generates the wildcard cache if expired.
| $regexpArrayCallback | function to get an array of regexps |
Definition at line 472 of file ezurlwildcard.php.
eZURLWildcard::$cacheFiles = array() [static, protected] |
Definition at line 67 of file ezurlwildcard.php.
eZURLWildcard::$wildcardsIndex = null [static, protected] |
Definition at line 73 of file ezurlwildcard.php.
Referenced by createWildcardsIndex(), and wildcardsIndex().
| const eZURLWildcard::CACHE_SIGNATURE = 'urlalias-wildcard' |
Definition at line 61 of file ezurlwildcard.php.
| const eZURLWildcard::TYPE_DIRECT = 2 |
Definition at line 55 of file ezurlwildcard.php.
| const eZURLWildcard::TYPE_FORWARD = 1 |
Definition at line 54 of file ezurlwildcard.php.
| const eZURLWildcard::TYPE_NONE = 0 |
Definition at line 53 of file ezurlwildcard.php.
| const eZURLWildcard::WILDCARDS_PER_CACHE_FILE = 100 |
Definition at line 47 of file ezurlwildcard.php.
Referenced by createWildcardsIndex().