r108677 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108676‎ | r108677 | r108678 >
Date:20:44, 11 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* Use wfMessage() instead of wfMsg*()
* Removed usage of wfEmptyMsg()
* Some other misc fixes
Modified paths:
  • /trunk/extensions/Configure/Configure.diff.php (modified) (history)
  • /trunk/extensions/Configure/pager/PagerFiles.php (modified) (history)
  • /trunk/extensions/Configure/specials/ConfigurationPage.php (modified) (history)
  • /trunk/extensions/Configure/specials/SpecialViewConfig.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/pager/PagerFiles.php
@@ -27,7 +27,7 @@
2828 function getBody() {
2929 $versions = $this->mHandler->getArchiveVersions( $this->getVersionOptions() );
3030 if ( empty( $versions ) ) {
31 - return wfMsgExt( 'configure-no-old', array( 'parse' ) );
 31+ return wfMessage( 'configure-no-old' )->parseAsBlock();
3232 }
3333
3434 $text = "<ul>\n";
Index: trunk/extensions/Configure/specials/SpecialViewConfig.php
@@ -84,7 +84,7 @@
8585 * Build links to old version of the configuration
8686 */
8787 protected function buildOldVersionSelect() {
88 - global $wgConf, $wgLang, $wgUser, $wgRequest, $wgScript;
 88+ global $wgConf, $wgUser, $wgRequest, $wgScript;
8989
9090 $self = $this->getTitle();
9191 $pager = $wgConf->getPager();
@@ -104,7 +104,7 @@
105105 'allowedExtensionsAll' => $wgUser->isAllowed( 'extensions-interwiki' ),
106106 'self' => $self,
107107 'skin' => $wgUser->getSkin(),
108 - 'editMsg' => wfMsg( 'edit' ) . wfMsg( 'colon-separator' ),
 108+ 'editMsg' => wfMessage( 'edit' )->text() . wfMessage( 'colon-separator' )->text(),
109109 );
110110
111111 if ( $formatConf['allowedConfig'] )
@@ -115,7 +115,7 @@
116116
117117 $this->formatConf = $formatConf;
118118
119 - $text = wfMsgExt( 'configure-old-versions', array( 'parse' ) );
 119+ $text = wfMessage( 'configure-old-versions' )->parseAsBlock();
120120 if( $this->isUserAllowedInterwiki() )
121121 $text .= $this->getWikiSelectForm();
122122 $text .= $pager->getNavigationBar();
@@ -141,7 +141,7 @@
142142 $hasSelf = in_array( $this->mWiki, $wikis );
143143
144144 extract( $this->formatConf );
145 - $datime = $wgLang->timeAndDate( $ts );
 145+ $datime = $wgLang->timeanddate( $ts );
146146 $date = $wgLang->date( $ts );
147147 $time = $wgLang->time( $ts );
148148
@@ -165,14 +165,14 @@
166166 $actions = array();
167167 $view = '';
168168 if ( $hasSelf )
169 - $view .= $skin->makeKnownLinkObj( $self, wfMsgHtml( 'configure-view' ), "version=$ts" );
 169+ $view .= $skin->linkKnown( $self, wfMessage( 'configure-view' )->escaped(), array(), array( 'version' => $ts ) );
170170 elseif( $allowedAll )
171 - $view .= wfMsgHtml( 'configure-view' );
 171+ $view .= wfMessage( 'configure-view' )->escaped();
172172
173173 if ( $allowedAll ) {
174174 $viewWikis = array();
175175 foreach ( $wikis as $wiki ) {
176 - $viewWikis[] = $skin->makeKnownLinkObj( $self, htmlspecialchars( $wiki ), "version={$ts}&wiki={$wiki}" );
 176+ $viewWikis[] = $skin->linkKnown( $self, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
177177 }
178178 $view .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
179179 }
@@ -183,16 +183,16 @@
184184 $editDone = false;
185185 if ( $allowedConfig ) {
186186 if ( $hasSelf )
187 - $editCore = $editMsg . $skin->makeKnownLinkObj( $configTitle, wfMsgHtml( 'configure-edit-core' ), "version=$ts" );
 187+ $editCore = $editMsg . $skin->linkKnown( $configTitle, wfMessage( 'configure-edit-core' )->escaped(), array(), array( 'version' => $ts ) );
188188 elseif( $allowedConfigAll )
189 - $editCore = $editMsg . wfMsgHtml( 'configure-edit-core' );
 189+ $editCore = $editMsg . wfMessage( 'configure-edit-core' )->escaped();
190190 else
191191 $editCore = $editMsg;
192192
193193 if ( $allowedConfigAll ) {
194194 $viewWikis = array();
195195 foreach ( $wikis as $wiki ) {
196 - $viewWikis[] = $skin->makeKnownLinkObj( $configTitle, htmlspecialchars( $wiki ), "version={$ts}&wiki={$wiki}" );
 196+ $viewWikis[] = $skin->linkKnown( $configTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
197197 }
198198 $editCore .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
199199 }
@@ -203,14 +203,14 @@
204204 if ( !$allowedConfig )
205205 $editExt .= $editMsg;
206206 if ( $hasSelf )
207 - $editExt .= $skin->makeKnownLinkObj( $extTitle, wfMsgHtml( 'configure-edit-ext' ), "version=$ts" );
 207+ $editExt .= $skin->linkKnown( $extTitle, wfMessage( 'configure-edit-ext' )->escaped(), array(), array( 'version' => $ts ) );
208208 elseif( $allowedExtensionsAll )
209 - $editExt .= wfMsgHtml( 'configure-edit-ext' );
 209+ $editExt .= wfMessage( 'configure-edit-ext' )->escaped();
210210
211211 if ( $allowedExtensionsAll ) {
212212 $viewWikis = array();
213213 foreach ( $wikis as $wiki ) {
214 - $viewWikis[] = $skin->makeKnownLinkObj( $extTitle, htmlspecialchars( $wiki ), "version={$ts}&wiki={$wiki}" );
 214+ $viewWikis[] = $skin->linkKnown( $extTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
215215 }
216216 $editExt .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
217217 }
@@ -227,7 +227,8 @@
228228 array( 'type' => 'radio', 'name' => 'version', 'value' => $ts ),
229229 $versionCheck ) );
230230
231 - $actions[] = $skin->link( $this->getTitle(), wfMsgHtml( 'configure-viewconfig-default-diff' ), array(), array( 'version' => $ts, 'diff' => 'default' ) );
 231+ $actions[] = $skin->link( $this->getTitle(), wfMessage( 'configure-viewconfig-default-diff' )->escaped(),
 232+ array(), array( 'version' => $ts, 'diff' => 'default' ) );
232233 } else {
233234 $buttons = '';
234235 }
@@ -236,9 +237,9 @@
237238
238239 $action = $wgLang->commaList( $actions );
239240
240 - // That's a damn hack because some parmaters must replaced before and some after...
241 - $msg = wfMsgExt( 'configure-viewconfig-line', array( 'parseinline' ), array( '$1', $datime, '$2', '$3', '$4', $date, $time, $username ) );
242 - return Xml::tags( 'li', null, wfMsgReplaceArgs( $msg, array( $buttons, $userLink, $action, $comment ) ) )."\n";
 241+ $msg = wfMessage( 'configure-viewconfig-line' )->rawParams( $buttons )->params(
 242+ $datime )->rawParams( $userLink, $action, $comment )->params( $date, $time, $username )->parse();
 243+ return Xml::tags( 'li', null, $msg )."\n";
243244 }
244245
245246 /**
@@ -248,14 +249,14 @@
249250 global $wgConfigureWikis, $wgScript, $wgRequest;
250251 if ( $wgConfigureWikis === false || !$this->isUserAllowedInterwiki() )
251252 return '';
252 - $form = '<fieldset><legend>' . wfMsgHtml( 'configure-select-wiki' ) . '</legend>';
253 - $form .= wfMsgExt( 'configure-select-wiki-view-desc', array( 'parse' ) );
 253+ $form = '<fieldset><legend>' . wfMessage( 'configure-select-wiki' )->escaped() . '</legend>';
 254+ $form .= wfMessage( 'configure-select-wiki-view-desc' )->parseAsBlock();
254255 $form .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
255256 $form .= Html::Hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
256257 $all = ( $wgRequest->getVal( 'view', 'all' ) == 'all' );
257 - $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-all' ), 'view', 'all', 'wiki-all', $all );
 258+ $form .= Xml::radioLabel( wfMessage( 'configure-select-wiki-view-all' )->text(), 'view', 'all', 'wiki-all', $all );
258259 $form .= "<br />\n";
259 - $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-specific' ), 'view', 'specific', 'wiki-specific', !$all ) . ' ';
 260+ $form .= Xml::radioLabel( wfMessage( 'configure-select-wiki-view-specific' )->text(), 'view', 'specific', 'wiki-specific', !$all ) . ' ';
260261
261262 if ( is_array( $wgConfigureWikis ) ) {
262263 $selector = new XmlSelect( 'wiki', 'wiki', $this->mWiki );
@@ -267,7 +268,7 @@
268269 $form .= Xml::input( 'wiki', false, $this->mWiki )."<br />";
269270 }
270271
271 - $form .= Xml::submitButton( wfMsg( 'configure-select-wiki-submit' ) );
 272+ $form .= Xml::submitButton( wfMessage( 'configure-select-wiki-submit' )->text() );
272273 $form .= '</form></fieldset>';
273274 return $form;
274275 }
@@ -276,11 +277,11 @@
277278 * Taken from PageHistory.php
278279 */
279280 protected function getButton() {
280 - return Xml::submitButton( wfMsg( 'compareselectedversions' ),
 281+ return Xml::submitButton( wfMessage( 'compareselectedversions' )->text(),
281282 array(
282283 'class' => 'historysubmit',
283 - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
284 - 'title' => wfMsg( 'tooltip-compareselectedversions' ),
 284+ 'accesskey' => wfMessage( 'accesskey-compareselectedversions' )->text(),
 285+ 'title' => wfMessage( 'tooltip-compareselectedversions' )->text(),
285286 )
286287 );
287288 }
Index: trunk/extensions/Configure/specials/ConfigurationPage.php
@@ -287,13 +287,13 @@
288288 protected function showResult( $result ) {
289289 global $wgOut, $wgUser;
290290 $ok = $result == 'success';
291 - $msg = wfMsgNoTrans( $ok ? 'configure-saved' : 'configure-error' );
 291+ $msg = $ok ? 'configure-saved' : 'configure-error';
292292 $class = $ok ? 'successbox' : 'errorbox';
293293
294 - $wgOut->addWikiText( Html::rawElement( 'div', array( 'class' => $class ), "<strong>$msg</strong>" ) );
 294+ $wgOut->wrapWikiMsg( Html::rawElement( 'div', array( 'class' => $class ), '$1' ), $msg );
295295
296296 $sk = $wgUser->getSkin();
297 - $linkText = wfMsgExt( 'configure-backlink', 'parseinline' );
 297+ $linkText = wfMessage( 'configure-backlink' )->parse();
298298 $wgOut->addHTML( Html::rawElement( 'p', array( 'style' => 'clear:both;' ), $sk->link( $this->getTitle(), $linkText ) ) );
299299 }
300300
@@ -311,7 +311,7 @@
312312 global $wgOut, $wgLang;
313313
314314 $wgOut->addWikiMsg( 'configure-edit-old',
315 - $wgLang->timeAndDate( $version ),
 315+ $wgLang->timeanddate( $version ),
316316 $wgLang->date( $version ),
317317 $wgLang->time( $version )
318318 );
@@ -380,16 +380,16 @@
381381 foreach ( $versions as $data ) {
382382 $ts = $data['timestamp'];
383383 $count++;
384 - $datetime = wfMsgExt( 'configure-old-summary-datetime', array( 'parsemag', 'escape' ),
385 - $wgLang->timeAndDate( $ts ),
 384+ $datetime = wfMessage( 'configure-old-summary-datetime',
 385+ $wgLang->timeanddate( $ts ),
386386 $wgLang->date( $ts ),
387387 $wgLang->time( $ts )
388 - );
 388+ )->escaped();
389389 $link = $skin->linkKnown( $title, $datetime, array(), array( 'version' => $ts ) );
390390 $diffLink = '';
391391 if ( $prev )
392392 $diffLink = '(' . $skin->linkKnown( SpecialPage::getTitleFor( 'ViewConfig' ),
393 - wfMsgHtml( 'configure-old-changes' ), array(), array( 'version' => $ts, 'diff' => $prev ) ) . ')';
 393+ wfMessage( 'configure-old-changes' )->escaped(), array(), array( 'version' => $ts, 'diff' => $prev ) ) . ')';
394394
395395 ## Make user link...
396396 $userLink = '';
@@ -410,8 +410,7 @@
411411
412412 $comment = $data['reason'] ? $skin->commentBlock( $data['reason'] ) : '';
413413
414 - $text = wfMsgExt( 'configure-old-summary', array( 'parseinline' ), array( '$1', '$2', '$3', '$4', $username ) );
415 - $text = wfMsgReplaceArgs( $text, array( $link, $userLink, $diffLink, $comment ) );
 414+ $text = wfMessage( 'configure-old-summary' )->rawParams( $link, $userLink, $diffLink, $comment )->params( $username )->parse();
416415
417416 $prev = $ts;
418417
@@ -423,18 +422,18 @@
424423 ## Take out the first ten...
425424 $links = array_slice( $links, 0, 10 );
426425
427 - $text = Html::element( 'legend', null, wfMsg( 'configure-old' ) );
 426+ $text = Html::element( 'legend', null, wfMessage( 'configure-old' )->text() );
428427 if ( !count( $links ) ) {
429 - $text .= wfMsgExt( 'configure-no-old', array( 'parse' ) );
 428+ $text .= wfMessage( 'configure-no-old' )->parseAsBlock();
430429 } else {
431 - $text .= wfMsgExt( 'configure-old-versions', array( 'parse' ) );
 430+ $text .= wfMessage( 'configure-old-versions' )->parseAsBlock();
432431 $text .= "<ul>\n<li>";
433432 $text .= implode( "</li>\n<li>", $links );
434433 $text .= "</li>\n</ul>\n";
435434 }
436435 $link = SpecialPage::getTitleFor( 'ViewConfig' );
437 - $text .= Html::rawElement( 'p', null, $skin->link( $link, wfMsgHtml( 'configure-view-all-versions' ), array(), array(), array( 'known' ) ) );
438 - $text .= Html::rawElement( 'p', null, $skin->link( $link, wfMsgHtml( 'configure-view-default' ), array(), array( 'version' => 'default' ), array( 'known' ) ) );
 436+ $text .= Html::rawElement( 'p', null, $skin->linkKnown( $link, wfMessage( 'configure-view-all-versions' )->escaped() ) );
 437+ $text .= Html::rawElement( 'p', null, $skin->linkKnown( $link, wfMessage( 'configure-view-default' )->escaped(), array(), array( 'version' => 'default' ) ) );
439438
440439 return Html::rawElement( 'fieldset', null, $text );
441440 }
@@ -446,8 +445,8 @@
447446 global $wgConfigureWikis, $wgScript;
448447 if ( $wgConfigureWikis === false || !$this->isUserAllowedInterwiki() )
449448 return '';
450 - $form = Html::element( 'legend', null, wfMsg( 'configure-select-wiki' ) );
451 - $form .= wfMsgExt( 'configure-select-wiki-desc', array( 'parse' ) );
 449+ $form = Html::element( 'legend', null, wfMessage( 'configure-select-wiki' )->text() );
 450+ $form .= wfMessage( 'configure-select-wiki-desc' )->parseAsBlock();
452451 $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
453452 $form .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
454453 if ( is_array( $wgConfigureWikis ) ) {
@@ -459,7 +458,7 @@
460459 } else {
461460 $form .= Html::input( 'wiki', $this->mWiki, 'text' ) . '&#160;';
462461 }
463 - $form .= Html::input( null, wfMsg( 'configure-select-wiki-submit' ), 'submit' );
 462+ $form .= Html::input( null, wfMessage( 'configure-select-wiki-submit' )->text(), 'submit' );
464463 $form .= Html::closeElement( 'form' );
465464 return Html::rawElement( 'fieldset', null, $form );
466465 }
@@ -844,7 +843,7 @@
845844 protected function showForm() {
846845 global $wgOut, $wgUser, $wgRequest;
847846
848 - $action = $this->getTitle()->escapeLocalURL();
 847+ $action = $this->getTitle()->getLocalURL();
849848
850849 $reason = $wgRequest->getText( 'wpReason' );
851850
@@ -860,12 +859,12 @@
861860 Html::openElement( 'div', array( 'id' => 'configure' ) ) . "\n" .
862861 $this->buildAllSettings() . "\n" .
863862 ( $this->mCanEdit ?
864 - wfMsgExt( 'configure-form-reason', 'parseinline' ) . ' ' . Html::input( 'wpReason', $reason, 'text', array( 'size' => 45 ) ) . "\n" .
 863+ wfMessage( 'configure-form-reason' )->text() . ' ' . Html::input( 'wpReason', $reason, 'text', array( 'size' => 45 ) ) . "\n" .
865864 Html::openElement( 'div', array( 'id' => 'prefsubmit' ) ) . "\n" .
866865 Html::openElement( 'div', array() ) . "\n" .
867866 Html::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n" .
868 - Html::input( 'wpSave', wfMsg( 'configure-btn-save' ), 'submit', array( 'class' => 'btnSavePrefs' ) ) . "\n" .
869 - Html::input( 'wpPreview', wfMsg( 'showdiff' ), 'submit' ) . "\n" .
 867+ Html::input( 'wpSave', wfMessage( 'configure-btn-save' )->text(), 'submit', array( 'class' => 'btnSavePrefs' ) ) . "\n" .
 868+ Html::input( 'wpPreview', wfMessage( 'showdiff' )->text(), 'submit' ) . "\n" .
870869 Html::closeElement( 'div' ) . "\n" .
871870 Html::closeElement( 'div' ) . "\n" .
872871 Html::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n" .
@@ -880,9 +879,9 @@
881880
882881 /** Show a hidden-by-default search form */
883882 protected function buildSearchForm() {
884 - $input = wfMsgExt( 'configure-js-search-prompt', 'parseinline' ) . wfMsgExt( 'word-separator', array( 'escapenoentities' ) ) .
885 - Html::element( 'input', array( 'id' => 'configure-search-input', 'size' => 45 ) );
886 - $form = Html::element( 'legend', null, wfMsg( 'configure-js-search-legend' ) ) . Html::rawElement( 'p', null, $input ) . "\n" .
 883+ $input = wfMessage( 'configure-js-search-prompt' )->parse() . wfMessage( 'word-separator' )->escaped() .
 884+ Html::element( 'input', array( 'id' => 'configure-search-input', 'size' => 45 ), null );
 885+ $form = Html::element( 'legend', null, wfMessage( 'configure-js-search-legend' )->text() ) . Html::rawElement( 'p', null, $input ) . "\n" .
887886 Html::openElement( 'ul', array( 'id' => 'configure-search-results' ) ) . Html::closeElement( 'ul' );
888887 $form = Html::rawElement( 'fieldset', array( 'style' => 'display: none;', 'id' => 'configure-search-form' ), $form );
889888 return $form;
@@ -904,10 +903,12 @@
905904 * @return String xhtml fragment
906905 */
907906 protected function buildTableHeading( $msg ) {
908 - $msgName = 'configure-section-' . $msg;
909 - $msgVal = wfMsgExt( $msgName, array( 'parseinline' ) );
910 - if ( wfEmptyMsg( $msgName, $msgVal ) )
 907+ $msgObj = wfMessage( 'configure-section-' . $msg );
 908+ if ( $msgObj->exists() ) {
 909+ $msgVal = $msgObj->parse();
 910+ } else {
911911 $msgVal = $msg;
 912+ }
912913 return "\n<h2>" . $msgVal . "</h2>" . Html::openElement( 'table', array( 'class' => 'configure-table' ) ) . "\n";
913914 }
914915
@@ -921,7 +922,7 @@
922923 protected function buildInput( $conf, $params = array() ) {
923924 $read = isset( $params['read'] ) ? $params['read'] : $this->userCanRead( $conf );
924925 if ( !$read )
925 - return Html::rawElement( 'span', array( 'class' => 'disabled' ), wfMsgExt( 'configure-view-not-allowed', array( 'parseinline' ) ) );
 926+ return Html::rawElement( 'span', array( 'class' => 'disabled' ), wfMessage( 'configure-view-not-allowed' )->parse() );
926927 $allowed = isset( $params['edit'] ) ? $params['edit'] : $this->userCanEdit( $conf );
927928 $type = isset( $params['type'] ) ? $params['type'] : $this->getSettingType( $conf );
928929 $default = isset( $params['value'] ) ? $params['value'] : $this->getSettingValue( $conf );
@@ -933,7 +934,7 @@
934935 if ( $type == 'image-url' ) {
935936 if ( !$allowed )
936937 return '<code>' . htmlspecialchars( (string)$default ) . '</code>';
937 - return wfMsgExt( 'configure-image-url-explanation', 'parseinline' ) . '<br />' .
 938+ return wfMessage( 'configure-image-url-explanation' )->parse() . '<br />' .
938939 Html::element( 'input', array( 'name' => "wp$conf", 'size' => 45, 'value' => (string)$default,
939940 'class' => 'image-selector', 'id' => 'image-url-textbox-' . $conf )
940941 ) . '&#160;' .
@@ -1013,7 +1014,7 @@
10141015 htmlspecialchars( ( is_array( $default ) ? implode( "\n", $default ) : $default ) ) .
10151016 "\n</pre>";
10161017 }
1017 - $text = wfMsgExt( 'configure-arrayinput-oneperline', 'parseinline' );
 1018+ $text = wfMessage( 'configure-arrayinput-oneperline' )->parse();
10181019 $text .= Html::textarea( "wp{$conf}", is_array( $default ) ? implode( "\n", $default ) : '',
10191020 array( 'id' => "wp{$conf}", 'rows' => 8, 'style' => 'width:95%;' ) );
10201021 return $text;
@@ -1021,13 +1022,19 @@
10221023 if ( $type == 'assoc' ) {
10231024 ## See if the key/value has a special description
10241025
1025 - $keydesc = wfMsgExt( "configure-setting-$conf-key", 'parseinline' );
1026 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
 1026+ $keydescmsg = wfMessage( "configure-setting-$conf-key" );
 1027+ if ( $keydescmsg->exists() ) {
 1028+ $keydesc = $keydescmsg->parse();
 1029+ } else {
 1030+ $keydesc = wfMessage( 'configure-desc-key' )->escaped();
 1031+ }
10271032
1028 - if ( wfEmptyMsg( "configure-setting-$conf-key", $keydesc ) )
1029 - $keydesc = wfMsgHtml( 'configure-desc-key' );
1030 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1031 - $valdesc = wfMsgHtml( 'configure-desc-val' );
 1033+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1034+ if ( $valdescmsg->exists() ) {
 1035+ $valdesc = $valdescmsg->parse();
 1036+ } else {
 1037+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1038+ }
10321039
10331040 $classes = array( 'configure-array-table', 'assoc' );
10341041
@@ -1051,13 +1058,14 @@
10521059 else
10531060 $text .= '<code>' . htmlspecialchars( $key ) . '</code>';
10541061 $text .= Html::closeElement( 'td' ) . Html::openElement( 'td' );
1055 - if ( $allowed )
 1062+ if ( $allowed ) {
10561063 $text .= Html::element( 'input', array(
10571064 'name' => 'wp' . $conf . "-val-{$i}",
10581065 'type' => 'text', 'value' => $val, 'size' => 20
10591066 ) ) . Html::element( 'br' ) . "\n";
1060 - else
 1067+ } else {
10611068 $text .= '<code>' . htmlspecialchars( $val ) . '</code>';
 1069+ }
10621070 $text .= Html::closeElement( 'td' ) . Html::closeElement( 'tr' );
10631071 $i++;
10641072 }
@@ -1085,13 +1093,19 @@
10861094 return $text;
10871095 }
10881096 if ( $type == 'rate-limits' ) { ## Some of this is stolen from assoc, since it's an assoc with an assoc.
1089 - $keydesc = wfMsgExt( "configure-setting-$conf-key", 'parseinline' );
1090 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
 1097+ $keydescmsg = wfMessage( "configure-setting-$conf-key" );
 1098+ if ( $keydescmsg->exists() ) {
 1099+ $keydesc = $keydescmsg->parse();
 1100+ } else {
 1101+ $keydesc = wfMessage( 'configure-desc-key' )->escaped();
 1102+ }
10911103
1092 - if ( wfEmptyMsg( "configure-setting-$conf-key", $keydesc ) )
1093 - $keydesc = wfMsgHtml( 'configure-desc-key' );
1094 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1095 - $valdesc = wfMsgHtml( 'configure-desc-val' );
 1104+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1105+ if ( $valdescmsg->exists() ) {
 1106+ $valdesc = $valdescmsg->parse();
 1107+ } else {
 1108+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1109+ }
10961110
10971111 $classes = array( 'configure-array-table', 'configure-rate-limits' );
10981112
@@ -1109,11 +1123,11 @@
11101124 if ( isset( $default[$action] ) )
11111125 $val = $default[$action];
11121126
1113 - $key = Html::rawElement( 'td', array(), wfMsgExt( "configure-throttle-action-$action", 'parseinline' ) );
 1127+ $key = Html::rawElement( 'td', array(), wfMessage( "configure-throttle-action-$action" )->parse() );
11141128
11151129 ## Build YET ANOTHER ASSOC TABLE ARGH!
1116 - $innerRows = Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), wfMsgExt( 'configure-throttle-group', 'parseinline' ) ) . ' ' .
1117 - Html::rawElement( 'th', array(), wfMsgExt( 'configure-throttle-limit', 'parseinline' ) ) )."\n";
 1130+ $innerRows = Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), wfMessage( 'configure-throttle-group' )->parse() ) . ' ' .
 1131+ Html::rawElement( 'th', array(), wfMessage( 'configure-throttle-limit' )->parse() ) )."\n";
11181132 foreach( $validGroups as $type ) {
11191133 $limits = null;
11201134 if ( isset( $default[$action][$type] ) )
@@ -1124,16 +1138,16 @@
11251139 $count = $period = 0;
11261140
11271141 $id = 'wp'.$conf.'-key-'.$action.'-'.$type;
1128 - $left_col = Html::rawElement( 'td', array(), wfMsgExt( "configure-throttle-group-$type", 'parseinline' ) );
 1142+ $left_col = Html::rawElement( 'td', array(), wfMessage( "configure-throttle-group-$type" )->parse() );
11291143
11301144 if ( $allowed ) {
1131 - $right_col = Html::element( 'label', array( 'for' => "$id-count" ), wfMsg( 'configure-throttle-count' ) ) .
 1145+ $right_col = Html::element( 'label', array( 'for' => "$id-count" ), wfMessage( 'configure-throttle-count' )->text() ) .
11321146 '&#160;' . Html::input( "$id-count", $count, 'text', array( 'name' => "$id-count", 'size' => 15 ) ) .
11331147 Html::element( 'br' ) .
1134 - Html::element( 'label', array( 'for' => "$id-period" ), wfMsg( 'configure-throttle-period' ) ) .
 1148+ Html::element( 'label', array( 'for' => "$id-period" ), wfMessage( 'configure-throttle-period' )->text() ) .
11351149 '&#160;' . Html::input( "$id-period", $period, 'text', array( 'name' => "$id-period", 'size' => 15 ) );
11361150 } else {
1137 - $right_col = ($count && $period) ? wfMsg( 'configure-throttle-summary', $count, $period ) : wfMsg( 'configure-throttle-none' );
 1151+ $right_col = ($count && $period) ? wfMessage( 'configure-throttle-summary', $count, $period )->text() : wfMessage( 'configure-throttle-none' )->text();
11381152 ## Laziness: Make summaries work by putting the data in hidden fields, rather than a special case in JS.
11391153 $right_col .= "\n" . Html::hidden( "$id-count", $count, array( 'id' => "$id-count" ) ) . Html::hidden( "$id-period", $period, array( 'id' => "$id-period" ) );
11401154 }
@@ -1171,7 +1185,7 @@
11721186 foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
11731187 $name = str_replace( '_', ' ', $name );
11741188 if ( '' == $name ) {
1175 - $name = wfMsgExt( 'blanknamespace', array( 'parseinline' ) );
 1189+ $name = wfMessage( 'blanknamespace' )->parse();
11761190 }
11771191 if ( $type == 'ns-bool' ) {
11781192 $checked = isset( $default[$ns] ) && $default[$ns];
@@ -1197,17 +1211,20 @@
11981212 }
11991213 if ( $type == 'ns-text' ) {
12001214 global $wgContLang;
1201 - $nsdesc = wfMsgHtml( 'configure-desc-ns' );
1202 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
 1215+ $nsdesc = wfMessage( 'configure-desc-ns' )->escaped();
 1216+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1217+ if ( $valdescmsg->exists() ) {
 1218+ $valdesc = $valdescmsg->parse();
 1219+ } else {
 1220+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1221+ }
12031222
1204 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1205 - $valdesc = wfMsgHtml( 'configure-desc-val' );
12061223 $text = Html::openElement( 'table', array( 'class' => 'configure-array-table ns-text configure-biglist' ) ) . "\n" .
12071224 Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), $nsdesc ) . Html::rawElement( 'th', array(), $valdesc ) ) . "\n";
12081225 foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
12091226 $name = str_replace( '_', ' ', $name );
12101227 if ( '' == $name ) {
1211 - $name = wfMsgExt( 'blanknamespace', array( 'parseinline' ) );
 1228+ $name = wfMessage( 'blanknamespace' )->parse();
12121229 }
12131230 $text .= Html::openElement( 'tr', array() ) . Html::rawElement( 'td', array(), $name ) . Html::openElement( 'td', array() );
12141231 if ( $allowed )
@@ -1225,11 +1242,14 @@
12261243 }
12271244 if ( $type == 'ns-array' ) {
12281245 global $wgContLang;
1229 - $nsdesc = wfMsgHtml( 'configure-desc-ns' );
1230 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
 1246+ $nsdesc = wfMessage( 'configure-desc-ns' )->escaped();
 1247+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1248+ if ( $valdescmsg->exists() ) {
 1249+ $valdesc = $valdescmsg->parse();
 1250+ } else {
 1251+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1252+ }
12311253
1232 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1233 - $valdesc = wfMsgHtml( 'configure-desc-val' );
12341254 $text = Html::openElement( 'table', array( 'class' => 'ns-array configure-biglist configure-array-table' ) ) . "\n" .
12351255 Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), $nsdesc ) . Html::rawElement( 'th', array(), $valdesc ) ) . "\n";
12361256 foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
@@ -1237,7 +1257,7 @@
12381258 continue;
12391259 $name = str_replace( '_', ' ', $name );
12401260 if ( '' == $name ) {
1241 - $name = wfMsgExt( 'blanknamespace', array( 'parseinline' ) );
 1261+ $name = wfMessage( 'blanknamespace' )->parse();
12421262 }
12431263 $text .= Html::openElement( 'tr' ) . Html::rawElement( 'td', array(),
12441264 Html::rawElement( 'label', array( 'for' => "wp{$conf}-ns{$ns}" ), $name ) ) . Html::openElement( 'td' );
@@ -1278,11 +1298,14 @@
12791299 $all = array_diff( $all, $this->getSettingValue( 'wgImplicitGroups' ) );
12801300 }
12811301 sort( $all );
1282 - $groupdesc = wfMsgHtml( 'configure-desc-group' );
1283 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
 1302+ $groupdesc = wfMessage( 'configure-desc-group' )->escaped();
 1303+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1304+ if ( $valdescmsg->exists() ) {
 1305+ $valdesc = $valdescmsg->parse();
 1306+ } else {
 1307+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1308+ }
12841309
1285 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1286 - $valdesc = wfMsgHtml( 'configure-desc-val' );
12871310 $classes = "{$type} configure-array-table" . ( $type == 'group-bool' ? ' ajax-group' : '' );
12881311 $text = Html::openElement( 'table', array( 'id' => $conf, 'class' => $classes ) ) ."\n";
12891312 $text .= Html::rawElement( 'tr', array( 'class' => 'configure-maintable-row' ),
@@ -1300,10 +1323,14 @@
13011324 }
13021325 if ( $type == 'promotion-conds' ) {
13031326
1304 - $groupdesc = wfMsgHtml( 'configure-desc-group' );
1305 - $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' );
1306 - if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) )
1307 - $valdesc = wfMsgHtml( 'configure-desc-val' );
 1327+ $groupdesc = wfMessage( 'configure-desc-group' )->escaped();
 1328+ $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1329+ if ( $valdescmsg->exists() ) {
 1330+ $valdesc = $valdescmsg->parse();
 1331+ } else {
 1332+ $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1333+ }
 1334+
13081335 $text = Html::openElement( 'table', array( 'id' => $conf, 'class' => "{$type} configure-array-table ajax-group" ) ) ."\n";
13091336 $text .= Html::rawElement( 'tr', array( 'class' => 'configure-maintable-row' ),
13101337 Html::rawElement( 'th', array(), $groupdesc ) . Html::rawElement( 'th', array(), $valdesc ) ) . "\n";
@@ -1338,7 +1365,7 @@
13391366 APCOND_AGE_FROM_EDIT => 'int' );
13401367
13411368 $row = Html::openElement( 'div', array( 'class' => 'configure-biglist promotion-conds-element' ) );
1342 - $row .= wfMsgHtml( 'configure-condition-operator' ) . ' ';
 1369+ $row .= wfMessage( 'configure-condition-operator' )->escaped() . ' ';
13431370 $encConf = htmlspecialchars( $conf );
13441371 $encGroup = htmlspecialchars( $group );
13451372 $encId = 'wp'.$encConf.'-'.$encGroup;
@@ -1354,7 +1381,7 @@
13551382 $opts['checked'] = 'checked';
13561383 }
13571384 $row .= Html::input( $encId.'-opt-'.$desc, $desc, 'radio', $opts ) .
1358 - '&#160;' . Html::element( 'label', array( 'for' => $encId.'-opt-'.$desc ), wfMsg( 'configure-condition-operator-'.$desc ) );
 1385+ '&#160;' . Html::element( 'label', array( 'for' => $encId.'-opt-'.$desc ), wfMessage( 'configure-condition-operator-'.$desc )->text() );
13591386 }
13601387 $row .= Html::element( 'br' ) . "\n";
13611388
@@ -1379,10 +1406,10 @@
13801407
13811408 $row .= Html::openElement( 'table', array( 'class' => 'configure-table-promotion' ) );
13821409
1383 - $row .= Html::rawElement( 'tr', array(), Html::element( 'th', array(), wfMsg( 'configure-condition-name' ) ) .
1384 - Html::element( 'th', array(), wfMsg( 'configure-condition-requirement' ) ) )."\n";
 1410+ $row .= Html::rawElement( 'tr', array(), Html::element( 'th', array(), wfMessage( 'configure-condition-name' )->text() ) .
 1411+ Html::element( 'th', array(), wfMessage( 'configure-condition-requirement' )->text() ) )."\n";
13851412 foreach ( $conds as $condName => $condType ) {
1386 - $desc = wfMsg( 'configure-condition-name-' . $condName );
 1413+ $desc = wfMessage( 'configure-condition-name-' . $condName )->text();
13871414 $row .= Html::openElement( 'tr' ) . Html::rawElement( 'td', array(),
13881415 Html::element( 'label', array( 'for' => "{$encId}-cond-{$condName}" ), $desc ) ) . Html::openElement( 'td' );
13891416 switch( $condType ) {
@@ -1469,7 +1496,6 @@
14701497 $showLink = isset( $params['link'] ) ? $params['link'] : true;
14711498
14721499 ## First TD
1473 - $msgVal = wfMsgExt( $msg, array( 'parseinline' ) );
14741500 $rawVal = Html::element( 'tt', null, "\$$conf" );
14751501 if ( $showLink ) {
14761502 $url = 'http://www.mediawiki.org/wiki/Manual:$' . $conf;
@@ -1477,13 +1503,17 @@
14781504 } else {
14791505 $link = $rawVal;
14801506 }
1481 - if ( wfEmptyMsg( $msg, $msgVal ) )
 1507+
 1508+ $msgObj = wfMessage( $msg );
 1509+ if ( $msgObj->exists() ) {
 1510+ $msgVal = $msgObj->parse() . " ($link)";
 1511+ } else {
14821512 $msgVal = $link;
1483 - else
1484 - $msgVal = "$msgVal ($link)";
 1513+ }
14851514
1486 - if ( $params['customised'] )
1487 - $msgVal = Html::rawElement( 'p', null, $msgVal ).wfMsgExt( 'configure-customised', 'parse' );
 1515+ if ( $params['customised'] ) {
 1516+ $msgVal = Html::rawElement( 'p', null, $msgVal ) . wfMessage( 'configure-customised' )->parseAsBlock();
 1517+ }
14881518
14891519 $attribs = array();
14901520 $attribs['style'] = 'text-align:' . ( $wgContLang->isRtl() ? 'right' : 'left' ) . ';vertical-align:top;';
@@ -1588,7 +1618,7 @@
15891619 }
15901620
15911621 if ( $thisSection ) {
1592 - $thisSection = Html::rawElement( 'legend', null, wfMsgExt( "configure-section-$title", array( 'parseinline' ) ) ) . $thisSection;
 1622+ $thisSection = Html::rawElement( 'legend', null, wfMessage( "configure-section-$title" )->parse() ) . $thisSection;
15931623 $ret .= Html::rawElement( 'fieldset', null, $thisSection );
15941624 }
15951625 }
Index: trunk/extensions/Configure/Configure.diff.php
@@ -118,7 +118,7 @@
119119 $old = $this->getOldVersion();
120120 $new = $this->getNewVersion();
121121 if ( !( $wikis = $this->cleanWikis( $old, $new ) ) ) {
122 - return wfMsgExt( 'configure-no-diff', array( 'parse' ) );
 122+ return wfMessage( 'configure-no-diff' )->parseAsBlock();
123123 }
124124 $text = '';
125125 foreach ( $wikis as $wiki ) {
@@ -152,22 +152,25 @@
153153 $groupDiff .= $this->processDiffSetting( $setting, $oldSetting, $newSetting, $type ) . "\n";
154154 }
155155 if ( $groupDiff != '' ) {
156 - $name = wfMsgExt( 'configure-section-' . $groupName, array( 'parseinline' ) );
157 - if ( wfEmptyMsg( 'configure-section-' . $groupName, $name ) )
 156+ $msg = wfMessage( 'configure-section-' . $groupName );
 157+ if ( $msg->exists() ) {
 158+ $name = $msg->parse();
 159+ } else {
158160 $name = $groupName;
 161+ }
159162 $sectionDiff .= "<tr><td colspan=\"4\"><h4 class=\"config-diff-group\">{$name}</h4></td></tr>\n";
160163 $sectionDiff .= $groupDiff;
161164 }
162165 }
163166 if ( $sectionDiff != '' ) {
164 - $name = wfMsgExt( 'configure-section-' . $sectionName, array( 'parseinline' ) );
 167+ $name = wfMessage( 'configure-section-' . $sectionName )->parse();
165168 $text .= "<tr><td colspan=\"4\"><h3 class=\"config-diff-section\">{$name}</h3></td></tr>\n";
166169 $text .= $sectionDiff;
167170 }
168171 }
169172
170173 if ( empty( $text ) )
171 - return wfMsgExt( 'configure-no-diff', array( 'parse' ) );
 174+ return wfMessage( 'configure-no-diff' )->parseAsBlock();
172175
173176 $ret = "<table class='diff'>\n";
174177 $ret .= "<col class='diff-marker' />";
@@ -189,13 +192,13 @@
190193 * @return String: XHTML
191194 */
192195 function processDiffSetting( $name, $old, $new, $type ) {
193 - $msg = 'configure-setting-' . $name;
194 - $msgVal = wfMsgExt( $msg, array( 'parseinline' ) );
 196+ $msg = wfMessage( 'configure-setting-' . $name );
195197 $rawVal = Xml::element( 'tt', null, "\$$name" );
196 - if ( wfEmptyMsg( $msg, $msgVal ) )
 198+ if ( $msg->exists() ) {
 199+ $msgVal = $msg->parse() . " ($rawVal)";
 200+ } else {
197201 $msgVal = $rawVal;
198 - else
199 - $msgVal = "$msgVal ($rawVal)";
 202+ }
200203
201204 $oldSet = $this->getSettingAsArray( WebConfiguration::filterVar( $old ), $name, $type );
202205 $newSet = $this->getSettingAsArray( WebConfiguration::filterVar( $new ), $name, $type );
@@ -272,7 +275,7 @@
273276 if ($count == 0 || $period == 0)
274277 continue;
275278
276 - $val[] = "$action, $group: " . wfMsg( 'configure-throttle-summary', $count, $period );
 279+ $val[] = "$action, $group: " . wfMessage( 'configure-throttle-summary', $count, $period )->text();
277280 }
278281 }
279282 }
@@ -285,11 +288,11 @@
286289
287290 foreach( $setting as $group => $conds ) {
288291 if ( !is_array( $conds ) ) {
289 - $val[] = "$group: ".wfMsg( "configure-condition-description-$conds" );
 292+ $val[] = "$group: ".wfMessage( "configure-condition-description-$conds" )->text();
290293 continue;
291294 }
292295 if ( count( $conds ) == 0 ) {
293 - $val[] = "$group: ".wfMsg( 'configure-autopromote-noconds' );
 296+ $val[] = "$group: ".wfMessage( 'configure-autopromote-noconds' )->text();
294297 continue;
295298 }
296299
@@ -297,7 +300,7 @@
298301 $boolop = array_shift( $conds );
299302 $boolop = $opToName[$boolop];
300303
301 - $val[] = "$group: " . wfMsg( "configure-boolop-description-$boolop" );
 304+ $val[] = "$group: " . wfMessage( "configure-boolop-description-$boolop" )->text();
302305 } else {
303306 $conds = array( $conds );
304307 }
@@ -305,7 +308,7 @@
306309 // Analyse each individual one...
307310 foreach( $conds as $cond ) {
308311 if ($cond == array( APCOND_AGE, -1 ) ) {
309 - $val[] = "$group: " . wfMsg( 'configure-autopromote-noconds' );
 312+ $val[] = "$group: " . wfMessage( 'configure-autopromote-noconds' )->text();
310313 continue;
311314 }
312315
@@ -318,7 +321,7 @@
319322 $argSummary = implode( ', ', $cond );
320323 $count = count( $cond );
321324
322 - $val[] = "$group: ".wfMsgExt( "configure-condition-description-$name", array( 'parsemag' ), $argSummary, $count );
 325+ $val[] = "$group: ".wfMessage( "configure-condition-description-$name", $argSummary, $count )->text();
323326 }
324327 }
325328 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r108678And I forogot to commit this file in r108677ialex20:45, 11 January 2012

Status & tagging log