r85667 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85666‎ | r85667 | r85668 >
Date:09:29, 8 April 2011
Author:ialex
Status:deferred
Tags:
Comment:
* Use MWNamespace::getCanonicalName() instead of $wgCanonicalNamespaceNames
* Localised a bit the interface by displaying namespace names in content language in the form instead of English only
* Also replace spaces by underscores in $namespace_str; some langauges have spaces in that messages and thus were breaking XML output
Modified paths:
  • /trunk/extensions/DataTransfer/specials/DT_ViewXML.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransfer/specials/DT_ViewXML.php
@@ -405,13 +405,13 @@
406406 }
407407
408408 function doSpecialViewXML() {
409 - global $wgOut, $wgRequest, $wgUser, $wgCanonicalNamespaceNames, $wgContLang;
 409+ global $wgOut, $wgRequest, $wgUser, $wgContLang;
410410 $skin = $wgUser->getSkin();
411411 $namespace_labels = $wgContLang->getNamespaces();
412412 $category_label = $namespace_labels[NS_CATEGORY];
413413 $template_label = $namespace_labels[NS_TEMPLATE];
414414 $name_str = str_replace( ' ', '_', wfMsgForContent( 'dt_xml_name' ) );
415 - $namespace_str = wfMsg( 'dt_xml_namespace' );
 415+ $namespace_str = str_replace( ' ', '_', wfMsg( 'dt_xml_namespace' ) );
416416 $pages_str = str_replace( ' ', '_', wfMsgForContent( 'dt_xml_pages' ) );
417417
418418 $form_submitted = false;
@@ -455,7 +455,7 @@
456456 if ( $ns == 0 ) {
457457 $ns_name = "Main";
458458 } else {
459 - $ns_name = $wgCanonicalNamespaceNames[$ns];
 459+ $ns_name = MWNamespace::getCanonicalName( $ns );
460460 }
461461 if ( $simplified_format )
462462 $text .= '<' . str_replace( ' ', '_', $ns_name ) . ">\n";
@@ -495,9 +495,9 @@
496496 $namespaces = getNamespacesList();
497497 foreach ( $namespaces as $namespace ) {
498498 if ( $namespace == 0 ) {
499 - $ns_name = "Main";
 499+ $ns_name = wfMsgHtml( 'blanknamespace' );
500500 } else {
501 - $ns_name = $wgCanonicalNamespaceNames["$namespace"];
 501+ $ns_name = htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) );
502502 }
503503 $ns_name = str_replace( '_', ' ', $ns_name );
504504 $text .= "<input type=\"checkbox\" name=\"namespaces[$namespace]\" /> $ns_name <br />\n";

Status & tagging log