public function getGlobal($global) { if (wfWAFUtils::strpos($global, '.') === false) { return null; } list($prefix, $_global) = explode('.', $global); switch ($prefix) { case 'request': $method = "get" . ucfirst($_global); if (method_exists('wfWAFRequestInterface', $method)) { return call_user_func(array($this->getRequest(), $method)); } break; case 'server': $key = wfWAFUtils::strtoupper($_global); if (isset($_SERVER) && array_key_exists($key, $_SERVER)) { return $_SERVER[$key]; } break; } return null; }
/** * @return string * @throws wfWAFRuleLogicalOperatorException */ public function render() { if (!$this->isValid()) { throw new wfWAFRuleLogicalOperatorException(sprintf('Invalid logical operator "%s", must be one of %s', $this->getOperator(), join(", ", $this->validOperators))); } return sprintf("new %s(%s)", get_class($this), var_export(trim(wfWAFUtils::strtoupper($this->getOperator())), true)); }
/** * @return string */ public function getUpperCaseValue() { return wfWAFUtils::strtoupper($this->getValue()); }