70 function setupTemplate( $classname, $repository =
false, $cache_dir =
false ) {
71 return new $classname( $this->
getConfig() );
88 foreach ( $this->
getOutput()->getLanguageLinks() as $languageLinkText ) {
89 $class =
'interlanguage-link interwiki-' . explode(
':', $languageLinkText, 2 )[0];
91 $languageLinkTitle = Title::newFromText( $languageLinkText );
92 if ( $languageLinkTitle ) {
93 $ilInterwikiCode = $languageLinkTitle->getInterwiki();
94 $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
96 if ( strval( $ilLangName ) ===
'' ) {
97 $ilDisplayTextMsg =
wfMessage(
"interlanguage-link-$ilInterwikiCode" );
98 if ( !$ilDisplayTextMsg->isDisabled() ) {
100 $ilLangName = $ilDisplayTextMsg->text();
103 $ilLangName = $languageLinkText;
112 $ilLangLocalName = Language::fetchLanguageName(
117 $languageLinkTitleText = $languageLinkTitle->getText();
118 if ( $ilLangLocalName ===
'' ) {
119 $ilFriendlySiteName =
wfMessage(
"interlanguage-link-sitename-$ilInterwikiCode" );
120 if ( !$ilFriendlySiteName->isDisabled() ) {
121 if ( $languageLinkTitleText ===
'' ) {
123 'interlanguage-link-title-nonlangonly',
124 $ilFriendlySiteName->text()
128 'interlanguage-link-title-nonlang',
129 $languageLinkTitleText,
130 $ilFriendlySiteName->text()
137 $ilTitle = $languageLinkTitle->getInterwiki() .
138 ":$languageLinkTitleText";
140 } elseif ( $languageLinkTitleText ===
'' ) {
142 'interlanguage-link-title-langonly',
147 'interlanguage-link-title',
148 $languageLinkTitleText,
153 $ilInterwikiCodeBCP47 = LanguageCode::bcp47( $ilInterwikiCode );
155 'href' => $languageLinkTitle->getFullURL(),
156 'text' => $ilLangName,
159 'link-class' =>
'interlanguage-link-target',
160 'lang' => $ilInterwikiCodeBCP47,
161 'hreflang' => $ilInterwikiCodeBCP47,
164 'SkinTemplateGetLanguageLink',
167 $languageLinks[] = $languageLink;
171 return $languageLinks;
181 $this->thispage = $title->getPrefixedDBkey();
182 $this->titletxt = $title->getPrefixedText();
183 $this->userpage = $user->getUserPage()->getPrefixedText();
188 unset(
$query[
'returnto'] );
189 unset(
$query[
'returntoquery'] );
192 $this->loggedin = $user->isLoggedIn();
193 $this->username = $user->getName();
195 if ( $this->loggedin ) {
196 $this->userpageUrlDetails = self::makeUrlDetails( $this->userpage );
198 # This won't be used in the standard skins, but we define it to preserve the interface
199 # To save time, we check for existence
200 $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage );
212 Profiler::instance()->setTemplated(
true );
215 if (
$out !==
null ) {
227 $res = $tpl->execute();
245 # An ID that includes the actual body text; without categories, contentSub, ...
246 $realBodyAttribs = [
'id' =>
'mw-content-text' ];
248 # Add a mw-content-ltr/rtl class to be able to style based on text
249 # direction when the content is different from the UI language (only
251 # Most information on special pages and file pages is in user language,
252 # rather than content language, so those will not get this
255 $pageLang = $title->getPageViewLanguage();
256 $realBodyAttribs[
'lang'] = $pageLang->getHtmlCode();
257 $realBodyAttribs[
'dir'] = $pageLang->getDir();
258 $realBodyAttribs[
'class'] =
'mw-content-' . $pageLang->getDir();
261 return Html::rawElement(
'div', $realBodyAttribs,
$html );
281 $tpl->set(
'title',
$out->getPageTitle() );
282 $tpl->set(
'pagetitle',
$out->getHTMLTitle() );
283 $tpl->set(
'displaytitle',
$out->mPageLinkTitle );
285 $tpl->set(
'thispage', $this->thispage );
286 $tpl->set(
'titleprefixeddbkey', $this->thispage );
287 $tpl->set(
'titletext', $title->getText() );
288 $tpl->set(
'articleid', $title->getArticleID() );
290 $tpl->set(
'isarticle',
$out->isArticle() );
293 if ( $subpagestr !==
'' ) {
294 $subpagestr =
'<span class="subpages">' . $subpagestr .
'</span>';
296 $tpl->set(
'subtitle', $subpagestr .
$out->getSubtitle() );
299 if ( $undelete ===
'' ) {
300 $tpl->set(
'undelete',
'' );
302 $tpl->set(
'undelete',
'<span class="subpages">' . $undelete .
'</span>' );
306 if (
$out->isSyndicated() ) {
308 foreach (
$out->getSyndicationLinks() as $format =>
$link ) {
311 'text' => $this->
msg(
"feed-$format" )->text(),
315 $tpl->set(
'feeds', $feeds );
317 $tpl->set(
'feeds',
false );
322 $tpl->set(
'charset',
'UTF-8' );
324 $tpl->set(
'skinname', $this->skinname );
325 $tpl->set(
'skinclass', static::class );
326 $tpl->set(
'skin', $this );
327 $tpl->set(
'stylename', $this->stylename );
328 $tpl->set(
'printable',
$out->isPrintable() );
329 $tpl->set(
'handheld',
$request->getBool(
'handheld' ) );
330 $tpl->set(
'loggedin', $this->loggedin );
331 $tpl->set(
'notspecialpage', !$title->isSpecialPage() );
333 $tpl->set(
'searchtitle', SpecialPage::getTitleFor(
'Search' )->getPrefixedDBkey() );
334 $tpl->set(
'search', trim(
$request->getVal(
'search' ) ) );
339 $tpl->set(
'logopath',
$wgLogo );
343 $userLangCode = $userLang->getHtmlCode();
344 $userLangDir = $userLang->getDir();
346 $tpl->set(
'lang', $userLangCode );
347 $tpl->set(
'dir', $userLangDir );
348 $tpl->set(
'rtl', $userLang->isRTL() );
350 $tpl->set(
'capitalizeallnouns', $userLang->capitalizeAllNouns() ?
' capitalize-all-nouns' :
'' );
351 $tpl->set(
'showjumplinks',
true );
352 $tpl->set(
'username', $this->loggedin ? $this->username : null );
353 $tpl->set(
'userpage', $this->userpage );
354 $tpl->set(
'userpageurl', $this->userpageUrlDetails[
'href'] );
355 $tpl->set(
'userlang', $userLangCode );
360 $tpl->set(
'userlangattributes',
'' );
361 $tpl->set(
'specialpageattributes',
'' ); # obsolete
364 $tpl->set(
'prebodyhtml',
'' );
366 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
368 $userLangCode !== $contLang->getHtmlCode() ||
369 $userLangDir !== $contLang->getDir()
371 $escUserlang = htmlspecialchars( $userLangCode );
372 $escUserdir = htmlspecialchars( $userLangDir );
375 $attrs =
" lang=\"$escUserlang\" dir=\"$escUserdir\"";
376 $tpl->set(
'userlangattributes', $attrs );
380 $tpl->set(
'logo', $this->
logoText() );
382 $tpl->set(
'copyright',
false );
384 $tpl->set(
'viewcount',
false );
385 $tpl->set(
'lastmod',
false );
386 $tpl->set(
'credits',
false );
387 $tpl->set(
'numberofwatchingusers',
false );
388 if ( $title->exists() ) {
389 if (
$out->isArticle() ) {
399 if (
$out->showsCopyright() ) {
408 $tpl->set(
'about', $this->
aboutLink() );
410 $tpl->set(
'footerlinks', [
413 'numberofwatchingusers',
426 foreach ( $tpl->data[
'footericons'] as $footerIconsKey => &$footerIconsBlock ) {
427 if ( count( $footerIconsBlock ) > 0 ) {
428 foreach ( $footerIconsBlock as &$footerIcon ) {
429 if ( isset( $footerIcon[
'src'] ) ) {
430 if ( !isset( $footerIcon[
'width'] ) ) {
431 $footerIcon[
'width'] = 88;
433 if ( !isset( $footerIcon[
'height'] ) ) {
434 $footerIcon[
'height'] = 31;
439 unset( $tpl->data[
'footericons'][$footerIconsKey] );
443 $tpl->set(
'indicators',
$out->getIndicators() );
449 $tpl->set(
'bodytext',
$out->mBodytext );
452 if ( count( $language_urls ) ) {
453 $tpl->set(
'language_urls', $language_urls );
455 $tpl->set(
'language_urls',
false );
462 $tpl->set(
'content_navigation', $content_navigation );
463 $tpl->set(
'content_actions', $content_actions );
472 $tpl->set(
'headelement',
$out->headElement( $this ) );
474 $tpl->set(
'debug',
'' );
479 $skinTemplate = $this;
481 if ( !Hooks::run(
'SkinTemplateOutputPageBeforeExec', [ &$skinTemplate, &$tpl ] ) ) {
482 wfDebug( __METHOD__ .
": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
487 $tpl->set(
'bodycontent', $tpl->data[
'bodytext'] );
492 $tpl->data[
'bodytext'] .= Html::rawElement(
494 [
'class' =>
'printfooter' ],
495 "\n{$tpl->data['printfooter']}"
497 $tpl->data[
'bodytext'] .= $tpl->data[
'debughtml'];
528 if ( $personalTools ===
null ) {
529 $personalTools = $tpl->getPersonalTools();
532 foreach ( $personalTools as $key => $item ) {
550 return $tpl->getPersonalTools();
598 $pageurl = $title->getLocalURL();
599 $authManager = AuthManager::singleton();
604 # Due to T34276, if a user does not have read permissions,
605 # $this->getTitle() will just give Special:Badtitle, which is
606 # not especially useful as a returnto parameter. Use the title
607 # from the request instead, if there was one.
608 if ( $this->
getUser()->isAllowed(
'read' ) ) {
611 $page = Title::newFromText(
$request->getVal(
'title',
'' ) );
613 $page =
$request->getVal(
'returnto', $page );
615 if ( strval( $page ) !==
'' ) {
616 $returnto[
'returnto'] = $page;
619 unset( $paramsArray[
'logoutToken'] );
622 $returnto[
'returntoquery'] =
$query;
626 if ( $this->loggedin ) {
627 $personal_urls[
'userpage'] = [
629 'href' => &$this->userpageUrlDetails[
'href'],
630 'class' => $this->userpageUrlDetails[
'exists'] ?
false :
'new',
631 'exists' => $this->userpageUrlDetails[
'exists'],
632 'active' => ( $this->userpageUrlDetails[
'href'] == $pageurl ),
636 $personal_urls[
'mytalk'] = [
637 'text' => $this->
msg(
'mytalk' )->text(),
638 'href' => &$usertalkUrlDetails[
'href'],
639 'class' => $usertalkUrlDetails[
'exists'] ?
false :
'new',
640 'exists' => $usertalkUrlDetails[
'exists'],
641 'active' => ( $usertalkUrlDetails[
'href'] == $pageurl )
643 $href = self::makeSpecialUrl(
'Preferences' );
644 $personal_urls[
'preferences'] = [
645 'text' => $this->
msg(
'mypreferences' )->text(),
647 'active' => ( $href == $pageurl )
650 if ( $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
651 $href = self::makeSpecialUrl(
'Watchlist' );
652 $personal_urls[
'watchlist'] = [
653 'text' => $this->
msg(
'mywatchlist' )->text(),
655 'active' => ( $href == $pageurl )
659 # We need to do an explicit check for Special:Contributions, as we
660 # have to match both the title, and the target, which could come
661 # from request values (Special:Contributions?target=Jimbo_Wales)
662 # or be specified in "sub page" form
663 # (Special:Contributions/Jimbo_Wales). The plot
664 # thickens, because the Title object is altered for special pages,
665 # so it doesn't contain the original alias-with-subpage.
666 $origTitle = Title::newFromText(
$request->getText(
'title' ) );
668 list( $spName, $spPar ) =
669 MediaWikiServices::getInstance()->getSpecialPageFactory()->
670 resolveAlias( $origTitle->getText() );
671 $active = $spName ==
'Contributions'
678 $href = self::makeSpecialUrlSubpage(
'Contributions', $this->username );
679 $personal_urls[
'mycontris'] = [
680 'text' => $this->
msg(
'mycontris' )->text(),
686 if (
$request->getSession()->canSetUser() ) {
687 $personal_urls[
'logout'] = [
688 'text' => $this->
msg(
'pt-userlogout' )->text(),
689 'href' => self::makeSpecialUrl(
'Userlogout',
692 ( $title->isSpecial(
'Preferences' ) ? [] : $returnto )
693 + [
'logoutToken' => $this->
getUser()->getEditToken(
'logoutToken', $this->
getRequest() ) ] ),
699 if ( !$authManager->canCreateAccounts() || !$authManager->canAuthenticateNow() ) {
701 $useCombinedLoginLink =
false;
704 $loginlink = $this->
getUser()->isAllowed(
'createaccount' ) && $useCombinedLoginLink
705 ?
'nav-login-createaccount'
709 'text' => $this->
msg( $loginlink )->text(),
710 'href' => self::makeSpecialUrl(
'Userlogin', $returnto ),
711 'active' => $title->isSpecial(
'Userlogin' )
712 || $title->isSpecial(
'CreateAccount' ) && $useCombinedLoginLink,
714 $createaccount_url = [
715 'text' => $this->
msg(
'pt-createaccount' )->text(),
716 'href' => self::makeSpecialUrl(
'CreateAccount', $returnto ),
717 'active' => $title->isSpecial(
'CreateAccount' ),
728 $personal_urls[
'anontalk'] = [
729 'text' => $this->
msg(
'anontalk' )->text(),
730 'href' => self::makeSpecialUrlSubpage(
'Mytalk',
false ),
733 $personal_urls[
'anoncontribs'] = [
734 'text' => $this->
msg(
'anoncontribs' )->text(),
735 'href' => self::makeSpecialUrlSubpage(
'Mycontributions',
false ),
741 $authManager->canCreateAccounts()
742 && $this->getUser()->isAllowed(
'createaccount' )
743 && !$useCombinedLoginLink
745 $personal_urls[
'createaccount'] = $createaccount_url;
748 if ( $authManager->canAuthenticateNow() ) {
752 $personal_urls[$key] = $login_url;
756 Hooks::runWithoutAbort(
'PersonalUrls', [ &$personal_urls, &$title, $this ] );
757 return $personal_urls;
774 $classes[] =
'selected';
777 if ( $checkEdit && !$title->isKnown() ) {
783 $query =
'action=edit&redlink=1';
787 $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses( $title );
792 if ( is_array( $message ) ) {
794 $message = end( $message );
796 if ( $msg->exists() ) {
797 $text = $msg->text();
799 $text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()->
800 convertNamespace( MWNamespace::getSubject( $title->getNamespace() ) );
804 $skinTemplate = $this;
806 if ( !Hooks::run(
'SkinTemplateTabAction', [ &$skinTemplate,
807 $title, $message, $selected, $checkEdit,
808 &$classes, &
$query, &$text, &$result ] ) ) {
813 'class' => implode(
' ', $classes ),
815 'href' => $title->getLocalURL(
$query ),
818 if ( $linkClass !==
'' ) {
819 $result[
'link-class'] = $linkClass;
826 $title = Title::newFromText( $name );
827 if ( !is_object( $title ) ) {
828 throw new MWException( __METHOD__ .
" given invalid pagename $name" );
830 $title = $title->getTalkPage();
831 self::checkTitle( $title, $name );
833 'href' => $title->getLocalURL( $urlaction ),
834 'exists' => $title->isKnown(),
845 $title = Title::newFromText( $name );
846 $title = $title->getSubjectPage();
847 self::checkTitle( $title, $name );
849 'href' => $title->getLocalURL( $urlaction ),
850 'exists' => $title->exists(),
893 $onPage = $title->equals( $this->
getTitle() );
899 $content_navigation = [
907 $action =
$request->getVal(
'action',
'view' );
909 $userCanRead = $title->quickUserCan(
'read', $user );
912 $skinTemplate = $this;
913 $preventActiveTabs =
false;
914 Hooks::run(
'SkinTemplatePreventOtherActiveTabs', [ &$skinTemplate, &$preventActiveTabs ] );
917 if ( $title->canExist() ) {
919 $subjectPage = $title->getSubjectPage();
920 $talkPage = $title->getTalkPage();
923 $isTalk = $title->isTalkPage();
926 $subjectId = $title->getNamespaceKey(
'' );
928 if ( $subjectId ==
'main' ) {
931 $talkId =
"{$subjectId}_talk";
934 $skname = $this->skinname;
937 $subjectMsg = [
"nstab-$subjectId" ];
938 if ( $subjectPage->isMainPage() ) {
939 array_unshift( $subjectMsg,
'mainpage-nstab' );
941 $content_navigation[
'namespaces'][$subjectId] = $this->
tabAction(
942 $subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs,
'', $userCanRead
944 $content_navigation[
'namespaces'][$subjectId][
'context'] =
'subject';
945 $content_navigation[
'namespaces'][$talkId] = $this->
tabAction(
946 $talkPage, [
"nstab-$talkId",
'talk' ], $isTalk && !$preventActiveTabs,
'', $userCanRead
948 $content_navigation[
'namespaces'][$talkId][
'context'] =
'talk';
950 if ( $userCanRead ) {
952 if ( $title->isKnown() ) {
953 $content_navigation[
'views'][
'view'] = $this->
tabAction(
954 $isTalk ? $talkPage : $subjectPage,
955 [
"$skname-view-view",
'view' ],
956 ( $onPage && ( $action ==
'view' || $action ==
'purge' ) ),
'',
true
959 $content_navigation[
'views'][
'view'][
'redundant'] =
true;
963 $isRemoteContent = $page && !$page->isLocal();
967 if ( $isRemoteContent ) {
968 $content_navigation[
'views'][
'view-foreign'] = [
972 params( $page->getWikiDisplayName() )->text(),
973 'href' => $page->getSourceURL(),
979 if ( $title->quickUserCan(
'edit', $user )
980 && ( $title->exists() || $title->quickUserCan(
'create', $user ) )
983 $isTalkClass = $isTalk ?
' istalk' :
'';
985 $isEditing = $onPage && ( $action ==
'edit' || $action ==
'submit' );
988 $showNewSection = !
$out->forceHideNewSectionLink()
992 if ( $title->exists()
993 || ( $title->getNamespace() == NS_MEDIAWIKI
994 && $title->getDefaultMessageText() !==
false
997 $msgKey = $isRemoteContent ?
'edit-local' :
'edit';
999 $msgKey = $isRemoteContent ?
'create-local' :
'create';
1001 $content_navigation[
'views'][
'edit'] = [
1002 'class' => ( $isEditing && (
$section !==
'new' || !$showNewSection )
1009 'primary' => !$isRemoteContent,
1013 if ( $showNewSection ) {
1016 $content_navigation[
'views'][
'addsection'] = [
1017 'class' => ( $isEditing &&
$section ==
'new' ) ?
'selected' :
false,
1020 'href' => $title->getLocalURL(
'action=edit§ion=new' )
1024 } elseif ( $title->hasSourceText() ) {
1026 $content_navigation[
'views'][
'viewsource'] = [
1027 'class' => ( $onPage && $action ==
'edit' ) ?
'selected' :
false,
1036 if ( $title->exists() ) {
1038 $content_navigation[
'views'][
'history'] = [
1039 'class' => ( $onPage && $action ==
'history' ) ?
'selected' :
false,
1042 'href' => $title->getLocalURL(
'action=history' ),
1045 if ( $title->quickUserCan(
'delete', $user ) ) {
1046 $content_navigation[
'actions'][
'delete'] = [
1047 'class' => ( $onPage && $action ==
'delete' ) ?
'selected' :
false,
1050 'href' => $title->getLocalURL(
'action=delete' )
1054 if ( $title->quickUserCan(
'move', $user ) ) {
1055 $moveTitle = SpecialPage::getTitleFor(
'Movepage', $title->getPrefixedDBkey() );
1056 $content_navigation[
'actions'][
'move'] = [
1057 'class' => $this->
getTitle()->isSpecial(
'Movepage' ) ?
'selected' :
false,
1060 'href' => $moveTitle->getLocalURL()
1065 if ( $title->quickUserCan(
'deletedhistory', $user ) ) {
1066 $n = $title->isDeleted();
1068 $undelTitle = SpecialPage::getTitleFor(
'Undelete', $title->getPrefixedDBkey() );
1071 $msgKey = $title->quickUserCan(
'undelete', $user ) ?
'undelete' :
'viewdeleted';
1072 $content_navigation[
'actions'][
'undelete'] = [
1073 'class' => $this->
getTitle()->isSpecial(
'Undelete' ) ?
'selected' :
false,
1075 ->setContext( $this->
getContext() )->numParams( $n )->text(),
1076 'href' => $undelTitle->getLocalURL()
1082 if ( $title->quickUserCan(
'protect', $user ) && $title->getRestrictionTypes() &&
1083 MWNamespace::getRestrictionLevels( $title->getNamespace(), $user ) !== [
'' ]
1085 $mode = $title->isProtected() ?
'unprotect' :
'protect';
1086 $content_navigation[
'actions'][$mode] = [
1087 'class' => ( $onPage && $action == $mode ) ?
'selected' :
false,
1090 'href' => $title->getLocalURL(
"action=$mode" )
1095 if ( $this->loggedin && $user->isAllowedAll(
'viewmywatchlist',
'editmywatchlist' ) ) {
1105 $mode = $user->isWatched( $title ) ?
'unwatch' :
'watch';
1106 $content_navigation[
'actions'][$mode] = [
1107 'class' =>
'mw-watchlink ' . (
1108 $onPage && ( $action ==
'watch' || $action ==
'unwatch' ) ?
'selected' :
''
1111 'text' => $this->
msg( $mode )->text(),
1112 'href' => $title->getLocalURL( [
'action' => $mode ] ),
1116 'mw' =>
'interface',
1123 $skinTemplate = $this;
1124 Hooks::runWithoutAbort(
1125 'SkinTemplateNavigation',
1126 [ &$skinTemplate, &$content_navigation ]
1130 $pageLang = $title->getPageLanguage();
1133 if ( $pageLang->hasVariants() ) {
1135 $variants = $pageLang->getVariants();
1138 $preferred = $pageLang->getPreferredVariant();
1146 foreach ( $variants as
$code ) {
1148 $varname = $pageLang->getVariantname(
$code );
1150 $content_navigation[
'variants'][] = [
1151 'class' => (
$code == $preferred ) ?
'selected' :
false,
1153 'href' => $title->getLocalURL( [
'variant' =>
$code ] +
$params ),
1154 'lang' => LanguageCode::bcp47(
$code ),
1155 'hreflang' => LanguageCode::bcp47(
$code ),
1162 $content_navigation[
'namespaces'][
'special'] = [
1163 'class' =>
'selected',
1164 'text' => $this->
msg(
'nstab-special' )->text(),
1165 'href' =>
$request->getRequestURL(),
1166 'context' =>
'subject'
1170 $skinTemplate = $this;
1171 Hooks::runWithoutAbort(
'SkinTemplateNavigation::SpecialPage',
1172 [ &$skinTemplate, &$content_navigation ] );
1176 $skinTemplate = $this;
1178 Hooks::runWithoutAbort(
'SkinTemplateNavigation::Universal',
1179 [ &$skinTemplate, &$content_navigation ] );
1182 foreach ( $content_navigation as
$section => &$links ) {
1183 foreach ( $links as $key => &
$link ) {
1185 if ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'subject' ) {
1186 $xmlID =
'ca-nstab-' . $xmlID;
1187 } elseif ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'talk' ) {
1189 $link[
'rel'] =
'discussion';
1190 } elseif (
$section ==
'variants' ) {
1191 $xmlID =
'ca-varlang-' . $xmlID;
1193 $xmlID =
'ca-' . $xmlID;
1195 $link[
'id'] = $xmlID;
1199 # We don't want to give the watch tab an accesskey if the
1200 # page is being edited, because that conflicts with the
1201 # accesskey on the watch checkbox. We also don't want to
1202 # give the edit tab an accesskey, because that's fairly
1203 # superfluous and conflicts with an accesskey (Ctrl-E) often
1204 # used for editing in Safari.
1205 if ( in_array( $action, [
'edit',
'submit' ] ) ) {
1206 if ( isset( $content_navigation[
'views'][
'edit'] ) ) {
1207 $content_navigation[
'views'][
'edit'][
'tooltiponly'] =
true;
1209 if ( isset( $content_navigation[
'actions'][
'watch'] ) ) {
1210 $content_navigation[
'actions'][
'watch'][
'tooltiponly'] =
true;
1212 if ( isset( $content_navigation[
'actions'][
'unwatch'] ) ) {
1213 $content_navigation[
'actions'][
'unwatch'][
'tooltiponly'] =
true;
1217 return $content_navigation;
1230 $content_actions = [];
1232 foreach ( $content_navigation as $links ) {
1233 foreach ( $links as $key =>
$value ) {
1234 if ( isset(
$value[
'redundant'] ) &&
$value[
'redundant'] ) {
1243 if ( isset(
$value[
'id'] ) && substr(
$value[
'id'], 0, 3 ) ==
'ca-' ) {
1244 $key = substr(
$value[
'id'], 3 );
1247 if ( isset( $content_actions[$key] ) ) {
1248 wfDebug( __METHOD__ .
": Found a duplicate key for $key while flattening " .
1249 "content_navigation into content_actions.\n" );
1253 $content_actions[$key] =
$value;
1257 return $content_actions;
1271 $nav_urls[
'mainpage'] = [
'href' => self::makeMainPageUrl() ];
1275 $nav_urls[
'upload'] = [
'href' => self::makeSpecialUrl(
'Upload' ) ];
1277 $nav_urls[
'upload'] =
false;
1279 $nav_urls[
'specialpages'] = [
'href' => self::makeSpecialUrl(
'Specialpages' ) ];
1281 $nav_urls[
'print'] =
false;
1282 $nav_urls[
'permalink'] =
false;
1283 $nav_urls[
'info'] =
false;
1284 $nav_urls[
'whatlinkshere'] =
false;
1285 $nav_urls[
'recentchangeslinked'] =
false;
1286 $nav_urls[
'contributions'] =
false;
1287 $nav_urls[
'log'] =
false;
1288 $nav_urls[
'blockip'] =
false;
1289 $nav_urls[
'emailuser'] =
false;
1290 $nav_urls[
'userrights'] =
false;
1294 if ( !
$out->isPrintable() && (
$out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
1295 $nav_urls[
'print'] = [
1296 'text' => $this->
msg(
'printableversion' )->text(),
1297 'href' => $this->
getTitle()->getLocalURL(
1298 $request->appendQueryValue(
'printable',
'yes' ) )
1302 if (
$out->isArticle() ) {
1306 $nav_urls[
'permalink'] = [
1307 'text' => $this->
msg(
'permalink' )->text(),
1308 'href' => $this->
getTitle()->getLocalURL(
"oldid=$revid" )
1313 $skinTemplate = $this;
1315 Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
1316 [ &$skinTemplate, &$nav_urls, &$revid, &$revid ] );
1319 if (
$out->isArticleRelated() ) {
1320 $nav_urls[
'whatlinkshere'] = [
1321 'href' => SpecialPage::getTitleFor(
'Whatlinkshere', $this->thispage )->getLocalURL()
1324 $nav_urls[
'info'] = [
1325 'text' => $this->
msg(
'pageinfo-toolboxlink' )->text(),
1326 'href' => $this->
getTitle()->getLocalURL(
"action=info" )
1330 $nav_urls[
'recentchangeslinked'] = [
1331 'href' => SpecialPage::getTitleFor(
'Recentchangeslinked', $this->thispage )->getLocalURL()
1338 $rootUser = $user->getName();
1340 $nav_urls[
'contributions'] = [
1341 'text' => $this->
msg(
'contributions', $rootUser )->text(),
1342 'href' => self::makeSpecialUrlSubpage(
'Contributions', $rootUser ),
1343 'tooltip-params' => [ $rootUser ],
1346 $nav_urls[
'log'] = [
1347 'href' => self::makeSpecialUrlSubpage(
'Log', $rootUser )
1350 if ( $this->
getUser()->isAllowed(
'block' ) ) {
1351 $nav_urls[
'blockip'] = [
1352 'text' => $this->
msg(
'blockip', $rootUser )->text(),
1353 'href' => self::makeSpecialUrlSubpage(
'Block', $rootUser )
1358 $nav_urls[
'emailuser'] = [
1359 'text' => $this->
msg(
'tool-link-emailuser', $rootUser )->text(),
1360 'href' => self::makeSpecialUrlSubpage(
'Emailuser', $rootUser ),
1361 'tooltip-params' => [ $rootUser ],
1365 if ( !$user->isAnon() ) {
1368 $canChange = $sur->userCanChangeRights( $user );
1369 $nav_urls[
'userrights'] = [
1370 'text' => $this->
msg(
1371 $canChange ?
'tool-link-userrights' :
'tool-link-userrights-readonly',
1374 'href' => self::makeSpecialUrlSubpage(
'Userrights', $rootUser )
1387 return $this->
getTitle()->getNamespaceKey();
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgScript
The URL path to index.php.
$wgMimeType
The default Content-Type header.
$wgDisableLangConversion
Whether to enable language variant conversion.
$wgSitename
Name of the site.
$wgUseCombinedLoginLink
Login / create account link behavior when it's possible for anonymous users to create an account.
$wgHideInterlanguageLinks
Hide interlanguage links from the sidebar.
$wgShowCreditsIfMax
If there are more than $wgMaxCredits authors, show $wgMaxCredits of them.
$wgJsMimeType
Previously used as content type in HTML script tags.
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
$wgUploadNavigationUrl
Point the upload navigation link to an external URL Useful if you want to use a shared repository by ...
$wgScriptPath
The path we should point to.
$wgStylePath
The URL path of the skins directory.
$wgServer
URL of the server.
$wgLogo
The URL path of the wiki logo.
$wgMaxCredits
Set this to the number of authors that you want to be credited below an article text.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfReportTime( $nonce=null)
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in millis...
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static factory( $action, Page $page, IContextSource $context=null)
Get an appropriate Action subclass for the given action.
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getWikiPage()
Get the WikiPage object.
setContext(IContextSource $context)
This class should be covered by a general architecture document which does not exist as of January 20...
Base class for template-based skins.
setupTemplate( $classname, $repository=false, $cache_dir=false)
Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML.
formatLanguageName( $name)
Format language name for use in sidebar interlanguage links list.
prepareQuickTemplate()
initialize various variables and generate the template
getPersonalToolsList()
Get the HTML for the p-personal list.
buildPersonalUrls()
build array of urls for personal toolbar
buildContentNavigationUrls()
a structured array of links usually used for the tabs in a skin
useCombinedLoginLink()
Output a boolean indicating if buildPersonalUrls should output separate login and create account link...
getStructuredPersonalTools()
Get personal tools for the user.
getLanguages()
Generates array of language links for the current page.
wrapHTML( $title, $html)
Wrap the body text with language information and identifiable element.
makeTalkUrlDetails( $name, $urlaction='')
outputPage(OutputPage $out=null)
initialize various variables and generate the template
makePersonalToolsList( $personalTools=null, $options=[])
Get the HTML for the personal tools list.
buildNavUrls()
build array of common navigation links
string $skinname
Name of our skin, it probably needs to be all lower case.
buildContentActionUrls( $content_navigation)
an array of edit links by default used for the tabs
makeArticleUrlDetails( $name, $urlaction='')
tabAction( $title, $message, $selected, $query='', $checkEdit=false)
Builds an array with tab definition.
getNameSpaceKey()
Generate strings used for xml 'id' names.
printOrError( $str)
Output the string, or print error message if it's an error object of the appropriate type.
The main skin class which provides methods and properties for all other skins.
aboutLink()
Gets the link to the wiki's about page.
isRevisionCurrent()
Whether the revision displayed is the latest revision of the page.
afterContentHook()
This runs a hook to allow extensions placing their stuff after content and article metadata (e....
getNewtalks()
Gets new talk page messages for the current user and returns an appropriate alert message (or an empt...
generateDebugHTML()
Generate debug data HTML for displaying at the bottom of the main content area.
privacyLink()
Gets the link to the wiki's privacy policy page.
getSiteNotice()
Get the site notice.
getPoweredBy()
Gets the powered by MediaWiki icon.
getRelevantUser()
Return the "relevant" user.
editUrlOptions()
Return URL options for the 'edit page' link.
buildSidebar()
Build an array that represents the sidebar(s), the navigation bar among them.
getCopyright( $type='detect')
printSource()
Text with the permalink to the source page, usually shown on the footer of a printed page.
getRevisionId()
Get the current revision ID.
bottomScripts()
This gets called shortly before the "</body>" tag.
disclaimerLink()
Gets the link to the wiki's general disclaimers page.
lastModified()
Get the timestamp of the latest revision, formatted in user language.
initPage(OutputPage $out)
subPageSubtitle( $out=null)
getRelevantTitle()
Return the "relevant" title.
setContext( $context)
Sets the context this SpecialPage is executed in.
Represents a title within MediaWiki.
isSpecialPage()
Returns true if this is a special page.
static isEnabled()
Returns true if uploads are enabled.
static isAllowed( $user)
Returns true if the user can use this upload module or else a string identifying the missing permissi...
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Special page to allow managing user group membership.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
namespace being checked & $result
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
this hook is for auditing only or null if authentication failed before getting that far $username
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
processing should stop and the error should be shown to the user * false