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

Public Member Functions

 __construct (CacheHashConfiguration $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)
 

Protected Attributes

CacheHashConfiguration $configuration
 

Detailed Description

Logic for cHash calculation

Definition at line 24 of file CacheHashCalculator.php.

Constructor & Destructor Documentation

◆ __construct()

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

Initialise class properties by using the relevant TYPO3 configuration

Parameters
CacheHashConfiguration | null$configuration

Definition at line 35 of file CacheHashCalculator.php.

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

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 46 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 70 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashConfiguration\ASPECT_REQUIRED_CACHE_HASH_PRESENCE_PARAMETERS, and 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 58 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 208 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashConfiguration\ASPECT_CACHED_PARAMETERS_WHITELIST.

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.

Parameters
string$key
Returns
‪bool

Definition at line 159 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
string$key
Returns
‪bool

Definition at line 221 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashConfiguration\ASPECT_EXCLUDED_PARAMETERS_IF_EMPTY.

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 170 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 181 of file CacheHashCalculator.php.

References TYPO3\CMS\Frontend\Page\CacheHashConfiguration\ASPECT_EXCLUDED_PARAMETERS.

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

References TYPO3\CMS\Frontend\Page\CacheHashConfiguration\ASPECT_CACHED_PARAMETERS_WHITELIST.

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

◆ setConfiguration()

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

Extends (or overrides) property names of current configuration.

Definition at line 233 of file CacheHashCalculator.php.

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

◆ 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 134 of file CacheHashCalculator.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

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

Member Data Documentation

◆ $configuration

CacheHashConfiguration TYPO3\CMS\Frontend\Page\CacheHashCalculator::$configuration
protected