‪TYPO3CMS  9.5
TYPO3\CMS\Frontend\Page\CacheHashCalculator Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Page\CacheHashCalculator:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (array $configuration=null)
 
string calculateCacheHash (array $params)
 
string generateForParameters ($queryString)
 
bool doParametersRequireCacheHash ($queryString)
 
array getRelevantParameters ($queryString)
 
 setConfiguration (array $configuration)
 

Protected Member Functions

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

Protected Attributes

array $cachedParametersWhiteList = array( )
 
array $excludedParameters = array( )
 
array $requireCacheHashPresenceParameters = array( )
 
array $excludedParametersIfEmpty = array( )
 
bool $excludeAllEmptyParameters = false
 

Detailed Description

Logic for cHash calculation

Definition at line 23 of file CacheHashCalculator.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Page\CacheHashCalculator::__construct ( array  $configuration = null)

Initialise class properties by using the relevant TYPO3 configuration

Parameters
array$configuration

Definition at line 50 of file CacheHashCalculator.php.

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

Member Function Documentation

◆ calculateCacheHash()

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

Calculates the cHash based on the provided parameters

Parameters
array$params‪Array of cHash key-value pairs
Returns
‪string Hash of all the values

Definition at line 62 of file CacheHashCalculator.php.

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

◆ doParametersRequireCacheHash()

bool 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 86 of file CacheHashCalculator.php.

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

◆ generateForParameters()

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

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

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

Definition at line 74 of file CacheHashCalculator.php.

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

◆ getRelevantParameters()

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

◆ hasCachedParametersWhiteList()

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

Checks whether cachedParametersWhiteList parameters are configured

Returns
‪bool

Definition at line 218 of file CacheHashCalculator.php.

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

◆ isAdminPanelParameter()

bool 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 173 of file CacheHashCalculator.php.

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

◆ isAllowedWithEmptyValue()

bool 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 229 of file CacheHashCalculator.php.

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

◆ isCoreParameter()

bool 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 186 of file CacheHashCalculator.php.

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

◆ isExcludedParameter()

bool 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 197 of file CacheHashCalculator.php.

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

◆ isInCachedParametersWhiteList()

bool 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 208 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 253 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 240 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 261 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 269 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 277 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 285 of file CacheHashCalculator.php.

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

◆ splitQueryStringToArray()

array 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 148 of file CacheHashCalculator.php.

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

Member Data Documentation

◆ $cachedParametersWhiteList

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

Parameters that are relevant for cacheHash calculation. Optional.

Definition at line 27 of file CacheHashCalculator.php.

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

◆ $excludeAllEmptyParameters

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

Whether to exclude all empty parameters for cacheHash calculation

Definition at line 43 of file CacheHashCalculator.php.

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

◆ $excludedParameters

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

Parameters that are not relevant for cacheHash calculation.

Definition at line 31 of file CacheHashCalculator.php.

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

◆ $excludedParametersIfEmpty

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

Parameters that need a value to be relevant for cacheHash calculation

Definition at line 39 of file CacheHashCalculator.php.

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

◆ $requireCacheHashPresenceParameters

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

Parameters that forces a presence of a valid cacheHash.

Definition at line 35 of file CacheHashCalculator.php.

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