From: Chad Horohoe Date: Wed, 26 May 2010 00:50:46 +0000 (+0000) Subject: Add getCookie(). Stuff should use this now instead of accessing $_COOKIE directly X-Git-Tag: 1.31.0-rc.0~36716 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=8da9785fc96230efabbd8308c232e0f9f732a3cb;p=lhc%2Fweb%2Fwiklou.git Add getCookie(). Stuff should use this now instead of accessing $_COOKIE directly --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 834f2b1e77..83f9690d00 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -431,6 +431,21 @@ class WebRequest { return isset( $_COOKIE[session_name()] ); } + /** + * Get a cookie from the $_COOKIE jar + * @param String $key The name of the cookie + * @param mixed $default What to return if the value isn't found + * @param String $prefix A prefix to use for the cookie name, if not $wgCookiePrefix + * @return + */ + public function getCookie( $key, $default = null, $prefix = '' ) { + if( !$prefix ) { + global $wgCookiePrefix; + $prefix = $wgCookiePrefix; + } + return $this->getGPCVal( $_COOKIE, $prefix . $key , $default ); + } + /** * Return the path portion of the request URI. * @return string