http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99383

Revision: 99383
Author:   kaldari
Date:     2011-10-09 23:07:05 +0000 (Sun, 09 Oct 2011)
Log Message:
-----------
follow-up to r99341 - abstracting script calls, switching to camelcase for 
cookie name as seems to be the convention

Modified Paths:
--------------
    trunk/extensions/CentralNotice/CentralNotice.php

Modified: trunk/extensions/CentralNotice/CentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.php    2011-10-09 22:55:51 UTC 
(rev 99382)
+++ trunk/extensions/CentralNotice/CentralNotice.php    2011-10-09 23:07:05 UTC 
(rev 99383)
@@ -201,14 +201,14 @@
 
 function efCentralNoticeGeoLoader( $skin, &$text ) {
        // Insert the geo IP lookup and cookie setter
-       $text .= <<<HTML
-<script type="text/javascript" src="//geoiplookup.wikimedia.org/"></script>
-<script>
+       $text .= Html::linkedScript( "//geoiplookup.wikimedia.org/" );
+       $cookieScript = <<<JAVASCRIPT
 var e = new Date();
 e.setTime( e.getTime() + (30*24*60*60*1000) ); // 30 days
-document.cookie = 'geo_country=' + Geo.country + '; expires=' + 
e.toGMTString() + '; path=/';
-</script>
-HTML;
+document.cookie = 'geoCountry=' + Geo.country + '; expires=' + e.toGMTString() 
+ '; path=/';
+
+JAVASCRIPT;
+       $text .= Html::inlineScript( $cookieScript );
        return true;
 }
 
@@ -217,8 +217,8 @@
        // Initialize global Javascript variables
        $geo = (object)array();
        $geo->{'city'} = '';
-       if ( array_key_exists( 'geo_country', $_COOKIE ) && 
$_COOKIE['geo_country'] != '' ) {
-               $geo->{'country'} = $_COOKIE['geo_country'];
+       if ( array_key_exists( 'geoCountry', $_COOKIE ) && 
$_COOKIE['geoCountry'] != '' ) {
+               $geo->{'country'} = $_COOKIE['geoCountry'];
        } else {
                $geo->{'country'} = '';
        }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to