Back to Cache class

Method makeId

public static string
makeId
()
Create a safe ID for cached data from URL parameters
Returns
  • string MD5 encoded cache ID
Since
  • 1.7.0
Class: Cache
Project: Joomla

Method makeId - Source code

/**
 * Create a safe ID for cached data from URL parameters
 *
 * @return  string  MD5 encoded cache ID
 *
 * @since   1.7.0
 */
public static function makeId()
{
    $app = Factory::getApplication();
    $registeredurlparams = new \stdClass();
    // Get url parameters set by plugins
    if (!empty($app->registeredurlparams)) {
        $registeredurlparams = $app->registeredurlparams;
    }
    // Platform defaults
    $defaulturlparams = array('format' => 'WORD', 'option' => 'WORD', 'view' => 'WORD', 'layout' => 'WORD', 'tpl' => 'CMD', 'id' => 'INT');
    // Use platform defaults if parameter doesn't already exist.
    foreach ($defaulturlparams as $param => $type) {
        if (!property_exists($registeredurlparams, $param)) {
            $registeredurlparams->{$param} = $type;
        }
    }
    $safeuriaddon = new \stdClass();
    foreach ($registeredurlparams as $key => $value) {
        $safeuriaddon->{$key} = $app->input->get($key, null, $value);
    }
    return md5(serialize($safeuriaddon));
}