Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | self::$forceClickToViewImages = $wgRequest->getFuzzyBool( 'forceClickToViewImages' ); |
52 | 52 | self::$acceptBilling = $wgRequest->getVal( 'acceptbilling' ); |
53 | 53 | self::$title = $out->getTitle(); |
54 | | - |
| 54 | + |
55 | 55 | $carrier = $wgRequest->getHeader( 'HTTP_X_CARRIER' ); |
56 | 56 | if ( $carrier !== '(null)' && $carrier ) { |
57 | 57 | self::$renderZeroRatedBanner = true; |
— | — | @@ -86,10 +86,7 @@ |
87 | 87 | array( 'id' => 'zero-rated-banner-text' ), |
88 | 88 | wfMsg( 'zero-rated-mobile-access-banner-text-data-charges', $acceptBillingYes, $acceptBillingNo ) ); |
89 | 89 | $banner = Html::rawElement( 'div', |
90 | | - array( 'style' => 'display:none;', |
91 | | - 'id' => 'zero-rated-banner-red' ), |
92 | | - $bannerText |
93 | | - ); |
| 90 | + array( 'style' => 'display:none;', 'id' => 'zero-rated-banner-red' ), $bannerText ); |
94 | 91 | $output .= $banner; |
95 | 92 | $out->clearHTML(); |
96 | 93 | $out->setPageTitle( null ); |
— | — | @@ -106,10 +103,7 @@ |
107 | 104 | array( 'id' => 'zero-rated-banner-text' ), |
108 | 105 | wfMsg( 'zero-rated-mobile-access-banner-text-data-charges', $acceptBillingYes, $acceptBillingNo ) ); |
109 | 106 | $banner = Html::rawElement( 'div', |
110 | | - array( 'style' => 'display:none;', |
111 | | - 'id' => 'zero-rated-banner-red' ), |
112 | | - $bannerText |
113 | | - ); |
| 107 | + array( 'style' => 'display:none;', 'id' => 'zero-rated-banner-red' ), $bannerText ); |
114 | 108 | $output .= $banner; |
115 | 109 | $out->clearHTML(); |
116 | 110 | $out->setPageTitle( null ); |
— | — | @@ -125,10 +119,7 @@ |
126 | 120 | array( 'id' => 'zero-rated-banner-text' ), |
127 | 121 | wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) ); |
128 | 122 | $banner = Html::rawElement( 'div', |
129 | | - array( 'style' => 'display:none;', |
130 | | - 'id' => 'zero-rated-banner' ), |
131 | | - $bannerText |
132 | | - ); |
| 123 | + array( 'style' => 'display:none;', 'id' => 'zero-rated-banner' ), $bannerText ); |
133 | 124 | $output .= $banner; |
134 | 125 | } |
135 | 126 | } |
— | — | @@ -147,9 +138,9 @@ |
148 | 139 | 'FRANCE' => '90.6.70.28', |
149 | 140 | ); |
150 | 141 | $ip = ( strpos( $ip, '192.168.' ) === 0 ) ? $countryIps['THAILAND'] : $ip; |
151 | | - if ( IP::isValid( $ip ) ) { |
152 | | - // If no country was passed, try to do GeoIP lookup |
153 | | - // Requires php5-geoip package |
| 142 | + if ( IP::isValid( $ip ) ) { |
| 143 | + // If no country was passed, try to do GeoIP lookup |
| 144 | + // Requires php5-geoip package |
154 | 145 | if ( !$country && function_exists( 'geoip_country_code_by_name' ) ) { |
155 | 146 | $country = geoip_country_code_by_name( $ip ); |
156 | 147 | } |
— | — | @@ -159,7 +150,6 @@ |
160 | 151 | //self::$displayDebugOutput = true; |
161 | 152 | $languagesForCountry = ( isset( $languageOptions[self::getFullCountryNameFromCode( $country )] ) ) ? |
162 | 153 | $languageOptions[self::getFullCountryNameFromCode( $country )] : null; |
163 | | - //self::addDebugOutput( $languageOptions ); |
164 | 154 | self::addDebugOutput( self::getFullCountryNameFromCode( $country ) ); |
165 | 155 | self::addDebugOutput( $languagesForCountry ); |
166 | 156 | self::writeDebugOutput(); |
— | — | @@ -170,10 +160,7 @@ |
171 | 161 | $languageName = $languageNames[$languagesForCountry[$i]['language']]; |
172 | 162 | $languageCode = $languagesForCountry[$i]['language']; |
173 | 163 | $output .= Html::element( 'hr' ); |
174 | | - $output .= Html::element( 'h3', |
175 | | - array( 'id' => 'lang_' . $languageCode ), |
176 | | - $languageName |
177 | | - ); |
| 164 | + $output .= Html::element( 'h3', array( 'id' => 'lang_' . $languageCode ), $languageName ); |
178 | 165 | if ( $i == 0 ) { |
179 | 166 | $output .= self::getSearchFormHtml( $languageCode ); |
180 | 167 | } else { |
— | — | @@ -323,7 +310,7 @@ |
324 | 311 | |
325 | 312 | /** |
326 | 313 | * Writes objects from the debugOutput Array to buffer |
327 | | - * |
| 314 | + * |
328 | 315 | * @return bool |
329 | 316 | */ |
330 | 317 | private static function writeDebugOutput() { |
— | — | @@ -347,7 +334,7 @@ |
348 | 335 | private static function createCarrierOptionsFromWikiText() { |
349 | 336 | global $wgMemc; |
350 | 337 | wfProfileIn( __METHOD__ ); |
351 | | - |
| 338 | + |
352 | 339 | $carrierOptionsWikiPage = wfMsgForContent( 'zero-rated-mobile-access-carrier-options-wiki-page' ); |
353 | 340 | |
354 | 341 | list( $revId, $rev ) = self::getOptionsFromForeignWiki( $carrierOptionsWikiPage ); |
— | — | @@ -406,7 +393,7 @@ |
407 | 394 | $rev = null; |
408 | 395 | |
409 | 396 | if ( $pageName ) { |
410 | | - |
| 397 | + |
411 | 398 | $memcKey = wfMemcKey( 'zero-rated-mobile-access-foreign-options-', md5( $pageName ) ); |
412 | 399 | $foreignOptions = $wgMemc->get( $memcKey ); |
413 | 400 | |
— | — | @@ -455,7 +442,7 @@ |
456 | 443 | |
457 | 444 | /** |
458 | 445 | * Returns the language options array parsed from a valid wiki page |
459 | | - * |
| 446 | + * |
460 | 447 | * @return Array |
461 | 448 | */ |
462 | 449 | private static function createLanguageOptionsFromWikiText() { |
— | — | @@ -487,12 +474,12 @@ |
488 | 475 | $languageOptions[$countryName] = ''; |
489 | 476 | } elseif ( strpos( $line, '**' ) === 0 && $i > 0 ) { |
490 | 477 | $lineParts = explode('#', $line); |
491 | | - $language = ( isset( $lineParts[0] ) ) ? |
| 478 | + $language = ( isset( $lineParts[0] ) ) ? |
492 | 479 | trim( str_replace( '** ', '', $lineParts[0] ) ) : |
493 | 480 | trim( str_replace( '** ', '', $line ) ) ; |
494 | 481 | if ( $language !== 'portal' && $language !== 'other' ) { |
495 | 482 | $languageOptions[$countryName][] = ( isset( $lineParts[1] ) ) ? |
496 | | - array( 'language' => $language, |
| 483 | + array( 'language' => $language, |
497 | 484 | 'percentage' => intval( str_replace( '%', '', trim( $lineParts[1] ) ) ) ) : |
498 | 485 | $language; |
499 | 486 | } |
— | — | @@ -507,7 +494,7 @@ |
508 | 495 | |
509 | 496 | /** |
510 | 497 | * Returns the Unix timestamp of current day's first second |
511 | | - * |
| 498 | + * |
512 | 499 | * @return int: Timestamp |
513 | 500 | */ |
514 | 501 | private static function todaysStart() { |
— | — | @@ -530,7 +517,7 @@ |
531 | 518 | |
532 | 519 | /** |
533 | 520 | * Returns the number of seconds an item should stay in cache |
534 | | - * |
| 521 | + * |
535 | 522 | * @return int: Time in seconds |
536 | 523 | */ |
537 | 524 | private static function getMaxAge() { |
— | — | @@ -543,7 +530,7 @@ |
544 | 531 | |
545 | 532 | /** |
546 | 533 | * Get full country name from code |
547 | | - * |
| 534 | + * |
548 | 535 | * @param string $code: alpha-2 code ISO 3166 country code |
549 | 536 | * @return String |
550 | 537 | */ |
— | — | @@ -797,7 +784,7 @@ |
798 | 785 | |
799 | 786 | /** |
800 | 787 | * Search form for various languages |
801 | | - * |
| 788 | + * |
802 | 789 | * @param string $langCode: alpha-2 code for language |
803 | 790 | * @return String |
804 | 791 | */ |
— | — | @@ -810,7 +797,7 @@ |
811 | 798 | <div id="sq" class="divclearable"> |
812 | 799 | <input type="text" name="search" id="search" size="22" value="" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024"> |
813 | 800 | <div class="clearlink" id="clearsearch" title="Clear"></div> |
814 | | - </div> |
| 801 | + </div> |
815 | 802 | <button id="goButton" type="submit">{$searchValue}</button> |
816 | 803 | </form> |
817 | 804 | HTML; |