/**
     * Prepares links used in the mobile footer
     * @param Skin $sk
     * @param QuickTemplate $tpl
     * @param MobileContext $ctx
     * @param Title $title
     * @param WebRequest $req
     * @return QuickTemplate
     */
    protected static function mobileFooter($sk, $tpl, $ctx, $title, $req)
    {
        $url = $sk->getOutput()->getProperty('desktopUrl');
        if ($url) {
            $url = wfAppendQuery($url, 'mobileaction=toggle_view_desktop');
        } else {
            $url = $title->getLocalUrl($req->appendQueryValue('mobileaction', 'toggle_view_desktop', true));
        }
        $url = htmlspecialchars($ctx->getDesktopUrl(wfExpandUrl($url, PROTO_RELATIVE)));
        $desktop = wfMessage('mobile-frontend-view-desktop')->escaped();
        $mobile = wfMessage('mobile-frontend-view-mobile')->escaped();
        $sitename = self::getSitename(true);
        $switcherHtml = <<<HTML
<h2>{$sitename}</h2>
<ul>
\t<li>{$mobile}</li><li><a id="mw-mf-display-toggle" href="{$url}">{$desktop}</a></li>
</ul>
HTML;
        // Generate the licensing text displayed in the footer of each page.
        // See Skin::getCopyright for desktop equivalent.
        $license = self::getLicense('footer');
        if (isset($license['link']) && $license['link']) {
            $licenseText = $sk->msg($license['msg'])->rawParams($license['link'])->text();
        } else {
            $licenseText = '';
        }
        // Enable extensions to add links to footer in Mobile view, too - bug 66350
        Hooks::run('MobileSiteOutputPageBeforeExec', array(&$sk, &$tpl));
        // FIXME: Deprecate this hook.
        Hooks::run('SkinMinervaOutputPageBeforeExec', array(&$sk, &$tpl), '1.26');
        $tpl->set('mobile-switcher', $switcherHtml);
        $tpl->set('mobile-license', $licenseText);
        $tpl->set('privacy', $sk->footerLink('mobile-frontend-privacy-link-text', 'privacypage'));
        $tpl->set('terms-use', self::getTermsLink($sk));
        $tpl->set('footerlinks', array('info' => array('mobile-switcher', 'mobile-license'), 'places' => array('terms-use', 'privacy')));
        return $tpl;
    }
 /**
  * Changes the section edit links to add a VE edit link.
  *
  * This is attached to the MediaWiki 'SkinEditSectionLinks' hook.
  *
  * @param $skin Skin
  * @param $title Title
  * @param $section string
  * @param $tooltip string
  * @param $result array
  * @param $lang Language
  * @return bool true
  */
 public static function onSkinEditSectionLinks(Skin $skin, Title $title, $section, $tooltip, &$result, $lang)
 {
     // Only do this if the user has VE enabled
     // (and we're not in parserTests)
     // (and we're not on a foreign file description page)
     if (isset($GLOBALS['wgVisualEditorInParserTests']) || !$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable') || $title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
         return true;
     }
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     $tabMessages = $config->get('VisualEditorTabMessages');
     $veEditSection = $tabMessages['editsection'] !== null ? $tabMessages['editsection'] : 'editsection';
     $sourceEditSection = $tabMessages['editsectionsource'] !== null ? $tabMessages['editsectionsource'] : 'editsection';
     $result['editsection']['text'] = $skin->msg($sourceEditSection)->inLanguage($lang)->text();
     $veLink = array('text' => $skin->msg($veEditSection)->inLanguage($lang)->text(), 'targetTitle' => $title, 'attribs' => $result['editsection']['attribs'] + array('class' => 'mw-editsection-visualeditor'), 'query' => array('veaction' => 'edit', 'vesection' => $section), 'options' => array('noclasses', 'known'));
     $result['veeditsection'] = $veLink;
     if ($config->get('VisualEditorTabPosition') === 'before') {
         krsort($result);
         // TODO: This will probably cause weird ordering if any other extensions added something already.
         // ... wfArrayInsertBefore?
     }
     return true;
 }
 /**
  * Converts the edit tab (if exists) for translation pages to translate tab.
  * Hook: SkinTemplateNavigation
  * @since 2013.06
  */
 static function translateTab(Skin $skin, array &$tabs)
 {
     $title = $skin->getTitle();
     $handle = new MessageHandle($title);
     $code = $handle->getCode();
     $page = TranslatablePage::isTranslationPage($title);
     if (!$page) {
         return true;
     }
     // The source language has a subpage too, but cannot be translated
     if ($page->getSourceLanguageCode() === $code) {
         return true;
     }
     if (isset($tabs['views']['edit'])) {
         $tabs['views']['edit']['text'] = $skin->msg('tpt-tab-translate')->text();
         $tabs['views']['edit']['href'] = $page->getTranslationUrl($code);
     }
     return true;
 }
 /**
  * Changes the section edit links to add a VE edit link.
  *
  * This is attached to the MediaWiki 'SkinEditSectionLinks' hook.
  *
  * @param $skin Skin
  * @param $title Title
  * @param $section string
  * @param $tooltip string
  * @param $result array
  * @param $lang Language
  * @return bool true
  */
 public static function onSkinEditSectionLinks(Skin $skin, Title $title, $section, $tooltip, &$result, $lang)
 {
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     // Exit if we're using the single edit tab.
     if ($config->get('VisualEditorUseSingleEditTab') && $skin->getUser()->getOption('visualeditor-tabs') !== 'multi-tab') {
         return true;
     }
     // Exit if we're in parserTests
     if (isset($GLOBALS['wgVisualEditorInParserTests'])) {
         return true;
     }
     // Exit if the user doesn't have VE enabled
     if (!$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable') || $skin->getUser()->getOption('visualeditor-autodisable') || $config->get('VisualEditorDisableForAnons') && $skin->getUser()->isAnon()) {
         return true;
     }
     // Exit if we're on a foreign file description page
     if ($title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
         return true;
     }
     $tabMessages = $config->get('VisualEditorTabMessages');
     $sourceEditSection = $tabMessages['editsectionsource'] !== null ? $tabMessages['editsectionsource'] : 'editsection';
     $result['editsection']['text'] = $skin->msg($sourceEditSection)->inLanguage($lang)->text();
     $availableNamespaces = $config->get('VisualEditorAvailableNamespaces');
     // add VE edit section in VE available namespaces
     if ($title->inNamespaces(array_keys(array_filter($availableNamespaces)))) {
         $veEditSection = $tabMessages['editsection'] !== null ? $tabMessages['editsection'] : 'editsection';
         $veLink = array('text' => $skin->msg($veEditSection)->inLanguage($lang)->text(), 'targetTitle' => $title, 'attribs' => $result['editsection']['attribs'] + array('class' => 'mw-editsection-visualeditor'), 'query' => array('veaction' => 'edit', 'vesection' => $section), 'options' => array('noclasses', 'known'));
         $result['veeditsection'] = $veLink;
         if ($config->get('VisualEditorTabPosition') === 'before') {
             krsort($result);
             // TODO: This will probably cause weird ordering if any other extensions added something
             // already.
             // ... wfArrayInsertBefore?
         }
     }
     return true;
 }