/** * @dataProvider providerGetSitename */ public function testGetSitename($configValue, $expected) { // set config variables $values = array('wgMFTrademarkSitename' => $configValue, 'wgSitename' => 'MyWiki'); $this->setMwGlobals($values); $sitename = SkinMinerva::getSitename(true); $this->assertEquals($sitename, $expected); }
/** * @inheritdoc * Renders a search link and branding. */ protected function makeChromeHeaderContent($data) { $templateParser = new TemplateParser(__DIR__ . '/../../templates'); $args = array('siteName' => SkinMinerva::getSitename(), 'showSearchForm' => $this->isSpecialMobileMenuPage, 'showTitle' => !$this->isSpecialMobileMenuPage); if ($this->isSpecialMobileMenuPage) { $args += array('mobileMenuClass' => 'js-only back ' . MobileUI::iconClass('back'), 'mobileMenuLink' => '#back', 'mobileMenuTitle' => wfMessage('mobile-frontend-main-menu-back')->parse(), 'searchForm' => $this->makeSearchForm($data)); } else { $args += array('mobileMenuClass' => MobileUI::iconClass('search'), 'mobileMenuLink' => SpecialPage::getTitleFor('MobileMenu')->getLocalUrl(), 'mobileMenuTitle' => wfMessage('mobile-frontend-main-menu')->parse(), 'searchInputClass' => 'hidden'); } echo $templateParser->processTemplate('header', $args); }
/** * Add talk, contributions, and uploads links at the top of the user page. * * @inheritdoc * @param BaseTemplate $tpl */ protected function prepareHeaderAndFooter(BaseTemplate $tpl) { parent::prepareHeaderAndFooter($tpl); if ($this->isUserPage) { $talkPage = $this->pageUser->getTalkPage(); $data = array('talkPageTitle' => $talkPage->getPrefixedURL(), 'talkPageLink' => $talkPage->getLocalUrl(), 'talkPageLinkTitle' => $this->msg('mobile-frontend-user-page-talk')->escaped(), 'contributionsPageLink' => SpecialPage::getTitleFor('Contributions', $this->pageUser)->getLocalURL(), 'contributionsPageTitle' => $this->msg('mobile-frontend-user-page-contributions')->escaped(), 'uploadsPageLink' => SpecialPage::getTitleFor('Uploads', $this->pageUser)->getLocalURL(), 'uploadsPageTitle' => $this->msg('mobile-frontend-user-page-uploads')->escaped()); $templateParser = new TemplateParser(__DIR__); $tpl->set('postheadinghtml', $templateParser->processTemplate('user_page_links', $data)); } }
/** @inheritdoc */ protected function preparePageContent(QuickTemplate $tpl) { parent::preparePageContent($tpl); $title = $this->getTitle(); if (!$title) { return; } }
/** * ResourceLoaderGetConfigVars hook handler * This should be used for variables which vary with the html * and for variables this should work cross skin including anonymous users * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars * * @param array $vars * @return boolean */ public static function onResourceLoaderGetConfigVars(&$vars) { $context = MobileContext::singleton(); $config = $context->getMFConfig(); // Get the licensing agreement that is displayed in the uploading interface. $wgMFUploadLicense = SkinMinerva::getLicense('upload'); $vars += array('wgMFExperiments' => $config->get('MFExperiments'), 'wgMFNearbyEndpoint' => $config->get('MFNearbyEndpoint'), 'wgMFThumbnailSizes' => array('tiny' => MobilePage::TINY_IMAGE_WIDTH, 'small' => MobilePage::SMALL_IMAGE_WIDTH), 'wgMFContentNamespace' => $config->get('MFContentNamespace'), 'wgMFEditorOptions' => $config->get('MFEditorOptions'), 'wgMFLicense' => SkinMinerva::getLicense('editor'), 'wgMFUploadLicenseLink' => $wgMFUploadLicense['link']); // add CodeMirror specific things, if it is installed (for CodeMirror editor) if (class_exists('CodeMirrorHooks')) { $vars += CodeMirrorHooks::getGlobalVariables(MobileContext::singleton()); $vars['wgMFCodeMirror'] = true; } return true; }
/** * Modify mobile frontend modules to hook into the watchstar * @param SkinMinerva $skin * @param array $modules Resource loader modules * @return boolean */ public static function onSkinMinervaDefaultModules($skin, &$modules) { // Gather code should be loaded unconditionally since it also controls revealing the menu item. $modules['watch'] = array('ext.gather.init'); // FIXME: abuse of the hook. $skin->getOutput()->addModuleStyles('ext.gather.menu.icon'); return true; }
/** * @inheritdoc */ protected function getHeaderHtml($data) { $templateParser = new TemplateParser(__DIR__); $args = array('siteName' => SkinMinerva::getSitename(), 'mobileMenuClass' => MobileUI::iconClass('search-gray', 'element', 'header-icon'), 'mobileMenuLink' => SpecialPage::getTitleFor('MobileMenu')->getLocalUrl(), 'mobileMenuTitle' => wfMessage('mobile-frontend-main-menu')->parse(), 'secondaryButton' => $data['secondaryButton']); return $templateParser->processTemplate('header', $args); }
/** * Prepare warnings for mobile devices * @param BaseTemplate $tpl */ protected function prepareWarnings(BaseTemplate $tpl) { parent::prepareWarnings($tpl); $out = $this->getOutput(); if ($out->getRequest()->getText('oldid')) { $subtitle = $out->getSubtitle(); $tpl->set('_old_revision_warning', Html::openElement('div', array('class' => 'alert warning')) . Html::openElement('p', array()) . Html::element('a', array('href' => '#editor/0'), $this->msg('mobile-frontend-view-source')->text()) . Html::closeElement('p') . $subtitle . Html::closeElement('div')); } }