/** * 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]); }
/** * @brief Returns true * @details This function doesn't actually do anything - handler for MediaWiki hook * * @param OutputPage &$out MediaWiki OutputPage passed by reference * @param string &$text The article contents passed by reference * * @return true */ public static function onEditPageInitial(EditPage $editPage) { $app = F::app(); if ($app->checkSkin('wikiamobile')) { //We want mobile editing to be as clean as possible WikiaMobileNavigationService::setSkipRendering(true); WikiaMobileFooterService::setSkipRendering(true); $editPage->editFormTextBottom .= $app->renderView(__CLASS__, 'editPage'); } return true; }
/** * Makes all required adjustments for rendering single map page on mobile */ private function setMapOnMobile() { global $wgHooks; // adds class to body $wgHooks['SkinGetPageClasses'][] = function (&$classes) { $classes .= ' int-map-mobile-map-page'; return true; }; // skip rendering parts of Wikia page WikiaMobileFooterService::setSkipRendering(true); WikiaMobilePageHeaderService::setSkipRendering(true); }
static function setSkipRendering($value = false) { self::$skipRendering = $value; }