PHP 클래스 DmitryDulepov\Realurl\Decoder\UrlDecoder

저자: Dmitry Dulepov ([email protected])
상속: extends DmitryDulepov\Realurl\EncodeDecoderBase
파일 보기 프로젝트 열기: dmitryd/typo3-realurl

보호된 프로퍼티들

프로퍼티 타입 설명
$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.

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