Index: trunk/phase3/includes/PrefixSearch.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | } |
24 | 24 | $namespaces = self::validateNamespaces( $namespaces ); |
25 | 25 | |
| 26 | + // Find a Title which is not an interwiki and is in NS_MAIN |
26 | 27 | $title = Title::newFromText( $search ); |
27 | 28 | if( $title && $title->getInterwiki() == '' ) { |
28 | 29 | $ns = array($title->getNamespace()); |
— | — | @@ -162,10 +163,12 @@ |
163 | 164 | * Validate an array of numerical namespace indexes |
164 | 165 | * |
165 | 166 | * @param $namespaces Array |
166 | | - * @return Array |
| 167 | + * @return Array (default: contains only NS_MAIN) |
167 | 168 | */ |
168 | 169 | protected static function validateNamespaces($namespaces){ |
169 | 170 | global $wgContLang; |
| 171 | + |
| 172 | + // We will look at each given namespace against wgContLang namespaces |
170 | 173 | $validNamespaces = $wgContLang->getNamespaces(); |
171 | 174 | if( is_array($namespaces) && count($namespaces)>0 ){ |
172 | 175 | $valid = array(); |
— | — | @@ -173,8 +176,9 @@ |
174 | 177 | if( is_numeric($ns) && array_key_exists($ns, $validNamespaces) ) |
175 | 178 | $valid[] = $ns; |
176 | 179 | } |
177 | | - if( count($valid) > 0 ) |
| 180 | + if( count($valid) > 0 ) { |
178 | 181 | return $valid; |
| 182 | + } |
179 | 183 | } |
180 | 184 | |
181 | 185 | return array( NS_MAIN ); |