r113744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113743‎ | r113744 | r113745 >
Date:18:31, 13 March 2012
Author:preilly
Status:ok
Tags:
Comment:
1.19wmf: MFT r113741 - r113743
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.i18n.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php
@@ -34,6 +34,7 @@
3535 private static $formatMobileUrl = '//%s.m.wikipedia.org/';
3636 private static $title;
3737 private static $isFilePage;
 38+ public static $isMainPage = false;
3839 private static $acceptBilling;
3940 private static $carrier;
4041 private static $renderZeroRatedRedirect;
@@ -80,6 +81,10 @@
8182 self::$acceptBilling = $wgRequest->getVal( 'acceptbilling' );
8283 self::$title = $out->getTitle();
8384
 85+ if ( self::$title->isMainPage() ) {
 86+ self::$isMainPage = true;
 87+ }
 88+
8489 $carrier = $wgRequest->getHeader( 'X-CARRIER' );
8590 if ( $carrier !== '(null)' && $carrier ) {
8691 self::$renderZeroRatedBanner = true;
@@ -142,6 +147,10 @@
143148 if ( $wgZeroDisableImages === 1 ) {
144149 self::$forceClickToViewImages = $wgZeroDisableImages;
145150 }
 151+ if ( self::$isMainPage ) {
 152+ $redirect = SpecialPage::getTitleFor( 'ZeroRatedMobileAccess' )->getLocalUrl();
 153+ $wgRequest->response()->header( 'Location: ' . $redirect );
 154+ }
146155 $html = $out->getHTML();
147156 $parsedHtml = $this->parseLinksForZeroQueryString( $html );
148157 $out->clearHTML();
@@ -149,7 +158,7 @@
150159 $carrierLink = ( isset( self::$carrier['link'] ) ) ? self::$carrier['link'] : '';
151160 $bannerText = Html::rawElement( 'span',
152161 array( 'id' => 'zero-rated-banner-text' ),
153 - wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) );
 162+ $carrierLink );
154163 $banner = Html::rawElement( 'div',
155164 array( 'style' => 'display:none;', 'id' => 'zero-rated-banner' ), $bannerText );
156165 $output .= $banner;
@@ -446,9 +455,11 @@
447456 }
448457
449458 public function createUrlCallback( $url, $name ) {
 459+ $carrier = strtolower( $name );
 460+ $linkText = wfMsg( 'zero-rated-mobile-access-banner-text-' . $carrier, $name );
450461 $carrierLink = Html::rawElement( 'a',
451462 array( 'href' => $url ),
452 - $name );
 463+ $linkText );
453464 return $carrierLink;
454465 }
455466
Index: branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.i18n.php
@@ -23,6 +23,8 @@
2424 'zero-rated-mobile-access-home-page-selection' => '$1 home page',
2525 'zero-rated-mobile-access-home-page-selection-text' => 'Or go to the home page in the following language:',
2626 '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',
2729 'zero-rated-mobile-access-banner-text-data-charges' => 'Data charges may apply if you continue: $1 or $2',
2830 'zero-rated-mobile-access-banner-text-data-charges-yes' => 'Yes',
2931 'zero-rated-mobile-access-banner-text-data-charges-no' => 'No',
@@ -370,6 +372,15 @@
371373 'zero-rated-mobile-access-click-to-view-image' => 'Klik om de afbeelding te zien of "$1"...',
372374 );
373375
 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+
374385 /** Pashto (پښتو)
375386 * @author Ahmed-Najib-Biabani-Ibrahimkhel
376387 */
@@ -403,6 +414,21 @@
404415 'zero-rated-mobile-access-banner-text-data-charges-no' => 'Ne',
405416 );
406417
 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+
407433 /** Telugu (తెలుగు)
408434 * @author Veeven
409435 */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113741add carrier custom banner textpreilly18:28, 13 March 2012
r113743add custom banner text and main page redirection to landing page for zeropreilly18:30, 13 March 2012

Status & tagging log