self::WFWAF_BLOCK_COUNTRY_REDIR_REGEX, self::WFWAF_BLOCK_INVALIDUSERNAME => self::WFWAF_BLOCK_INVALIDUSERNAME_REGEX, self::WFWAF_BLOCK_LOGINSEC_FORGOTPASSWD => self::WFWAF_BLOCK_LOGINSEC_FORGOTPASSWD_REGEX, self::WFWAF_BLOCK_LOGINSEC_FAILURES => self::WFWAF_BLOCK_LOGINSEC_FAILURES_REGEX, ); foreach ($formatPatternStrings as $formatString => $pattern) { $flags = 0; if (defined('PREG_UNMATCHED_AS_NULL')) { $flags = PREG_UNMATCHED_AS_NULL; } if (preg_match($pattern, $string, $matches, $flags)) { array_shift($matches); $parameters = $matches; return $formatString; } } } $parameters = null; return null; } /** * Map the WFWAF_BLOCK_ constants to translated strings * (The constants are string descriptions for legacy reasons and should * now be regarded as identifiers) * @param string $key the WFWAF_BLOCK_ constant * @param ...$parameters any format parameters to pass to the description * @return string a translated description when available, otherwise the original text */ public static function getBlockDescription($key) { $args = func_get_args(); array_unshift($args, false); return call_user_func_array(array(get_called_class(), 'formatBlockDescription'), $args); } public static function matchesBlockKey($string, $key) { if ($key === $string) return true; return self::parseBlockKey($string) === $key; } }