/** * Page Not Found * * Get 20 most recent edited page * get 5 images per page * * display random image on 404 page * example: * * Open non existent page on any wiki * */ function pageNotFound() { //setup all needed assets on 404 page /** * @var $out OutputPage */ $out = $this->request->getVal('out', $this->wg->Out); $assetManager = F::build('AssetsManager', array(), 'getInstance'); //add styles that belongs only to 404 page $styles = $assetManager->getURL(array('wikiamobile_404_scss')); //this is going to be additional call but at least it won't be loaded on every page foreach ($styles as $s) { $out->addStyle($s); } //this is mainly for tracking $scipts = $assetManager->getURL(array('wikiamobile_404_js')); foreach ($scipts as $s) { $out->addScript('<script src="' . $s . '"></script>'); } //suppress rendering stuff that is not to be on 404 page WikiaMobileFooterService::setSkipRendering(true); WikiaMobilePageHeaderService::setSkipRendering(true); /** * @var $wikiaMobileStatsModel WikiaMobileStatsModel */ $wikiaMobileStatsModel = F::build('WikiaMobileStatsModel'); $ret = $wikiaMobileStatsModel->getRandomPopularPage(); $this->response->setVal('title', $this->wg->Out->getTitle()); $this->response->setVal('link', $ret[0]); $this->response->setVal('img', $ret[1]); }
static function setSkipRendering($value = false) { self::$skipRendering = $value; }
/** * Sets template variables depending on skin * @param Array $mapsResponse an array taken from API response * @param String $selectedSort a sorting option passed in $_GET */ private function prepareTemplateData($mapsResponse, $selectedSort) { $isWikiaMobileSkin = $this->app->checkSkin(self::WIKIA_MOBILE_SKIN_NAME); $thumbWidth = $isWikiaMobileSkin ? self::MAP_MOBILE_THUMB_WIDTH : self::MAP_THUMB_WIDTH; $thumbHeight = $isWikiaMobileSkin ? self::MAP_MOBILE_THUMB_HEIGHT : self::MAP_THUMB_HEIGHT; $this->convertImagesToThumbs($mapsResponse->items, $thumbWidth, $thumbHeight); $this->setVal('mapThumbWidth', $thumbWidth); $this->setVal('mapThumbHeight', $thumbHeight); $this->setVal('renderControls', $isWikiaMobileSkin ? false : true); $this->setVal('renderTitle', $isWikiaMobileSkin ? false : true); $messages = ['no-maps-header' => wfMessage('wikia-interactive-maps-no-maps-header'), 'no-maps-text' => wfMessage('wikia-interactive-maps-no-maps-text'), 'no-maps-learn-more' => wfMessage('wikia-interactive-maps-no-maps-learn-more')]; if ($isWikiaMobileSkin) { WikiaMobilePageHeaderService::setSkipRendering(true); } else { $messages = array_merge($messages, ['title' => wfMessage('wikia-interactive-maps-title'), 'create-a-map' => wfMessage('wikia-interactive-maps-create-a-map')]); $this->setVal('sortingOptions', $this->getModel()->getSortingOptions($selectedSort)); } // template variables shared between skins $this->setVal('messages', $messages); $this->setVal('maps', $mapsResponse->items); $this->setVal('hasMaps', !empty($mapsResponse->total)); $this->setVal('learnMoreUrl', self::MAPS_WIKIA_URL); $this->setVal('baseUrl', self::getSpecialUrl()); }