/** * fetchSectionItems - returns gets array of items from category from specyfic namespace. * @param $sCategoryDBKey int category namespace * @param $mNamespace mixed: int namespace or array of int for category query * @return array */ protected function fetchSectionItems($mNamespace = NS_MAIN, $negative = false) { $sCategoryDBKey = $this->categoryTitle->getDBkey(); // Check if page is a redirect if ($this->categoryTitle->isRedirect()) { $oTmpArticle = new Article($this->categoryTitle); if (!is_null($oTmpArticle)) { $rdTitle = $oTmpArticle->getRedirectTarget(); if (!is_null($rdTitle) && $rdTitle->getNamespace() == NS_CATEGORY) { $sCategoryDBKey = $rdTitle->getDBkey(); } } } if (!is_array($mNamespace)) { $mNamespace = (int) $mNamespace; } else { $mNamespace = implode(',', $mNamespace); } switch ($this->getSortType()) { case 'mostvisited': $res = CategoryDataService::getMostVisited($sCategoryDBKey, $mNamespace, false, $negative); //FB#26239 - fall back to alphabetical order if most visited data is empty return !empty($res) ? $res : CategoryDataService::getAlphabetical($sCategoryDBKey, $mNamespace, $negative); case 'alphabetical': return CategoryDataService::getAlphabetical($sCategoryDBKey, $mNamespace, $negative); case 'recentedits': return CategoryDataService::getRecentlyEdited($sCategoryDBKey, $mNamespace, $negative); } return array(); }