PHP Класс DmitryDulepov\Realurl\Decoder\UrlDecoder

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

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

Свойство Тип Описание
$appendedSlash boolean
$caller TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
$detectedLanguageId integer | null Finally preVar handling code will check for L after decoding and set this attribute either to the decoded value or to zero. This value can be null until preVars are decoded. After that it is either zero or the decoded language uid.
$disallowedDoktypes string
$expiredPath string Holds information about expired path for the SEO redirect.
$isExpiredPath boolean Indicates that the path is expired but we could not redirect because non-expired path is missing from the path cache. In such case we do not cache the entry in the URL cache to force resolving of the path when the current URL is fetched.
$mimeType string
$mountPointStartPid integer Contains a mount point starting pid for the current branch. Zero means "no mount point in the path". This variable will direct the decoder to continue page look up from this branch of tree.
$mountPointVariable string Contains a generated $_GET['MP'] for the currently decoded branch.
$originalPath string This variable is set to the speaking path only if he decoding has to run.
$savedErrorHandler string
$siteScript string
$speakingUri string

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

Метод Описание
__construct ( ) Initializes the class.
decodeUrl ( array $params ) : void Decodes the URL. This function is called from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::checkAlternativeIdMethods()

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

Метод Описание
callPreDecodeHooks ( array $params ) Calls user-defined hooks.
canDecoderExecute ( ) : boolean Checks if the decoder can execute.
checkExpiration ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry ) Checks if the entry is expired and redirects to a non-expired entry.
checkMissingSlash ( ) : void Checks if the missing slash should be corrected.
convertAliasToId ( array $configuration, string $value ) : integer | string Converts alias to id.
createPathCacheEntry ( string $segment, array $pages, array &$shortcutPages ) : DmitryDulepov\Realurl\Cache\PathCacheEntry Find a page entry for the current segment and returns a PathCacheEntry for it.
createQueryStringParameter ( array $parameters, string $prependString = '' ) : array Generates a parameter string from an array recursively
decodeFixedPostVars ( integer $pageId, array &$pathSegments ) : array Decodes fixedPostVars into request variables.
decodePath ( array &$pathSegments ) : integer Decodes the path.
decodePathByOverride ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry Tries to decode the path by path override when the whole path is overriden.
decodePostVarSets ( integer $pageId, array &$pathSegments ) : array Decodes postVarSets into request variables.
decodePreVars ( array &$pathSegments ) : array Decodes preVars into request variables.
decodeSingleVariable ( array $varConfiguration, array &$pathSegments, array &$requestVariables, &$previousValue ) : void Decodes a single variable and adds it to the list of request variables.
decodeUrlParameterBlockUseAsIs ( array $configuration, $getVarValue, array &$requestVariables ) : boolean Sets segment value as is to the request variables
decodeUrlParameterBlockUsingLookupTable ( array $configuration, $getVarValue, array &$requestVariables ) : boolean Sets segment value as is to the request variables
decodeUrlParameterBlockUsingNoMatch ( array $configuration, $getVarValue, array &$requestVariables, array &$pathSegments, boolean $isFakeValue ) : boolean Sets segment value as is to the request variables
decodeUrlParameterBlockUsingUserFunc ( array $configuration, $getVarValue, array &$requestVariables, array &$pathSegments, boolean $isFakeValue ) : boolean Sets segment value as is to the request variables
decodeUrlParameterBlockUsingValueDefault ( array $configuration, $getVarValue, array &$requestVariables ) : boolean Sets segment value as is to the request variables
decodeUrlParameterBlockUsingValueMap ( array $configuration, $getVarValue, array &$requestVariables ) : boolean Sets segment value as is to the request variables
doDecoding ( string $path ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry Decodes the URL. This function is called only if the URL is not in the URL cache.
fixBracketsAfterParseStr ( array &$array ) : void Fixes a problem with parse_str that returns a[b[c] instead of a[b[c]] when parsing a%5Bb%5Bc%5D%5D
getFromUrlCache ( string $speakingUrl ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null Gets the entry from cache.
getPathCacheEntryAfterExcludedPages ( string $segment, array $pages, string $pagesEnableFields, array &$shortcutPages ) : DmitryDulepov\Realurl\Cache\PathCacheEntry Searches a page below excluded pages and returns the PathCacheEntry if something was found.
getRootPageIdForPage ( integer $pageUid ) : integer Obtains a root page id for the given page.
getUrlPath ( ) : array Parses the URL and validates the result. This function will strip possible query string from speaking URL (we only need to decode the speaking URL!)
getVarsFromDomainConfiguration ( ) : array Obtains variables from the domain confuguration.
handleFileName ( array &$urlParts ) : array Processes the file name component. There can be several scenarios: 1. File name is mapped to a _GET var. We set a _GET var and discard the segment.
handleFileNameMappingToGetVar ( string &$fileNameSegment, array &$getVars, boolean &$putBack ) : boolean Handles mapping of file names to GET vars (like 'print.html' => 'type=98')
handleNonExistingPostVarSet ( integer $pageId, string $postVarSetKey, array &$pathSegments ) Handles non-existing postVarSet according to configuration.
initialize ( ) Initializes the decoder.
initializeConfiguration ( ) Initializes configuration reader.
isPostVar ( string $segment, integer $pageId ) : boolean Checks if the given segment is a name of the postVar.
isProperTsfe ( ) : boolean Checks if TSFE is initialized correctly.
isSpeakingUrl ( ) : boolean Checks if the current URL is a speaking URL.
makeRealPhpArrayFromRequestVars ( array $requestVariables ) : array Converts array('tx_ext[var1]' => 1, 'tx_ext[var2]' => 2) to array('tx_ext' => array('var1' => 1, 'var2' => 2)).
mergeGetVarsFromDomainsConfiguration ( ) : void Merges $_GET from domains configuration.
mergeWithExistingGetVars ( array &$requestVariables ) : void Merges generated request variables with existing $_GET variables. Those in $_GET override generated.
parseQueryStringParameters ( string $queryString ) : array Parses query string to a set of key/value.
putToPathCache ( DmitryDulepov\Realurl\Cache\PathCacheEntry $newCacheEntry ) : void Adds data to the path cache. Cache ntry should have page path, language id and page id set.
runDecoding ( ) : void Contains the actual decoding logic after $this->speakingUri is set.
searchForPathOverrideInPages ( string $path ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Searches the given path in pages table.
searchForPathOverrideInPagesLanguageOverlay ( string $path ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Searches the given path in page language overlays.
searchPages ( integer $currentPid, string $segment, boolean &$saveToCache ) : DmitryDulepov\Realurl\Cache\PathCacheEntry Searches pages for the match to the segment
searchPagesByPathOverride ( array $possibleSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Searches for a match in tx_realurl_pathsegment with override option.
searchPathInCache ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null Fetches the entry from the RealURL path cache. This would start stripping segments if the entry is not found until none is left. Effectively it is a search for the largest caching path for those segments.
setLanguageFromQueryString ( ) : void Sets current language from the query string variable ('L').
setRequestVariables ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry ) Sets variables after the decoding.
setSpeakingUriFromSiteScript ( ) : void Obtains speaking URI from the site script.
throw404 ( string $errorMessage ) : void Throws a 404 error with the corresponding message.

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

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

Initializes the class.
public __construct ( )

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

Calls user-defined hooks.
protected callPreDecodeHooks ( array $params )
$params array

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

Checks if the decoder can execute.
protected canDecoderExecute ( ) : boolean
Результат boolean

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

Checks if the entry is expired and redirects to a non-expired entry.
protected checkExpiration ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry )
$cacheEntry DmitryDulepov\Realurl\Cache\UrlCacheEntry

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

Checks if the missing slash should be corrected.
protected checkMissingSlash ( ) : void
Результат void

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

Converts alias to id.
protected convertAliasToId ( array $configuration, string $value ) : integer | string
$configuration array
$value string
Результат integer | string

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

Find a page entry for the current segment and returns a PathCacheEntry for it.
protected createPathCacheEntry ( string $segment, array $pages, array &$shortcutPages ) : DmitryDulepov\Realurl\Cache\PathCacheEntry
$segment string
$pages array
$shortcutPages array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | NULL

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

Generates a parameter string from an array recursively
protected createQueryStringParameter ( array $parameters, string $prependString = '' ) : array
$parameters array Array to generate strings from
$prependString string path to prepend to every parameter
Результат array

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

Decodes fixedPostVars into request variables.
protected decodeFixedPostVars ( integer $pageId, array &$pathSegments ) : array
$pageId integer
$pathSegments array
Результат array

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

Decodes the path.
protected decodePath ( array &$pathSegments ) : integer
$pathSegments array
Результат integer

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

Tries to decode the path by path override when the whole path is overriden.
protected decodePathByOverride ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry
$pathSegments array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry

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

Decodes postVarSets into request variables.
protected decodePostVarSets ( integer $pageId, array &$pathSegments ) : array
$pageId integer
$pathSegments array
Результат array

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

Decodes preVars into request variables.
protected decodePreVars ( array &$pathSegments ) : array
$pathSegments array
Результат array

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

Decodes a single variable and adds it to the list of request variables.
protected decodeSingleVariable ( array $varConfiguration, array &$pathSegments, array &$requestVariables, &$previousValue ) : void
$varConfiguration array
$pathSegments array
$requestVariables array
$previousValue
Результат void

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

Decodes the URL. This function is called from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::checkAlternativeIdMethods()
public decodeUrl ( array $params ) : void
$params array
Результат void

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUseAsIs ( array $configuration, $getVarValue, array &$requestVariables ) : boolean
$configuration array
$getVarValue
$requestVariables array
Результат boolean

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUsingLookupTable ( array $configuration, $getVarValue, array &$requestVariables ) : boolean
$configuration array
$getVarValue
$requestVariables array
Результат boolean

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUsingNoMatch ( array $configuration, $getVarValue, array &$requestVariables, array &$pathSegments, boolean $isFakeValue ) : boolean
$configuration array
$getVarValue
$requestVariables array
$pathSegments array
$isFakeValue boolean
Результат boolean

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUsingUserFunc ( array $configuration, $getVarValue, array &$requestVariables, array &$pathSegments, boolean $isFakeValue ) : boolean
$configuration array
$getVarValue
$requestVariables array
$pathSegments array
$isFakeValue boolean
Результат boolean

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUsingValueDefault ( array $configuration, $getVarValue, array &$requestVariables ) : boolean
$configuration array
$getVarValue
$requestVariables array
Результат boolean

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

Sets segment value as is to the request variables
protected decodeUrlParameterBlockUsingValueMap ( array $configuration, $getVarValue, array &$requestVariables ) : boolean
$configuration array
$getVarValue
$requestVariables array
Результат boolean

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

Decodes the URL. This function is called only if the URL is not in the URL cache.
protected doDecoding ( string $path ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry
$path string
Результат DmitryDulepov\Realurl\Cache\UrlCacheEntry with only pageId and requestVariables filled in

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

Fixes a problem with parse_str that returns a[b[c] instead of a[b[c]] when parsing a%5Bb%5Bc%5D%5D
protected fixBracketsAfterParseStr ( array &$array ) : void
$array array
Результат void

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

Gets the entry from cache.
protected getFromUrlCache ( string $speakingUrl ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null
$speakingUrl string
Результат DmitryDulepov\Realurl\Cache\UrlCacheEntry | null

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

Searches a page below excluded pages and returns the PathCacheEntry if something was found.
protected getPathCacheEntryAfterExcludedPages ( string $segment, array $pages, string $pagesEnableFields, array &$shortcutPages ) : DmitryDulepov\Realurl\Cache\PathCacheEntry
$segment string
$pages array
$pagesEnableFields string
$shortcutPages array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | NULL

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

Obtains a root page id for the given page.
protected getRootPageIdForPage ( integer $pageUid ) : integer
$pageUid integer
Результат integer

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

Parses the URL and validates the result. This function will strip possible query string from speaking URL (we only need to decode the speaking URL!)
protected getUrlPath ( ) : array
Результат array

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

Obtains variables from the domain confuguration.
protected getVarsFromDomainConfiguration ( ) : array
Результат array

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

2. File name is a segment with suffix appended. We discard the suffix.
protected handleFileName ( array &$urlParts ) : array
$urlParts array
Результат array

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

Handles mapping of file names to GET vars (like 'print.html' => 'type=98')
protected handleFileNameMappingToGetVar ( string &$fileNameSegment, array &$getVars, boolean &$putBack ) : boolean
$fileNameSegment string
$getVars array
$putBack boolean
Результат boolean

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

Handles non-existing postVarSet according to configuration.
protected handleNonExistingPostVarSet ( integer $pageId, string $postVarSetKey, array &$pathSegments )
$pageId integer
$postVarSetKey string
$pathSegments array

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

Initializes the decoder.
protected initialize ( )

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

Initializes configuration reader.
protected initializeConfiguration ( )

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

Checks if the given segment is a name of the postVar.
protected isPostVar ( string $segment, integer $pageId ) : boolean
$segment string
$pageId integer
Результат boolean

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

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

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

Checks if the current URL is a speaking URL.
protected isSpeakingUrl ( ) : boolean
Результат boolean

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

Converts array('tx_ext[var1]' => 1, 'tx_ext[var2]' => 2) to array('tx_ext' => array('var1' => 1, 'var2' => 2)).
protected makeRealPhpArrayFromRequestVars ( array $requestVariables ) : array
$requestVariables array
Результат array

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

Merges $_GET from domains configuration.
protected mergeGetVarsFromDomainsConfiguration ( ) : void
Результат void

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

Merges generated request variables with existing $_GET variables. Those in $_GET override generated.
protected mergeWithExistingGetVars ( array &$requestVariables ) : void
$requestVariables array
Результат void

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

Parses query string to a set of key/value.
protected parseQueryStringParameters ( string $queryString ) : array
$queryString string
Результат array

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

Adds data to the path cache. Cache ntry should have page path, language id and page id set.
protected putToPathCache ( DmitryDulepov\Realurl\Cache\PathCacheEntry $newCacheEntry ) : void
$newCacheEntry DmitryDulepov\Realurl\Cache\PathCacheEntry
Результат void

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

Contains the actual decoding logic after $this->speakingUri is set.
protected runDecoding ( ) : void
Результат void

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

Searches the given path in pages table.
protected searchForPathOverrideInPages ( string $path ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$path string
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | null

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

Searches the given path in page language overlays.
protected searchForPathOverrideInPagesLanguageOverlay ( string $path ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$path string
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | null

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

Searches pages for the match to the segment
protected searchPages ( integer $currentPid, string $segment, boolean &$saveToCache ) : DmitryDulepov\Realurl\Cache\PathCacheEntry
$currentPid integer
$segment string
$saveToCache boolean
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry

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

Searches for a match in tx_realurl_pathsegment with override option.
protected searchPagesByPathOverride ( array $possibleSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$possibleSegments array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | null

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

Fetches the entry from the RealURL path cache. This would start stripping segments if the entry is not found until none is left. Effectively it is a search for the largest caching path for those segments.
protected searchPathInCache ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$pathSegments array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | null

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

Sets current language from the query string variable ('L').
protected setLanguageFromQueryString ( ) : void
Результат void

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

Sets variables after the decoding.
protected setRequestVariables ( DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry )
$cacheEntry DmitryDulepov\Realurl\Cache\UrlCacheEntry

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

Obtains speaking URI from the site script.
protected setSpeakingUriFromSiteScript ( ) : void
Результат void

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

Throws a 404 error with the corresponding message.
protected throw404 ( string $errorMessage ) : void
$errorMessage string
Результат void

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

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

protected bool $appendedSlash
Результат boolean

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

protected TypoScriptFrontendController,TYPO3\CMS\Frontend\Controller $caller
Результат TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController

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

Finally preVar handling code will check for L after decoding and set this attribute either to the decoded value or to zero. This value can be null until preVars are decoded. After that it is either zero or the decoded language uid.
protected int|null $detectedLanguageId
Результат integer | null

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

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

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

Holds information about expired path for the SEO redirect.
protected string $expiredPath
Результат string

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

Indicates that the path is expired but we could not redirect because non-expired path is missing from the path cache. In such case we do not cache the entry in the URL cache to force resolving of the path when the current URL is fetched.
protected bool $isExpiredPath
Результат boolean

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

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

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

Contains a mount point starting pid for the current branch. Zero means "no mount point in the path". This variable will direct the decoder to continue page look up from this branch of tree.
protected int $mountPointStartPid
Результат integer

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

Contains a generated $_GET['MP'] for the currently decoded branch.
protected string $mountPointVariable
Результат string

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

This variable is set to the speaking path only if he decoding has to run.
protected string $originalPath
Результат string

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

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

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

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

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

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