PHP Класс DmitryDulepov\Realurl\Encoder\UrlEncoder

Автор: Dmitry Dulepov ([email protected])
Наследование: extends DmitryDulepov\Realurl\EncodeDecoderBase
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$encodedUrl string
$encoderParameters array
$originalUrl string This is the URL with sorted GET parameters. It is used for cache manipulation.
$originalUrlParameters array
$pageRepository TYPO3\CMS\Frontend\Page\PageRepository
$sysLanguageUid integer
$urlParameters array
$urlPrepend string
$urlPrependRegister array
$urlToEncode string
$usedAliases array

Открытые методы

Метод Описание
__construct ( ) Initializes the class.
cleanUpAlias ( array $configuration, string $newAliasValue ) : string Cleans up the alias
encodeUrl ( array &$encoderParameters ) : void Entry point for the URL encoder.
getConfiguration ( ) : ConfigurationReader Returns the configuration reader. This can be used in hooks.
getOriginalUrlParameters ( ) : array Returns a coipy of original url parameters. This can be used in hooks.
getUtility ( ) : Utility Returns $this->utility. This can be used in hooks.
postProcessEncodedUrl ( array &$parameters, TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $pObj ) : void Post-processes the URL. If necessary prepends another domain to the URL.

Защищенные методы

Метод Описание
addRemainingUrlParameters ( ) : void Adds remaining parameters to the generated URL. Note: parameters that are ignored by the 'cache/ignoredGetParametersRegExp' configuration option are not considered here!
addToPathCache ( string $pagePath ) : void Adds an entry to the path cache.
appendToEncodedUrl ( string $stringToAppend, boolean $addSlash = TRUE ) : void Appends a string to $this->encodedUrl properly handling slashes in between.
callPostEncodeHooks ( ) Calls user-defined hooks after encoding
canCacheUrl ( string $url ) : boolean Checks if the URL can be cached. This function may prevent RealURL cache pollution with Solr or Indexed search URLs. Also some doktypes are ignored for the cache.
canEncoderExecute ( ) : boolean Checks if RealURL can encode URLs.
checkForAllEmptySegments ( array &$segments ) : void Checks if all segments are empty and makes the empty array in such case.
createAliasForValue ( string $getVarValue, array $configuration ) : string Converts value to the alias
createPathComponent ( ) : void Creates a path part of the URL.
createPathComponentThroughOverride ( ) : boolean Checks if tx_realurl_pathoverride is set and goes the easy way.
createPathComponentUsingRootline ( ) : void Creates a path part of the URL.
createUniqueAlias ( array $configuration, $newAliasValue, $idValue ) : string Creates a unique alias.
encodeFixedPostVars ( ) : void Encodes fixed postVars.
encodePathComponents ( ) : void Encodes the path to the page.
encodePostVarSets ( ) : void Encodes 'postVarSets' into URL segments.
encodePreVars ( ) : void Encodes 'preVars' into URL segments.
encodeSingleVariable ( array $configuration, string &$previousValue, array &$segments ) Encodes a single variable for xxxVars.
encodeUrlParameterBlock ( array $configurationArray ) : string Encodes pre- or postVars according to the given configuration.
encodeUrlParameterBlockUseAsIs ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Just sets the value to the segment as is.
encodeUrlParameterBlockUsingLookupTable ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Uses lookUpMap to set the segment.
encodeUrlParameterBlockUsingNoMatch ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Uses 'noMatch' options to set the segment.
encodeUrlParameterBlockUsingUserFunc ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Calls the userFunc for the value to get the segment.
encodeUrlParameterBlockUsingValueDefault ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Just sets the default value to the segment.
encodeUrlParameterBlockUsingValueMap ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean Uses the value map to determine the segment value.
executeEncoder ( ) : void Encodes the URL.
fetchFromUrlCache ( ) : boolean Attempts to fetch the speaking URL from the url cache.
fixEmptySegments ( array &$segments ) Changes empty segments to the value of $this->emptySegmentValue.
fixPageId ( ) Fixes page id if it is not a direct numeric page id.
getFromAliasCache ( array $configuration, string $getVarValue, integer $languageUid, string $onlyThisAlias = '' ) : string | null Obtains the value from the alias cache.
handleFileName ( ) : void Appends file name and suffix if necessary.
handleFileNameSetDefaultSuffix ( ) : void Sets the default suffix to the URL if configured so.
handleFileNameUsingGetVars ( ) : boolean Checks if the file name like 'rss.xml' should be produced according to _GET vars.
hasUrlParameters ( array $configurationArray ) : boolean Checks if any GETvar from the parameter block is present in $this->urlParameters.
initializeConfiguration ( ) Initializes configuration reader.
initializeUrlPrepend ( ) : void Checks if we should prpend URL according to _DOMAINS configuration.
isProperTsfe ( ) : boolean Checks if TSFE is initialized correctly.
isRealURLEnabled ( ) : boolean Checks if RealURL is enabled.
isSimulateStaticEnabled ( ) : boolean Checks if simulatestatic is enabled.
isTypo3Url ( ) : boolean Checks if a TYPO3 URL is going to be encoded.
parseUrlParameters ( ) : void Parses query string to a set of key/value inside $this->urlParameters.
prepareUrlPrepend ( ) : void Prepares the URL to use with _DOMAINS configuration.
reapplyAbsRefPrefix ( ) : void Reapplies absRefPrefix if necessary.
removeIgnoredUrlParameters ( ) Removes ignored parameters from various members.
removeIgnoredUrlParametersFromArray ( array $urlParameters ) : array Removes ignored URL parameters from the parameter list.
setLanguage ( ) : void Sets language for the encoder either from the URl or from the TSFE.
storeAliasToUrlCacheMapping ( string $urlCacheId ) : void Stores mapping between used aliases and url cache id. This information is used in the DataHandle hook to clear URl cache when record are renamed (= aliases change).
storeInAliasCache ( array $configuration, string $newAliasValue, string $idValue, integer $languageUid ) : string Adds the value to the alias cache.
storeInUrlCache ( ) : void Stores data in the URL cache.
trimMultipleSlashes ( ) Removes multiple slashes at the end of the encoded URL.

Описание методов

__construct() публичный Метод

Initializes the class.
public __construct ( )

addRemainingUrlParameters() защищенный Метод

Adds remaining parameters to the generated URL. Note: parameters that are ignored by the 'cache/ignoredGetParametersRegExp' configuration option are not considered here!
protected addRemainingUrlParameters ( ) : void
Результат void

addToPathCache() защищенный Метод

Adds an entry to the path cache.
protected addToPathCache ( string $pagePath ) : void
$pagePath string
Результат void

appendToEncodedUrl() защищенный Метод

Appends a string to $this->encodedUrl properly handling slashes in between.
protected appendToEncodedUrl ( string $stringToAppend, boolean $addSlash = TRUE ) : void
$stringToAppend string
$addSlash boolean
Результат void

callPostEncodeHooks() защищенный Метод

Calls user-defined hooks after encoding
protected callPostEncodeHooks ( )

canCacheUrl() защищенный Метод

Checks if the URL can be cached. This function may prevent RealURL cache pollution with Solr or Indexed search URLs. Also some doktypes are ignored for the cache.
protected canCacheUrl ( string $url ) : boolean
$url string
Результат boolean

canEncoderExecute() защищенный Метод

Checks if RealURL can encode URLs.
protected canEncoderExecute ( ) : boolean
Результат boolean

checkForAllEmptySegments() защищенный Метод

Checks if all segments are empty and makes the empty array in such case.
protected checkForAllEmptySegments ( array &$segments ) : void
$segments array
Результат void

cleanUpAlias() публичный Метод

Cleans up the alias
public cleanUpAlias ( array $configuration, string $newAliasValue ) : string
$configuration array Configuration array
$newAliasValue string Alias value to clean up
Результат string

createAliasForValue() защищенный Метод

Converts value to the alias
protected createAliasForValue ( string $getVarValue, array $configuration ) : string
$getVarValue string
$configuration array 'lookUpTable' configuration
Результат string

createPathComponent() защищенный Метод

Creates a path part of the URL.
protected createPathComponent ( ) : void
Результат void

createPathComponentThroughOverride() защищенный Метод

Checks if tx_realurl_pathoverride is set and goes the easy way.
protected createPathComponentThroughOverride ( ) : boolean
Результат boolean

createPathComponentUsingRootline() защищенный Метод

Creates a path part of the URL.
protected createPathComponentUsingRootline ( ) : void
Результат void

createUniqueAlias() защищенный Метод

Creates a unique alias.
protected createUniqueAlias ( array $configuration, $newAliasValue, $idValue ) : string
$configuration array
$newAliasValue
$idValue
Результат string

encodeFixedPostVars() защищенный Метод

Encodes fixed postVars.
protected encodeFixedPostVars ( ) : void
Результат void

encodePathComponents() защищенный Метод

Encodes the path to the page.
protected encodePathComponents ( ) : void
Результат void

encodePostVarSets() защищенный Метод

Encodes 'postVarSets' into URL segments.
protected encodePostVarSets ( ) : void
Результат void

encodePreVars() защищенный Метод

Encodes 'preVars' into URL segments.
protected encodePreVars ( ) : void
Результат void

encodeSingleVariable() защищенный Метод

Encodes a single variable for xxxVars.
protected encodeSingleVariable ( array $configuration, string &$previousValue, array &$segments )
$configuration array
$previousValue string
$segments array

encodeUrl() публичный Метод

Entry point for the URL encoder.
public encodeUrl ( array &$encoderParameters ) : void
$encoderParameters array
Результат void

encodeUrlParameterBlock() защищенный Метод

Encodes pre- or postVars according to the given configuration.
protected encodeUrlParameterBlock ( array $configurationArray ) : string
$configurationArray array
Результат string

encodeUrlParameterBlockUseAsIs() защищенный Метод

Just sets the value to the segment as is.
protected encodeUrlParameterBlockUseAsIs ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

encodeUrlParameterBlockUsingLookupTable() защищенный Метод

Uses lookUpMap to set the segment.
protected encodeUrlParameterBlockUsingLookupTable ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

encodeUrlParameterBlockUsingNoMatch() защищенный Метод

Uses 'noMatch' options to set the segment.
protected encodeUrlParameterBlockUsingNoMatch ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

encodeUrlParameterBlockUsingUserFunc() защищенный Метод

Calls the userFunc for the value to get the segment.
protected encodeUrlParameterBlockUsingUserFunc ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

encodeUrlParameterBlockUsingValueDefault() защищенный Метод

Just sets the default value to the segment.
protected encodeUrlParameterBlockUsingValueDefault ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

encodeUrlParameterBlockUsingValueMap() защищенный Метод

Uses the value map to determine the segment value.
protected encodeUrlParameterBlockUsingValueMap ( string $getVarName, string $getVarValue, array $configuration, array &$segments, string &$previousValue ) : boolean
$getVarName string
$getVarValue string
$configuration array
$segments array
$previousValue string
Результат boolean

executeEncoder() защищенный Метод

Encodes the URL.
protected executeEncoder ( ) : void
Результат void

fetchFromUrlCache() защищенный Метод

Attempts to fetch the speaking URL from the url cache.
protected fetchFromUrlCache ( ) : boolean
Результат boolean

fixEmptySegments() защищенный Метод

Changes empty segments to the value of $this->emptySegmentValue.
protected fixEmptySegments ( array &$segments )
$segments array

fixPageId() защищенный Метод

Fixes page id if it is not a direct numeric page id.
protected fixPageId ( )

getConfiguration() публичный Метод

Returns the configuration reader. This can be used in hooks.
public getConfiguration ( ) : ConfigurationReader
Результат DmitryDulepov\Realurl\Configuration\ConfigurationReader

getFromAliasCache() защищенный Метод

Obtains the value from the alias cache.
protected getFromAliasCache ( array $configuration, string $getVarValue, integer $languageUid, string $onlyThisAlias = '' ) : string | null
$configuration array
$getVarValue string
$languageUid integer
$onlyThisAlias string
Результат string | null

getOriginalUrlParameters() публичный Метод

Returns a coipy of original url parameters. This can be used in hooks.
public getOriginalUrlParameters ( ) : array
Результат array

getUtility() публичный Метод

Returns $this->utility. This can be used in hooks.
public getUtility ( ) : Utility
Результат DmitryDulepov\Realurl\Utility

handleFileName() защищенный Метод

Appends file name and suffix if necessary.
protected handleFileName ( ) : void
Результат void

handleFileNameSetDefaultSuffix() защищенный Метод

Sets the default suffix to the URL if configured so.
protected handleFileNameSetDefaultSuffix ( ) : void
Результат void

handleFileNameUsingGetVars() защищенный Метод

Checks if the file name like 'rss.xml' should be produced according to _GET vars.
protected handleFileNameUsingGetVars ( ) : boolean
Результат boolean

hasUrlParameters() защищенный Метод

Checks if any GETvar from the parameter block is present in $this->urlParameters.
protected hasUrlParameters ( array $configurationArray ) : boolean
$configurationArray array
Результат boolean

initializeConfiguration() защищенный Метод

Initializes configuration reader.
protected initializeConfiguration ( )

initializeUrlPrepend() защищенный Метод

Checks if we should prpend URL according to _DOMAINS configuration.
protected initializeUrlPrepend ( ) : void
Результат void

isProperTsfe() защищенный Метод

Checks if TSFE is initialized correctly.
protected isProperTsfe ( ) : boolean
Результат boolean

isRealURLEnabled() защищенный Метод

Checks if RealURL is enabled.
protected isRealURLEnabled ( ) : boolean
Результат boolean

isSimulateStaticEnabled() защищенный Метод

Checks if simulatestatic is enabled.
protected isSimulateStaticEnabled ( ) : boolean
Результат boolean

isTypo3Url() защищенный Метод

Checks if a TYPO3 URL is going to be encoded.
protected isTypo3Url ( ) : boolean
Результат boolean

parseUrlParameters() защищенный Метод

Parses query string to a set of key/value inside $this->urlParameters.
protected parseUrlParameters ( ) : void
Результат void

postProcessEncodedUrl() публичный Метод

Post-processes the URL. If necessary prepends another domain to the URL.
public postProcessEncodedUrl ( array &$parameters, TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $pObj ) : void
$parameters array
$pObj TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Результат void

prepareUrlPrepend() защищенный Метод

Prepares the URL to use with _DOMAINS configuration.
protected prepareUrlPrepend ( ) : void
Результат void

reapplyAbsRefPrefix() защищенный Метод

Reapplies absRefPrefix if necessary.
protected reapplyAbsRefPrefix ( ) : void
Результат void

removeIgnoredUrlParameters() защищенный Метод

Removes ignored parameters from various members.

removeIgnoredUrlParametersFromArray() защищенный Метод

Removes ignored URL parameters from the parameter list.
protected removeIgnoredUrlParametersFromArray ( array $urlParameters ) : array
$urlParameters array
Результат array

setLanguage() защищенный Метод

Sets language for the encoder either from the URl or from the TSFE.
protected setLanguage ( ) : void
Результат void

storeAliasToUrlCacheMapping() защищенный Метод

Stores mapping between used aliases and url cache id. This information is used in the DataHandle hook to clear URl cache when record are renamed (= aliases change).
protected storeAliasToUrlCacheMapping ( string $urlCacheId ) : void
$urlCacheId string
Результат void

storeInAliasCache() защищенный Метод

Adds the value to the alias cache.
protected storeInAliasCache ( array $configuration, string $newAliasValue, string $idValue, integer $languageUid ) : string
$configuration array
$newAliasValue string
$idValue string
$languageUid integer
Результат string

storeInUrlCache() защищенный Метод

Stores data in the URL cache.
protected storeInUrlCache ( ) : void
Результат void

trimMultipleSlashes() защищенный Метод

Removes multiple slashes at the end of the encoded URL.
protected trimMultipleSlashes ( )

Описание свойств

$encodedUrl защищенное свойство

protected string $encodedUrl
Результат string

$encoderParameters защищенное свойство

protected array $encoderParameters
Результат array

$originalUrl защищенное свойство

This is the URL with sorted GET parameters. It is used for cache manipulation.
protected string $originalUrl
Результат string

$originalUrlParameters защищенное свойство

protected array $originalUrlParameters
Результат array

$pageRepository защищенное свойство

protected PageRepository,TYPO3\CMS\Frontend\Page $pageRepository
Результат TYPO3\CMS\Frontend\Page\PageRepository

$sysLanguageUid защищенное свойство

protected int $sysLanguageUid
Результат integer

$urlParameters защищенное свойство

protected array $urlParameters
Результат array

$urlPrepend защищенное свойство

protected string $urlPrepend
Результат string

$urlPrependRegister защищенное статическое свойство

protected static array $urlPrependRegister
Результат array

$urlToEncode защищенное свойство

protected string $urlToEncode
Результат string

$usedAliases защищенное свойство

protected array $usedAliases
Результат array