r75908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75907‎ | r75908 | r75909 >
Date:05:25, 3 November 2010
Author:tstarling
Status:deferred
Tags:
Comment:
* Break long lines.
* In SpecialBannerController.php, use a type-specific end tag for heredoc-style strings, so that syntax is highlighted correctly.
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerAllocation.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerController.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerListLoader.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerLoader.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
@@ -72,7 +72,8 @@
7373
7474 if ( !$templates && $this->project == 'wikipedia' ) {
7575 // See if we have any preferred notices for this language wikipedia
76 - $notices = CentralNoticeDB::getNotices( 'wikipedia', $this->language, false, 1, 1, $this->location );
 76+ $notices = CentralNoticeDB::getNotices( 'wikipedia', $this->language,
 77+ false, 1, 1, $this->location );
7778
7879 if ( $notices ) {
7980 // Pull banners
@@ -82,7 +83,8 @@
8384
8485 // Didn't find any preferred matches so do an old style lookup
8586 if ( !$templates ) {
86 - $templates = CentralNotice::selectNoticeTemplates( $this->project, $this->language, $this->location );
 87+ $templates = CentralNotice::selectNoticeTemplates(
 88+ $this->project, $this->language, $this->location );
8789 }
8890
8991 return FormatJson::encode( $templates );
Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -123,19 +123,29 @@
124124 global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
125125
126126 if ( $wgDBtype == 'mysql' ) {
127 - $wgExtNewTables[] = array( 'cn_notices', $base . '/CentralNotice.sql' );
128 - $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
129 - $wgExtNewTables[] = array( 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' );
130 - $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
131 - $wgExtNewTables[] = array( 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' );
 127+ $wgExtNewTables[] = array( 'cn_notices',
 128+ $base . '/CentralNotice.sql' );
 129+ $wgExtNewFields[] = array( 'cn_notices', 'not_preferred',
 130+ $base . '/patches/patch-notice_preferred.sql' );
 131+ $wgExtNewTables[] = array( 'cn_notice_languages',
 132+ $base . '/patches/patch-notice_languages.sql' );
 133+ $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon',
 134+ $base . '/patches/patch-template_settings.sql' );
 135+ $wgExtNewTables[] = array( 'cn_notice_countries',
 136+ $base . '/patches/patch-notice_countries.sql' );
132137 }
133138 } else {
134139 if ( $updater->getDB()->getType() == 'mysql' ) {
135 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notices', $base . '/CentralNotice.sql' ) );
136 - $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' ) );
137 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' ) );
138 - $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' ) );
139 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' ) );
 140+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notices',
 141+ $base . '/CentralNotice.sql' ) );
 142+ $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred',
 143+ $base . '/patches/patch-notice_preferred.sql' ) );
 144+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages',
 145+ $base . '/patches/patch-notice_languages.sql' ) );
 146+ $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon',
 147+ $base . '/patches/patch-template_settings.sql' ) );
 148+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries',
 149+ $base . '/patches/patch-notice_countries.sql' ) );
140150 }
141151 }
142152 return true;
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -147,7 +147,8 @@
148148 if ( $noticeName == '' ) {
149149 $this->showError( 'centralnotice-null-string' );
150150 } else {
151 - $this->addNotice( $noticeName, '0', $start, $project_name, $project_languages, $geotargeted, $geo_countries );
 151+ $this->addNotice( $noticeName, '0', $start, $project_name,
 152+ $project_languages, $geotargeted, $geo_countries );
152153 }
153154 }
154155
@@ -418,7 +419,10 @@
419420
420421 // If campaign is currently active, set special class on table row.
421422 $attribs = array();
422 - if ( wfTimestamp() > wfTimestamp( TS_UNIX , $row->not_start ) && wfTimestamp() < wfTimestamp( TS_UNIX , $row->not_end ) && $row->not_enabled == '1' ) {
 423+ if ( wfTimestamp() > wfTimestamp( TS_UNIX , $row->not_start )
 424+ && wfTimestamp() < wfTimestamp( TS_UNIX , $row->not_end )
 425+ && $row->not_enabled == '1' )
 426+ {
423427 $attribs = array( 'class' => 'cn-active-campaign' );
424428 }
425429
@@ -481,7 +485,8 @@
482486 // Name
483487 $htmlOut .= Xml::openElement( 'tr' );
484488 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-notice-name' ) );
485 - $htmlOut .= Xml::tags( 'td', array(), Xml::input( 'noticeName', 25, $wgRequest->getVal( 'noticeName' ) ) );
 489+ $htmlOut .= Xml::tags( 'td', array(),
 490+ Xml::input( 'noticeName', 25, $wgRequest->getVal( 'noticeName' ) ) );
486491 $htmlOut .= Xml::closeElement( 'tr' );
487492 // Start Date
488493 $htmlOut .= Xml::openElement( 'tr' );
@@ -501,15 +506,21 @@
502507 // Languages
503508 $htmlOut .= Xml::openElement( 'tr' );
504509 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'yourlanguage' ) );
505 - $htmlOut .= Xml::tags( 'td', array(), $this->languageMultiSelector( $noticeLanguages ) );
 510+ $htmlOut .= Xml::tags( 'td', array(),
 511+ $this->languageMultiSelector( $noticeLanguages ) );
506512 $htmlOut .= Xml::closeElement( 'tr' );
507513 // Countries
508514 $htmlOut .= Xml::openElement( 'tr' );
509 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
510 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'geotargeted', false, wfArrayMerge( $readonly, array( 'value' => 1, 'id' => 'geotargeted' ) ) ) );
 515+ $htmlOut .= Xml::tags( 'td', array(),
 516+ Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
 517+ $htmlOut .= Xml::tags( 'td', array(),
 518+ Xml::check( 'geotargeted', false,
 519+ wfArrayMerge( $readonly, array( 'value' => 1, 'id' => 'geotargeted' ) ) ) );
511520 $htmlOut .= Xml::closeElement( 'tr' );
512 - $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
513 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'centralnotice-countries' ) );
 521+ $htmlOut .= Xml::openElement( 'tr',
 522+ array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
 523+ $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 524+ wfMsgHtml( 'centralnotice-countries' ) );
514525 $htmlOut .= Xml::tags( 'td', array(), $this->geoMultiSelector() );
515526 $htmlOut .= Xml::closeElement( 'tr' );
516527
@@ -651,7 +662,8 @@
652663
653664 // If there were no errors, reload the page to prevent duplicate form submission
654665 if ( !$this->centralNoticeError ) {
655 - $wgOut->redirect( $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" ) );
 666+ $wgOut->redirect( $this->getTitle()->getLocalUrl(
 667+ "method=listNoticeDetail&notice=$notice" ) );
656668 return;
657669 }
658670 } else {
@@ -669,7 +681,8 @@
670682 $htmlOut .= Xml::openElement( 'form',
671683 array(
672684 'method' => 'post',
673 - 'action' => $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" )
 685+ 'action' => $this->getTitle()->getLocalUrl(
 686+ "method=listNoticeDetail&notice=$notice" )
674687 )
675688 );
676689 }
@@ -820,41 +833,64 @@
821834 // Languages
822835 $htmlOut .= Xml::openElement( 'tr' );
823836 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'yourlanguage' ) );
824 - $htmlOut .= Xml::tags( 'td', array(), $this->languageMultiSelector( $noticeLanguages ) );
 837+ $htmlOut .= Xml::tags( 'td', array(),
 838+ $this->languageMultiSelector( $noticeLanguages ) );
825839 $htmlOut .= Xml::closeElement( 'tr' );
826840 // Countries
827841 $htmlOut .= Xml::openElement( 'tr' );
828 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
829 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'geotargeted', $isGeotargeted, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'geotargeted' ) ) ) );
 842+ $htmlOut .= Xml::tags( 'td', array(),
 843+ Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
 844+ $htmlOut .= Xml::tags( 'td', array(),
 845+ Xml::check( 'geotargeted', $isGeotargeted,
 846+ wfArrayMerge(
 847+ $readonly,
 848+ array( 'value' => $row->not_name, 'id' => 'geotargeted' ) ) ) );
830849 $htmlOut .= Xml::closeElement( 'tr' );
831850 if ( $isGeotargeted ) {
832851 $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector' ) );
833852 } else {
834 - $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
 853+ $htmlOut .= Xml::openElement( 'tr',
 854+ array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
835855 }
836 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'centralnotice-countries' ) );
 856+ $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 857+ wfMsgHtml( 'centralnotice-countries' ) );
837858 $htmlOut .= Xml::tags( 'td', array(), $this->geoMultiSelector( $countries ) );
838859 $htmlOut .= Xml::closeElement( 'tr' );
839860 // Enabled
840861 $htmlOut .= Xml::openElement( 'tr' );
841 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-enabled' ), 'enabled' ) );
842 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled', $isEnabled, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
 862+ $htmlOut .= Xml::tags( 'td', array(),
 863+ Xml::label( wfMsg( 'centralnotice-enabled' ), 'enabled' ) );
 864+ $htmlOut .= Xml::tags( 'td', array(),
 865+ Xml::check( 'enabled', $isEnabled,
 866+ wfArrayMerge( $readonly,
 867+ array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
843868 $htmlOut .= Xml::closeElement( 'tr' );
844869 // Preferred
845870 $htmlOut .= Xml::openElement( 'tr' );
846 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-preferred' ), 'preferred' ) );
847 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred', $isPreferred, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
 871+ $htmlOut .= Xml::tags( 'td', array(),
 872+ Xml::label( wfMsg( 'centralnotice-preferred' ), 'preferred' ) );
 873+ $htmlOut .= Xml::tags( 'td', array(),
 874+ Xml::check( 'preferred', $isPreferred,
 875+ wfArrayMerge( $readonly,
 876+ array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
848877 $htmlOut .= Xml::closeElement( 'tr' );
849878 // Locked
850879 $htmlOut .= Xml::openElement( 'tr' );
851 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-locked' ), 'locked' ) );
852 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked', $isLocked, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
 880+ $htmlOut .= Xml::tags( 'td', array(),
 881+ Xml::label( wfMsg( 'centralnotice-locked' ), 'locked' ) );
 882+ $htmlOut .= Xml::tags( 'td', array(),
 883+ Xml::check( 'locked', $isLocked,
 884+ wfArrayMerge( $readonly,
 885+ array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
853886 $htmlOut .= Xml::closeElement( 'tr' );
854887 if ( $this->editable ) {
855888 // Locked
856889 $htmlOut .= Xml::openElement( 'tr' );
857 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-remove' ), 'remove' ) );
858 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'remove', false, array( 'value' => $row->not_name, 'id' => 'remove' ) ) );
 890+ $htmlOut .= Xml::tags( 'td', array(),
 891+ Xml::label( wfMsg( 'centralnotice-remove' ), 'remove' ) );
 892+ $htmlOut .= Xml::tags( 'td', array(),
 893+ Xml::check( 'remove', false,
 894+ array( 'value' => $row->not_name, 'id' => 'remove' ) ) );
859895 $htmlOut .= Xml::closeElement( 'tr' );
860896 }
861897 $htmlOut .= Xml::closeElement( 'table' );
@@ -982,9 +1018,13 @@
9831019 $htmlOut = Xml::fieldset( wfMsg( "centralnotice-available-templates" ) );
9841020
9851021 // Show paginated list of banners
986 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 1022+ $htmlOut .= Xml::tags( 'div',
 1023+ array( 'class' => 'cn-pager' ),
 1024+ $pager->getNavigationBar() );
9871025 $htmlOut .= $pager->getBody();
988 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 1026+ $htmlOut .= Xml::tags( 'div',
 1027+ array( 'class' => 'cn-pager' ),
 1028+ $pager->getNavigationBar() );
9891029
9901030 $htmlOut .= Xml::closeElement( 'fieldset' );
9911031 } else {
@@ -1074,7 +1114,9 @@
10751115 return $templates;
10761116 }
10771117
1078 - function addNotice( $noticeName, $enabled, $start, $project_name, $project_languages, $geotargeted, $geo_countries ) {
 1118+ function addNotice( $noticeName, $enabled, $start, $project_name,
 1119+ $project_languages, $geotargeted, $geo_countries )
 1120+ {
10791121 if ( $this->noticeExists( $noticeName ) ) {
10801122 $this->showError( 'centralnotice-notice-exists' );
10811123 return;
@@ -1093,12 +1135,17 @@
10941136 $end['month'] = '10';
10951137 $end['year'] = $start['year'];
10961138 } else {
1097 - $end['month'] = ( substr( $start['month'], 0, 1 ) ) == 0 ? 0 . ( intval( $start['month'] ) + 1 ) : ( $start['month'] + 1 );
 1139+ $end['month'] =
 1140+ ( substr( $start['month'], 0, 1 ) ) == 0
 1141+ ? 0 . ( intval( $start['month'] ) + 1 )
 1142+ : ( $start['month'] + 1 );
10981143 $end['year'] = $start['year'];
10991144 }
11001145
1101 - $startTs = wfTimeStamp( TS_MW, "{$start['year']}:{$start['month']}:{$start['day']} {$start['hour']}:{$start['min']}:00" );
1102 - $endTs = wfTimeStamp( TS_MW, "{$end['year']}:{$end['month']}:{$start['day']} {$start['hour']}:{$start['min']}:00" );
 1146+ $startTs = wfTimeStamp( TS_MW, "{$start['year']}:{$start['month']}:{$start['day']} " .
 1147+ "{$start['hour']}:{$start['min']}:00" );
 1148+ $endTs = wfTimeStamp( TS_MW, "{$end['year']}:{$end['month']}:{$start['day']} " .
 1149+ "{$start['hour']}:{$start['min']}:00" );
11031150
11041151 $res = $dbw->insert( 'cn_notices',
11051152 array( 'not_name' => $noticeName,
@@ -1116,7 +1163,8 @@
11171164 foreach( $project_languages as $code ) {
11181165 $insertArray[] = array( 'nl_notice_id' => $not_id, 'nl_language' => $code );
11191166 }
1120 - $res = $dbw->insert( 'cn_notice_languages', $insertArray, __METHOD__, array( 'IGNORE' ) );
 1167+ $res = $dbw->insert( 'cn_notice_languages', $insertArray,
 1168+ __METHOD__, array( 'IGNORE' ) );
11211169
11221170 if ( $geotargeted ) {
11231171 // Do multi-row insert for campaign countries
@@ -1124,7 +1172,8 @@
11251173 foreach( $geo_countries as $code ) {
11261174 $insertArray[] = array( 'nc_notice_id' => $not_id, 'nc_country' => $code );
11271175 }
1128 - $res = $dbw->insert( 'cn_notice_countries', $insertArray, __METHOD__, array( 'IGNORE' ) );
 1176+ $res = $dbw->insert( 'cn_notice_countries', $insertArray,
 1177+ __METHOD__, array( 'IGNORE' ) );
11291178 }
11301179
11311180 $dbw->commit();
@@ -1207,7 +1256,8 @@
12081257 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
12091258 $languages = array();
12101259 if ( $row ) {
1211 - $res = $dbr->select( 'cn_notice_languages', 'nl_language', array( 'nl_notice_id' => $row->not_id ) );
 1260+ $res = $dbr->select( 'cn_notice_languages', 'nl_language',
 1261+ array( 'nl_notice_id' => $row->not_id ) );
12121262 foreach ( $res as $langRow ) {
12131263 $languages[] = $langRow->nl_language;
12141264 }
@@ -1221,7 +1271,8 @@
12221272 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
12231273 $countries = array();
12241274 if ( $row ) {
1225 - $res = $dbr->select( 'cn_notice_countries', 'nc_country', array( 'nc_notice_id' => $row->not_id ) );
 1275+ $res = $dbr->select( 'cn_notice_countries', 'nc_country',
 1276+ array( 'nc_notice_id' => $row->not_id ) );
12261277 foreach ( $res as $countryRow ) {
12271278 $countries[] = $countryRow->nc_country;
12281279 }
@@ -1384,7 +1435,8 @@
13851436 function languageMultiSelector( $selected = array(), $customisedOnly = true ) {
13861437 global $wgContLanguageCode, $wgExtensionAssetsPath, $wgLang;
13871438 $scriptPath = "$wgExtensionAssetsPath/CentralNotice";
1388 - // Make sure the site language is in the list; a custom language code might not have a defined name...
 1439+ // Make sure the site language is in the list; a custom language code
 1440+ // might not have a defined name...
13891441 $languages = Language::getLanguageNames( $customisedOnly );
13901442 if( !array_key_exists( $wgContLanguageCode, $languages ) ) {
13911443 $languages[$wgContLanguageCode] = $wgContLanguageCode;
@@ -1406,16 +1458,26 @@
14071459 $options
14081460 );
14091461 $buttons = array();
1410 - $buttons[] = '<a href="#" onclick="selectLanguages(true);return false;">' . wfMsg( 'powersearch-toggleall' ) . '</a>';
1411 - $buttons[] = '<a href="#" onclick="selectLanguages(false);return false;">' . wfMsg( 'powersearch-togglenone' ) . '</a>';
1412 - $buttons[] = '<a href="#" onclick="top10Languages();return false;">' . wfMsg( 'centralnotice-top-ten-languages' ) . '</a>';
 1462+ $buttons[] = '<a href="#" onclick="selectLanguages(true);return false;">' .
 1463+ wfMsg( 'powersearch-toggleall' ) . '</a>';
 1464+ $buttons[] = '<a href="#" onclick="selectLanguages(false);return false;">' .
 1465+ wfMsg( 'powersearch-togglenone' ) . '</a>';
 1466+ $buttons[] = '<a href="#" onclick="top10Languages();return false;">' .
 1467+ wfMsg( 'centralnotice-top-ten-languages' ) . '</a>';
14131468 $htmlOut .= Xml::tags( 'div',
14141469 array( 'style' => 'margin-top: 0.2em;' ),
1415 - '<img src="'.$scriptPath.'/up-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-select', $wgLang->commaList( $buttons ) )
 1470+ '<img src="'.$scriptPath.'/up-arrow.png" style="vertical-align:baseline;"/>' .
 1471+ wfMsg( 'centralnotice-select', $wgLang->commaList( $buttons ) )
14161472 );
14171473 } else {
14181474 $htmlOut .= Xml::tags( 'select',
1419 - array( 'multiple' => 'multiple', 'size' => 4, 'id' => 'project_languages[]', 'name' => 'project_languages[]', 'disabled' => 'disabled' ),
 1475+ array(
 1476+ 'multiple' => 'multiple',
 1477+ 'size' => 4,
 1478+ 'id' => 'project_languages[]',
 1479+ 'name' => 'project_languages[]',
 1480+ 'disabled' => 'disabled'
 1481+ ),
14201482 $options
14211483 );
14221484 }
@@ -1542,12 +1604,23 @@
15431605 $htmlOut = '';
15441606 if ( $this->editable ) {
15451607 $htmlOut .= Xml::tags( 'select',
1546 - array( 'multiple' => 'multiple', 'size' => 5, 'id' => 'geo_countries[]', 'name' => 'geo_countries[]' ),
 1608+ array(
 1609+ 'multiple' => 'multiple',
 1610+ 'size' => 5,
 1611+ 'id' => 'geo_countries[]',
 1612+ 'name' => 'geo_countries[]'
 1613+ ),
15471614 $options
15481615 );
15491616 } else {
15501617 $htmlOut .= Xml::tags( 'select',
1551 - array( 'multiple' => 'multiple', 'size' => 5, 'id' => 'geo_countries[]', 'name' => 'geo_countries[]', 'disabled' => 'disabled' ),
 1618+ array(
 1619+ 'multiple' => 'multiple',
 1620+ 'size' => 5,
 1621+ 'id' => 'geo_countries[]',
 1622+ 'name' => 'geo_countries[]',
 1623+ 'disabled' => 'disabled'
 1624+ ),
15521625 $options
15531626 );
15541627 }
@@ -1578,7 +1651,8 @@
15791652 'join_conds' => array(
15801653 'cn_assignments' => array(
15811654 'LEFT JOIN',
1582 - "cn_assignments.tmp_id = cn_templates.tmp_id AND cn_assignments.not_id = $noticeId"
 1655+ "cn_assignments.tmp_id = cn_templates.tmp_id " .
 1656+ "AND cn_assignments.not_id = $noticeId"
15831657 )
15841658 )
15851659 );
@@ -1607,7 +1681,9 @@
16081682 // Weight select
16091683 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
16101684 Xml::listDropDown( "weight[$row->tmp_id]",
1611 - CentralNotice::dropDownList( wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 ) ) ,
 1685+ CentralNotice::dropDownList(
 1686+ wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 )
 1687+ ) ,
16121688 '',
16131689 '25',
16141690 '',
Index: trunk/extensions/CentralNotice/SpecialBannerLoader.php
@@ -53,7 +53,8 @@
5454
5555 /**
5656 * Generate the JS for the requested banner
57 - * @return a string of Javascript containing a call to insertBanner() with JSON containing the banner content as the parameter
 57+ * @return a string of Javascript containing a call to insertBanner()
 58+ * with JSON containing the banner content as the parameter
5859 */
5960 function getJsNotice( $bannerName ) {
6061 // Make sure the banner exists
@@ -165,16 +166,18 @@
166167 wfRestoreWarnings();
167168 if ( !$count ) {
168169 // Pull long-cached amount
169 - $count = intval( $wgMemc->get( wfMemcKey( 'centralnotice', 'counter', 'fallback' ) ) );
 170+ $count = intval( $wgMemc->get(
 171+ wfMemcKey( 'centralnotice', 'counter', 'fallback' ) ) );
170172 if ( !$count ) {
171173 // Return hard-coded amount if all else fails
172174 return 1100000; // Update as needed during fundraiser
173175 }
174176 }
175 - $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), $count, 60 ); // Expire in 60 seconds
176 - $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 'fallback' ), $count ); // No expiration
 177+ // Expire in 60 seconds
 178+ $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), $count, 60 );
 179+ // No expiration
 180+ $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 'fallback' ), $count );
177181 }
178182 return $count;
179183 }
180 -
181184 }
Index: trunk/extensions/CentralNotice/SpecialBannerController.php
@@ -43,7 +43,7 @@
4444 global $wgCentralPagePath;
4545
4646 $js = $this->getScriptFunctions() . $this->getToggleScripts();
47 - $js .= <<<EOT
 47+ $js .= <<<JAVASCRIPT
4848 ( function( $ ) {
4949 $.ajaxSetup({ cache: true });
5050 $.centralNotice = {
@@ -53,12 +53,18 @@
5454 'fn': {
5555 'loadBanner': function( bannerName ) {
5656 // Get the requested banner
57 - var bannerPageQuery = $.param( { 'banner': bannerName, 'userlang': wgUserLanguage, 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country } );
 57+ var bannerPageQuery = $.param( {
 58+ 'banner': bannerName, 'userlang': wgUserLanguage,
 59+ 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country } );
5860 var bannerPage = '?title=Special:BannerLoader&' + bannerPageQuery;
59 -EOT;
60 - $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"".Xml::escapeJsString( $wgCentralPagePath )."' + bannerPage + '\"></script>';\n";
61 - $js .= <<<EOT
62 - $( '#siteNotice' ).prepend( '<div id="centralNotice" class="' + ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) + '">'+bannerScript+'</div>' );
 61+JAVASCRIPT;
 62+ $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"" .
 63+ Xml::escapeJsString( $wgCentralPagePath ) .
 64+ "' + bannerPage + '\"></script>';\n";
 65+ $js .= <<<JAVASCRIPT
 66+ $( '#siteNotice' ).prepend( '<div id="centralNotice" class="' +
 67+ ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) +
 68+ '">'+bannerScript+'</div>' );
6369 },
6470 'loadBannerList': function( geoOverride ) {
6571 if ( geoOverride ) {
@@ -85,7 +91,9 @@
8692
8793 for( var i = 0; i < bannerList.length; i++ ) {
8894 // Only include this banner if it's inteded for the current user
89 - if( ( wgUserName && bannerList[i].display_account ) || ( !wgUserName && bannerList[i].display_anon == 1 ) ) {
 95+ if( ( wgUserName && bannerList[i].display_account ) ||
 96+ ( !wgUserName && bannerList[i].display_anon == 1 ) )
 97+ {
9098 // add the banner to our list once per weight
9199 for( var j=0; j < bannerList[i].weight; j++ ) {
92100 groomedBannerList.push( bannerList[i] );
@@ -98,7 +106,9 @@
99107
100108 // Load a random banner from our groomed list
101109 $.centralNotice.fn.loadBanner(
102 - groomedBannerList[ Math.floor( Math.random() * groomedBannerList.length ) ].name
 110+ groomedBannerList[
 111+ Math.floor( Math.random() * groomedBannerList.length )
 112+ ].name
103113 );
104114 },
105115 'getQueryStringVariables': function() {
@@ -123,19 +133,19 @@
124134 }
125135 } ); //document ready
126136 } )( jQuery );
127 -EOT;
 137+JAVASCRIPT;
128138 return $js;
129139
130140 }
131141
132142 function getToggleScripts() {
133 - $showStyle = <<<END
 143+ $showStyle = <<<HTML
134144 <style type="text/css">
135145 #centralNotice .siteNoticeSmall {display:none;}
136146 #centralNotice.collapsed .siteNoticeBig {display:none;}
137147 #centralNotice.collapsed .siteNoticeSmall {display:block;}
138148 </style>
139 -END;
 149+HTML;
140150 $encShowStyle = Xml::encodeJsVar( $showStyle );
141151
142152 $script = "
@@ -145,7 +155,7 @@
146156 }
147157
148158 function getScriptFunctions() {
149 - $script = "
 159+ $script = <<<JAVASCRIPT
150160 function insertBanner(bannerJson) {
151161 jQuery('div#centralNotice').prepend( bannerJson.banner );
152162 }
@@ -170,7 +180,9 @@
171181 e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week
172182 var work='hidesnmessage='+state+'; expires=' + e.toGMTString() + '; path=/';
173183 document.cookie = work;
174 -}\n\n";
 184+}
 185+
 186+JAVASCRIPT;
175187 return $script;
176188 }
177189
Index: trunk/extensions/CentralNotice/SpecialBannerAllocation.php
@@ -59,7 +59,9 @@
6060
6161 $htmlOut .= Xml::openElement( 'table', array ( 'id' => 'envpicker', 'cellpadding' => 7 ) );
6262 $htmlOut .= Xml::openElement( 'tr' );
63 - $htmlOut .= Xml::tags( 'td', array( 'style' => 'width: 20%;' ), wfMsg( 'centralnotice-project-name' ) );
 63+ $htmlOut .= Xml::tags( 'td',
 64+ array( 'style' => 'width: 20%;' ),
 65+ wfMsg( 'centralnotice-project-name' ) );
6466 $htmlOut .= Xml::openElement( 'td' );
6567 $htmlOut .= Xml::openElement( 'select', array( 'name' => 'project' ) );
6668 foreach ( $wgNoticeProjects as $value ) {
@@ -69,9 +71,12 @@
7072 $htmlOut .= Xml::closeElement( 'td' );
7173 $htmlOut .= Xml::closeElement( 'tr' );
7274 $htmlOut .= Xml::openElement( 'tr' );
73 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsg( 'centralnotice-project-language' ) );
 75+ $htmlOut .= Xml::tags( 'td',
 76+ array( 'valign' => 'top' ),
 77+ wfMsg( 'centralnotice-project-language' ) );
7478 $htmlOut .= Xml::openElement( 'td' );
75 - // Make sure the site language is in the list; a custom language code might not have a defined name...
 79+ // Make sure the site language is in the list; a custom language code
 80+ // might not have a defined name...
7681 $languages = Language::getLanguageNames( true );
7782 if( !array_key_exists( $wgLanguageCode, $languages ) ) {
7883 $languages[$wgLanguageCode] = $wgLanguageCode;
@@ -79,7 +84,9 @@
8085 ksort( $languages );
8186 $htmlOut .= Xml::openElement( 'select', array( 'name' => 'language' ) );
8287 foreach( $languages as $code => $name ) {
83 - $htmlOut .= Xml::option( wfMsg( 'centralnotice-language-listing', $code, $name ), $code, $code === $this->language );
 88+ $htmlOut .= Xml::option(
 89+ wfMsg( 'centralnotice-language-listing', $code, $name ),
 90+ $code, $code === $this->language );
8491 }
8592 $htmlOut .= Xml::closeElement( 'select' );
8693 $htmlOut .= Xml::closeElement( 'td' );
@@ -153,10 +160,13 @@
154161 $totalWeight += $banner['weight'];
155162 }
156163 if ( $banners ) {
157 - $htmlOut .= Xml::openElement( 'table', array ( 'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
 164+ $htmlOut .= Xml::openElement( 'table',
 165+ array ( 'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
158166 $htmlOut .= Xml::openElement( 'tr' );
159 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-percentage' ) );
160 - $htmlOut .= Xml::element( 'th', array( 'width' => '60%' ), wfMsg ( 'centralnotice-banner' ) );
 167+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 168+ wfMsg ( 'centralnotice-percentage' ) );
 169+ $htmlOut .= Xml::element( 'th', array( 'width' => '60%' ),
 170+ wfMsg ( 'centralnotice-banner' ) );
161171 $htmlOut .= Xml::closeElement( 'tr' );
162172 foreach ( $banners as $banner ) {
163173 $htmlOut .= Xml::openElement( 'tr' );
@@ -165,7 +175,8 @@
166176 $htmlOut .= wfMsg ( 'percent', $wgLang->formatNum( $percentage ) );
167177 $htmlOut .= Xml::closeElement( 'td' );
168178 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
169 - $sk->makeLinkObj( $viewPage, htmlspecialchars( $banner['name'] ), 'template=' . urlencode( $banner['name'] ) )
 179+ $sk->makeLinkObj( $viewPage, htmlspecialchars( $banner['name'] ),
 180+ 'template=' . urlencode( $banner['name'] ) )
170181 );
171182 $htmlOut .= Xml::closeElement( 'tr' );
172183 }
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -146,7 +146,8 @@
147147 $newTemplate = $wgRequest->getVal( 'newTemplate' );
148148 // We use the returned name in case any special characters had to be removed
149149 $template = $this->cloneTemplate( $oldTemplate, $newTemplate );
150 - $wgOut->redirect( $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) );
 150+ $wgOut->redirect(
 151+ $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) );
151152 return;
152153
153154 } else {
@@ -188,9 +189,11 @@
189190 $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-manage-templates' ) );
190191
191192 // Show paginated list of banners
192 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 193+ $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ),
 194+ $pager->getNavigationBar() );
193195 $htmlOut .= $pager->getBody();
194 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 196+ $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ),
 197+ $pager->getNavigationBar() );
195198
196199 if ( $this->editable ) {
197200 $htmlOut .= Xml::closeElement( 'form' );
@@ -219,40 +222,53 @@
220223 // Build HTML
221224 $htmlOut = '';
222225 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
223 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
 226+ $htmlOut .= Xml::openElement( 'form',
 227+ array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
224228 $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) );
225229 $htmlOut .= Html::hidden( 'wpMethod', 'addTemplate' );
226230 $htmlOut .= Xml::tags( 'p', null,
227 - Xml::inputLabel( wfMsg( 'centralnotice-banner-name' ), 'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' ) )
 231+ Xml::inputLabel(
 232+ wfMsg( 'centralnotice-banner-name' ),
 233+ 'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' )
 234+ )
228235 );
229236
230237 $htmlOut .= Xml::openElement( 'p', null );
231238 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
232239 if ( $wgRequest->wasPosted() ) {
233 - $displayAnon = $wgRequest->getCheck( 'displayAnon' ); // Restore checkbox state in event of error
 240+ // Restore checkbox state in event of error
 241+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
234242 } else {
235 - $displayAnon = true; // Default is checked
 243+ // Default is checked
 244+ $displayAnon = true;
236245 }
237246 $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) );
238247 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
239248 if ( $wgRequest->wasPosted() ) {
240 - $displayAccount = $wgRequest->getCheck( 'displayAccount' ); // Restore checkbox state in event of error
 249+ // Restore checkbox state in event of error
 250+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
241251 } else {
242 - $displayAccount = true; // Default is checked
 252+ // Default is checked
 253+ $displayAccount = true;
243254 }
244 - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, array( 'id' => 'displayAccount' ) );
 255+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
 256+ array( 'id' => 'displayAccount' ) );
245257 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
246258 $htmlOut .= Xml::closeElement( 'p' );
247259
248260 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
249261 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
250262 $buttons = array();
251 - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . wfMsg( 'centralnotice-close-button' ) . '</a>';
252 - $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' . wfMsg( 'centralnotice-hide-button' ) . '</a>';
253 - $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' . wfMsg( 'centralnotice-translate-button' ) . '</a>';
 263+ $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' .
 264+ wfMsg( 'centralnotice-close-button' ) . '</a>';
 265+ $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' .
 266+ wfMsg( 'centralnotice-hide-button' ) . '</a>';
 267+ $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' .
 268+ wfMsg( 'centralnotice-translate-button' ) . '</a>';
254269 $htmlOut .= Xml::tags( 'div',
255270 array( 'style' => 'margin-bottom: 0.2em;' ),
256 - '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
 271+ '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' .
 272+ wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
257273 );
258274
259275 // Restore banner body state in the event of an error on form submit
@@ -319,14 +335,16 @@
320336 // Begin View Banner fieldset
321337 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
322338
323 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner-heading', $currentTemplate ) );
 339+ $htmlOut .= Xml::element( 'h2', null,
 340+ wfMsg( 'centralnotice-banner-heading', $currentTemplate ) );
324341
325342 // Show preview of banner
326343 $render = new SpecialBannerLoader();
327344 $render->siteName = 'Wikipedia';
328345 $render->language = $wpUserLang;
329346 if ( $render->language != '' ) {
330 - $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-preview' ) . " ($render->language)",
 347+ $htmlOut .= Xml::fieldset(
 348+ wfMsg( 'centralnotice-preview' ) . " ($render->language)",
331349 $render->getHtmlNotice( $wgRequest->getText( 'template' ) )
332350 );
333351 } else {
@@ -336,7 +354,8 @@
337355 }
338356
339357 // Pull banner text and respect any inc: markup
340 - $bodyPage = Title::newFromText( "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
 358+ $bodyPage = Title::newFromText(
 359+ "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
341360 $curRev = Revision::newFromTitle( $bodyPage );
342361 $body = $curRev ? $curRev->getText() : '';
343362
@@ -363,22 +382,29 @@
364383 );
365384
366385 // Table headers
367 - $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ), wfMsg( 'centralnotice-message' ) );
368 - $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ), wfMsg ( 'centralnotice-number-uses' ) );
369 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-english' ) );
 386+ $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ),
 387+ wfMsg( 'centralnotice-message' ) );
 388+ $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ),
 389+ wfMsg ( 'centralnotice-number-uses' ) );
 390+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 391+ wfMsg ( 'centralnotice-english' ) );
370392 $languages = Language::getLanguageNames();
371 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), $languages[$wpUserLang] );
 393+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 394+ $languages[$wpUserLang] );
372395
373396 // Remove duplicate message fields
374397 $filteredFields = array();
375398 foreach ( $fields[1] as $field ) {
376 - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 : 1;
 399+ $filteredFields[$field] = array_key_exists( $field, $filteredFields )
 400+ ? $filteredFields[$field] + 1 : 1;
377401 }
378402
379403 // Table rows
380404 foreach ( $filteredFields as $field => $count ) {
381405 // Message
382 - $message = ( $wpUserLang == 'en' ) ? "Centralnotice-{$currentTemplate}-{$field}" : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
 406+ $message = ( $wpUserLang == 'en' )
 407+ ? "Centralnotice-{$currentTemplate}-{$field}"
 408+ : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
383409
384410 // English value
385411 $htmlOut .= Xml::openElement( 'tr' );
@@ -393,7 +419,11 @@
394420 // English text
395421 $englishText = wfMsg( 'centralnotice-message-not-set' );
396422 $englishTextExists = false;
397 - if ( Title::newFromText( "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI )->exists() ) {
 423+ if (
 424+ Title::newFromText(
 425+ "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI
 426+ )->exists() )
 427+ {
398428 $englishText = wfMsgExt( "Centralnotice-{$currentTemplate}-{$field}",
399429 array( 'language' => 'en' )
400430 );
@@ -401,7 +431,10 @@
402432 }
403433 $htmlOut .= Xml::tags( 'td', null,
404434 Xml::element( 'span',
405 - array( 'style' => 'font-style:italic;' . ( !$englishTextExists ? 'color:silver' : '' ) ),
 435+ array(
 436+ 'style' => 'font-style:italic;' .
 437+ ( !$englishTextExists ? 'color:silver' : '' )
 438+ ),
406439 $englishText
407440 )
408441 );
@@ -416,9 +449,13 @@
417450 $foreignTextExists = true;
418451 }
419452 $htmlOut .= Xml::tags( 'td', null,
420 - Xml::input( "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", '', $foreignText,
 453+ Xml::input(
 454+ "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]",
 455+ '',
 456+ $foreignText,
421457 wfArrayMerge( $readonly,
422 - array( 'style' => 'width:100%;' . ( !$foreignTextExists ? 'color:red' : '' ) ) )
 458+ array( 'style' => 'width:100%;' .
 459+ ( !$foreignTextExists ? 'color:red' : '' ) ) )
423460 )
424461 );
425462 $htmlOut .= Xml::closeElement( 'tr' );
@@ -430,7 +467,10 @@
431468 $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
432469 $htmlOut .= Xml::tags( 'div',
433470 array( 'class' => 'cn-buttons' ),
434 - Xml::submitButton( wfMsg( 'centralnotice-modify' ), array( 'name' => 'update' ) )
 471+ Xml::submitButton(
 472+ wfMsg( 'centralnotice-modify' ),
 473+ array( 'name' => 'update' )
 474+ )
435475 );
436476 }
437477
@@ -457,7 +497,12 @@
458498 );
459499 $htmlOut .= Xml::tags( 'tr', null,
460500 Xml::tags( 'td', null, '' ) .
461 - Xml::tags( 'td', null, $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-preview-all-template-translations' ), "template=$currentTemplate&wpUserLanguage=all" ) )
 501+ Xml::tags( 'td', null,
 502+ $sk->makeLinkObj(
 503+ $newPage,
 504+ wfMsgHtml( 'centralnotice-preview-all-template-translations' ),
 505+ "template=$currentTemplate&wpUserLanguage=all" )
 506+ )
462507 );
463508 $htmlOut .= Xml::closeElement( 'table' );
464509 $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
@@ -467,7 +512,12 @@
468513
469514 // Show edit form
470515 if ( $this->editable ) {
471 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
 516+ $htmlOut .= Xml::openElement( 'form',
 517+ array(
 518+ 'method' => 'post',
 519+ 'onsubmit' => 'return validateBannerForm(this)'
 520+ )
 521+ );
472522 $htmlOut .= Html::hidden( 'wpMethod', 'editTemplate' );
473523 }
474524
@@ -485,9 +535,11 @@
486536 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) );
487537 $htmlOut .= Xml::openElement( 'p', null );
488538 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
489 - $htmlOut .= Xml::check( 'displayAnon', $displayAnon, wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
 539+ $htmlOut .= Xml::check( 'displayAnon', $displayAnon,
 540+ wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
490541 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
491 - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
 542+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
 543+ wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
492544 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
493545 $htmlOut .= Xml::closeElement( 'p' );
494546 $htmlOut .= Xml::closeElement( 'fieldset' );
@@ -495,12 +547,17 @@
496548 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-edit-template' ) );
497549 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
498550 $buttons = array();
499 - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . wfMsg( 'centralnotice-close-button' ) . '</a>';
500 - $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' . wfMsg( 'centralnotice-hide-button' ) . '</a>';
501 - $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' . wfMsg( 'centralnotice-translate-button' ) . '</a>';
 551+ $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' .
 552+ wfMsg( 'centralnotice-close-button' ) . '</a>';
 553+ $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' .
 554+ wfMsg( 'centralnotice-hide-button' ) . '</a>';
 555+ $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' .
 556+ wfMsg( 'centralnotice-translate-button' ) . '</a>';
502557 $htmlOut .= Xml::tags( 'div',
503558 array( 'style' => 'margin-bottom: 0.2em;' ),
504 - '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
 559+ '<img src="' . $scriptPath . '/down-arrow.png" ' .
 560+ 'style="vertical-align:baseline;"/>' .
 561+ wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
505562 );
506563 } else {
507564 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
@@ -508,7 +565,8 @@
509566 $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20, $readonly );
510567 $htmlOut .= Xml::closeElement( 'fieldset' );
511568 if ( $this->editable ) {
512 - $htmlOut .= Html::hidden( 'mainform', 'true' ); // Indicate which form was submitted
 569+ // Indicate which form was submitted
 570+ $htmlOut .= Html::hidden( 'mainform', 'true' );
513571 $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
514572 $htmlOut .= Xml::tags( 'div',
515573 array( 'class' => 'cn-buttons' ),
@@ -529,8 +587,12 @@
530588 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-clone-notice' ) );
531589 $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) );
532590 $htmlOut .= Xml::openElement( 'tr' );
533 - $htmlOut .= Xml::inputLabel( wfMsg( 'centralnotice-clone-name' ), 'newTemplate', 'newTemplate', '25' );
534 - $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-clone' ), array ( 'id' => 'clone' ) );
 591+ $htmlOut .= Xml::inputLabel(
 592+ wfMsg( 'centralnotice-clone-name' ),
 593+ 'newTemplate', 'newTemplate', '25' );
 594+ $htmlOut .= Xml::submitButton(
 595+ wfMsg( 'centralnotice-clone' ),
 596+ array ( 'id' => 'clone' ) );
535597 $htmlOut .= Html::hidden( 'oldTemplate', $currentTemplate );
536598
537599 $htmlOut .= Xml::closeElement( 'tr' );
@@ -776,8 +838,9 @@
777839 // Remove duplicates
778840 $filteredFields = array();
779841 foreach ( $fields[1] as $field ) {
780 - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 :
781 - 1;
 842+ $filteredFields[$field] = array_key_exists( $field, $filteredFields )
 843+ ? $filteredFields[$field] + 1
 844+ : 1;
782845 }
783846 return $filteredFields;
784847 }
@@ -800,7 +863,9 @@
801864 // Iterate through all possible message fields
802865 foreach ( $fields as $field => $count ) {
803866 // Put all message fields together for a lookup
804 - $message = ( $lang == 'en' ) ? "Centralnotice-{$template}-{$field}" : "Centralnotice-{$template}-{$field}/{$lang}";
 867+ $message = ( $lang == 'en' )
 868+ ? "Centralnotice-{$template}-{$field}"
 869+ : "Centralnotice-{$template}-{$field}/{$lang}";
805870 if ( Title::newFromText( $message, NS_MEDIAWIKI )->exists() ) {
806871 $translations[$lang][$field] = wfMsgExt(
807872 "Centralnotice-{$template}-{$field}",
@@ -821,7 +886,8 @@
822887 public static function templateExists( $templateName ) {
823888 $dbr = wfGetDB( DB_SLAVE );
824889 $eTemplateName = htmlspecialchars( $templateName );
825 - $row = $dbr->selectRow( 'cn_templates', 'tmp_name', array( 'tmp_name' => $eTemplateName ) );
 890+ $row = $dbr->selectRow( 'cn_templates', 'tmp_name',
 891+ array( 'tmp_name' => $eTemplateName ) );
826892 if ( $row ) {
827893 return true;
828894 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r76143Picking up large changeset from r75908tomasz21:20, 5 November 2010

Status & tagging log