コード例 #1
0
ファイル: SearchEngine.php プロジェクト: amjadtbssm/website
 /**
  * Extract default namespaces to search from the given user's
  * settings, returning a list of index numbers.
  *
  * @param $user User
  * @return Array
  */
 public static function userNamespaces($user)
 {
     global $wgSearchEverythingOnlyLoggedIn;
     // get search everything preference, that can be set to be read for logged-in users
     $searcheverything = false;
     if ($wgSearchEverythingOnlyLoggedIn && $user->isLoggedIn() || !$wgSearchEverythingOnlyLoggedIn) {
         $searcheverything = $user->getOption('searcheverything');
     }
     // searcheverything overrides other options
     if ($searcheverything) {
         return array_keys(SearchEngine::searchableNamespaces());
     }
     $arr = Preferences::loadOldSearchNs($user);
     $searchableNamespaces = SearchEngine::searchableNamespaces();
     $arr = array_intersect($arr, array_keys($searchableNamespaces));
     // Filter
     return $arr;
 }