r108586 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108585‎ | r108586 | r108587 >
Date:01:36, 11 January 2012
Author:preilly
Status:ok (Comments)
Tags:mobile 
Comment:
only display banner if carrier is found
Modified paths:
  • /trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php
@@ -114,20 +114,22 @@
115115 } elseif ( self::$renderZeroRatedBanner === true ) {
116116 // a2enmod headers >>> .htaccess >>> RequestHeader set HTTP_CARRIER Verizon
117117 self::$carrier = $this->lookupCarrier( $carrier );
118 - $html = $out->getHTML();
119 - $parsedHtml = $this->parseLinksForZeroQueryString( $html );
120 - $out->clearHTML();
121 - $out->addHTML( $parsedHtml );
122 - $carrierLink = ( isset( self::$carrier['link'] ) ) ? self::$carrier['link'] : '';
123 - $bannerText = Html::rawElement( 'h3',
124 - array( 'id' => 'zero-rated-banner-text' ),
125 - wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) );
126 - $banner = Html::rawElement( 'div',
127 - array( 'style' => 'display:none;',
128 - 'id' => 'zero-rated-banner' ),
129 - $bannerText
130 - );
131 - $output .= $banner;
 118+ if ( isset( self::$carrier['name'] ) ) {
 119+ $html = $out->getHTML();
 120+ $parsedHtml = $this->parseLinksForZeroQueryString( $html );
 121+ $out->clearHTML();
 122+ $out->addHTML( $parsedHtml );
 123+ $carrierLink = ( isset( self::$carrier['link'] ) ) ? self::$carrier['link'] : '';
 124+ $bannerText = Html::rawElement( 'h3',
 125+ array( 'id' => 'zero-rated-banner-text' ),
 126+ wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) );
 127+ $banner = Html::rawElement( 'div',
 128+ array( 'style' => 'display:none;',
 129+ 'id' => 'zero-rated-banner' ),
 130+ $bannerText
 131+ );
 132+ $output .= $banner;
 133+ }
132134 }
133135 if ( self::$renderZeroRatedLandingPage === true ) {
134136 $out->clearHTML();

Follow-up revisions

RevisionCommit summaryAuthorDate
r1085871.18wmf1: MFT r108586preilly01:37, 11 January 2012

Comments

#Comment by MaxSem (talk | contribs)   11:23, 19 January 2012

There's some weird spacing such as inside of array(.

Status & tagging log