http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76143

Revision: 76143
Author:   tomasz
Date:     2010-11-05 21:20:21 +0000 (Fri, 05 Nov 2010)
Log Message:
-----------
Picking up large changeset from r75908

Modified Paths:
--------------
    branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php
    branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php

Property Changed:
----------------
    branches/wmf/1.16wmf4/extensions/CentralNotice/


Property changes on: branches/wmf/1.16wmf4/extensions/CentralNotice
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/wmf-deployment/extensions/CentralNotice:60970
/trunk/extensions/CentralNotice:62820-67552,67557,67559-71720,71725-71731,71734-71739,71748-71753,71774-71997,72058-72131,72136-73830,73847,73850,73852,73855,73973,73980,73983,73991,73994-73995,74000-74321,74325-74406,75376-75470,75849
/trunk/phase3/extensions/CentralNotice:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816
   + /branches/wmf-deployment/extensions/CentralNotice:60970
/trunk/extensions/CentralNotice:62820-67552,67557,67559-71720,71725-71731,71734-71739,71748-71753,71774-71997,72058-72131,72136-73830,73847,73850,73852,73855,73973,73980,73983,73991,73994-73995,74000-74321,74325-74406,75376-75470,75849,75908
/trunk/phase3/extensions/CentralNotice:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816

Modified: branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php    
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php    
2010-11-05 21:20:21 UTC (rev 76143)
@@ -122,19 +122,29 @@
                global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
 
                if ( $wgDBtype == 'mysql' ) {
-                       $wgExtNewTables[] = array( 'cn_notices', $base . 
'/CentralNotice.sql' );
-                       $wgExtNewFields[] = array( 'cn_notices', 
'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
-                       $wgExtNewTables[] = array( 'cn_notice_languages', $base 
. '/patches/patch-notice_languages.sql' );
-                       $wgExtNewFields[] = array( 'cn_templates', 
'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
-                       $wgExtNewTables[] = array( 'cn_notice_countries', $base 
. '/patches/patch-notice_countries.sql' );
+                       $wgExtNewTables[] = array( 'cn_notices', 
+                               $base . '/CentralNotice.sql' );
+                       $wgExtNewFields[] = array( 'cn_notices', 
'not_preferred',
+                          $base . '/patches/patch-notice_preferred.sql' );
+                       $wgExtNewTables[] = array( 'cn_notice_languages', 
+                               $base . '/patches/patch-notice_languages.sql' );
+                       $wgExtNewFields[] = array( 'cn_templates', 
'tmp_display_anon', 
+                               $base . '/patches/patch-template_settings.sql' 
);
+                       $wgExtNewTables[] = array( 'cn_notice_countries', 
+                               $base . '/patches/patch-notice_countries.sql' );
                }
        } else {
                if ( $updater->getDB()->getType() == 'mysql' ) {
-                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notices', $base . '/CentralNotice.sql' ) );
-                       $updater->addExtensionUpdate( array( 'addField', 
'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' ) 
);
-                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' ) );
-                       $updater->addExtensionUpdate( array( 'addField', 
'cn_templates', 'tmp_display_anon', $base . 
'/patches/patch-template_settings.sql' ) );
-                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' ) );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notices', 
+                               $base . '/CentralNotice.sql' ) );
+                       $updater->addExtensionUpdate( array( 'addField', 
'cn_notices', 'not_preferred', 
+                               $base . '/patches/patch-notice_preferred.sql' ) 
);
+                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notice_languages', 
+                               $base . '/patches/patch-notice_languages.sql' ) 
);
+                       $updater->addExtensionUpdate( array( 'addField', 
'cn_templates', 'tmp_display_anon', 
+                               $base . '/patches/patch-template_settings.sql' 
) );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'cn_notice_countries', 
+                               $base . '/patches/patch-notice_countries.sql' ) 
);
                }
        }
        return true;

Modified: 
branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php  
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php  
2010-11-05 21:20:21 UTC (rev 76143)
@@ -59,7 +59,9 @@
                
                $htmlOut .= Xml::openElement( 'table', array ( 'id' => 
'envpicker', 'cellpadding' => 7 ) );
                $htmlOut .= Xml::openElement( 'tr' );
-               $htmlOut .= Xml::tags( 'td', array( 'style' => 'width: 20%;' ), 
wfMsg( 'centralnotice-project-name' ) );
+               $htmlOut .= Xml::tags( 'td', 
+                       array( 'style' => 'width: 20%;' ), 
+                       wfMsg( 'centralnotice-project-name' ) );
                $htmlOut .= Xml::openElement( 'td' );
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'project' ) );
                foreach ( $wgNoticeProjects as $value ) {
@@ -69,9 +71,12 @@
                $htmlOut .= Xml::closeElement( 'td' );
                $htmlOut .= Xml::closeElement( 'tr' );
                $htmlOut .= Xml::openElement( 'tr' );
-               $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsg( 
'centralnotice-project-language' ) );
+               $htmlOut .= Xml::tags( 'td', 
+                       array( 'valign' => 'top' ), 
+                       wfMsg( 'centralnotice-project-language' ) );
                $htmlOut .= Xml::openElement( 'td' );
-               // Make sure the site language is in the list; a custom 
language code might not have a defined name...
+               // Make sure the site language is in the list; a custom 
language code 
+               // might not have a defined name...
                $languages = Language::getLanguageNames( true );
                if( !array_key_exists( $wgLanguageCode, $languages ) ) {
                        $languages[$wgLanguageCode] = $wgLanguageCode;
@@ -79,7 +84,9 @@
                ksort( $languages );
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'language' ) );
                foreach( $languages as $code => $name ) {
-                       $htmlOut .= Xml::option( wfMsg( 
'centralnotice-language-listing', $code, $name ), $code, $code === 
$this->language );
+                       $htmlOut .= Xml::option( 
+                               wfMsg( 'centralnotice-language-listing', $code, 
$name ), 
+                               $code, $code === $this->language );
                }
                $htmlOut .= Xml::closeElement( 'select' );
                $htmlOut .= Xml::closeElement( 'td' );
@@ -153,10 +160,13 @@
                        $totalWeight += $banner['weight'];
                }
                if ( $banners ) {
-                       $htmlOut .= Xml::openElement( 'table', array ( 
'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
+                       $htmlOut .= Xml::openElement( 'table', 
+                               array ( 'cellpadding' => 9, 'class' => 
'wikitable sortable' ) );
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::element( 'th', array( 'width' => '40%' 
), wfMsg ( 'centralnotice-percentage' ) );
-                       $htmlOut .= Xml::element( 'th', array( 'width' => '60%' 
), wfMsg ( 'centralnotice-banner' ) );
+                       $htmlOut .= Xml::element( 'th', array( 'width' => '40%' 
), 
+                               wfMsg ( 'centralnotice-percentage' ) );
+                       $htmlOut .= Xml::element( 'th', array( 'width' => '60%' 
), 
+                               wfMsg ( 'centralnotice-banner' ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        foreach ( $banners as $banner ) {
                                $htmlOut .= Xml::openElement( 'tr' );
@@ -165,7 +175,8 @@
                                $htmlOut .= wfMsg ( 'percent', 
$wgLang->formatNum( $percentage ) );
                                $htmlOut .= Xml::closeElement( 'td' );
                                $htmlOut .= Xml::tags( 'td', array( 'valign' => 
'top' ),
-                                       $sk->makeLinkObj( $viewPage, 
htmlspecialchars( $banner['name'] ), 'template=' . urlencode( $banner['name'] ) 
)
+                                       $sk->makeLinkObj( $viewPage, 
htmlspecialchars( $banner['name'] ), 
+                                               'template=' . urlencode( 
$banner['name'] ) )
                                );
                                $htmlOut .= Xml::closeElement( 'tr' );
                        }

Modified: 
branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php  
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php  
2010-11-05 21:20:21 UTC (rev 76143)
@@ -45,7 +45,7 @@
                global $wgCentralPagePath;
                
                $js = $this->getScriptFunctions() . $this->getToggleScripts();
-               $js .= <<<EOT
+               $js .= <<<JAVASCRIPT
 ( function( $ ) {
        $.ajaxSetup({ cache: true });
        $.centralNotice = {
@@ -55,12 +55,18 @@
                'fn': {
                        'loadBanner': function( bannerName ) {
                                // Get the requested banner
-                               var bannerPageQuery = $.param( { 'banner': 
bannerName, 'userlang': wgUserLanguage, 'db': wgDBname, 'sitename': wgSiteName, 
'country': Geo.country } );
+                               var bannerPageQuery = $.param( { 
+                                       'banner': bannerName, 'userlang': 
wgUserLanguage, 
+                                       'db': wgDBname, 'sitename': wgSiteName, 
'country': Geo.country } );
                                var bannerPage = '?title=Special:BannerLoader&' 
+ bannerPageQuery;
-EOT;
-               $js .= "\n\t\t\t\tvar bannerScript = '<script 
type=\"text/javascript\" src=\"".Xml::escapeJsString( $wgCentralPagePath )."' + 
bannerPage + '\"></script>';\n";
-               $js .= <<<EOT
-                               $( '#siteNotice' ).prepend( '<div 
id="centralNotice" class="' + ( wgNoticeToggleState ? 'expanded' : 'collapsed' 
) + '">'+bannerScript+'</div>' );
+JAVASCRIPT;
+               $js .= "\n\t\t\t\tvar bannerScript = '<script 
type=\"text/javascript\" src=\"" . 
+                       Xml::escapeJsString( $wgCentralPagePath ) .
+                       "' + bannerPage + '\"></script>';\n";
+               $js .= <<<JAVASCRIPT
+                               $( '#siteNotice' ).prepend( '<div 
id="centralNotice" class="' + 
+                                       ( wgNoticeToggleState ? 'expanded' : 
'collapsed' ) + 
+                                       '">'+bannerScript+'</div>' );
                        },
                        'loadBannerList': function( geoOverride ) {
                                if ( geoOverride ) {
@@ -87,7 +93,9 @@
                                
                                for( var i = 0; i < bannerList.length; i++ ) {
                                        // Only include this banner if it's 
inteded for the current user
-                                       if( ( wgUserName && 
bannerList[i].display_account ) || ( !wgUserName && bannerList[i].display_anon 
== 1 ) ) {
+                                       if( ( wgUserName && 
bannerList[i].display_account ) || 
+                                               ( !wgUserName && 
bannerList[i].display_anon == 1 ) ) 
+                                       {
                                                // add the banner to our list 
once per weight
                                                for( var j=0; j < 
bannerList[i].weight; j++ ) {
                                                        groomedBannerList.push( 
bannerList[i] );
@@ -100,7 +108,9 @@
                                
                                // Load a random banner from our groomed list
                                $.centralNotice.fn.loadBanner( 
-                                       groomedBannerList[ Math.floor( 
Math.random() * groomedBannerList.length ) ].name
+                                       groomedBannerList[ 
+                                               Math.floor( Math.random() * 
groomedBannerList.length ) 
+                                       ].name
                                );
                        },
                        'getQueryStringVariables': function() {
@@ -125,19 +135,19 @@
                }
        } ); //document ready
 } )( jQuery );
-EOT;
+JAVASCRIPT;
                return $js;
                        
        }
        
        function getToggleScripts() {
-               $showStyle = <<<END
+               $showStyle = <<<HTML
 <style type="text/css">
 #centralNotice .siteNoticeSmall {display:none;}
 #centralNotice.collapsed .siteNoticeBig {display:none;}
 #centralNotice.collapsed .siteNoticeSmall {display:block;}
 </style>
-END;
+HTML;
                $encShowStyle = Xml::encodeJsVar( $showStyle );
 
                $script = "
@@ -147,7 +157,7 @@
        }
 
        function getScriptFunctions() {
-               $script = "
+               $script = <<<JAVASCRIPT
 function insertBanner(bannerJson) {
        jQuery('div#centralNotice').prepend( bannerJson.banner );
 }
@@ -172,7 +182,9 @@
        e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week
        var work='hidesnmessage='+state+'; expires=' + e.toGMTString() + '; 
path=/';
        document.cookie = work;
-}\n\n";
+}
+
+JAVASCRIPT;
                return $script;
        }
        

Modified: 
branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php  
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php  
2010-11-05 21:20:21 UTC (rev 76143)
@@ -72,7 +72,8 @@
 
                if ( !$templates && $this->project == 'wikipedia' ) {
                        // See if we have any preferred notices for this 
language wikipedia
-                       $notices = CentralNoticeDB::getNotices( 'wikipedia', 
$this->language, false, 1, 1, $this->location );
+                       $notices = CentralNoticeDB::getNotices( 'wikipedia', 
$this->language, 
+                               false, 1, 1, $this->location );
                        
                        if ( $notices ) {
                                // Pull banners
@@ -82,7 +83,8 @@
 
                // Didn't find any preferred matches so do an old style lookup
                if ( !$templates )  {
-                       $templates = CentralNotice::selectNoticeTemplates( 
$this->project, $this->language, $this->location );
+                       $templates = CentralNotice::selectNoticeTemplates( 
+                               $this->project, $this->language, 
$this->location );
                }
                
                return FormatJson::encode( $templates );

Modified: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php      
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php      
2010-11-05 21:20:21 UTC (rev 76143)
@@ -53,7 +53,8 @@
        
        /**
         * Generate the JS for the requested banner
-        * @return a string of Javascript containing a call to insertBanner() 
with JSON containing the banner content as the parameter
+        * @return a string of Javascript containing a call to insertBanner() 
+        *   with JSON containing the banner content as the parameter
         */
        function getJsNotice( $bannerName ) {
                // Make sure the banner exists
@@ -161,16 +162,18 @@
                        wfRestoreWarnings();
                        if ( !$count ) {
                                // Pull long-cached amount
-                               $count = intval( $wgMemc->get( wfMemcKey( 
'centralnotice', 'counter', 'fallback' ) ) );
+                               $count = intval( $wgMemc->get( 
+                                       wfMemcKey( 'centralnotice', 'counter', 
'fallback' ) ) );
                                if ( !$count ) {
                                        // Return hard-coded amount if all else 
fails
                                        return 1100000; // Update as needed 
during fundraiser
                                }
                        }
-                       $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), 
$count, 60 ); // Expire in 60 seconds
-                       $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 
'fallback' ), $count ); // No expiration
+                       // Expire in 60 seconds
+                       $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), 
$count, 60 );
+                       // No expiration
+                       $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 
'fallback' ), $count );
                }
                return $count;
        }
-       
 }

Modified: 
branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php     
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php     
2010-11-05 21:20:21 UTC (rev 76143)
@@ -147,7 +147,8 @@
                                        if ( $noticeName == '' ) {
                                                $this->showError( 
'centralnotice-null-string' );
                                        } else {
-                                               $this->addNotice( $noticeName, 
'0', $start, $project_name, $project_languages, $geotargeted, $geo_countries );
+                                               $this->addNotice( $noticeName, 
'0', $start, $project_name,
+                                                       $project_languages, 
$geotargeted, $geo_countries );
                                        }
                                }
                                
@@ -419,7 +420,10 @@
                                
                                // If campaign is currently active, set special 
class on table row.
                                $attribs = array();
-                               if ( wfTimestamp() > wfTimestamp( TS_UNIX , 
$row->not_start ) && wfTimestamp() < wfTimestamp( TS_UNIX , $row->not_end ) && 
$row->not_enabled == '1' ) {
+                               if ( wfTimestamp() > wfTimestamp( TS_UNIX , 
$row->not_start ) 
+                                       && wfTimestamp() < wfTimestamp( TS_UNIX 
, $row->not_end ) 
+                                       && $row->not_enabled == '1' ) 
+                               {
                                        $attribs = array( 'class' => 
'cn-active-campaign' );
                                }
                                
@@ -482,7 +486,8 @@
                        // Name
                        $htmlOut .= Xml::openElement( 'tr' );
                        $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 
'centralnotice-notice-name' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::input( 
'noticeName', 25, $wgRequest->getVal( 'noticeName' ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::input( 'noticeName', 25, 
$wgRequest->getVal( 'noticeName' ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Start Date
                        $htmlOut .= Xml::openElement( 'tr' );
@@ -502,15 +507,21 @@
                        // Languages
                        $htmlOut .= Xml::openElement( 'tr' );
                        $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), wfMsgHtml( 'yourlanguage' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), 
$this->languageMultiSelector( $noticeLanguages ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               $this->languageMultiSelector( $noticeLanguages 
) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Countries
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::label( 
wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::check( 
'geotargeted', false, wfArrayMerge( $readonly, array( 'value' => 1, 'id' => 
'geotargeted' ) ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::label( wfMsg( 'centralnotice-geotargeted' 
), 'geotargeted' ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::check( 'geotargeted', false, 
+                                       wfArrayMerge( $readonly, array( 'value' 
=> 1, 'id' => 'geotargeted' ) ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
-                       $htmlOut .= Xml::openElement( 'tr', array( 
'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
-                       $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), wfMsgHtml( 'centralnotice-countries' ) );
+                       $htmlOut .= Xml::openElement( 'tr', 
+                               array( 'id'=>'geoMultiSelector', 
'style'=>'display:none;' ) );
+                       $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), 
+                               wfMsgHtml( 'centralnotice-countries' ) );
                        $htmlOut .= Xml::tags( 'td', array(), 
$this->geoMultiSelector() );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        
@@ -652,7 +663,8 @@
                                        
                                        // If there were no errors, reload the 
page to prevent duplicate form submission
                                        if ( !$this->centralNoticeError ) {
-                                               $wgOut->redirect( 
$this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" ) );
+                                               $wgOut->redirect( 
$this->getTitle()->getLocalUrl( 
+                                                       
"method=listNoticeDetail&notice=$notice" ) );
                                                return;
                                        }
                                } else {
@@ -670,7 +682,8 @@
                                $htmlOut .= Xml::openElement( 'form',
                                        array(
                                                'method' => 'post',
-                                               'action' => 
$this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" )
+                                               'action' => 
$this->getTitle()->getLocalUrl( 
+                                                       
"method=listNoticeDetail&notice=$notice" )
                                        )
                                );
                        }
@@ -821,41 +834,64 @@
                        // Languages
                        $htmlOut .= Xml::openElement( 'tr' );
                        $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), wfMsgHtml( 'yourlanguage' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), 
$this->languageMultiSelector( $noticeLanguages ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               $this->languageMultiSelector( $noticeLanguages 
) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Countries
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::label( 
wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::check( 
'geotargeted', $isGeotargeted, wfArrayMerge( $readonly, array( 'value' => 
$row->not_name, 'id' => 'geotargeted' ) ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::label( wfMsg( 'centralnotice-geotargeted' 
), 'geotargeted' ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::check( 'geotargeted', $isGeotargeted, 
+                                       wfArrayMerge( 
+                                               $readonly, 
+                                               array( 'value' => 
$row->not_name, 'id' => 'geotargeted' ) ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        if ( $isGeotargeted ) {
                                $htmlOut .= Xml::openElement( 'tr', array( 
'id'=>'geoMultiSelector' ) );
                        } else {
-                               $htmlOut .= Xml::openElement( 'tr', array( 
'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
+                               $htmlOut .= Xml::openElement( 'tr', 
+                                       array( 'id'=>'geoMultiSelector', 
'style'=>'display:none;' ) );
                        }
-                       $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), wfMsgHtml( 'centralnotice-countries' ) );
+                       $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' 
), 
+                               wfMsgHtml( 'centralnotice-countries' ) );
                        $htmlOut .= Xml::tags( 'td', array(), 
$this->geoMultiSelector( $countries ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Enabled
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::label( 
wfMsg( 'centralnotice-enabled' ), 'enabled' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::check( 
'enabled', $isEnabled, wfArrayMerge( $readonly, array( 'value' => 
$row->not_name, 'id' => 'enabled' ) ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::label( wfMsg( 'centralnotice-enabled' ), 
'enabled' ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::check( 'enabled', $isEnabled, 
+                                       wfArrayMerge( $readonly, 
+                                               array( 'value' => 
$row->not_name, 'id' => 'enabled' ) ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Preferred
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::label( 
wfMsg( 'centralnotice-preferred' ), 'preferred' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::check( 
'preferred', $isPreferred, wfArrayMerge( $readonly, array( 'value' => 
$row->not_name, 'id' => 'preferred' ) ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::label( wfMsg( 'centralnotice-preferred' ), 
'preferred' ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::check( 'preferred', $isPreferred, 
+                                       wfArrayMerge( $readonly, 
+                                               array( 'value' => 
$row->not_name, 'id' => 'preferred' ) ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        // Locked
                        $htmlOut .= Xml::openElement( 'tr' );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::label( 
wfMsg( 'centralnotice-locked' ), 'locked' ) );
-                       $htmlOut .= Xml::tags( 'td', array(), Xml::check( 
'locked', $isLocked, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 
'id' => 'locked' ) ) ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::label( wfMsg( 'centralnotice-locked' ), 
'locked' ) );
+                       $htmlOut .= Xml::tags( 'td', array(), 
+                               Xml::check( 'locked', $isLocked, 
+                                       wfArrayMerge( $readonly, 
+                                               array( 'value' => 
$row->not_name, 'id' => 'locked' ) ) ) );
                        $htmlOut .= Xml::closeElement( 'tr' );
                        if ( $this->editable ) {
                                // Locked
                                $htmlOut .= Xml::openElement( 'tr' );
-                               $htmlOut .= Xml::tags( 'td', array(), 
Xml::label( wfMsg( 'centralnotice-remove' ), 'remove' ) );
-                               $htmlOut .= Xml::tags( 'td', array(), 
Xml::check( 'remove', false, array( 'value' => $row->not_name, 'id' => 'remove' 
) ) );
+                               $htmlOut .= Xml::tags( 'td', array(), 
+                                       Xml::label( wfMsg( 
'centralnotice-remove' ), 'remove' ) );
+                               $htmlOut .= Xml::tags( 'td', array(), 
+                                       Xml::check( 'remove', false, 
+                                               array( 'value' => 
$row->not_name, 'id' => 'remove' ) ) );
                                $htmlOut .= Xml::closeElement( 'tr' );
                        }
                        $htmlOut .= Xml::closeElement( 'table' );
@@ -983,9 +1019,13 @@
                        $htmlOut  = Xml::fieldset( wfMsg( 
"centralnotice-available-templates" ) );
                        
                        // Show paginated list of banners
-                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), $pager->getNavigationBar() );
+                       $htmlOut .= Xml::tags( 'div', 
+                               array( 'class' => 'cn-pager' ), 
+                               $pager->getNavigationBar() );
                        $htmlOut .= $pager->getBody();
-                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), $pager->getNavigationBar() );
+                       $htmlOut .= Xml::tags( 'div', 
+                               array( 'class' => 'cn-pager' ), 
+                               $pager->getNavigationBar() );
                        
                        $htmlOut .= Xml::closeElement( 'fieldset' );
                } else {
@@ -1075,7 +1115,9 @@
                return $templates;
        }
 
-       function addNotice( $noticeName, $enabled, $start, $project_name, 
$project_languages, $geotargeted, $geo_countries ) {
+       function addNotice( $noticeName, $enabled, $start, $project_name, 
+               $project_languages, $geotargeted, $geo_countries ) 
+       {
                global $wgOut;
 
                if ( $this->noticeExists( $noticeName ) ) {
@@ -1096,12 +1138,17 @@
                                $end['month'] = '10';
                                $end['year'] = $start['year'];
                        } else {
-                               $end['month'] = ( substr( $start['month'], 0, 1 
) ) == 0 ? 0 . ( intval( $start['month'] ) + 1 ) : ( $start['month'] + 1 );
+                               $end['month'] = 
+                                       ( substr( $start['month'], 0, 1 ) ) == 
0 
+                                       ? 0 . ( intval( $start['month'] ) + 1 ) 
+                                       : ( $start['month'] + 1 );
                                $end['year'] = $start['year'];
                        }
 
-                       $startTs = wfTimeStamp( TS_MW, 
"{$start['year']}:{$start['month']}:{$start['day']} 
{$start['hour']}:{$start['min']}:00" );
-                       $endTs = wfTimeStamp( TS_MW, 
"{$end['year']}:{$end['month']}:{$start['day']} 
{$start['hour']}:{$start['min']}:00" );
+                       $startTs = wfTimeStamp( TS_MW, 
"{$start['year']}:{$start['month']}:{$start['day']} " . 
+                               "{$start['hour']}:{$start['min']}:00" );
+                       $endTs = wfTimeStamp( TS_MW, 
"{$end['year']}:{$end['month']}:{$start['day']} " .
+                               "{$start['hour']}:{$start['min']}:00" );
 
                        $res = $dbw->insert( 'cn_notices',
                                array( 'not_name' => $noticeName,
@@ -1119,7 +1166,8 @@
                        foreach( $project_languages as $code ) {
                                $insertArray[] = array( 'nl_notice_id' => 
$not_id, 'nl_language' => $code );
                        }
-                       $res = $dbw->insert( 'cn_notice_languages', 
$insertArray, __METHOD__, array( 'IGNORE' ) );
+                       $res = $dbw->insert( 'cn_notice_languages', 
$insertArray, 
+                               __METHOD__, array( 'IGNORE' ) );
                        
                        if ( $geotargeted ) {
                                // Do multi-row insert for campaign countries
@@ -1127,7 +1175,8 @@
                                foreach( $geo_countries as $code ) {
                                        $insertArray[] = array( 'nc_notice_id' 
=> $not_id, 'nc_country' => $code );
                                }
-                               $res = $dbw->insert( 'cn_notice_countries', 
$insertArray, __METHOD__, array( 'IGNORE' ) );
+                               $res = $dbw->insert( 'cn_notice_countries', 
$insertArray, 
+                                       __METHOD__, array( 'IGNORE' ) );
                        }
                
                        $dbw->commit();
@@ -1213,7 +1262,8 @@
                $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 
'not_name' => $eNoticeName ) );
                $languages = array();
                if ( $row ) {
-                       $res = $dbr->select( 'cn_notice_languages', 
'nl_language', array( 'nl_notice_id' => $row->not_id ) );
+                       $res = $dbr->select( 'cn_notice_languages', 
'nl_language', 
+                               array( 'nl_notice_id' => $row->not_id ) );
                        foreach ( $res as $langRow ) {
                                $languages[] = $langRow->nl_language;
                        }
@@ -1227,7 +1277,8 @@
                $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 
'not_name' => $eNoticeName ) );
                $countries = array();
                if ( $row ) {
-                       $res = $dbr->select( 'cn_notice_countries', 
'nc_country', array( 'nc_notice_id' => $row->not_id ) );
+                       $res = $dbr->select( 'cn_notice_countries', 
'nc_country', 
+                               array( 'nc_notice_id' => $row->not_id ) );
                        foreach ( $res as $countryRow ) {
                                $countries[] = $countryRow->nc_country;
                        }
@@ -1400,7 +1451,8 @@
        function languageMultiSelector( $selected = array(), $customisedOnly = 
true ) {
                global $wgContLanguageCode, $wgExtensionAssetsPath, $wgLang;
                $scriptPath = "$wgExtensionAssetsPath/CentralNotice";
-               // Make sure the site language is in the list; a custom 
language code might not have a defined name...
+               // Make sure the site language is in the list; a custom 
language code 
+               // might not have a defined name...
                $languages = Language::getLanguageNames( $customisedOnly );
                if( !array_key_exists( $wgContLanguageCode, $languages ) ) {
                        $languages[$wgContLanguageCode] = $wgContLanguageCode;
@@ -1422,16 +1474,26 @@
                                $options
                        );
                        $buttons = array();
-                       $buttons[] = '<a href="#" 
onclick="selectLanguages(true);return false;">' . wfMsg( 
'powersearch-toggleall' ) . '</a>';
-                       $buttons[] = '<a href="#" 
onclick="selectLanguages(false);return false;">' . wfMsg( 
'powersearch-togglenone' ) . '</a>';
-                       $buttons[] = '<a href="#" 
onclick="top10Languages();return false;">' . wfMsg( 
'centralnotice-top-ten-languages' ) . '</a>';
+                       $buttons[] = '<a href="#" 
onclick="selectLanguages(true);return false;">' . 
+                               wfMsg( 'powersearch-toggleall' ) . '</a>';
+                       $buttons[] = '<a href="#" 
onclick="selectLanguages(false);return false;">' . 
+                               wfMsg( 'powersearch-togglenone' ) . '</a>';
+                       $buttons[] = '<a href="#" 
onclick="top10Languages();return false;">' . 
+                               wfMsg( 'centralnotice-top-ten-languages' ) . 
'</a>';
                        $htmlOut .= Xml::tags( 'div',
                                array( 'style' => 'margin-top: 0.2em;' ),
-                               '<img src="'.$scriptPath.'/up-arrow.png" 
style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-select', 
$wgLang->commaList( $buttons ) )
+                               '<img src="'.$scriptPath.'/up-arrow.png" 
style="vertical-align:baseline;"/>' . 
+                               wfMsg( 'centralnotice-select', 
$wgLang->commaList( $buttons ) )
                        );
                } else {
                        $htmlOut .= Xml::tags( 'select',
-                               array( 'multiple' => 'multiple', 'size' => 4, 
'id' => 'project_languages[]', 'name' => 'project_languages[]', 'disabled' => 
'disabled' ),
+                               array( 
+                                       'multiple' => 'multiple', 
+                                       'size' => 4, 
+                                       'id' => 'project_languages[]', 
+                                       'name' => 'project_languages[]', 
+                                       'disabled' => 'disabled' 
+                               ),
                                $options
                        );
                }
@@ -1559,12 +1621,23 @@
                $htmlOut = '';
                if ( $this->editable ) {
                        $htmlOut .= Xml::tags( 'select',
-                               array( 'multiple' => 'multiple', 'size' => 5, 
'id' => 'geo_countries[]', 'name' => 'geo_countries[]' ),
+                               array( 
+                                       'multiple' => 'multiple', 
+                                       'size' => 5, 
+                                       'id' => 'geo_countries[]', 
+                                       'name' => 'geo_countries[]' 
+                               ),
                                $options
                        );
                } else {
                        $htmlOut .= Xml::tags( 'select',
-                               array( 'multiple' => 'multiple', 'size' => 5, 
'id' => 'geo_countries[]', 'name' => 'geo_countries[]', 'disabled' => 
'disabled' ),
+                               array( 
+                                       'multiple' => 'multiple', 
+                                       'size' => 5, 
+                                       'id' => 'geo_countries[]', 
+                                       'name' => 'geo_countries[]', 
+                                       'disabled' => 'disabled' 
+                               ),
                                $options
                        );
                }
@@ -1595,7 +1668,8 @@
                                'join_conds' => array(
                                        'cn_assignments' => array( 
                                                'LEFT JOIN',
-                                               "cn_assignments.tmp_id = 
cn_templates.tmp_id AND cn_assignments.not_id = $noticeId"
+                                               "cn_assignments.tmp_id = 
cn_templates.tmp_id " . 
+                                               "AND cn_assignments.not_id = 
$noticeId"
                                        )
                                )
                        );
@@ -1624,7 +1698,9 @@
                        // Weight select
                        $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
                                Xml::listDropDown( "weight[$row->tmp_id]",
-                                       CentralNotice::dropDownList( wfMsg( 
'centralnotice-weight' ), range ( 0, 100, 5 ) ) ,
+                                       CentralNotice::dropDownList( 
+                                               wfMsg( 'centralnotice-weight' 
), range ( 0, 100, 5 ) 
+                                       ) ,
                                        '',
                                        '25',
                                        '',

Modified: 
branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php
===================================================================
--- branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php    
2010-11-05 21:15:48 UTC (rev 76142)
+++ branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php    
2010-11-05 21:20:21 UTC (rev 76143)
@@ -146,7 +146,8 @@
                                        $newTemplate =  $wgRequest->getVal( 
'newTemplate' );
                                        // We use the returned name in case any 
special characters had to be removed
                                        $template = $this->cloneTemplate( 
$oldTemplate, $newTemplate );
-                                       $wgOut->redirect( $this->getTitle( 
'view' )->getLocalUrl( "template=$template" ) );
+                                       $wgOut->redirect( 
+                                               $this->getTitle( 'view' 
)->getLocalUrl( "template=$template" ) );
                                        return;
                                        
                                } else {
@@ -188,9 +189,11 @@
                        $htmlOut .= Xml::element( 'h2', null, wfMsg( 
'centralnotice-manage-templates' ) );
                        
                        // Show paginated list of banners
-                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), $pager->getNavigationBar() );
+                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), 
+                               $pager->getNavigationBar() );
                        $htmlOut .= $pager->getBody();
-                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), $pager->getNavigationBar() );
+                       $htmlOut .= Xml::tags( 'div', array( 'class' => 
'cn-pager' ), 
+                               $pager->getNavigationBar() );
                
                        if ( $this->editable ) {
                                $htmlOut .= Xml::closeElement( 'form' );
@@ -219,40 +222,53 @@
                // Build HTML
                $htmlOut = '';
                $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 
'prefsection' ) );
-               $htmlOut .= Xml::openElement( 'form', array( 'method' => 
'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
+               $htmlOut .= Xml::openElement( 'form', 
+                       array( 'method' => 'post', 'onsubmit' => 'return 
validateBannerForm(this)' ) );
                $htmlOut .= Xml::element( 'h2', null, wfMsg( 
'centralnotice-add-template' ) );
                $htmlOut .= Xml::hidden( 'wpMethod', 'addTemplate' );
                $htmlOut .= Xml::tags( 'p', null,
-                       Xml::inputLabel( wfMsg( 'centralnotice-banner-name' ), 
'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' ) )
+                       Xml::inputLabel( 
+                               wfMsg( 'centralnotice-banner-name' ), 
+                               'templateName', 'templateName', 25, 
$wgRequest->getVal( 'templateName' ) 
+                       )
                );
                
                $htmlOut .= Xml::openElement( 'p', null );
                $htmlOut .= wfMsg( 'centralnotice-banner-display' );
                if ( $wgRequest->wasPosted() ) {
-                       $displayAnon = $wgRequest->getCheck( 'displayAnon' ); 
// Restore checkbox state in event of error
+                       // Restore checkbox state in event of error
+                       $displayAnon = $wgRequest->getCheck( 'displayAnon' ); 
                } else {
-                       $displayAnon = true; // Default is checked
+                       // Default is checked
+                       $displayAnon = true; 
                }
                $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 
'id' => 'displayAnon' ) );
                $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' 
), 'displayAnon' );
                if ( $wgRequest->wasPosted() ) {
-                       $displayAccount = $wgRequest->getCheck( 
'displayAccount' ); // Restore checkbox state in event of error
+                       // Restore checkbox state in event of error
+                       $displayAccount = $wgRequest->getCheck( 
'displayAccount' );
                } else {
-                       $displayAccount = true; // Default is checked
+                       // Default is checked
+                       $displayAccount = true; 
                }
-               $htmlOut .= Xml::check( 'displayAccount', $displayAccount, 
array( 'id' => 'displayAccount' ) );
+               $htmlOut .= Xml::check( 'displayAccount', $displayAccount, 
+                       array( 'id' => 'displayAccount' ) );
                $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' 
), 'displayAccount' );
                $htmlOut .= Xml::closeElement( 'p' );
                
                $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
                $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
                $buttons = array();
-               $buttons[] = '<a href="#" 
onclick="insertButton(\'close\');return false;">' . wfMsg( 
'centralnotice-close-button' ) . '</a>';
-               $buttons[] = '<a href="#" 
onclick="insertButton(\'hide\');return false;">' . wfMsg( 
'centralnotice-hide-button' ) . '</a>';
-               $buttons[] = '<a href="#" 
onclick="insertButton(\'translate\');return false;">' . wfMsg( 
'centralnotice-translate-button' ) . '</a>';
+               $buttons[] = '<a href="#" 
onclick="insertButton(\'close\');return false;">' . 
+                       wfMsg( 'centralnotice-close-button' ) . '</a>';
+               $buttons[] = '<a href="#" 
onclick="insertButton(\'hide\');return false;">' . 
+                       wfMsg( 'centralnotice-hide-button' ) . '</a>';
+               $buttons[] = '<a href="#" 
onclick="insertButton(\'translate\');return false;">' . 
+                       wfMsg( 'centralnotice-translate-button' ) . '</a>';
                $htmlOut .= Xml::tags( 'div',
                        array( 'style' => 'margin-bottom: 0.2em;' ),
-                       '<img src="'.$scriptPath.'/down-arrow.png" 
style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-insert', 
$wgLang->commaList( $buttons ) )
+                       '<img src="'.$scriptPath.'/down-arrow.png" 
style="vertical-align:baseline;"/>' . 
+                               wfMsg( 'centralnotice-insert', 
$wgLang->commaList( $buttons ) )
                );
                
                // Restore banner body state in the event of an error on form 
submit
@@ -319,14 +335,16 @@
                        // Begin View Banner fieldset
                        $htmlOut .= Xml::openElement( 'fieldset', array( 
'class' => 'prefsection' ) );
                        
-                       $htmlOut .= Xml::element( 'h2', null, wfMsg( 
'centralnotice-banner-heading', $currentTemplate ) );
+                       $htmlOut .= Xml::element( 'h2', null, 
+                               wfMsg( 'centralnotice-banner-heading', 
$currentTemplate ) );
        
                        // Show preview of banner
                        $render = new SpecialBannerLoader();
                        $render->siteName = 'Wikipedia';
                        $render->language = $wpUserLang;
                        if ( $render->language != '' ) {
-                               $htmlOut .= Xml::fieldset( wfMsg( 
'centralnotice-preview' ) . " ($render->language)",
+                               $htmlOut .= Xml::fieldset( 
+                                       wfMsg( 'centralnotice-preview' ) . " 
($render->language)",
                                        $render->getHtmlNotice( 
$wgRequest->getText( 'template' ) )
                                );
                        } else {
@@ -336,7 +354,8 @@
                        }
        
                        // Pull banner text and respect any inc: markup
-                       $bodyPage = Title::newFromText( 
"Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
+                       $bodyPage = Title::newFromText( 
+                               "Centralnotice-template-{$currentTemplate}", 
NS_MEDIAWIKI );
                        $curRev = Revision::newFromTitle( $bodyPage );
                        $body = $curRev ? $curRev->getText() : '';
        
@@ -363,22 +382,29 @@
                                );
        
                                // Table headers
-                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '15%' ), wfMsg( 'centralnotice-message' ) );
-                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '5%' ), wfMsg ( 'centralnotice-number-uses' )  );
-                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '40%' ), wfMsg ( 'centralnotice-english' ) );
+                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '15%' ), 
+                                       wfMsg( 'centralnotice-message' ) );
+                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '5%' ), 
+                                       wfMsg ( 'centralnotice-number-uses' )  
);
+                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '40%' ), 
+                                       wfMsg ( 'centralnotice-english' ) );
                                $languages = Language::getLanguageNames();
-                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '40%' ), $languages[$wpUserLang] );
+                               $htmlOut .= Xml::element( 'th', array( 'width' 
=> '40%' ), 
+                                       $languages[$wpUserLang] );
        
                                // Remove duplicate message fields
                                $filteredFields = array();
                                foreach ( $fields[1] as $field ) {
-                                       $filteredFields[$field] = 
array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 : 1;
+                                       $filteredFields[$field] = 
array_key_exists( $field, $filteredFields ) 
+                                               ? $filteredFields[$field] + 1 : 
1;
                                }
        
                                // Table rows
                                foreach ( $filteredFields as $field => $count ) 
{
                                        // Message
-                                       $message = ( $wpUserLang == 'en' ) ? 
"Centralnotice-{$currentTemplate}-{$field}" : 
"Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
+                                       $message = ( $wpUserLang == 'en' ) 
+                                               ? 
"Centralnotice-{$currentTemplate}-{$field}" 
+                                               : 
"Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
                
                                        // English value
                                        $htmlOut .= Xml::openElement( 'tr' );
@@ -393,7 +419,11 @@
                                        // English text
                                        $englishText = wfMsg( 
'centralnotice-message-not-set' );
                                        $englishTextExists = false;
-                                       if ( Title::newFromText( 
"Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI )->exists() ) {
+                                       if ( 
+                                               Title::newFromText( 
+                                                       
"Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI 
+                                               )->exists() ) 
+                                       {
                                                $englishText = wfMsgExt( 
"Centralnotice-{$currentTemplate}-{$field}",
                                                        array( 'language' => 
'en' )
                                                );
@@ -401,7 +431,10 @@
                                        }
                                        $htmlOut .= Xml::tags( 'td', null,
                                                Xml::element( 'span',
-                                                       array( 'style' => 
'font-style:italic;' . ( !$englishTextExists ? 'color:silver' : '' ) ),
+                                                       array( 
+                                                               'style' => 
'font-style:italic;' . 
+                                                                       ( 
!$englishTextExists ? 'color:silver' : '' ) 
+                                                       ),
                                                        $englishText
                                                )
                                        );
@@ -416,9 +449,13 @@
                                                $foreignTextExists = true;
                                        }
                                        $htmlOut .= Xml::tags( 'td', null,
-                                               Xml::input( 
"updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", '', $foreignText,
+                                               Xml::input( 
+                                                       
"updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", 
+                                                       '', 
+                                                       $foreignText,
                                                        wfArrayMerge( $readonly,
-                                                               array( 'style' 
=> 'width:100%;' . ( !$foreignTextExists ? 'color:red' : '' ) ) )
+                                                               array( 'style' 
=> 'width:100%;' . 
+                                                                       ( 
!$foreignTextExists ? 'color:red' : '' ) ) )
                                                )
                                        );
                                        $htmlOut .= Xml::closeElement( 'tr' );
@@ -430,7 +467,10 @@
                                        $htmlOut .= Xml::hidden( 'authtoken', 
$wgUser->editToken() );
                                        $htmlOut .= Xml::tags( 'div', 
                                                array( 'class' => 'cn-buttons' 
), 
-                                               Xml::submitButton( wfMsg( 
'centralnotice-modify' ), array( 'name' => 'update' ) ) 
+                                               Xml::submitButton( 
+                                                       wfMsg( 
'centralnotice-modify' ), 
+                                                       array( 'name' => 
'update' ) 
+                                               ) 
                                        );
                                }
                                
@@ -457,7 +497,12 @@
                                );
                                $htmlOut .= Xml::tags( 'tr', null,
                                        Xml::tags( 'td', null, '' ) .
-                                       Xml::tags( 'td', null, 
$sk->makeLinkObj( $newPage, wfMsgHtml( 
'centralnotice-preview-all-template-translations' ), 
"template=$currentTemplate&wpUserLanguage=all" ) )
+                                       Xml::tags( 'td', null, 
+                                               $sk->makeLinkObj( 
+                                                       $newPage, 
+                                                       wfMsgHtml( 
'centralnotice-preview-all-template-translations' ), 
+                                                       
"template=$currentTemplate&wpUserLanguage=all" ) 
+                                               )
                                );
                                $htmlOut .= Xml::closeElement( 'table' );
                                $htmlOut .= Xml::hidden( 'authtoken', 
$wgUser->editToken() );
@@ -467,7 +512,12 @@
        
                        // Show edit form
                        if ( $this->editable ) {
-                               $htmlOut .= Xml::openElement( 'form', array( 
'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
+                               $htmlOut .= Xml::openElement( 'form', 
+                                       array( 
+                                               'method' => 'post', 
+                                               'onsubmit' => 'return 
validateBannerForm(this)' 
+                                       ) 
+                               );
                                $htmlOut .= Xml::hidden( 'wpMethod', 
'editTemplate' );
                        }
                        
@@ -485,9 +535,11 @@
                        $htmlOut .= Xml::fieldset( wfMsg( 
'centralnotice-settings' ) );
                        $htmlOut .= Xml::openElement( 'p', null );
                        $htmlOut .= wfMsg( 'centralnotice-banner-display' );
-                       $htmlOut .= Xml::check( 'displayAnon', $displayAnon, 
wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
+                       $htmlOut .= Xml::check( 'displayAnon', $displayAnon, 
+                               wfArrayMerge( $disabled, array( 'id' => 
'displayAnon' ) ) );
                        $htmlOut .= Xml::label( wfMsg( 
'centralnotice-banner-anonymous' ), 'displayAnon' );
-                       $htmlOut .= Xml::check( 'displayAccount', 
$displayAccount, wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
+                       $htmlOut .= Xml::check( 'displayAccount', 
$displayAccount, 
+                               wfArrayMerge( $disabled, array( 'id' => 
'displayAccount' ) ) );
                        $htmlOut .= Xml::label( wfMsg( 
'centralnotice-banner-logged-in' ), 'displayAccount' );
                        $htmlOut .= Xml::closeElement( 'p' );
                        $htmlOut .= Xml::closeElement( 'fieldset' );
@@ -495,12 +547,17 @@
                                $htmlOut .= Xml::fieldset( wfMsg( 
'centralnotice-edit-template' ) );
                                $htmlOut .= wfMsg( 
'centralnotice-edit-template-summary' );
                                $buttons = array();
-                               $buttons[] = '<a href="#" 
onclick="insertButton(\'close\');return false;">' . wfMsg( 
'centralnotice-close-button' ) . '</a>';
-                               $buttons[] = '<a href="#" 
onclick="insertButton(\'hide\');return false;">' . wfMsg( 
'centralnotice-hide-button' ) . '</a>';
-                               $buttons[] = '<a href="#" 
onclick="insertButton(\'translate\');return false;">' . wfMsg( 
'centralnotice-translate-button' ) . '</a>';
+                               $buttons[] = '<a href="#" 
onclick="insertButton(\'close\');return false;">' . 
+                                       wfMsg( 'centralnotice-close-button' ) . 
'</a>';
+                               $buttons[] = '<a href="#" 
onclick="insertButton(\'hide\');return false;">' . 
+                                       wfMsg( 'centralnotice-hide-button' ) . 
'</a>';
+                               $buttons[] = '<a href="#" 
onclick="insertButton(\'translate\');return false;">' . 
+                                       wfMsg( 'centralnotice-translate-button' 
) . '</a>';
                                $htmlOut .= Xml::tags( 'div',
                                        array( 'style' => 'margin-bottom: 
0.2em;' ),
-                                       '<img 
src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . 
wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
+                                       '<img src="' . $scriptPath . 
'/down-arrow.png" ' . 
+                                       'style="vertical-align:baseline;"/>' . 
+                                       wfMsg( 'centralnotice-insert', 
$wgLang->commaList( $buttons ) )
                                );
                        } else {
                                $htmlOut .= Xml::fieldset( wfMsg( 
'centralnotice-banner' ) );
@@ -508,8 +565,9 @@
                        $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 
20, $readonly );
                        $htmlOut .= Xml::closeElement( 'fieldset' );
                        if ( $this->editable ) {
-                               $htmlOut .= Xml::hidden( 'mainform', 'true' ); 
// Indicate which form was submitted
-                               $htmlOut .= Xml::hidden( 'authtoken', 
$wgUser->editToken() );
+                               // Indicate which form was submitted
+                               $htmlOut .= Html::hidden( 'mainform', 'true' );
+                               $htmlOut .= Html::hidden( 'authtoken', 
$wgUser->editToken() );
                                $htmlOut .= Xml::tags( 'div', 
                                        array( 'class' => 'cn-buttons' ), 
                                        Xml::submitButton( wfMsg( 
'centralnotice-save-banner' ) ) 
@@ -529,8 +587,12 @@
                                $htmlOut .= Xml::fieldset( wfMsg( 
'centralnotice-clone-notice' ) );
                                $htmlOut .= Xml::openElement( 'table', array( 
'cellpadding' => 9 ) );
                                $htmlOut .= Xml::openElement( 'tr' );
-                               $htmlOut .= Xml::inputLabel( wfMsg( 
'centralnotice-clone-name' ), 'newTemplate', 'newTemplate', '25' );
-                               $htmlOut .= Xml::submitButton( wfMsg( 
'centralnotice-clone' ), array ( 'id' => 'clone' ) );
+                               $htmlOut .= Xml::inputLabel( 
+                                       wfMsg( 'centralnotice-clone-name' ), 
+                                       'newTemplate', 'newTemplate', '25' );
+                               $htmlOut .= Xml::submitButton( 
+                                       wfMsg( 'centralnotice-clone' ), 
+                                       array ( 'id' => 'clone' ) );
                                $htmlOut .= Xml::hidden( 'oldTemplate', 
$currentTemplate );
        
                                $htmlOut .= Xml::closeElement( 'tr' );
@@ -783,8 +845,9 @@
                // Remove duplicates
                $filteredFields = array();
                foreach ( $fields[1] as $field ) {
-                       $filteredFields[$field] = array_key_exists( $field, 
$filteredFields ) ? $filteredFields[$field] + 1 :
-                       1;
+                       $filteredFields[$field] = array_key_exists( $field, 
$filteredFields ) 
+                               ? $filteredFields[$field] + 1 
+                               : 1;
                }
                return $filteredFields;
        }
@@ -807,7 +870,9 @@
                        // Iterate through all possible message fields
                        foreach ( $fields as $field => $count ) {
                                // Put all message fields together for a lookup
-                               $message = ( $lang == 'en' ) ? 
"Centralnotice-{$template}-{$field}" : 
"Centralnotice-{$template}-{$field}/{$lang}";
+                               $message = ( $lang == 'en' ) 
+                                       ? "Centralnotice-{$template}-{$field}" 
+                                       : 
"Centralnotice-{$template}-{$field}/{$lang}";
                                if ( Title::newFromText( $message,  
NS_MEDIAWIKI )->exists() ) {
                                        $translations[$lang][$field] = wfMsgExt(
                                                
"Centralnotice-{$template}-{$field}",
@@ -828,7 +893,8 @@
        public static function templateExists( $templateName ) {
                 $dbr = wfGetDB( DB_SLAVE );
                 $eTemplateName = htmlspecialchars( $templateName );
-                $row = $dbr->selectRow( 'cn_templates', 'tmp_name', array( 
'tmp_name' => $eTemplateName ) );
+                $row = $dbr->selectRow( 'cn_templates', 'tmp_name', 
+                        array( 'tmp_name' => $eTemplateName ) );
                 if ( $row ) {
                        return true;
                 } else {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to