/** * Inserts the necessary HTML to start the left column * * @param string $input Input between the <sample> and </sample> tags, or null if the tag is "closed", i.e. <sample /> * @param array $args Tag arguments, which are entered like HTML tag attributes; this is an associative array indexed by attribute name. * @param array $parser The parent parser (a Parser object); more advanced extensions use this to obtain the contextual Title, parse wiki text, expand braces, register link relationships and dependencies, etc. */ function wfMainPageTag_lcs($input, $args, $parser) { global $wfMainPageTag_rcs_called, $wfMainPageTag_lcs_called, $wgMainPageTag_count; $wfMainPageTag_lcs_called = true; $wgMainPageTag_count++; $isOasis = F::app()->checkSkin('oasis'); $isGridLayoutEnabled = $isOasis && BodyController::isGridLayoutEnabled(); $isResponsiveLayoutEnabled = $isOasis && BodyController::isResponsiveLayoutEnabled(); $areBreakpointsLayoutEnabled = $isOasis && BodyController::isOasisBreakpoints(); $gutter = isset($args['gutter']) ? str_replace('px', '', $args['gutter']) : 10; $html = '<div class="main-page-tag-lcs '; if ($isGridLayoutEnabled) { $html .= 'grid-4 alpha '; } if ($wfMainPageTag_rcs_called) { $html .= 'main-page-tag-lcs-collapsed"'; if (!$isResponsiveLayoutEnabled && !$areBreakpointsLayoutEnabled) { $html .= ' style="padding-right: ' . $gutter . 'px"'; } $html .= '><div class="lcs-container">'; } else { $gutter += 300; $html .= 'main-page-tag-lcs-exploded" '; if ($isGridLayoutEnabled || $isResponsiveLayoutEnabled || $areBreakpointsLayoutEnabled) { $html .= '><div class="lcs-container">'; } else { $html .= 'style="margin-right: -' . $gutter . 'px; "><div class="lcs-container" style="margin-right: ' . $gutter . 'px;">'; } } return $html; }
public function executeIndex($params) { wfProfileIn(__METHOD__); $this->railModuleList = isset($params['railModuleList']) ? $params['railModuleList'] : null; $this->isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); wfProfileOut(__METHOD__); }
public function executeIndex($params) { wfProfileIn(__METHOD__); $railModules = isset($params['railModuleList']) ? $params['railModuleList'] : []; $this->railModuleList = $this->filterModules($railModules, self::FILTER_NON_LAZY_MODULES); $this->isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); $this->isAside = $this->wg->RailInAside; $this->loadLazyRail = $railModules > $this->railModuleList; wfProfileOut(__METHOD__); }
/** * Sets values for the view to work with during index method. * @param Wikia\Search\Config $searchConfig */ protected function setResponseValuesFromConfig(Wikia\Search\Config $searchConfig) { global $wgLanguageCode; $response = $this->getResponse(); $format = $response->getFormat(); if ($format == 'json' || $format == 'jsonp') { $results = $searchConfig->getResults(); if ($results) { $response->setData($results->toArray(explode(',', $this->getVal('jsonfields', 'title,url,pageid')))); } else { $response->setData([]); } return; } if (!$searchConfig->getInterWiki()) { $this->setVal('advancedSearchBox', $this->sendSelfRequest('advancedBox', array('config' => $searchConfig))); } $isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); $tabsArgs = array('config' => $searchConfig, 'by_category' => $this->getVal('by_category', false), 'filters' => $this->getVal('filters', array())); $isMonobook = $this->app->checkSkin('monobook'); $this->setVal('results', $searchConfig->getResults()); $this->setVal('resultsFound', $searchConfig->getResultsFound()); $this->setVal('resultsFoundTruncated', $searchConfig->getTruncatedResultsNum(true)); $this->setVal('isOneResultsPageOnly', $searchConfig->getNumPages() < 2); $this->setVal('pagesCount', $searchConfig->getNumPages()); $this->setVal('currentPage', $searchConfig->getPage()); $this->setVal('paginationLinks', $this->sendSelfRequest('pagination', $tabsArgs)); $this->setVal('tabs', $this->sendSelfRequest('tabs', $tabsArgs)); $this->setVal('query', $searchConfig->getQuery()->getQueryForHtml()); $this->setVal('resultsPerPage', $searchConfig->getLimit()); $this->setVal('specialSearchUrl', $this->wg->Title->getFullUrl()); $this->setVal('isInterWiki', $searchConfig->getInterWiki()); $this->setVal('namespaces', $searchConfig->getNamespaces()); $this->setVal('hub', $searchConfig->getHub()); $this->setVal('hasArticleMatch', $searchConfig->hasArticleMatch()); $this->setVal('isMonobook', $isMonobook); $this->setVal('isCorporateWiki', $this->isCorporateWiki()); $this->setVal('wgExtensionsPath', $this->wg->ExtensionsPath); $this->setVal('isGridLayoutEnabled', $isGridLayoutEnabled); $this->setVal('shownResultsBegin', $this->resultsPerPage * $this->currentPage - $this->resultsPerPage + 1); if ($this->isCorporateWiki()) { $resultsLang = $searchConfig->getLanguageCode(); if ($resultsLang != $this->app->wg->ContLang->getCode()) { $this->setVal('resultsLang', $resultsLang); } } if ($this->currentPage == $this->pagesCount) { $this->setVal('shownResultsEnd', $this->resultsFound); } else { $this->setVal('shownResultsEnd', $this->resultsPerPage * $this->currentPage); } $sanitizedQuery = $searchConfig->getQuery()->getSanitizedQuery(); if (strlen($sanitizedQuery) > 0 && in_array(0, $searchConfig->getNamespaces()) && !in_array(6, $searchConfig->getNamespaces())) { $combinedMediaResult = $this->sendSelfRequest('combinedMediaSearch', array('q' => $sanitizedQuery, 'videoOnly' => true))->getData(); if (isset($combinedMediaResult) && sizeof($combinedMediaResult['items']) == 4) { $this->setVal('mediaData', $combinedMediaResult); } } else { $this->setVal('mediaData', []); } if ($this->wg->OnWikiSearchIncludesWikiMatch && $searchConfig->hasWikiMatch()) { $this->registerWikiMatch($searchConfig); } $topWikiArticlesHtml = ''; if (!$searchConfig->getInterWiki() && $wgLanguageCode == 'en' && !$isMonobook) { $dbname = $this->wg->DBName; $cacheKey = wfMemcKey(__CLASS__, 'WikiaSearch', 'topWikiArticles', $this->wg->CityId, static::TOP_ARTICLES_CACHE, $isGridLayoutEnabled); $topWikiArticlesHtml = WikiaDataAccess::cache($cacheKey, 86400 * 5, function () { return $this->app->renderView('WikiaSearchController', 'topWikiArticles'); }); } $this->setVal('topWikiArticles', $topWikiArticlesHtml); }