r99383 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99382‎ | r99383 | r99384 >
Date:23:07, 9 October 2011
Author:kaldari
Status:reverted (Comments)
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -201,14 +201,14 @@
202202
203203 function efCentralNoticeGeoLoader( $skin, &$text ) {
204204 // Insert the geo IP lookup and cookie setter
205 - $text .= <<<HTML
206 -<script type="text/javascript" src="//geoiplookup.wikimedia.org/"></script>
207 -<script>
 205+ $text .= Html::linkedScript( "//geoiplookup.wikimedia.org/" );
 206+ $cookieScript = <<<JAVASCRIPT
208207 var e = new Date();
209208 e.setTime( e.getTime() + (30*24*60*60*1000) ); // 30 days
210 -document.cookie = 'geo_country=' + Geo.country + '; expires=' + e.toGMTString() + '; path=/';
211 -</script>
212 -HTML;
 209+document.cookie = 'geoCountry=' + Geo.country + '; expires=' + e.toGMTString() + '; path=/';
 210+
 211+JAVASCRIPT;
 212+ $text .= Html::inlineScript( $cookieScript );
213213 return true;
214214 }
215215
@@ -217,8 +217,8 @@
218218 // Initialize global Javascript variables
219219 $geo = (object)array();
220220 $geo->{'city'} = '';
221 - if ( array_key_exists( 'geo_country', $_COOKIE ) && $_COOKIE['geo_country'] != '' ) {
222 - $geo->{'country'} = $_COOKIE['geo_country'];
 221+ if ( array_key_exists( 'geoCountry', $_COOKIE ) && $_COOKIE['geoCountry'] != '' ) {
 222+ $geo->{'country'} = $_COOKIE['geoCountry'];
223223 } else {
224224 $geo->{'country'} = '';
225225 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r99496reverting new banner loading scheme for now - reverts r99341 and r99383kaldari17:02, 11 October 2011
r100100MFT r92510, r92676, r96496, r97304, r99160, r99165, r99169, r99176, r99178, r...awjrichards23:56, 17 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99341entirely new scheme to optimize banner loading - down from 1.1 seconds to 0.1...kaldari08:33, 9 October 2011

Comments

#Comment by Nikerabbit (talk | contribs)   16:42, 11 October 2011

Why such a fancy syntax as $geo->{'country'}?

Status & tagging log