r109276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109275‎ | r109276 | r109277 >
Date:01:33, 18 January 2012
Author:preilly
Status:ok
Tags:sopa 
Comment:
add sopa banner to mobile
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.i18n.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/SopaNoticeTemplate.php (added) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/SopaNoticeTemplate.php
@@ -0,0 +1,27 @@
 2+<?php
 3+
 4+if ( !defined( 'MEDIAWIKI' ) ) {
 5+ die( -1 );
 6+}
 7+
 8+class SopaNoticeTemplate extends MobileFrontendTemplate {
 9+
 10+ public function getHTML() {
 11+
 12+ $sopaNotice = $this->data['messages']['mobile-frontend-sopa-notice'];
 13+
 14+ $noticeHtml = <<<HTML
 15+ <div class='mwm-message mwm-notice'>
 16+ {$sopaNotice}
 17+ <br/>
 18+ {$sopaNotice}
 19+ <br/>
 20+ {$sopaNotice}
 21+ <br/>
 22+ {$sopaNotice}
 23+ <br/>
 24+ </div>
 25+HTML;
 26+ return $noticeHtml;
 27+ }
 28+}
Property changes on: trunk/extensions/MobileFrontend/SopaNoticeTemplate.php
___________________________________________________________________
Added: svn:eol-style
129 + native
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -54,6 +54,7 @@
5555 'OptOutTemplate',
5656 'ApplicationWmlTemplate',
5757 'ThanksNoticeTemplate',
 58+ 'SopaNoticeTemplate',
5859 );
5960
6061 foreach ( $autoloadClasses as $class ) {
@@ -200,6 +201,7 @@
201202 'mobile-frontend-login',
202203 'mobile-frontend-placeholder',
203204 'mobile-frontend-dismiss-notification',
 205+ 'mobile-frontend-sopa-notice',
204206 );
205207
206208 public $itemsToRemove = array(
@@ -557,6 +559,7 @@
558560 self::$disableImages = $wgRequest->getText( 'disableImages', 0 );
559561 self::$enableImages = $wgRequest->getText( 'enableImages', 0 );
560562 self::$displayNoticeId = $wgRequest->getText( 'noticeid', '' );
 563+ self::$displayNoticeId = 2;
561564
562565 if ( self::$disableImages == 1 ) {
563566 $wgRequest->response()->setcookie( 'disableImages', 1 );
@@ -1584,6 +1587,13 @@
15851588 $noticeHtml = $thanksNoticeTemplate->getHTML();
15861589 }
15871590 }
 1591+ if ( !empty( self::$displayNoticeId ) ) {
 1592+ if ( intval( self::$displayNoticeId ) === 2 ) {
 1593+ $sopaNoticeTemplate = new SopaNoticeTemplate();
 1594+ $sopaNoticeTemplate->set( 'messages', self::$messages );
 1595+ $noticeHtml = $sopaNoticeTemplate->getHTML();
 1596+ }
 1597+ }
15881598
15891599 // header( 'Content-Type: application/xhtml+xml; charset=utf-8' );
15901600 $searchTemplate = $this->getSearchTemplate();
Index: trunk/extensions/MobileFrontend/MobileFrontend.i18n.php
@@ -74,6 +74,7 @@
7575 'mobile-frontend-login' => 'Log in',
7676 'mobile-frontend-placeholder' => 'Type your search here...',
7777 'mobile-frontend-dismiss-notification' => 'dismiss this notification',
 78+ 'mobile-frontend-sopa-notice' => 'WE NEED YOU TO PROTECT FREE SPEECH ONLINE',
7879 );
7980
8081 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r1092881.18wmf: MFT r109276 - r109287preilly02:42, 18 January 2012
r109346r109276: Ignore new message for translation. Propably for 1 day in use only.raymond08:22, 18 January 2012

Status & tagging log