Exemplo n.º 1
0
        if (function_exists('apc_fetch') && function_exists('apc_store')) {
            $cacheKey = 'kHtmlPurifierAllowedProperties-' . kConf::getCachedVersionId();
            self::$AllowedProperties = apc_fetch($cacheKey);
        }
        if (!self::$AllowedProperties) {
            self::$AllowedProperties = kConf::get("xss_allowed_object_properties");
            // Convert values to keys (we don't care about the values) in order to test via array_key_exists.
            self::$AllowedProperties = array_flip(self::$AllowedProperties);
            if ($cacheKey) {
                apc_store($cacheKey, self::$AllowedProperties);
            }
        }
    }
    public static function initAllowedTokenPatterns()
    {
        $cacheKey = null;
        if (function_exists('apc_fetch') && function_exists('apc_store')) {
            $cacheKey = 'kHtmlPurifierAllowedTokenPatterns-' . kConf::getCachedVersionId();
            self::$allowedTokenPatterns = apc_fetch($cacheKey);
        }
        if (!self::$allowedTokenPatterns) {
            self::$allowedTokenPatterns = kConf::get("xss_allowed_token_patterns");
            self::$allowedTokenPatterns = preg_replace("/\\\\/", "\\", self::$allowedTokenPatterns);
            if ($cacheKey) {
                apc_store($cacheKey, self::$allowedTokenPatterns);
            }
        }
    }
}
kHtmlPurifier::init();