예제 #1
0
 /**
  * @param $skin Skin
  * @param $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = Linker::linkKnown($nt, htmlspecialchars($text));
     $token = WatchAction::getWatchToken($nt, $this->getUser());
     $wlink = Linker::linkKnown($nt, wfMsgHtml('watch'), array(), array('action' => 'watch', 'token' => $token));
     return $this->getLanguage()->specialList($plink, $wlink);
 }
 /**
  * @param Skin $skin
  * @param object $result Result row
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = Title::makeTitleSafe($result->namespace, $result->title);
     if (!$nt) {
         return Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $result->namespace, $result->title));
     }
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = Linker::linkKnown($nt, htmlspecialchars($text));
     $token = WatchAction::getWatchToken($nt, $this->getUser());
     $wlink = Linker::linkKnown($nt, $this->msg('watch')->escaped(), array(), array('action' => 'watch', 'token' => $token));
     return $this->getLanguage()->specialList($plink, $wlink);
 }
예제 #3
0
파일: View.php 프로젝트: Rikuforever/wiki
 /**
  * @param $thread Thread
  */
 function topLevelThreadCommands($thread)
 {
     $commands = array();
     $commands['history'] = array('label' => wfMessage('history_short')->parse(), 'href' => self::permalinkUrl($thread, 'thread_history'), 'enabled' => true);
     if ($this->user->isAllowed('move')) {
         $move_href = SpecialPage::getTitleFor('MoveThread', $thread->title()->getPrefixedText())->getLocalURL();
         $commands['move'] = array('label' => wfMessage('lqt-movethread')->parse(), 'href' => $move_href, 'enabled' => true);
     }
     if ($this->user->isAllowed('protect')) {
         $protect_href = $thread->title()->getLocalURL('action=protect');
         // Check if it's already protected
         if (!$thread->title()->isProtected()) {
             $label = wfMessage('protect')->parse();
         } else {
             $label = wfMessage('unprotect')->parse();
         }
         $commands['protect'] = array('label' => $label, 'href' => $protect_href, 'enabled' => true);
     }
     if (!$this->user->isAnon() && !$thread->title()->userIsWatching()) {
         $commands['watch'] = array('label' => wfMessage('watch')->parse(), 'href' => self::permalinkUrlWithQuery($thread, array('action' => 'watch', 'token' => WatchAction::getWatchToken($thread->title(), $this->user, 'watch'))), 'enabled' => true);
     } elseif (!$this->user->isAnon()) {
         $commands['unwatch'] = array('label' => wfMessage('unwatch')->parse(), 'href' => self::permalinkUrlWithQuery($thread, array('action' => 'unwatch', 'token' => WatchAction::getWatchToken($thread->title(), $this->user, 'unwatch'))), 'enabled' => true);
     }
     if (LqtDispatch::isLqtPage($thread->getTitle())) {
         $summarizeUrl = self::permalinkUrl($thread, 'summarize', $thread->id());
         $commands['summarize'] = array('label' => wfMessage('lqt_summarize_link')->parse(), 'href' => $summarizeUrl, 'enabled' => true);
     }
     Hooks::run('LiquidThreadsTopLevelCommands', array($thread, &$commands));
     return $commands;
 }
예제 #4
0
 /**
  * a structured array of links usually used for the tabs in a skin
  *
  * There are 4 standard sections
  * namespaces: Used for namespace tabs like special, page, and talk namespaces
  * views: Used for primary page views like read, edit, history
  * actions: Used for most extra page actions like deletion, protection, etc...
  * variants: Used to list the language variants for the page
  *
  * Each section's value is a key/value array of links for that section.
  * The links themselves have these common keys:
  * - class: The css classes to apply to the tab
  * - text: The text to display on the tab
  * - href: The href for the tab to point to
  * - rel: An optional rel= for the tab's link
  * - redundant: If true the tab will be dropped in skins using content_actions
  *   this is useful for tabs like "Read" which only have meaning in skins that
  *   take special meaning from the grouped structure of content_navigation
  *
  * Views also have an extra key which can be used:
  * - primary: If this is not true skins like vector may try to hide the tab
  *            when the user has limited space in their browser window
  *
  * content_navigation using code also expects these ids to be present on the
  * links, however these are usually automatically generated by SkinTemplate
  * itself and are not necessary when using a hook. The only things these may
  * matter to are people modifying content_navigation after it's initial creation:
  * - id: A "preferred" id, most skins are best off outputting this preferred
  *   id for best compatibility.
  * - tooltiponly: This is set to true for some tabs in cases where the system
  *   believes that the accesskey should not be added to the tab.
  *
  * @return array
  */
 protected function buildContentNavigationUrls()
 {
     global $wgDisableLangConversion;
     // Display tabs for the relevant title rather than always the title itself
     $title = $this->getRelevantTitle();
     $onPage = $title->equals($this->getTitle());
     $out = $this->getOutput();
     $request = $this->getRequest();
     $user = $this->getUser();
     $content_navigation = array('namespaces' => array(), 'views' => array(), 'actions' => array(), 'variants' => array());
     // parameters
     $action = $request->getVal('action', 'view');
     $userCanRead = $title->quickUserCan('read', $user);
     $preventActiveTabs = false;
     Hooks::run('SkinTemplatePreventOtherActiveTabs', array(&$this, &$preventActiveTabs));
     // Checks if page is some kind of content
     if ($title->canExist()) {
         // Gets page objects for the related namespaces
         $subjectPage = $title->getSubjectPage();
         $talkPage = $title->getTalkPage();
         // Determines if this is a talk page
         $isTalk = $title->isTalkPage();
         // Generates XML IDs from namespace names
         $subjectId = $title->getNamespaceKey('');
         if ($subjectId == 'main') {
             $talkId = 'talk';
         } else {
             $talkId = "{$subjectId}_talk";
         }
         $skname = $this->skinname;
         // Adds namespace links
         $subjectMsg = array("nstab-{$subjectId}");
         if ($subjectPage->isMainPage()) {
             array_unshift($subjectMsg, 'mainpage-nstab');
         }
         $content_navigation['namespaces'][$subjectId] = $this->tabAction($subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs, '', $userCanRead);
         $content_navigation['namespaces'][$subjectId]['context'] = 'subject';
         $content_navigation['namespaces'][$talkId] = $this->tabAction($talkPage, array("nstab-{$talkId}", 'talk'), $isTalk && !$preventActiveTabs, '', $userCanRead);
         $content_navigation['namespaces'][$talkId]['context'] = 'talk';
         if ($userCanRead) {
             $isForeignFile = $title->inNamespace(NS_FILE) && $this->canUseWikiPage() && $this->getWikiPage() instanceof WikiFilePage && !$this->getWikiPage()->isLocal();
             // Adds view view link
             if ($title->exists() || $isForeignFile) {
                 $content_navigation['views']['view'] = $this->tabAction($isTalk ? $talkPage : $subjectPage, array("{$skname}-view-view", 'view'), $onPage && ($action == 'view' || $action == 'purge'), '', true);
                 // signal to hide this from simple content_actions
                 $content_navigation['views']['view']['redundant'] = true;
             }
             // If it is a non-local file, show a link to the file in its own repository
             if ($isForeignFile) {
                 $file = $this->getWikiPage()->getFile();
                 $content_navigation['views']['view-foreign'] = array('class' => '', 'text' => wfMessageFallback("{$skname}-view-foreign", 'view-foreign')->setContext($this->getContext())->params($file->getRepo()->getDisplayName())->text(), 'href' => $file->getDescriptionUrl(), 'primary' => false);
             }
             // Checks if user can edit the current page if it exists or create it otherwise
             if ($title->quickUserCan('edit', $user) && ($title->exists() || $title->quickUserCan('create', $user))) {
                 // Builds CSS class for talk page links
                 $isTalkClass = $isTalk ? ' istalk' : '';
                 // Whether the user is editing the page
                 $isEditing = $onPage && ($action == 'edit' || $action == 'submit');
                 // Whether to show the "Add a new section" tab
                 // Checks if this is a current rev of talk page and is not forced to be hidden
                 $showNewSection = !$out->forceHideNewSectionLink() && ($isTalk && $this->isRevisionCurrent() || $out->showNewSectionLink());
                 $section = $request->getVal('section');
                 if ($title->exists() || $title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !== false) {
                     $msgKey = $isForeignFile ? 'edit-local' : 'edit';
                 } else {
                     $msgKey = $isForeignFile ? 'create-local' : 'create';
                 }
                 $content_navigation['views']['edit'] = array('class' => ($isEditing && ($section !== 'new' || !$showNewSection) ? 'selected' : '') . $isTalkClass, 'text' => wfMessageFallback("{$skname}-view-{$msgKey}", $msgKey)->setContext($this->getContext())->text(), 'href' => $title->getLocalURL($this->editUrlOptions()), 'primary' => !$isForeignFile);
                 // section link
                 if ($showNewSection) {
                     // Adds new section link
                     //$content_navigation['actions']['addsection']
                     $content_navigation['views']['addsection'] = array('class' => $isEditing && $section == 'new' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-addsection", 'addsection')->setContext($this->getContext())->text(), 'href' => $title->getLocalURL('action=edit&section=new'));
                 }
                 // Checks if the page has some kind of viewable content
             } elseif ($title->hasSourceText()) {
                 // Adds view source view link
                 $content_navigation['views']['viewsource'] = array('class' => $onPage && $action == 'edit' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-viewsource", 'viewsource')->setContext($this->getContext())->text(), 'href' => $title->getLocalURL($this->editUrlOptions()), 'primary' => true);
             }
             // Checks if the page exists
             if ($title->exists()) {
                 // Adds history view link
                 $content_navigation['views']['history'] = array('class' => $onPage && $action == 'history' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-view-history", 'history_short')->setContext($this->getContext())->text(), 'href' => $title->getLocalURL('action=history'));
                 if ($title->quickUserCan('delete', $user)) {
                     $content_navigation['actions']['delete'] = array('class' => $onPage && $action == 'delete' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-delete", 'delete')->setContext($this->getContext())->text(), 'href' => $title->getLocalURL('action=delete'));
                 }
                 if ($title->quickUserCan('move', $user)) {
                     $moveTitle = SpecialPage::getTitleFor('Movepage', $title->getPrefixedDBkey());
                     $content_navigation['actions']['move'] = array('class' => $this->getTitle()->isSpecial('Movepage') ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-move", 'move')->setContext($this->getContext())->text(), 'href' => $moveTitle->getLocalURL());
                 }
             } else {
                 // article doesn't exist or is deleted
                 if ($user->isAllowed('deletedhistory')) {
                     $n = $title->isDeleted();
                     if ($n) {
                         $undelTitle = SpecialPage::getTitleFor('Undelete', $title->getPrefixedDBkey());
                         // If the user can't undelete but can view deleted
                         // history show them a "View .. deleted" tab instead.
                         $msgKey = $user->isAllowed('undelete') ? 'undelete' : 'viewdeleted';
                         $content_navigation['actions']['undelete'] = array('class' => $this->getTitle()->isSpecial('Undelete') ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$msgKey}", "{$msgKey}_short")->setContext($this->getContext())->numParams($n)->text(), 'href' => $undelTitle->getLocalURL());
                     }
                 }
             }
             if ($title->quickUserCan('protect', $user) && $title->getRestrictionTypes() && MWNamespace::getRestrictionLevels($title->getNamespace(), $user) !== array('')) {
                 $mode = $title->isProtected() ? 'unprotect' : 'protect';
                 $content_navigation['actions'][$mode] = array('class' => $onPage && $action == $mode ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$mode}", $mode)->setContext($this->getContext())->text(), 'href' => $title->getLocalURL("action={$mode}"));
             }
             // Checks if the user is logged in
             if ($this->loggedin && $user->isAllowedAll('viewmywatchlist', 'editmywatchlist')) {
                 /**
                  * The following actions use messages which, if made particular to
                  * the any specific skins, would break the Ajax code which makes this
                  * action happen entirely inline. OutputPage::getJSVars
                  * defines a set of messages in a javascript object - and these
                  * messages are assumed to be global for all skins. Without making
                  * a change to that procedure these messages will have to remain as
                  * the global versions.
                  */
                 $mode = $user->isWatched($title) ? 'unwatch' : 'watch';
                 $token = WatchAction::getWatchToken($title, $user, $mode);
                 $content_navigation['actions'][$mode] = array('class' => $onPage && ($action == 'watch' || $action == 'unwatch') ? 'selected' : false, 'text' => $this->msg($mode)->text(), 'href' => $title->getLocalURL(array('action' => $mode, 'token' => $token)));
             }
         }
         Hooks::run('SkinTemplateNavigation', array(&$this, &$content_navigation));
         if ($userCanRead && !$wgDisableLangConversion) {
             $pageLang = $title->getPageLanguage();
             // Gets list of language variants
             $variants = $pageLang->getVariants();
             // Checks that language conversion is enabled and variants exist
             // And if it is not in the special namespace
             if (count($variants) > 1) {
                 // Gets preferred variant (note that user preference is
                 // only possible for wiki content language variant)
                 $preferred = $pageLang->getPreferredVariant();
                 if (Action::getActionName($this) === 'view') {
                     $params = $request->getQueryValues();
                     unset($params['title']);
                 } else {
                     $params = array();
                 }
                 // Loops over each variant
                 foreach ($variants as $code) {
                     // Gets variant name from language code
                     $varname = $pageLang->getVariantname($code);
                     // Appends variant link
                     $content_navigation['variants'][] = array('class' => $code == $preferred ? 'selected' : false, 'text' => $varname, 'href' => $title->getLocalURL(array('variant' => $code) + $params), 'lang' => wfBCP47($code), 'hreflang' => wfBCP47($code));
                 }
             }
         }
     } else {
         // If it's not content, it's got to be a special page
         $content_navigation['namespaces']['special'] = array('class' => 'selected', 'text' => $this->msg('nstab-special')->text(), 'href' => $request->getRequestURL(), 'context' => 'subject');
         Hooks::run('SkinTemplateNavigation::SpecialPage', array(&$this, &$content_navigation));
     }
     // Equiv to SkinTemplateContentActions
     Hooks::run('SkinTemplateNavigation::Universal', array(&$this, &$content_navigation));
     // Setup xml ids and tooltip info
     foreach ($content_navigation as $section => &$links) {
         foreach ($links as $key => &$link) {
             $xmlID = $key;
             if (isset($link['context']) && $link['context'] == 'subject') {
                 $xmlID = 'ca-nstab-' . $xmlID;
             } elseif (isset($link['context']) && $link['context'] == 'talk') {
                 $xmlID = 'ca-talk';
             } elseif ($section == 'variants') {
                 $xmlID = 'ca-varlang-' . $xmlID;
             } else {
                 $xmlID = 'ca-' . $xmlID;
             }
             $link['id'] = $xmlID;
         }
     }
     # We don't want to give the watch tab an accesskey if the
     # page is being edited, because that conflicts with the
     # accesskey on the watch checkbox.  We also don't want to
     # give the edit tab an accesskey, because that's fairly
     # superfluous and conflicts with an accesskey (Ctrl-E) often
     # used for editing in Safari.
     if (in_array($action, array('edit', 'submit'))) {
         if (isset($content_navigation['views']['edit'])) {
             $content_navigation['views']['edit']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['watch'])) {
             $content_navigation['actions']['watch']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['unwatch'])) {
             $content_navigation['actions']['unwatch']['tooltiponly'] = true;
         }
     }
     return $content_navigation;
 }
예제 #5
0
 function watchThisPage()
 {
     global $wgOut, $wgUser;
     ++$this->mWatchLinkNum;
     // Cache
     $title = $this->getSkin()->getTitle();
     if ($wgOut->isArticleRelated()) {
         if ($wgUser->isWatched($title)) {
             $text = wfMessage('unwatchthispage')->text();
             $query = array('action' => 'unwatch', 'token' => UnwatchAction::getUnwatchToken($title, $wgUser));
             $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
         } else {
             $text = wfMessage('watchthispage')->text();
             $query = array('action' => 'watch', 'token' => WatchAction::getWatchToken($title, $wgUser));
             $id = 'mw-watch-link' . $this->mWatchLinkNum;
         }
         $s = Linker::linkKnown($title, $text, array('id' => $id), $query);
     } else {
         $s = wfMessage('notanarticle')->text();
     }
     return $s;
 }
예제 #6
0
 /**
  * a structured array of links usually used for the tabs in a skin
  *
  * There are 4 standard sections
  * namespaces: Used for namespace tabs like special, page, and talk namespaces
  * views: Used for primary page views like read, edit, history
  * actions: Used for most extra page actions like deletion, protection, etc...
  * variants: Used to list the language variants for the page
  *
  * Each section's value is a key/value array of links for that section.
  * The links themseves have these common keys:
  * - class: The css classes to apply to the tab
  * - text: The text to display on the tab
  * - href: The href for the tab to point to
  * - rel: An optional rel= for the tab's link
  * - redundant: If true the tab will be dropped in skins using content_actions
  *   this is useful for tabs like "Read" which only have meaning in skins that
  *   take special meaning from the grouped structure of content_navigation
  *
  * Views also have an extra key which can be used:
  * - primary: If this is not true skins like vector may try to hide the tab
  *            when the user has limited space in their browser window
  *
  * content_navigation using code also expects these ids to be present on the
  * links, however these are usually automatically generated by SkinTemplate
  * itself and are not necessary when using a hook. The only things these may
  * matter to are people modifying content_navigation after it's initial creation:
  * - id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility
  * - tooltiponly: This is set to true for some tabs in cases where the system
  *                believes that the accesskey should not be added to the tab.
  *
  * @return array
  */
 protected function buildContentNavigationUrls(OutputPage $out)
 {
     global $wgContLang, $wgLang, $wgUser, $wgRequest;
     global $wgDisableLangConversion;
     wfProfileIn(__METHOD__);
     $title = $this->getRelevantTitle();
     // Display tabs for the relevant title rather than always the title itself
     $onPage = $title->equals($this->getTitle());
     $content_navigation = array('namespaces' => array(), 'views' => array(), 'actions' => array(), 'variants' => array());
     // parameters
     $action = $wgRequest->getVal('action', 'view');
     $section = $wgRequest->getVal('section');
     $userCanRead = $title->userCanRead();
     $skname = $this->skinname;
     $preventActiveTabs = false;
     wfRunHooks('SkinTemplatePreventOtherActiveTabs', array(&$this, &$preventActiveTabs));
     // Checks if page is some kind of content
     if ($title->canExist()) {
         // Gets page objects for the related namespaces
         $subjectPage = $title->getSubjectPage();
         $talkPage = $title->getTalkPage();
         // Determines if this is a talk page
         $isTalk = $title->isTalkPage();
         // Generates XML IDs from namespace names
         $subjectId = $title->getNamespaceKey('');
         if ($subjectId == 'main') {
             $talkId = 'talk';
         } else {
             $talkId = "{$subjectId}_talk";
         }
         // Adds namespace links
         $subjectMsg = array("nstab-{$subjectId}");
         if ($subjectPage->isMainPage()) {
             array_unshift($subjectMsg, 'mainpage-nstab');
         }
         $content_navigation['namespaces'][$subjectId] = $this->tabAction($subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs, '', $userCanRead);
         $content_navigation['namespaces'][$subjectId]['context'] = 'subject';
         $content_navigation['namespaces'][$talkId] = $this->tabAction($talkPage, array("nstab-{$talkId}", 'talk'), $isTalk && !$preventActiveTabs, '', $userCanRead);
         $content_navigation['namespaces'][$talkId]['context'] = 'talk';
         // Adds view view link
         if ($title->exists() && $userCanRead) {
             $content_navigation['views']['view'] = $this->tabAction($isTalk ? $talkPage : $subjectPage, array("{$skname}-view-view", 'view'), $onPage && ($action == 'view' || $action == 'purge'), '', true);
             $content_navigation['views']['view']['redundant'] = true;
             // signal to hide this from simple content_actions
         }
         wfProfileIn(__METHOD__ . '-edit');
         // Checks if user can...
         if ($userCanRead && $title->quickUserCan('edit') && ($title->exists() || $title->quickUserCan('create'))) {
             // Builds CSS class for talk page links
             $isTalkClass = $isTalk ? ' istalk' : '';
             // Determines if we're in edit mode
             $selected = $onPage && ($action == 'edit' || $action == 'submit') && $section != 'new';
             $msgKey = $title->exists() || $title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !== false ? "edit" : "create";
             $content_navigation['views']['edit'] = array('class' => ($selected ? 'selected' : '') . $isTalkClass, 'text' => wfMessageFallback("{$skname}-view-{$msgKey}", $msgKey)->text(), 'href' => $title->getLocalURL($this->editUrlOptions()), 'primary' => true);
             // Checks if this is a current rev of talk page and we should show a new
             // section link
             if ($isTalk && $this->isRevisionCurrent() || $out->showNewSectionLink()) {
                 // Checks if we should ever show a new section link
                 if (!$out->forceHideNewSectionLink()) {
                     // Adds new section link
                     //$content_navigation['actions']['addsection']
                     $content_navigation['views']['addsection'] = array('class' => $section == 'new' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-addsection", 'addsection')->text(), 'href' => $title->getLocalURL('action=edit&section=new'));
                 }
             }
             // Checks if the page has some kind of viewable content
         } elseif ($title->hasSourceText() && $userCanRead) {
             // Adds view source view link
             $content_navigation['views']['viewsource'] = array('class' => $onPage && $action == 'edit' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-viewsource", 'viewsource')->text(), 'href' => $title->getLocalURL($this->editUrlOptions()), 'primary' => true);
         }
         wfProfileOut(__METHOD__ . '-edit');
         wfProfileIn(__METHOD__ . '-live');
         // Checks if the page exists
         if ($title->exists() && $userCanRead) {
             // Adds history view link
             $content_navigation['views']['history'] = array('class' => $onPage && $action == 'history' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-view-history", 'history_short')->text(), 'href' => $title->getLocalURL('action=history'), 'rel' => 'archives');
             if ($wgUser->isAllowed('delete')) {
                 $content_navigation['actions']['delete'] = array('class' => $onPage && $action == 'delete' ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-delete", 'delete')->text(), 'href' => $title->getLocalURL('action=delete'));
             }
             if ($title->quickUserCan('move')) {
                 $moveTitle = SpecialPage::getTitleFor('Movepage', $title->getPrefixedDBkey());
                 $content_navigation['actions']['move'] = array('class' => $this->getTitle()->isSpecial('Movepage') ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-move", 'move')->text(), 'href' => $moveTitle->getLocalURL());
             }
             if ($title->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed('protect')) {
                 $mode = !$title->isProtected() ? 'protect' : 'unprotect';
                 $content_navigation['actions'][$mode] = array('class' => $onPage && $action == $mode ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$mode}", $mode)->text(), 'href' => $title->getLocalURL("action={$mode}"));
             }
         } else {
             // article doesn't exist or is deleted
             if ($wgUser->isAllowed('deletedhistory')) {
                 $n = $title->isDeleted();
                 if ($n) {
                     $undelTitle = SpecialPage::getTitleFor('Undelete');
                     // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead
                     $msgKey = $wgUser->isAllowed('undelete') ? 'undelete' : 'viewdeleted';
                     $content_navigation['actions']['undelete'] = array('class' => $this->getTitle()->isSpecial('Undelete') ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$msgKey}", "{$msgKey}_short")->params($wgLang->formatNum($n))->text(), 'href' => $undelTitle->getLocalURL(array('target' => $title->getPrefixedDBkey())));
                 }
             }
             if ($title->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed('protect')) {
                 $mode = !$title->getRestrictions('create') ? 'protect' : 'unprotect';
                 $content_navigation['actions'][$mode] = array('class' => $onPage && $action == $mode ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$mode}", $mode)->text(), 'href' => $title->getLocalURL("action={$mode}"));
             }
         }
         wfProfileOut(__METHOD__ . '-live');
         // Checks if the user is logged in
         if ($this->loggedin) {
             /**
              * The following actions use messages which, if made particular to
              * the any specific skins, would break the Ajax code which makes this
              * action happen entirely inline. Skin::makeGlobalVariablesScript
              * defines a set of messages in a javascript object - and these
              * messages are assumed to be global for all skins. Without making
              * a change to that procedure these messages will have to remain as
              * the global versions.
              */
             $mode = $title->userIsWatching() ? 'unwatch' : 'watch';
             $token = WatchAction::getWatchToken($title, $wgUser, $mode);
             $content_navigation['actions'][$mode] = array('class' => $onPage && ($action == 'watch' || $action == 'unwatch') ? 'selected' : false, 'text' => wfMsg($mode), 'href' => $title->getLocalURL(array('action' => $mode, 'token' => $token)));
         }
         wfRunHooks('SkinTemplateNavigation', array(&$this, &$content_navigation));
     } else {
         // If it's not content, it's got to be a special page
         $content_navigation['namespaces']['special'] = array('class' => 'selected', 'text' => wfMsg('nstab-special'), 'href' => $wgRequest->getRequestURL(), 'context' => 'subject');
         wfRunHooks('SkinTemplateNavigation::SpecialPage', array(&$this, &$content_navigation));
     }
     // Gets list of language variants
     $variants = $wgContLang->getVariants();
     // Checks that language conversion is enabled and variants exist
     if (!$wgDisableLangConversion && count($variants) > 1) {
         // Gets preferred variant
         $preferred = $wgContLang->getPreferredVariant();
         // Loops over each variant
         foreach ($variants as $code) {
             // Gets variant name from language code
             $varname = $wgContLang->getVariantname($code);
             // Checks if the variant is marked as disabled
             if ($varname == 'disable') {
                 // Skips this variant
                 continue;
             }
             // Appends variant link
             $content_navigation['variants'][] = array('class' => $code == $preferred ? 'selected' : false, 'text' => $varname, 'href' => $title->getLocalURL('', $code));
         }
     }
     // Equiv to SkinTemplateContentActions
     wfRunHooks('SkinTemplateNavigation::Universal', array(&$this, &$content_navigation));
     // Setup xml ids and tooltip info
     foreach ($content_navigation as $section => &$links) {
         foreach ($links as $key => &$link) {
             $xmlID = $key;
             if (isset($link['context']) && $link['context'] == 'subject') {
                 $xmlID = 'ca-nstab-' . $xmlID;
             } elseif (isset($link['context']) && $link['context'] == 'talk') {
                 $xmlID = 'ca-talk';
             } elseif ($section == "variants") {
                 $xmlID = 'ca-varlang-' . $xmlID;
             } else {
                 $xmlID = 'ca-' . $xmlID;
             }
             $link['id'] = $xmlID;
         }
     }
     # We don't want to give the watch tab an accesskey if the
     # page is being edited, because that conflicts with the
     # accesskey on the watch checkbox.  We also don't want to
     # give the edit tab an accesskey, because that's fairly su-
     # perfluous and conflicts with an accesskey (Ctrl-E) often
     # used for editing in Safari.
     if (in_array($action, array('edit', 'submit'))) {
         if (isset($content_navigation['views']['edit'])) {
             $content_navigation['views']['edit']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['watch'])) {
             $content_navigation['actions']['watch']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['unwatch'])) {
             $content_navigation['actions']['unwatch']['tooltiponly'] = true;
         }
     }
     wfProfileOut(__METHOD__);
     return $content_navigation;
 }