$v) { $cleanValues[$k] = Qs_Request::_recursiveFilter($filter, $v); } return $cleanValues; } else { return call_user_func($filter, $value); } } public static function getPostValue($name, $default = null) { return Qs_Request::_getValue($_POST, $name, true, $default); } public static function getGetValue($name, $default = null) { return Qs_Request::_getValue($_GET, $name, true, $default); } public static function getGetValues() { $arguments = func_get_args(); $result = array(); foreach ($arguments as $argument) { $result[$argument] = Qs_Request::_getValue($_GET, $argument, true); } return $result; } public static function getRequestValue($name, $default = null) { return Qs_Request::_getValue($_REQUEST, $name, true, $default); } public static function getCookieValue($name, $default = null) { return Qs_Request::_getValue($_COOKIE, $name, false, $default); } public static function getHeader($header) { if (empty($header)) { return false; } // Try to get it from the $_SERVER array first $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); if (!empty($_SERVER[$temp])) { return $_SERVER[$temp]; } // This seems to be the only way to get the Authorization header on // Apache if (function_exists('apache_request_headers')) { $headers = apache_request_headers(); if (!empty($headers[$header])) { return $headers[$header]; } } return false; } public static function isXmlHttpRequest() { return (Qs_Request::getHeader('X_REQUESTED_WITH') == 'XMLHttpRequest'); } public static function getPost() { return Qs_Request::_get($_POST); } public static function getGet() { return Qs_Request::_get($_GET); } protected static function _get($array) { if (1 == get_magic_quotes_gpc()) { $array = Qs_Request::_recursiveFilter('stripslashes', $array); } return $array; } /** * Checks whether the url belongs to the site * The protocol is ignored * @param string $url * @return bool */ public static function isOwnUrl($url) { if (empty($url) || !is_string($url)) { return false; } $url = substr($url, strpos($url, '://') + 3); $baseUrl = substr(constant('BASE_URL'), strpos(constant('BASE_URL'), '://') + 3); return (0 === strpos($url, $baseUrl)); } /** * Checks whether the referer belongs to the site * @static * @return bool */ public static function isOwnReferer() { $referer = Qs_Array::get($_SERVER, 'HTTP_REFERER'); return (null === $referer) ? false : Qs_Request::isOwnUrl($referer); } public static function url(array $query = array()) { $url = BASE_URL_LANGUAGE . '/' . CURRENT_PAGE; if (!empty($query)) { $url .= '?' . http_build_query($query); } return $url; } }