TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Frontend\Page\CacheHashCalculator Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Page\CacheHashCalculator:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
 calculateCacheHash (array $params)
 
 generateForParameters ($queryString)
 
 doParametersRequireCacheHash ($queryString)
 
 getRelevantParameters ($queryString)
 
 setConfiguration (array $configuration)
 

Protected Member Functions

 splitQueryStringToArray ($queryString)
 
 isAdminPanelParameter ($key)
 
 isCoreParameter ($key)
 
 isExcludedParameter ($key)
 
 isInCachedParametersWhiteList ($key)
 
 hasCachedParametersWhiteList ()
 
 isAllowedWithEmptyValue ($key)
 
 setCachedParametersWhiteList (array $cachedParametersWhiteList)
 
 setExcludeAllEmptyParameters ($excludeAllEmptyParameters)
 
 setExcludedParameters (array $excludedParameters)
 
 setExcludedParametersIfEmpty (array $excludedParametersIfEmpty)
 
 setRequireCacheHashPresenceParameters (array $requireCacheHashPresenceParameters)
 

Protected Attributes

 $cachedParametersWhiteList = []
 
 $excludedParameters = []
 
 $requireCacheHashPresenceParameters = []
 
 $excludedParametersIfEmpty = []
 
 $excludeAllEmptyParameters = false
 

Detailed Description

Logic for cHash calculation

Definition at line 22 of file CacheHashCalculator.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::__construct ( )

Initialise class properties by using the relevant TYPO3 configuration

Definition at line 52 of file CacheHashCalculator.php.

References $GLOBALS, and TYPO3\CMS\Frontend\Page\CacheHashCalculator\setConfiguration().

Member Function Documentation

◆ calculateCacheHash()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::calculateCacheHash ( array  $params)

Calculates the cHash based on the provided parameters

Parameters
array$paramsArray of cHash key-value pairs
Returns
string Hash of all the values

Definition at line 63 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\generateForParameters().

◆ doParametersRequireCacheHash()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::doParametersRequireCacheHash (   $queryString)

Checks whether a parameter of the given $queryString requires cHash calculation

Parameters
string$queryString
Returns
bool

Definition at line 87 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\splitQueryStringToArray().

◆ generateForParameters()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::generateForParameters (   $queryString)

Returns the cHash based on provided query parameters and added values from internal call

Parameters
string$queryStringQuery-parameters: "&xxx=yyy&zzz=uuu
Returns
string Hash of all the values
Exceptions

Definition at line 75 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\calculateCacheHash(), and TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ getRelevantParameters()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::getRelevantParameters (   $queryString)

◆ hasCachedParametersWhiteList()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::hasCachedParametersWhiteList ( )
protected

Checks whether cachedParametersWhiteList parameters are configured

Returns
bool

Definition at line 216 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ isAdminPanelParameter()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::isAdminPanelParameter (   $key)
protected

Checks whether the given parameter is out of a known data-set starting with ADMCMD or starts with TSFE_ADMIN_PANEL.

Parameters
string$key
Returns
bool

Definition at line 171 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ isAllowedWithEmptyValue()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::isAllowedWithEmptyValue (   $key)
protected

Check whether the given parameter may be used even with an empty value

Parameters
$key
Returns
bool

Definition at line 227 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ isCoreParameter()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::isCoreParameter (   $key)
protected

Checks whether the given parameter is a core parameter

Parameters
string$key
Returns
bool

Definition at line 184 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ isExcludedParameter()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::isExcludedParameter (   $key)
protected

Checks whether the given parameter should be excluded from cHash calculation

Parameters
string$key
Returns
bool

Definition at line 195 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ isInCachedParametersWhiteList()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::isInCachedParametersWhiteList (   $key)
protected

Checks whether the given parameter is an exclusive parameter for cHash calculation

Parameters
string$key
Returns
bool

Definition at line 206 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

◆ setCachedParametersWhiteList()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setCachedParametersWhiteList ( array  $cachedParametersWhiteList)
protected
Parameters
array$cachedParametersWhiteList

Definition at line 251 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\$cachedParametersWhiteList.

◆ setConfiguration()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setConfiguration ( array  $configuration)

Loops through the configuration array and calls the accordant getters with the value.

Parameters
array$configuration

Definition at line 238 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\__construct().

◆ setExcludeAllEmptyParameters()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setExcludeAllEmptyParameters (   $excludeAllEmptyParameters)
protected
Parameters
bool$excludeAllEmptyParameters

Definition at line 259 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\$excludeAllEmptyParameters.

◆ setExcludedParameters()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setExcludedParameters ( array  $excludedParameters)
protected
Parameters
array$excludedParameters

Definition at line 267 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\$excludedParameters.

◆ setExcludedParametersIfEmpty()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setExcludedParametersIfEmpty ( array  $excludedParametersIfEmpty)
protected
Parameters
array$excludedParametersIfEmpty

Definition at line 275 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\$excludedParametersIfEmpty.

◆ setRequireCacheHashPresenceParameters()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::setRequireCacheHashPresenceParameters ( array  $requireCacheHashPresenceParameters)
protected
Parameters
array$requireCacheHashPresenceParameters

Definition at line 283 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashCalculator\$requireCacheHashPresenceParameters.

◆ splitQueryStringToArray()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::splitQueryStringToArray (   $queryString)
protected

Parses the query string and converts it to an array. Unlike parse_str it only creates an array with one level.

e.g. foo[bar]=baz will be array('foo[bar]' => 'baz')

Parameters
string$queryString
Returns
array

Definition at line 149 of file CacheHashCalculator.php.

Referenced by TYPO3\CMS\Frontend\Page\CacheHashCalculator\doParametersRequireCacheHash(), and TYPO3\CMS\Frontend\Page\CacheHashCalculator\getRelevantParameters().

Member Data Documentation

◆ $cachedParametersWhiteList

TYPO3\CMS\Frontend\Page\CacheHashCalculator::$cachedParametersWhiteList = []
protected

◆ $excludeAllEmptyParameters

TYPO3\CMS\Frontend\Page\CacheHashCalculator::$excludeAllEmptyParameters = false
protected

◆ $excludedParameters

TYPO3\CMS\Frontend\Page\CacheHashCalculator::$excludedParameters = []
protected

◆ $excludedParametersIfEmpty

TYPO3\CMS\Frontend\Page\CacheHashCalculator::$excludedParametersIfEmpty = []
protected

◆ $requireCacheHashPresenceParameters

TYPO3\CMS\Frontend\Page\CacheHashCalculator::$requireCacheHashPresenceParameters = []
protected