$wgAllowPrefChange = array();
/**
- * If an exact match is not found, try to find a match in a different namespace
+ * If an exact match is not found, try to find a match in different namespaces
* before performing a search.
*
- * Integer: Id of namespace to attempt match in.
+ * Array: Ids of namespaces to attempt match in, in desired order.
*/
-$wgSecondaryGoNamespace = null;
+$wgSecondaryGoNamespaces = null;
* @return Title
*/
public static function getNearMatch( $searchterm ) {
- global $wgContLang, $wgSecondaryGoNamespace;
+ global $wgContLang, $wgSecondaryGoNamespaces;
$allSearchTerms = array($searchterm);
return $title;
}
- # If a match is not found in the main namespace look in secondary go namespace.
- if( $wgSecondaryGoNamespace && $title->getNamespace() == NS_MAIN ) {
- $title = Title::newFromText( $term, $wgSecondaryGoNamespace );
- if( $title && $title->exists() ) return $title;
+ # If a match is not found in the main namespace look in secondary go namespaces.
+ if( $wgSecondaryGoNamespaces && $title->getNamespace() == NS_MAIN ) {
+ foreach( $wgSecondaryGoNamespaces as $ns ) {
+ $title = Title::newFromText( $term, $ns );
+ if( $title && $title->exists() ) return $title;
+ }
}
# Now try all lower case (i.e. first letter capitalized)