66 'mediawiki.legacy.shared',
67 'mediawiki.legacy.commonPrint',
68 'mediawiki.sectionAnchor'
70 if (
$out->isSyndicated() ) {
71 $moduleStyles[] =
'mediawiki.feedlink';
76 if ( strpos(
$out->getHTML(),
'mw-ui-button' ) !==
false ) {
77 $moduleStyles[] =
'mediawiki.ui.button';
80 $out->addModuleStyles( $moduleStyles );
94 function setupTemplate( $classname, $repository =
false, $cache_dir =
false ) {
95 return new $classname( $this->
getConfig() );
112 foreach ( $this->
getOutput()->getLanguageLinks() as $languageLinkText ) {
113 $class =
'interlanguage-link interwiki-' . explode(
':', $languageLinkText, 2 )[0];
115 $languageLinkTitle = Title::newFromText( $languageLinkText );
116 if ( $languageLinkTitle ) {
117 $ilInterwikiCode = $languageLinkTitle->getInterwiki();
118 $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
120 if ( strval( $ilLangName ) ===
'' ) {
121 $ilDisplayTextMsg =
wfMessage(
"interlanguage-link-$ilInterwikiCode" );
122 if ( !$ilDisplayTextMsg->isDisabled() ) {
124 $ilLangName = $ilDisplayTextMsg->text();
127 $ilLangName = $languageLinkText;
136 $ilLangLocalName = Language::fetchLanguageName(
141 $languageLinkTitleText = $languageLinkTitle->getText();
142 if ( $ilLangLocalName ===
'' ) {
143 $ilFriendlySiteName =
wfMessage(
"interlanguage-link-sitename-$ilInterwikiCode" );
144 if ( !$ilFriendlySiteName->isDisabled() ) {
145 if ( $languageLinkTitleText ===
'' ) {
147 'interlanguage-link-title-nonlangonly',
148 $ilFriendlySiteName->text()
152 'interlanguage-link-title-nonlang',
153 $languageLinkTitleText,
154 $ilFriendlySiteName->text()
161 $ilTitle = $languageLinkTitle->getInterwiki() .
162 ":$languageLinkTitleText";
164 } elseif ( $languageLinkTitleText ===
'' ) {
166 'interlanguage-link-title-langonly',
171 'interlanguage-link-title',
172 $languageLinkTitleText,
177 $ilInterwikiCodeBCP47 = LanguageCode::bcp47( $ilInterwikiCode );
179 'href' => $languageLinkTitle->getFullURL(),
180 'text' => $ilLangName,
183 'link-class' =>
'interlanguage-link-target',
184 'lang' => $ilInterwikiCodeBCP47,
185 'hreflang' => $ilInterwikiCodeBCP47,
188 'SkinTemplateGetLanguageLink',
191 $languageLinks[] = $languageLink;
195 return $languageLinks;
205 $this->thispage = $title->getPrefixedDBkey();
206 $this->titletxt = $title->getPrefixedText();
207 $this->userpage = $user->getUserPage()->getPrefixedText();
212 unset(
$query[
'returnto'] );
213 unset(
$query[
'returntoquery'] );
216 $this->loggedin = $user->isLoggedIn();
217 $this->username = $user->getName();
219 if ( $this->loggedin ) {
220 $this->userpageUrlDetails = self::makeUrlDetails( $this->userpage );
222 # This won't be used in the standard skins, but we define it to preserve the interface
223 # To save time, we check for existence
224 $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage );
236 Profiler::instance()->setTemplated(
true );
239 if (
$out !==
null ) {
251 $res = $tpl->execute();
269 # An ID that includes the actual body text; without categories, contentSub, ...
270 $realBodyAttribs = [
'id' =>
'mw-content-text' ];
272 # Add a mw-content-ltr/rtl class to be able to style based on text
273 # direction when the content is different from the UI language (only
275 # Most information on special pages and file pages is in user language,
276 # rather than content language, so those will not get this
279 $pageLang = $title->getPageViewLanguage();
280 $realBodyAttribs[
'lang'] = $pageLang->getHtmlCode();
281 $realBodyAttribs[
'dir'] = $pageLang->getDir();
282 $realBodyAttribs[
'class'] =
'mw-content-' . $pageLang->getDir();
285 return Html::rawElement(
'div', $realBodyAttribs,
$html );
305 $tpl->set(
'title',
$out->getPageTitle() );
306 $tpl->set(
'pagetitle',
$out->getHTMLTitle() );
307 $tpl->set(
'displaytitle',
$out->mPageLinkTitle );
309 $tpl->set(
'thispage', $this->thispage );
310 $tpl->set(
'titleprefixeddbkey', $this->thispage );
311 $tpl->set(
'titletext', $title->getText() );
312 $tpl->set(
'articleid', $title->getArticleID() );
314 $tpl->set(
'isarticle',
$out->isArticle() );
317 if ( $subpagestr !==
'' ) {
318 $subpagestr =
'<span class="subpages">' . $subpagestr .
'</span>';
320 $tpl->set(
'subtitle', $subpagestr .
$out->getSubtitle() );
323 if ( $undelete ===
'' ) {
324 $tpl->set(
'undelete',
'' );
326 $tpl->set(
'undelete',
'<span class="subpages">' . $undelete .
'</span>' );
330 if (
$out->isSyndicated() ) {
332 foreach (
$out->getSyndicationLinks() as $format =>
$link ) {
335 'text' => $this->
msg(
"feed-$format" )->text(),
339 $tpl->set(
'feeds', $feeds );
341 $tpl->set(
'feeds',
false );
346 $tpl->set(
'charset',
'UTF-8' );
348 $tpl->set(
'skinname', $this->skinname );
349 $tpl->set(
'skinclass', static::class );
350 $tpl->set(
'skin', $this );
351 $tpl->set(
'stylename', $this->stylename );
352 $tpl->set(
'printable',
$out->isPrintable() );
353 $tpl->set(
'handheld',
$request->getBool(
'handheld' ) );
354 $tpl->set(
'loggedin', $this->loggedin );
355 $tpl->set(
'notspecialpage', !$title->isSpecialPage() );
357 $tpl->set(
'searchtitle', SpecialPage::getTitleFor(
'Search' )->getPrefixedDBkey() );
358 $tpl->set(
'search', trim(
$request->getVal(
'search' ) ) );
363 $tpl->set(
'logopath',
$wgLogo );
367 $userLangCode = $userLang->getHtmlCode();
368 $userLangDir = $userLang->getDir();
370 $tpl->set(
'lang', $userLangCode );
371 $tpl->set(
'dir', $userLangDir );
372 $tpl->set(
'rtl', $userLang->isRTL() );
374 $tpl->set(
'capitalizeallnouns', $userLang->capitalizeAllNouns() ?
' capitalize-all-nouns' :
'' );
375 $tpl->set(
'showjumplinks',
true );
376 $tpl->set(
'username', $this->loggedin ? $this->username : null );
377 $tpl->set(
'userpage', $this->userpage );
378 $tpl->set(
'userpageurl', $this->userpageUrlDetails[
'href'] );
379 $tpl->set(
'userlang', $userLangCode );
384 $tpl->set(
'userlangattributes',
'' );
385 $tpl->set(
'specialpageattributes',
'' ); # obsolete
388 $tpl->set(
'prebodyhtml',
'' );
391 $escUserlang = htmlspecialchars( $userLangCode );
392 $escUserdir = htmlspecialchars( $userLangDir );
395 $attrs =
" lang=\"$escUserlang\" dir=\"$escUserdir\"";
396 $tpl->set(
'userlangattributes', $attrs );
400 $tpl->set(
'logo', $this->
logoText() );
402 $tpl->set(
'copyright',
false );
404 $tpl->set(
'viewcount',
false );
405 $tpl->set(
'lastmod',
false );
406 $tpl->set(
'credits',
false );
407 $tpl->set(
'numberofwatchingusers',
false );
408 if (
$out->isArticle() && $title->exists() ) {
424 $tpl->set(
'about', $this->
aboutLink() );
426 $tpl->set(
'footerlinks', [
429 'numberofwatchingusers',
442 foreach ( $tpl->data[
'footericons'] as $footerIconsKey => &$footerIconsBlock ) {
443 if ( count( $footerIconsBlock ) > 0 ) {
444 foreach ( $footerIconsBlock as &$footerIcon ) {
445 if ( isset( $footerIcon[
'src'] ) ) {
446 if ( !isset( $footerIcon[
'width'] ) ) {
447 $footerIcon[
'width'] = 88;
449 if ( !isset( $footerIcon[
'height'] ) ) {
450 $footerIcon[
'height'] = 31;
455 unset( $tpl->data[
'footericons'][$footerIconsKey] );
459 $tpl->set(
'indicators',
$out->getIndicators() );
465 $tpl->set(
'bodytext',
$out->mBodytext );
468 if ( count( $language_urls ) ) {
469 $tpl->set(
'language_urls', $language_urls );
471 $tpl->set(
'language_urls',
false );
478 $tpl->set(
'content_navigation', $content_navigation );
479 $tpl->set(
'content_actions', $content_actions );
488 $tpl->set(
'headelement',
$out->headElement( $this ) );
490 $tpl->set(
'debug',
'' );
495 $skinTemplate = $this;
497 if ( !Hooks::run(
'SkinTemplateOutputPageBeforeExec', [ &$skinTemplate, &$tpl ] ) ) {
498 wfDebug( __METHOD__ .
": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
503 $tpl->set(
'bodycontent', $tpl->data[
'bodytext'] );
508 $tpl->data[
'bodytext'] .= Html::rawElement(
510 [
'class' =>
'printfooter' ],
511 "\n{$tpl->data['printfooter']}"
513 $tpl->data[
'bodytext'] .= $tpl->data[
'debughtml'];
544 if ( $personalTools ===
null ) {
545 $personalTools = $tpl->getPersonalTools();
548 foreach ( $personalTools as $key => $item ) {
566 return $tpl->getPersonalTools();
614 $pageurl = $title->getLocalURL();
615 $authManager = AuthManager::singleton();
620 # Due to T34276, if a user does not have read permissions,
621 # $this->getTitle() will just give Special:Badtitle, which is
622 # not especially useful as a returnto parameter. Use the title
623 # from the request instead, if there was one.
624 if ( $this->
getUser()->isAllowed(
'read' ) ) {
627 $page = Title::newFromText(
$request->getVal(
'title',
'' ) );
629 $page =
$request->getVal(
'returnto', $page );
631 if ( strval( $page ) !==
'' ) {
632 $returnto[
'returnto'] = $page;
635 unset( $paramsArray[
'logoutToken'] );
638 $returnto[
'returntoquery'] =
$query;
642 if ( $this->loggedin ) {
643 $personal_urls[
'userpage'] = [
645 'href' => &$this->userpageUrlDetails[
'href'],
646 'class' => $this->userpageUrlDetails[
'exists'] ?
false :
'new',
647 'exists' => $this->userpageUrlDetails[
'exists'],
648 'active' => ( $this->userpageUrlDetails[
'href'] == $pageurl ),
652 $personal_urls[
'mytalk'] = [
653 'text' => $this->
msg(
'mytalk' )->text(),
654 'href' => &$usertalkUrlDetails[
'href'],
655 'class' => $usertalkUrlDetails[
'exists'] ?
false :
'new',
656 'exists' => $usertalkUrlDetails[
'exists'],
657 'active' => ( $usertalkUrlDetails[
'href'] == $pageurl )
659 $href = self::makeSpecialUrl(
'Preferences' );
660 $personal_urls[
'preferences'] = [
661 'text' => $this->
msg(
'mypreferences' )->text(),
663 'active' => ( $href == $pageurl )
666 if ( $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
667 $href = self::makeSpecialUrl(
'Watchlist' );
668 $personal_urls[
'watchlist'] = [
669 'text' => $this->
msg(
'mywatchlist' )->text(),
671 'active' => ( $href == $pageurl )
675 # We need to do an explicit check for Special:Contributions, as we
676 # have to match both the title, and the target, which could come
677 # from request values (Special:Contributions?target=Jimbo_Wales)
678 # or be specified in "sub page" form
679 # (Special:Contributions/Jimbo_Wales). The plot
680 # thickens, because the Title object is altered for special pages,
681 # so it doesn't contain the original alias-with-subpage.
682 $origTitle = Title::newFromText(
$request->getText(
'title' ) );
685 $active = $spName ==
'Contributions'
692 $href = self::makeSpecialUrlSubpage(
'Contributions', $this->username );
693 $personal_urls[
'mycontris'] = [
694 'text' => $this->
msg(
'mycontris' )->text(),
700 if (
$request->getSession()->canSetUser() ) {
701 $personal_urls[
'logout'] = [
702 'text' => $this->
msg(
'pt-userlogout' )->text(),
703 'href' => self::makeSpecialUrl(
'Userlogout',
706 ( $title->isSpecial(
'Preferences' ) ? [] : $returnto )
707 + [
'logoutToken' => $this->
getUser()->getEditToken(
'logoutToken', $this->
getRequest() ) ] ),
713 if ( !$authManager->canCreateAccounts() || !$authManager->canAuthenticateNow() ) {
715 $useCombinedLoginLink =
false;
718 $loginlink = $this->
getUser()->isAllowed(
'createaccount' ) && $useCombinedLoginLink
719 ?
'nav-login-createaccount'
723 'text' => $this->
msg( $loginlink )->text(),
724 'href' => self::makeSpecialUrl(
'Userlogin', $returnto ),
725 'active' => $title->isSpecial(
'Userlogin' )
726 || $title->isSpecial(
'CreateAccount' ) && $useCombinedLoginLink,
728 $createaccount_url = [
729 'text' => $this->
msg(
'pt-createaccount' )->text(),
730 'href' => self::makeSpecialUrl(
'CreateAccount', $returnto ),
731 'active' => $title->isSpecial(
'CreateAccount' ),
742 $personal_urls[
'anontalk'] = [
743 'text' => $this->
msg(
'anontalk' )->text(),
744 'href' => self::makeSpecialUrlSubpage(
'Mytalk',
false ),
747 $personal_urls[
'anoncontribs'] = [
748 'text' => $this->
msg(
'anoncontribs' )->text(),
749 'href' => self::makeSpecialUrlSubpage(
'Mycontributions',
false ),
755 $authManager->canCreateAccounts()
756 && $this->getUser()->isAllowed(
'createaccount' )
757 && !$useCombinedLoginLink
759 $personal_urls[
'createaccount'] = $createaccount_url;
762 if ( $authManager->canAuthenticateNow() ) {
766 $personal_urls[$key] = $login_url;
770 Hooks::runWithoutAbort(
'PersonalUrls', [ &$personal_urls, &$title, $this ] );
771 return $personal_urls;
788 $classes[] =
'selected';
791 if ( $checkEdit && !$title->isKnown() ) {
797 $query =
'action=edit&redlink=1';
801 $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses( $title );
806 if ( is_array( $message ) ) {
808 $message = end( $message );
810 if ( $msg->exists() ) {
811 $text = $msg->text();
814 $text =
$wgContLang->getConverter()->convertNamespace(
815 MWNamespace::getSubject( $title->getNamespace() ) );
819 $skinTemplate = $this;
821 if ( !Hooks::run(
'SkinTemplateTabAction', [ &$skinTemplate,
822 $title, $message, $selected, $checkEdit,
823 &$classes, &
$query, &$text, &$result ] ) ) {
828 'class' => implode(
' ', $classes ),
830 'href' => $title->getLocalURL(
$query ),
833 if ( $linkClass !==
'' ) {
834 $result[
'link-class'] = $linkClass;
841 $title = Title::newFromText( $name );
842 if ( !is_object( $title ) ) {
843 throw new MWException( __METHOD__ .
" given invalid pagename $name" );
845 $title = $title->getTalkPage();
846 self::checkTitle( $title, $name );
848 'href' => $title->getLocalURL( $urlaction ),
849 'exists' => $title->isKnown(),
860 $title = Title::newFromText( $name );
861 $title = $title->getSubjectPage();
862 self::checkTitle( $title, $name );
864 'href' => $title->getLocalURL( $urlaction ),
865 'exists' => $title->exists(),
908 $onPage = $title->equals( $this->
getTitle() );
914 $content_navigation = [
922 $action =
$request->getVal(
'action',
'view' );
924 $userCanRead = $title->quickUserCan(
'read', $user );
927 $skinTemplate = $this;
928 $preventActiveTabs =
false;
929 Hooks::run(
'SkinTemplatePreventOtherActiveTabs', [ &$skinTemplate, &$preventActiveTabs ] );
932 if ( $title->canExist() ) {
934 $subjectPage = $title->getSubjectPage();
935 $talkPage = $title->getTalkPage();
938 $isTalk = $title->isTalkPage();
941 $subjectId = $title->getNamespaceKey(
'' );
943 if ( $subjectId ==
'main' ) {
946 $talkId =
"{$subjectId}_talk";
949 $skname = $this->skinname;
952 $subjectMsg = [
"nstab-$subjectId" ];
953 if ( $subjectPage->isMainPage() ) {
954 array_unshift( $subjectMsg,
'mainpage-nstab' );
956 $content_navigation[
'namespaces'][$subjectId] = $this->
tabAction(
957 $subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs,
'', $userCanRead
959 $content_navigation[
'namespaces'][$subjectId][
'context'] =
'subject';
960 $content_navigation[
'namespaces'][$talkId] = $this->
tabAction(
961 $talkPage, [
"nstab-$talkId",
'talk' ], $isTalk && !$preventActiveTabs,
'', $userCanRead
963 $content_navigation[
'namespaces'][$talkId][
'context'] =
'talk';
965 if ( $userCanRead ) {
967 if ( $title->isKnown() ) {
968 $content_navigation[
'views'][
'view'] = $this->
tabAction(
969 $isTalk ? $talkPage : $subjectPage,
970 [
"$skname-view-view",
'view' ],
971 ( $onPage && ( $action ==
'view' || $action ==
'purge' ) ),
'',
true
974 $content_navigation[
'views'][
'view'][
'redundant'] =
true;
978 $isRemoteContent = $page && !$page->isLocal();
982 if ( $isRemoteContent ) {
983 $content_navigation[
'views'][
'view-foreign'] = [
987 params( $page->getWikiDisplayName() )->text(),
988 'href' => $page->getSourceURL(),
994 if ( $title->quickUserCan(
'edit', $user )
995 && ( $title->exists() || $title->quickUserCan(
'create', $user ) )
998 $isTalkClass = $isTalk ?
' istalk' :
'';
1000 $isEditing = $onPage && ( $action ==
'edit' || $action ==
'submit' );
1003 $showNewSection = !
$out->forceHideNewSectionLink()
1007 if ( $title->exists()
1008 || ( $title->getNamespace() == NS_MEDIAWIKI
1009 && $title->getDefaultMessageText() !==
false
1012 $msgKey = $isRemoteContent ?
'edit-local' :
'edit';
1014 $msgKey = $isRemoteContent ?
'create-local' :
'create';
1016 $content_navigation[
'views'][
'edit'] = [
1017 'class' => ( $isEditing && (
$section !==
'new' || !$showNewSection )
1024 'primary' => !$isRemoteContent,
1028 if ( $showNewSection ) {
1031 $content_navigation[
'views'][
'addsection'] = [
1032 'class' => ( $isEditing &&
$section ==
'new' ) ?
'selected' :
false,
1035 'href' => $title->getLocalURL(
'action=edit§ion=new' )
1039 } elseif ( $title->hasSourceText() ) {
1041 $content_navigation[
'views'][
'viewsource'] = [
1042 'class' => ( $onPage && $action ==
'edit' ) ?
'selected' :
false,
1051 if ( $title->exists() ) {
1053 $content_navigation[
'views'][
'history'] = [
1054 'class' => ( $onPage && $action ==
'history' ) ?
'selected' :
false,
1057 'href' => $title->getLocalURL(
'action=history' ),
1060 if ( $title->quickUserCan(
'delete', $user ) ) {
1061 $content_navigation[
'actions'][
'delete'] = [
1062 'class' => ( $onPage && $action ==
'delete' ) ?
'selected' :
false,
1065 'href' => $title->getLocalURL(
'action=delete' )
1069 if ( $title->quickUserCan(
'move', $user ) ) {
1070 $moveTitle = SpecialPage::getTitleFor(
'Movepage', $title->getPrefixedDBkey() );
1071 $content_navigation[
'actions'][
'move'] = [
1072 'class' => $this->
getTitle()->isSpecial(
'Movepage' ) ?
'selected' :
false,
1075 'href' => $moveTitle->getLocalURL()
1080 if ( $user->isAllowed(
'deletedhistory' ) ) {
1081 $n = $title->isDeleted();
1083 $undelTitle = SpecialPage::getTitleFor(
'Undelete', $title->getPrefixedDBkey() );
1086 $msgKey = $user->isAllowed(
'undelete' ) ?
'undelete' :
'viewdeleted';
1087 $content_navigation[
'actions'][
'undelete'] = [
1088 'class' => $this->
getTitle()->isSpecial(
'Undelete' ) ?
'selected' :
false,
1090 ->setContext( $this->
getContext() )->numParams( $n )->text(),
1091 'href' => $undelTitle->getLocalURL()
1097 if ( $title->quickUserCan(
'protect', $user ) && $title->getRestrictionTypes() &&
1098 MWNamespace::getRestrictionLevels( $title->getNamespace(), $user ) !== [
'' ]
1100 $mode = $title->isProtected() ?
'unprotect' :
'protect';
1101 $content_navigation[
'actions'][$mode] = [
1102 'class' => ( $onPage && $action == $mode ) ?
'selected' :
false,
1105 'href' => $title->getLocalURL(
"action=$mode" )
1110 if ( $this->loggedin && $user->isAllowedAll(
'viewmywatchlist',
'editmywatchlist' ) ) {
1120 $mode = $user->isWatched( $title ) ?
'unwatch' :
'watch';
1121 $content_navigation[
'actions'][$mode] = [
1122 'class' =>
'mw-watchlink ' . (
1123 $onPage && ( $action ==
'watch' || $action ==
'unwatch' ) ?
'selected' :
''
1126 'text' => $this->
msg( $mode )->text(),
1127 'href' => $title->getLocalURL( [
'action' => $mode ] ),
1131 'mw' =>
'interface',
1138 $skinTemplate = $this;
1139 Hooks::runWithoutAbort(
1140 'SkinTemplateNavigation',
1141 [ &$skinTemplate, &$content_navigation ]
1145 $pageLang = $title->getPageLanguage();
1147 $variants = $pageLang->getVariants();
1150 if ( count( $variants ) > 1 ) {
1153 $preferred = $pageLang->getPreferredVariant();
1161 foreach ( $variants as
$code ) {
1163 $varname = $pageLang->getVariantname(
$code );
1165 $content_navigation[
'variants'][] = [
1166 'class' => (
$code == $preferred ) ?
'selected' :
false,
1168 'href' => $title->getLocalURL( [
'variant' =>
$code ] +
$params ),
1169 'lang' => LanguageCode::bcp47(
$code ),
1170 'hreflang' => LanguageCode::bcp47(
$code ),
1177 $content_navigation[
'namespaces'][
'special'] = [
1178 'class' =>
'selected',
1179 'text' => $this->
msg(
'nstab-special' )->text(),
1180 'href' =>
$request->getRequestURL(),
1181 'context' =>
'subject'
1185 $skinTemplate = $this;
1186 Hooks::runWithoutAbort(
'SkinTemplateNavigation::SpecialPage',
1187 [ &$skinTemplate, &$content_navigation ] );
1191 $skinTemplate = $this;
1193 Hooks::runWithoutAbort(
'SkinTemplateNavigation::Universal',
1194 [ &$skinTemplate, &$content_navigation ] );
1197 foreach ( $content_navigation as
$section => &$links ) {
1198 foreach ( $links as $key => &
$link ) {
1200 if ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'subject' ) {
1201 $xmlID =
'ca-nstab-' . $xmlID;
1202 } elseif ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'talk' ) {
1204 $link[
'rel'] =
'discussion';
1205 } elseif (
$section ==
'variants' ) {
1206 $xmlID =
'ca-varlang-' . $xmlID;
1208 $xmlID =
'ca-' . $xmlID;
1210 $link[
'id'] = $xmlID;
1214 # We don't want to give the watch tab an accesskey if the
1215 # page is being edited, because that conflicts with the
1216 # accesskey on the watch checkbox. We also don't want to
1217 # give the edit tab an accesskey, because that's fairly
1218 # superfluous and conflicts with an accesskey (Ctrl-E) often
1219 # used for editing in Safari.
1220 if ( in_array( $action, [
'edit',
'submit' ] ) ) {
1221 if ( isset( $content_navigation[
'views'][
'edit'] ) ) {
1222 $content_navigation[
'views'][
'edit'][
'tooltiponly'] =
true;
1224 if ( isset( $content_navigation[
'actions'][
'watch'] ) ) {
1225 $content_navigation[
'actions'][
'watch'][
'tooltiponly'] =
true;
1227 if ( isset( $content_navigation[
'actions'][
'unwatch'] ) ) {
1228 $content_navigation[
'actions'][
'unwatch'][
'tooltiponly'] =
true;
1232 return $content_navigation;
1245 $content_actions = [];
1247 foreach ( $content_navigation as $links ) {
1248 foreach ( $links as $key =>
$value ) {
1249 if ( isset(
$value[
'redundant'] ) &&
$value[
'redundant'] ) {
1258 if ( isset(
$value[
'id'] ) && substr(
$value[
'id'], 0, 3 ) ==
'ca-' ) {
1259 $key = substr(
$value[
'id'], 3 );
1262 if ( isset( $content_actions[$key] ) ) {
1263 wfDebug( __METHOD__ .
": Found a duplicate key for $key while flattening " .
1264 "content_navigation into content_actions.\n" );
1268 $content_actions[$key] =
$value;
1272 return $content_actions;
1286 $nav_urls[
'mainpage'] = [
'href' => self::makeMainPageUrl() ];
1290 $nav_urls[
'upload'] = [
'href' => self::makeSpecialUrl(
'Upload' ) ];
1292 $nav_urls[
'upload'] =
false;
1294 $nav_urls[
'specialpages'] = [
'href' => self::makeSpecialUrl(
'Specialpages' ) ];
1296 $nav_urls[
'print'] =
false;
1297 $nav_urls[
'permalink'] =
false;
1298 $nav_urls[
'info'] =
false;
1299 $nav_urls[
'whatlinkshere'] =
false;
1300 $nav_urls[
'recentchangeslinked'] =
false;
1301 $nav_urls[
'contributions'] =
false;
1302 $nav_urls[
'log'] =
false;
1303 $nav_urls[
'blockip'] =
false;
1304 $nav_urls[
'emailuser'] =
false;
1305 $nav_urls[
'userrights'] =
false;
1309 if ( !
$out->isPrintable() && (
$out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
1310 $nav_urls[
'print'] = [
1311 'text' => $this->
msg(
'printableversion' )->text(),
1312 'href' => $this->
getTitle()->getLocalURL(
1313 $request->appendQueryValue(
'printable',
'yes' ) )
1317 if (
$out->isArticle() ) {
1321 $nav_urls[
'permalink'] = [
1322 'text' => $this->
msg(
'permalink' )->text(),
1323 'href' => $this->
getTitle()->getLocalURL(
"oldid=$revid" )
1328 $skinTemplate = $this;
1330 Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
1331 [ &$skinTemplate, &$nav_urls, &$revid, &$revid ] );
1334 if (
$out->isArticleRelated() ) {
1335 $nav_urls[
'whatlinkshere'] = [
1336 'href' => SpecialPage::getTitleFor(
'Whatlinkshere', $this->thispage )->getLocalURL()
1339 $nav_urls[
'info'] = [
1340 'text' => $this->
msg(
'pageinfo-toolboxlink' )->text(),
1341 'href' => $this->
getTitle()->getLocalURL(
"action=info" )
1345 $nav_urls[
'recentchangeslinked'] = [
1346 'href' => SpecialPage::getTitleFor(
'Recentchangeslinked', $this->thispage )->getLocalURL()
1358 if ( $user && $user->isRegistered() && $user->isHidden() &&
1359 !$this->getUser()->isAllowed(
'hideuser' )
1365 $rootUser = $user->getName();
1367 $nav_urls[
'contributions'] = [
1368 'text' => $this->
msg(
'contributions', $rootUser )->text(),
1369 'href' => self::makeSpecialUrlSubpage(
'Contributions', $rootUser ),
1370 'tooltip-params' => [ $rootUser ],
1373 $nav_urls[
'log'] = [
1374 'href' => self::makeSpecialUrlSubpage(
'Log', $rootUser )
1377 if ( $this->
getUser()->isAllowed(
'block' ) ) {
1378 $nav_urls[
'blockip'] = [
1379 'text' => $this->
msg(
'blockip', $rootUser )->text(),
1380 'href' => self::makeSpecialUrlSubpage(
'Block', $rootUser )
1385 $nav_urls[
'emailuser'] = [
1386 'text' => $this->
msg(
'tool-link-emailuser', $rootUser )->text(),
1387 'href' => self::makeSpecialUrlSubpage(
'Emailuser', $rootUser ),
1388 'tooltip-params' => [ $rootUser ],
1392 if ( !$user->isAnon() ) {
1395 $canChange = $sur->userCanChangeRights( $user );
1396 $nav_urls[
'userrights'] = [
1397 'text' => $this->
msg(
1398 $canChange ?
'tool-link-userrights' :
'tool-link-userrights-readonly',
1401 'href' => self::makeSpecialUrlSubpage(
'Userrights', $rootUser )
1414 return $this->
getTitle()->getNamespaceKey();
$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()
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in millis...
wfMessageFallback()
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='')
setupSkinUserCss(OutputPage $out)
Add specific styles for this skin.
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.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
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
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 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
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
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