kernel/classes/ezurlwildcard.php
\eZURLWildcard
- Parent(s)
- \eZPersistentObject
Constants
Properties


$PersistentDataDirty= ''
- Type
- n/a
- Inherited_from
- \eZPersistentObject::$$PersistentDataDirty


\array(eZClusterFileHandlerInterface)
$cacheFiles= 'array()'
Cluster file handler instances of cache files
array()
Details- Type
- \array(eZClusterFileHandlerInterface)
Methods


asArray(
)
:
array
Converts the url wildcard object to an associative array with the attribute names as array keys and the values as array values
Type | Description |
---|---|
array |


attribute(
$attr, $noFunction
=
false
)
:
void
Name | Type | Description |
---|---|---|
$attr | ||
$noFunction |


cacheInfo(
)
:
array
Returns an array with information on the wildcard cache The array containst the following keys - dir - The directory for the cache - file - The base filename for the caches - path - The entire path (including filename) for the cache - keys - Array with key values which is used to uniquely identify the cache
Type | Description |
---|---|
array |


cacheInfoDirectories(
$wildcardCacheDir, $wildcardCacheFile, $wildcardCachePath, $wildcardKeys
)
:
void
Sets the various cache information to the parameters.
Name | Type | Description |
---|---|---|
$wildcardCacheDir | ||
$wildcardCacheFile | ||
$wildcardCachePath | ||
$wildcardKeys |
- Private


cleanup(
string $baseURL
)
:
void
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/*
Name | Type | Description |
---|---|---|
$baseURL | string | URL prefix matched against destination_url |


count(
$def, $conds
=
null, $field
=
null
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$conds | ||
$field |


createWildcardsIndex(
)
:
void
Create the wildcard cache
The wildcard caches are splitted between several files:
'wildcard_


eZPersistentObject(
$row
)
:
void
Name | Type | Description |
---|---|---|
$row |


eZURLWildcard(
array $row
)
:
void
Initializes a new URL alias persistent object
Name | Type | Description |
---|---|---|
$row | array |


expireCache(
)
:
void
Expires the wildcard cache. This causes the wildcard cache to be regenerated on the next page load.


expiryTimestamp(
)
:
int | bool
Returns the expiry timestamp for wildcard cache from eZExpiryHandler
Type | Description |
---|---|
int | bool | the timestamp if set, false otherwise |


fetch(
int $id, bool $asObject
=
true
)
:
\eZURLWildcard
Fetch a wildcard by numerical ID
Name | Type | Description |
---|---|---|
$id | int | |
$asObject | bool |
Type | Description |
---|---|
\eZURLWildcard | null if no match was found |


fetchBySourceURL(
string $url, bool $asObject
=
true
)
:
\eZURLWildcard
Fetches a wildcard by source url
Name | Type | Description |
---|---|---|
$url | string | Source URL |
$asObject | bool |
Type | Description |
---|---|
\eZURLWildcard | Null if no match was found |


fetchCacheFile(
string $filepath
)
:
array
Includes a wildcard cache file and returns its return value This method is used as a callback by eZClusterFileHandler::processFile
Name | Type | Description |
---|---|---|
$filepath | string |
Type | Description |
---|---|
array |


fetchList(
int $offset
=
false, int $limit
=
false, bool $asObject
=
true
)
:
\array[eZURLWildcard]
Fetches the list of URL wildcards. By defaults, fetches all the wildcards
Name | Type | Description |
---|---|---|
$offset | int | Offset to limit the list from |
$limit | int | Limit to the number of fetched items |
$asObject | bool |
Type | Description |
---|---|
\array[eZURLWildcard] |


fetchListCount(
)
:
int
Returns the number of wildcards in the database without any filtering
Type | Description |
---|---|
int | Number of wildcards in the database |


fetchObject(
$def, $field_filters, $conds, $asObject
=
true, $grouping
=
null, $custom_fields
=
null
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$field_filters | ||
$conds | ||
$asObject | ||
$grouping | ||
$custom_fields |


fetchObjectList(
$def, $field_filters
=
null, $conds
=
null, $sorts
=
null, $limit
=
null, $asObject
=
true, $grouping
=
false, $custom_fields
=
null, $custom_tables
=
null, $custom_conds
=
null
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$field_filters | ||
$conds | ||
$sorts | ||
$limit | ||
$asObject | ||
$grouping | ||
$custom_fields | ||
$custom_tables | ||
$custom_conds |


fill(
$row
)
:
void
Name | Type | Description |
---|---|---|
$row |


getShortAttributeName(
$db, $def, $attrName
)
:
void
Name | Type | Description |
---|---|---|
$db | ||
$def | ||
$attrName |


handleRows(
$rows, $class_name, $asObject
)
:
void
Name | Type | Description |
---|---|---|
$rows | ||
$class_name | ||
$asObject |


hasAttribute(
$attr
)
:
void
Name | Type | Description |
---|---|---|
$attr |


isCacheExpired(
int $timestamp
)
:
bool
Checks if the wildcard cache is expired
Name | Type | Description |
---|---|---|
$timestamp | int | Timestamp expiry should be checked against |
Type | Description |
---|---|
bool | true if cache is expired |
- Deprecated
- since 4.2.0


loadCacheFile(
\$cacheID $cacheID
=
'index'
)
:
\eZClusterFileHandlerInterface
Loads and returns the cluster handler instance for the requested cache file.
The instance will be returned even if the file doesn't exist
Name | Type | Description |
---|---|---|
$cacheID | \$cacheID | Cache file number. Will load the index if not provided. |
Type | Description |
---|---|
\eZClusterFileHandlerInterface |


matchRegexpCode(
array $wildcard
)
:
string
Transforms the source-url of a wildcard to a preg_match compatible expression Example: foo/* will be converted to #^foo/(.*)$#
Name | Type | Description |
---|---|---|
$wildcard | array | wildcard data with a source_url key |
Type | Description |
---|---|
string | preg_match compatible string |


matchReplaceCode(
array $wildcard
)
:
string
Converts the destination-url of a wildcard to a preg_replace compatible expression.
Example: foobar/{1} will be converted to ...
Name | Type | Description |
---|---|---|
$wildcard | array | Wildcard array with a destination_url key |
Type | Description |
---|---|
string | match/replace PHP Code |
- Todo
- fix the example
- Todo
- Try to replace the eval'd code with a preg_replace expression


newObjectOrder(
$def, $orderField, $conditions
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$orderField | ||
$conditions |


remove(
$conditions
=
null, $extraConditions
=
null
)
:
void
Name | Type | Description |
---|---|---|
$conditions | ||
$extraConditions |


removeByIDs(
array $idList
)
:
void
Removes wildcards based on an ID list
Name | Type | Description |
---|---|---|
$idList | array | array of numerical ID |


removeObject(
$def, $conditions
=
null, $extraConditions
=
null
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$conditions | ||
$extraConditions |


reorderObject(
$def, $orderField, $conditions, $down
=
true
)
:
void
Name | Type | Description |
---|---|---|
$def | ||
$orderField | ||
$conditions | ||
$down |


replaceFieldsWithShortNames(
$db, $fieldDefs, $fields
)
:
void
Name | Type | Description |
---|---|---|
$db | ||
$fieldDefs | ||
$fields |


setAttribute(
$attr, $val
)
:
void
Name | Type | Description |
---|---|---|
$attr | ||
$val |


setHasDirtyData(
$hasDirtyData
)
:
void
Name | Type | Description |
---|---|---|
$hasDirtyData |


store(
$fieldFilters
=
null
)
:
void
Stores the eZURLWildcard persistent object
Name | Type | Description |
---|---|---|
$fieldFilters |


storeObject(
$obj, $fieldFilters
=
null
)
:
void
Name | Type | Description |
---|---|---|
$obj | ||
$fieldFilters |


swapRow(
$table, $keys, $order_id, $rows, $id1, $id2
)
:
void
Name | Type | Description |
---|---|---|
$table | ||
$keys | ||
$order_id | ||
$rows | ||
$id1 | ||
$id2 |


sync(
$fieldFilters
=
null
)
:
void
Name | Type | Description |
---|---|---|
$fieldFilters |


translate(
\eZURI | string $uri
)
:
mixed
Transforms the URI if there exists an alias for it.
Name | Type | Description |
---|---|---|
$uri | \eZURI | string |
Type | Description |
---|---|
mixed | The translated URI if the resource has moved, or true|false if translation was (un)successful |


translateWithCache(
int $wildcardNum, \eZURI | string $uri, mixed $wildcardInfo, $matchRegexp
)
:
bool
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.
Name | Type | Description |
---|---|---|
$wildcardNum | int | |
$uri | \eZURI | string | |
$wildcardInfo | mixed | |
$matchRegexp |
Type | Description |
---|---|
bool |
- Todo
- make private, this method isn't used anywhere else