public function index() { if (!$this->wg->User->isAllowed('gameguidespreview')) { $this->displayRestrictionError(); return false; // skip rendering } $this->wg->Out->setSubtitle(wfMessage('wikiagameguides-preview-description')->parse()); $titles = array_unique(explode('/', $this->getPar())); $urls = []; foreach ($titles as $title) { //Simple fallback to main page if Title does not exist or none specified if ($title == '') { $title = Title::newMainPage()->getFullText(); } else { $title = Title::newFromText($title); if ($title instanceof Title && $title->exists()) { $title = $title->getFullText(); } else { $title = Title::newMainPage()->getFullText(); } } $urls[] = GameGuidesController::getUrl('renderFullPage', array('allinone' => 1, 'page' => $title, 'cb' => $this->wg->StyleVersion)); } $this->setVal('urls', $urls); }
/** * @param String $message * @param String $input * @param String $expected * * @dataProvider gameGuidesContentDataProvider */ public function testConvertGameGuideContentToCuratedContent($message, $input, $expected) { $controller = new GameGuidesController(); $this->assertEquals($expected, $controller->curatedContentToGameGuides($input), $message); }
/** * @brief Whenever data is saved in Curated Content Management Tool * purge Varnish cache for it and Game Guides * * @return bool */ static function onCuratedContentSave($sections) { self::purgeMethod('getList'); if (class_exists('GameGuidesController')) { GameGuidesController::purgeMethod('getList'); } return true; }
/** * @param $title Title * @param $urls String[] * @return bool */ static function onTitleGetSquidURLs($title, &$urls) { $urls[] = GameGuidesController::getVarnishUrl('getPage', array('title' => $title->getPartialURL())); return true; }