Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php |
— | — | @@ -99,9 +99,10 @@ |
100 | 100 | $parsedHtml = $this->parseLinksForZeroQueryString( $html ); |
101 | 101 | $out->clearHTML(); |
102 | 102 | $out->addHTML( $parsedHtml ); |
| 103 | + $carrierLink = ( isset( self::$carrier['link'] ) ) ? self::$carrier['link'] : ''; |
103 | 104 | $bannerText = Html::rawElement( 'h3', |
104 | 105 | array( 'id' => 'zero-rated-banner-text' ), |
105 | | - wfMsg( 'zero-rated-mobile-access-banner-text', self::$carrier['link'] ) ); |
| 106 | + wfMsg( 'zero-rated-mobile-access-banner-text', $carrierLink ) ); |
106 | 107 | $banner = Html::rawElement( 'div', |
107 | 108 | array( 'style' => 'display:none;', |
108 | 109 | 'id' => 'zero-rated-banner' ), |
— | — | @@ -239,7 +240,7 @@ |
240 | 241 | if ( $zeroRatedLinkHref && substr( $zeroRatedLinkHref, 0, 1 ) !== '#' ) { |
241 | 242 | $zeroPartnerUrl = $this->appendQueryString( $zeroRatedLinkHref, |
242 | 243 | array( array( 'name' => 'zeropartner', |
243 | | - 'value' => self::$carrier['partnerId'] ), |
| 244 | + 'value' => ( isset( self::$carrier['partnerId'] ) ) ? self::$carrier['partnerId'] : 0 ), |
244 | 245 | array('name' => 'renderZeroRatedBanner', |
245 | 246 | 'value' => 'true') ) ); |
246 | 247 | if ( $zeroPartnerUrl ) { |
— | — | @@ -254,7 +255,7 @@ |
255 | 256 | if ( $zeroRatedExternalLinkHref && substr( $zeroRatedExternalLinkHref, 0, 1 ) !== '#' ) { |
256 | 257 | $zeroPartnerUrl = $this->appendQueryString( $zeroRatedLinkHref, |
257 | 258 | array( array( 'name' => 'zeropartner', |
258 | | - 'value' => self::$carrier['partnerId'] ), |
| 259 | + 'value' => ( isset( self::$carrier['partnerId'] ) ) ? self::$carrier['partnerId'] : 0 ), |
259 | 260 | array('name' => 'renderZeroRatedBanner', |
260 | 261 | 'value' => 'true') ) ); |
261 | 262 | if ( $zeroPartnerUrl ) { |
— | — | @@ -358,9 +359,13 @@ |
359 | 360 | $title = Title::newFromText( $carrierOptionsWikiPage, NS_MEDIAWIKI ); |
360 | 361 | // Use the revision directly to prevent other hooks to be called |
361 | 362 | $rev = Revision::newFromTitle( $title ); |
362 | | - $sha1OfRev = $rev->getSha1(); |
363 | | - $key = wfMemcKey( 'zero-rated-mobile-access-carrier-options', $sha1OfRev ); |
364 | | - $carrierOptions = $wgMemc->get( $key ); |
| 363 | + if ( $rev ) { |
| 364 | + $sha1OfRev = $rev->getSha1(); |
| 365 | + $key = wfMemcKey( 'zero-rated-mobile-access-carrier-options', $sha1OfRev ); |
| 366 | + $carrierOptions = $wgMemc->get( $key ); |
| 367 | + } else { |
| 368 | + $carrierOptions = null; |
| 369 | + } |
365 | 370 | |
366 | 371 | if ( !$carrierOptions ) { |
367 | 372 | $carrierOptions = array(); |
— | — | @@ -408,9 +413,13 @@ |
409 | 414 | $title = Title::newFromText( $languageOptionsWikiPage, NS_MEDIAWIKI ); |
410 | 415 | // Use the revision directly to prevent other hooks to be called |
411 | 416 | $rev = Revision::newFromTitle( $title ); |
412 | | - $sha1OfRev = $rev->getSha1(); |
413 | | - $key = wfMemcKey( 'zero-rated-mobile-access-language-options', $sha1OfRev ); |
414 | | - $languageOptions = $wgMemc->get( $key ); |
| 417 | + if ( $rev ) { |
| 418 | + $sha1OfRev = $rev->getSha1(); |
| 419 | + $key = wfMemcKey( 'zero-rated-mobile-access-language-options', $sha1OfRev ); |
| 420 | + $languageOptions = $wgMemc->get( $key ); |
| 421 | + } else { |
| 422 | + $languageOptions = null; |
| 423 | + } |
415 | 424 | |
416 | 425 | if ( !$languageOptions ) { |
417 | 426 | $languageOptions = array(); |