Index: branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | private static $formatMobileUrl = '//%s.m.wikipedia.org/'; |
36 | 36 | private static $title; |
37 | 37 | private static $isFilePage; |
| 38 | + public static $isMainPage = false; |
38 | 39 | private static $acceptBilling; |
39 | 40 | private static $carrier; |
40 | 41 | private static $renderZeroRatedRedirect; |
— | — | @@ -80,6 +81,10 @@ |
81 | 82 | self::$acceptBilling = $wgRequest->getVal( 'acceptbilling' ); |
82 | 83 | self::$title = $out->getTitle(); |
83 | 84 | |
| 85 | + if ( self::$title->isMainPage() ) { |
| 86 | + self::$isMainPage = true; |
| 87 | + } |
| 88 | + |
84 | 89 | $carrier = $wgRequest->getHeader( 'X-CARRIER' ); |
85 | 90 | if ( $carrier !== '(null)' && $carrier ) { |
86 | 91 | self::$renderZeroRatedBanner = true; |
— | — | @@ -142,6 +147,10 @@ |
143 | 148 | if ( $wgZeroDisableImages === 1 ) { |
144 | 149 | self::$forceClickToViewImages = $wgZeroDisableImages; |
145 | 150 | } |
| 151 | + if ( self::$isMainPage ) { |
| 152 | + $redirect = SpecialPage::getTitleFor( 'ZeroRatedMobileAccess' )->getLocalUrl(); |
| 153 | + $wgRequest->response()->header( 'Location: ' . $redirect ); |
| 154 | + } |
146 | 155 | $html = $out->getHTML(); |
147 | 156 | $parsedHtml = $this->parseLinksForZeroQueryString( $html ); |
148 | 157 | $out->clearHTML(); |
— | — | @@ -149,7 +158,7 @@ |
150 | 159 | $carrierLink = ( isset( self::$carrier['link'] ) ) ? self::$carrier['link'] : ''; |
151 | 160 | $bannerText = Html::rawElement( 'span', |
152 | 161 | array( 'id' => 'zero-rated-banner-text' ), |
153 | | - wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) ); |
| 162 | + $carrierLink ); |
154 | 163 | $banner = Html::rawElement( 'div', |
155 | 164 | array( 'style' => 'display:none;', 'id' => 'zero-rated-banner' ), $bannerText ); |
156 | 165 | $output .= $banner; |
— | — | @@ -446,9 +455,11 @@ |
447 | 456 | } |
448 | 457 | |
449 | 458 | public function createUrlCallback( $url, $name ) { |
| 459 | + $carrier = strtolower( $name ); |
| 460 | + $linkText = wfMsg( 'zero-rated-mobile-access-banner-text-' . $carrier, $name ); |
450 | 461 | $carrierLink = Html::rawElement( 'a', |
451 | 462 | array( 'href' => $url ), |
452 | | - $name ); |
| 463 | + $linkText ); |
453 | 464 | return $carrierLink; |
454 | 465 | } |
455 | 466 | |
Index: branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.i18n.php |
— | — | @@ -23,6 +23,8 @@ |
24 | 24 | 'zero-rated-mobile-access-home-page-selection' => '$1 home page', |
25 | 25 | 'zero-rated-mobile-access-home-page-selection-text' => 'Or go to the home page in the following language:', |
26 | 26 | 'zero-rated-mobile-access-banner-text' => 'Free {{SITENAME}} from $1', |
| 27 | + 'zero-rated-mobile-access-banner-text-digi' => 'Free Access on $1 Opera Mini', |
| 28 | + 'zero-rated-mobile-access-banner-text-wikimedia' => 'Free {{SITENAME}} from $1', |
27 | 29 | 'zero-rated-mobile-access-banner-text-data-charges' => 'Data charges may apply if you continue: $1 or $2', |
28 | 30 | 'zero-rated-mobile-access-banner-text-data-charges-yes' => 'Yes', |
29 | 31 | 'zero-rated-mobile-access-banner-text-data-charges-no' => 'No', |
— | — | @@ -370,6 +372,15 @@ |
371 | 373 | 'zero-rated-mobile-access-click-to-view-image' => 'Klik om de afbeelding te zien of "$1"...', |
372 | 374 | ); |
373 | 375 | |
| 376 | +/** Polish (Polski) |
| 377 | + * @author BeginaFelicysym |
| 378 | + */ |
| 379 | +$messages['pl'] = array( |
| 380 | + 'zero-rated-mobile-access-search' => 'Szukaj', |
| 381 | + 'zero-rated-mobile-access-banner-text-data-charges-yes' => 'Tak', |
| 382 | + 'zero-rated-mobile-access-banner-text-data-charges-no' => 'Nie', |
| 383 | +); |
| 384 | + |
374 | 385 | /** Pashto (پښتو) |
375 | 386 | * @author Ahmed-Najib-Biabani-Ibrahimkhel |
376 | 387 | */ |
— | — | @@ -403,6 +414,21 @@ |
404 | 415 | 'zero-rated-mobile-access-banner-text-data-charges-no' => 'Ne', |
405 | 416 | ); |
406 | 417 | |
| 418 | +/** Swedish (Svenska) |
| 419 | + * @author WikiPhoenix |
| 420 | + */ |
| 421 | +$messages['sv'] = array( |
| 422 | + 'zero-rated-mobile-access-search' => 'Sök', |
| 423 | + 'zero-rated-mobile-access-language-selection' => 'Alla språk', |
| 424 | + 'zero-rated-mobile-access-home-page-selection' => '$1 hemsida', |
| 425 | + 'zero-rated-mobile-access-home-page-selection-text' => 'Eller gå till hemsidan i följande språk:', |
| 426 | + 'zero-rated-mobile-access-banner-text' => 'Gratis {{SITENAME}} från $1', |
| 427 | + 'zero-rated-mobile-access-banner-text-data-charges' => 'Datakostnader kan förekomma om du fortsätter: $1 eller $2', |
| 428 | + 'zero-rated-mobile-access-banner-text-data-charges-yes' => 'Ja', |
| 429 | + 'zero-rated-mobile-access-banner-text-data-charges-no' => 'Nej', |
| 430 | + 'zero-rated-mobile-access-click-to-view-image' => 'Klicka för att visa bilden för, "$1"...', |
| 431 | +); |
| 432 | + |
407 | 433 | /** Telugu (తెలుగు) |
408 | 434 | * @author Veeven |
409 | 435 | */ |