Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | } |
129 | 129 | |
130 | 130 | protected function appendNamespaces( $property ) { |
131 | | - global $wgContLang, $wgCanonicalNamespaceNames; |
| 131 | + global $wgContLang; |
132 | 132 | $data = array(); |
133 | 133 | foreach( $wgContLang->getFormattedNamespaces() as $ns => $title ) |
134 | 134 | { |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | 'id' => $ns |
137 | 137 | ); |
138 | 138 | ApiResult :: setContent( $data[$ns], $title ); |
139 | | - $canonical = isset($wgCanonicalNamespaceNames[$ns]) ? $wgCanonicalNamespaceNames[$ns] : false; |
| 139 | + $canonical = MWNamespace::getCanonicalName( $ns ); |
140 | 140 | |
141 | 141 | if( MWNamespace::hasSubpages( $ns ) ) |
142 | 142 | $data[$ns]['subpages'] = ''; |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -105,11 +105,15 @@ |
106 | 106 | * Returns the canonical (English Wikipedia) name for a given index |
107 | 107 | * |
108 | 108 | * @param $index Int: namespace index |
109 | | - * @return string |
| 109 | + * @return string or false if no canonical definition. |
110 | 110 | */ |
111 | 111 | public static function getCanonicalName( $index ) { |
112 | 112 | global $wgCanonicalNamespaceNames; |
113 | | - return $wgCanonicalNamespaceNames[$index]; |
| 113 | + if( isset( $wgCanonicalNamespaceNames[$index] ) ) { |
| 114 | + return $wgCanonicalNamespaceNames[$index]; |
| 115 | + } else { |
| 116 | + return false; |
| 117 | + } |
114 | 118 | } |
115 | 119 | |
116 | 120 | /** |