Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -201,14 +201,14 @@ |
202 | 202 | |
203 | 203 | function efCentralNoticeGeoLoader( $skin, &$text ) { |
204 | 204 | // 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 |
208 | 207 | var e = new Date(); |
209 | 208 | 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 ); |
213 | 213 | return true; |
214 | 214 | } |
215 | 215 | |
— | — | @@ -217,8 +217,8 @@ |
218 | 218 | // Initialize global Javascript variables |
219 | 219 | $geo = (object)array(); |
220 | 220 | $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']; |
223 | 223 | } else { |
224 | 224 | $geo->{'country'} = ''; |
225 | 225 | } |