Exemple #1
0
/**
 * Determines if $value is in the contents of $name request header.
 *
 * @param string $name		Header name, lowercase, without 'HTTP_'.
 * @param string $value		Value to search for.
 * @param bool $match_case	Whether to search case-sensitive, default false.
 * @return boolean			True if found, otherwise false.
 */
function http_in_request_header($name, $value, $match_case = false)
{
    return \HttpUtil\HTTP::instance()->inRequestHeader($name, $value, $match_case);
}
Exemple #2
0
/**
 * Determines best language from the 'Accept-Language' request header
 * given an array of accepted languages.
 *
 * Tries to find a direct match (e.g. 'en-US' to 'en-US') but if none is
 * found, finds the best match determined by prefix (e.g. "en").
 * 
 * @param array $accept Indexed array of accepted languages.
 * @param array &$result If given an array, will be populated with negotiation results.
 * @return string Best-match language, or first language given if no match.
 */
function http_negotiate_language(array $accept, &$result = null)
{
    return HTTP::instance()->negotiateLanguage($accept, $result);
}