r66901 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66900‎ | r66901 | r66902 >
Date:00:50, 26 May 2010
Author:demon
Status:ok
Tags:
Comment:
Add getCookie(). Stuff should use this now instead of accessing $_COOKIE directly
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebRequest.php
@@ -432,6 +432,21 @@
433433 }
434434
435435 /**
 436+ * Get a cookie from the $_COOKIE jar
 437+ * @param String $key The name of the cookie
 438+ * @param mixed $default What to return if the value isn't found
 439+ * @param String $prefix A prefix to use for the cookie name, if not $wgCookiePrefix
 440+ * @return <type>
 441+ */
 442+ public function getCookie( $key, $default = null, $prefix = '' ) {
 443+ if( !$prefix ) {
 444+ global $wgCookiePrefix;
 445+ $prefix = $wgCookiePrefix;
 446+ }
 447+ return $this->getGPCVal( $_COOKIE, $prefix . $key , $default );
 448+ }
 449+
 450+ /**
436451 * Return the path portion of the request URI.
437452 * @return string
438453 */

Status & tagging log