Elgg\Application\CacheHandler::parsePath PHP Méthode

parsePath() public méthode

Parse a request
public parsePath ( string $path ) : array
$path string Request URL path
Résultat array Cache parameters (empty array if failure)
    public function parsePath($path)
    {
        // no '..'
        if (false !== strpos($path, '..')) {
            return array();
        }
        // only alphanumeric characters plus /, ., -, and _
        if (preg_match('#[^a-zA-Z0-9/\\.\\-_]#', $path)) {
            return array();
        }
        // testing showed regex to be marginally faster than array / string functions over 100000 reps
        // it won't make a difference in real life and regex is easier to read.
        // <ts>/<viewtype>/<name/of/view.and.dots>.<type>
        if (!preg_match('#^/cache/([0-9]+)/([^/]+)/(.+)$#', $path, $matches)) {
            return array();
        }
        return array('ts' => $matches[1], 'viewtype' => $matches[2], 'view' => $matches[3]);
    }