PHP Class eZ\Publish\Core\Repository\URLAliasService

Inheritance: implements eZ\Publish\API\Repository\URLAliasService
Afficher le fichier Open project: ezsystems/ezpublish-kernel

Protected Properties

Свойство Type Description
$repository eZ\Publish\API\Repository\Repository
$settings array
$urlAliasHandler eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler

Méthodes publiques

Méthode Description
__construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler $urlAliasHandler, array $settings = [] ) Setups service with reference to repository object that created it & corresponding handler.
createGlobalUrlAlias ( string $resource, string $path, string $languageCode, boolean $forwarding = false, boolean $alwaysAvailable = false ) : eZ\Publish\API\Repository\Values\Content\URLAlias Create a user chosen $alias pointing to a resource in $languageCode.
createUrlAlias ( eZ\Publish\API\Repository\Values\Content\Location $location, string $path, string $languageCode, boolean $forwarding = false, boolean $alwaysAvailable = false ) : eZ\Publish\API\Repository\Values\Content\URLAlias Create a user chosen $alias pointing to $location in $languageCode.
listGlobalAliases ( string $languageCode = null, integer $offset, integer $limit ) : eZ\Publish\API\Repository\Values\Content\URLAlias[] List global aliases.
listLocationAliases ( eZ\Publish\API\Repository\Values\Content\Location $location, boolean $custom = true, string $languageCode = null, null | boolean $showAllTranslations = null, array $prioritizedLanguageList = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias[] List of url aliases pointing to $location, sorted by language priority.
load ( string $id ) : eZ\Publish\API\Repository\Values\Content\URLAlias Loads URL alias by given $id.
lookup ( string $url, string $languageCode = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias looks up the URLAlias for the given url.
removeAliases ( array $aliasList ) Removes urls aliases.
reverseLookup ( eZ\Publish\API\Repository\Values\Content\Location $location, string $languageCode = null, null | boolean $showAllTranslations = null, array $prioritizedLanguageList = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias Returns the URL alias for the given location in the given language.

Méthodes protégées

Méthode Description
buildSPIUrlAlias ( eZ\Publish\API\Repository\Values\Content\URLAlias $urlAlias ) : eZ\Publish\SPI\Persistence\Content\URLAlias Builds persistence domain object.
buildUrlAliasDomainObject ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $path ) : eZ\Publish\API\Repository\Values\Content\URLAlias Builds API UrlAlias object from given SPI UrlAlias object.
choosePrioritizedLanguageCode ( array $entries, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean Returns language code with highest priority.
cleanUrl ( string $url ) : string
extractPath ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string $languageCode, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean Returns path extracted from normalized path data returned from persistence, using language settings.
isPathLoadable ( array $pathData, array $languageCodes ) : boolean Returns true or false depending if URL alias is loadable or not for language settings in place.
isUrlAliasLoadable ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $languageCode, $showAllTranslations, $prioritizedLanguageList ) : boolean Returns true or false depending if URL alias is loadable or not for language settings in place.
matchLanguageCode ( array $pathElementData, string $pathElement ) : string | boolean
matchPath ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string $path, string $languageCode ) : array Matches path string with normalized path data returned from persistence.
selectAliasLanguageCode ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $languageCode, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean Determines alias language code.

Private Methods

Méthode Description
sortTranslationsByPrioritizedLanguages ( array $translations ) : array Needed when translations for the part of the alias are the same for multiple languages.

Method Details

__construct() public méthode

Setups service with reference to repository object that created it & corresponding handler.
public __construct ( eZ\Publish\API\Repository\Repository $repository, eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler $urlAliasHandler, array $settings = [] )
$repository eZ\Publish\API\Repository\Repository
$urlAliasHandler eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler
$settings array

buildSPIUrlAlias() protected méthode

Builds persistence domain object.
protected buildSPIUrlAlias ( eZ\Publish\API\Repository\Values\Content\URLAlias $urlAlias ) : eZ\Publish\SPI\Persistence\Content\URLAlias
$urlAlias eZ\Publish\API\Repository\Values\Content\URLAlias
Résultat eZ\Publish\SPI\Persistence\Content\URLAlias

buildUrlAliasDomainObject() protected méthode

Builds API UrlAlias object from given SPI UrlAlias object.
protected buildUrlAliasDomainObject ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $path ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$spiUrlAlias eZ\Publish\SPI\Persistence\Content\URLAlias
$path string | null
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

choosePrioritizedLanguageCode() protected méthode

Will return false if language code could nto be matched with language settings in place.
protected choosePrioritizedLanguageCode ( array $entries, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean
$entries array
$showAllTranslations boolean
$prioritizedLanguageList string[]
Résultat string | boolean

cleanUrl() protected méthode

protected cleanUrl ( string $url ) : string
$url string
Résultat string

createGlobalUrlAlias() public méthode

This method does not handle location resources - if a user enters a location target the createCustomUrlAlias method has to be used. This method runs URL filters and and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given. $alwaysAvailable makes the alias available in all languages.
public createGlobalUrlAlias ( string $resource, string $path, string $languageCode, boolean $forwarding = false, boolean $alwaysAvailable = false ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$resource string
$path string
$languageCode string
$forwarding boolean
$alwaysAvailable boolean
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

createUrlAlias() public méthode

This method runs URL filters and transformers before storing them. Hence the path returned in the URLAlias Value may differ from the given. $alwaysAvailable makes the alias available in all languages.
public createUrlAlias ( eZ\Publish\API\Repository\Values\Content\Location $location, string $path, string $languageCode, boolean $forwarding = false, boolean $alwaysAvailable = false ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$location eZ\Publish\API\Repository\Values\Content\Location
$path string
$languageCode string the languageCode for which this alias is valid
$forwarding boolean if true a redirect is performed
$alwaysAvailable boolean
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

extractPath() protected méthode

Will return false if path could not be determined.
protected extractPath ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string $languageCode, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean
$spiUrlAlias eZ\Publish\SPI\Persistence\Content\URLAlias
$languageCode string
$showAllTranslations boolean
$prioritizedLanguageList string[]
Résultat string | boolean

isPathLoadable() protected méthode

Returns true or false depending if URL alias is loadable or not for language settings in place.
protected isPathLoadable ( array $pathData, array $languageCodes ) : boolean
$pathData array
$languageCodes array
Résultat boolean

isUrlAliasLoadable() protected méthode

Returns true or false depending if URL alias is loadable or not for language settings in place.
protected isUrlAliasLoadable ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $languageCode, $showAllTranslations, $prioritizedLanguageList ) : boolean
$spiUrlAlias eZ\Publish\SPI\Persistence\Content\URLAlias
$languageCode string | null
Résultat boolean

listGlobalAliases() public méthode

List global aliases.
public listGlobalAliases ( string $languageCode = null, integer $offset, integer $limit ) : eZ\Publish\API\Repository\Values\Content\URLAlias[]
$languageCode string filters those which are valid for the given language
$offset integer
$limit integer
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias[]

listLocationAliases() public méthode

List of url aliases pointing to $location, sorted by language priority.
public listLocationAliases ( eZ\Publish\API\Repository\Values\Content\Location $location, boolean $custom = true, string $languageCode = null, null | boolean $showAllTranslations = null, array $prioritizedLanguageList = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias[]
$location eZ\Publish\API\Repository\Values\Content\Location
$custom boolean if true the user generated aliases are listed otherwise the autogenerated
$languageCode string filters those which are valid for the given language
$showAllTranslations null | boolean
$prioritizedLanguageList array
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias[]

load() public méthode

Loads URL alias by given $id.
public load ( string $id ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$id string
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

lookup() public méthode

looks up the URLAlias for the given url.
public lookup ( string $url, string $languageCode = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$url string
$languageCode string
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

matchLanguageCode() protected méthode

protected matchLanguageCode ( array $pathElementData, string $pathElement ) : string | boolean
$pathElementData array
$pathElement string
Résultat string | boolean

matchPath() protected méthode

Returns matched path string (possibly case corrected) and array of corresponding language codes or false if path could not be matched.
protected matchPath ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string $path, string $languageCode ) : array
$spiUrlAlias eZ\Publish\SPI\Persistence\Content\URLAlias
$path string
$languageCode string
Résultat array

removeAliases() public méthode

This method does not remove autogenerated aliases for locations.
public removeAliases ( array $aliasList )
$aliasList array

reverseLookup() public méthode

If $languageCode is null the method returns the url alias in the most prioritized language.
public reverseLookup ( eZ\Publish\API\Repository\Values\Content\Location $location, string $languageCode = null, null | boolean $showAllTranslations = null, array $prioritizedLanguageList = null ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$location eZ\Publish\API\Repository\Values\Content\Location
$languageCode string
$showAllTranslations null | boolean
$prioritizedLanguageList array
Résultat eZ\Publish\API\Repository\Values\Content\URLAlias

selectAliasLanguageCode() protected méthode

Method will return false if language code can't be matched against alias language codes or language settings.
protected selectAliasLanguageCode ( eZ\Publish\SPI\Persistence\Content\URLAlias $spiUrlAlias, string | null $languageCode, boolean $showAllTranslations, string[] $prioritizedLanguageList ) : string | boolean
$spiUrlAlias eZ\Publish\SPI\Persistence\Content\URLAlias
$languageCode string | null
$showAllTranslations boolean
$prioritizedLanguageList string[]
Résultat string | boolean

Property Details

$repository protected_oe property

protected Repository,eZ\Publish\API\Repository $repository
Résultat eZ\Publish\API\Repository\Repository

$settings protected_oe property

protected array $settings
Résultat array

$urlAliasHandler protected_oe property

protected Handler,eZ\Publish\SPI\Persistence\Content\UrlAlias $urlAliasHandler
Résultat eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler