Go to the documentation of this file.
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() );
105 if ( $wgHideInterlanguageLinks ) {
112 foreach ( $this->
getOutput()->getLanguageLinks()
as $languageLinkText ) {
113 $class =
'interlanguage-link interwiki-' . explode(
':', $languageLinkText, 2 )[0];
116 if ( $languageLinkTitle ) {
117 $ilInterwikiCode = $languageLinkTitle->getInterwiki();
120 if ( strval( $ilLangName ) ===
'' ) {
121 $ilDisplayTextMsg =
wfMessage(
"interlanguage-link-$ilInterwikiCode" );
122 if ( !$ilDisplayTextMsg->isDisabled() ) {
124 $ilLangName = $ilDisplayTextMsg->text();
127 $ilLangName = $languageLinkText;
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 =
wfBCP47( $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 ) {
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
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();
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 );
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() );
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() ) {
410 if ( $wgMaxCredits != 0 ) {
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'] );
510 [
'class' =>
'printfooter' ],
511 "\n{$tpl->data['printfooter']}"
513 $tpl->data[
'bodytext'] .= $tpl->data[
'debughtml'];
530 foreach ( $tpl->getPersonalTools()
as $key => $item ) {
531 $html .= $tpl->makeListItem( $key, $item );
581 $pageurl =
$title->getLocalURL();
582 $authManager = AuthManager::singleton();
587 # Due to T34276, if a user does not have read permissions,
588 # $this->getTitle() will just give Special:Badtitle, which is
589 # not especially useful as a returnto parameter. Use the title
590 # from the request instead, if there was one.
591 if ( $this->
getUser()->isAllowed(
'read' ) ) {
596 $page =
$request->getVal(
'returnto', $page );
598 if ( strval( $page ) !==
'' ) {
599 $a[
'returnto'] = $page;
602 $a[
'returntoquery'] =
$query;
607 if ( $this->loggedin ) {
608 $personal_urls[
'userpage'] = [
610 'href' => &$this->userpageUrlDetails[
'href'],
611 'class' => $this->userpageUrlDetails[
'exists'] ?
false :
'new',
612 'active' => ( $this->userpageUrlDetails[
'href'] == $pageurl ),
616 $personal_urls[
'mytalk'] = [
617 'text' => $this->
msg(
'mytalk' )->text(),
618 'href' => &$usertalkUrlDetails[
'href'],
619 'class' => $usertalkUrlDetails[
'exists'] ?
false :
'new',
620 'active' => ( $usertalkUrlDetails[
'href'] == $pageurl )
623 $personal_urls[
'preferences'] = [
624 'text' => $this->
msg(
'mypreferences' )->text(),
626 'active' => ( $href == $pageurl )
629 if ( $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
631 $personal_urls[
'watchlist'] = [
632 'text' => $this->
msg(
'mywatchlist' )->text(),
634 'active' => ( $href == $pageurl )
638 # We need to do an explicit check for Special:Contributions, as we
639 # have to match both the title, and the target, which could come
640 # from request values (Special:Contributions?target=Jimbo_Wales)
641 # or be specified in "sub page" form
642 # (Special:Contributions/Jimbo_Wales). The plot
643 # thickens, because the Title object is altered for special pages,
644 # so it doesn't contain the original alias-with-subpage.
648 $active = $spName ==
'Contributions'
656 $personal_urls[
'mycontris'] = [
657 'text' => $this->
msg(
'mycontris' )->text(),
663 if (
$request->getSession()->canSetUser() ) {
664 $personal_urls[
'logout'] = [
665 'text' => $this->
msg(
'pt-userlogout' )->text(),
669 $title->isSpecial(
'Preferences' ) ?
'noreturnto' : $returnto ),
675 if ( !$authManager->canCreateAccounts() || !$authManager->canAuthenticateNow() ) {
677 $useCombinedLoginLink =
false;
680 $loginlink = $this->
getUser()->isAllowed(
'createaccount' ) && $useCombinedLoginLink
681 ?
'nav-login-createaccount'
685 'text' => $this->
msg( $loginlink )->text(),
687 'active' =>
$title->isSpecial(
'Userlogin' )
688 ||
$title->isSpecial(
'CreateAccount' ) && $useCombinedLoginLink,
690 $createaccount_url = [
691 'text' => $this->
msg(
'pt-createaccount' )->text(),
693 'active' =>
$title->isSpecial(
'CreateAccount' ),
704 $personal_urls[
'anontalk'] = [
705 'text' => $this->
msg(
'anontalk' )->text(),
709 $personal_urls[
'anoncontribs'] = [
710 'text' => $this->
msg(
'anoncontribs' )->text(),
717 $authManager->canCreateAccounts()
718 && $this->
getUser()->isAllowed(
'createaccount' )
719 && !$useCombinedLoginLink
721 $personal_urls[
'createaccount'] = $createaccount_url;
724 if ( $authManager->canAuthenticateNow() ) {
728 $personal_urls[$key] = $login_url;
733 return $personal_urls;
750 $classes[] =
'selected';
752 if ( $checkEdit && !
$title->isKnown() ) {
757 $query =
'action=edit&redlink=1';
761 $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses(
$title );
766 if ( is_array( $message ) ) {
768 $message = end( $message );
770 if ( $msg->exists() ) {
771 $text = $msg->text();
774 $text =
$wgContLang->getConverter()->convertNamespace(
779 $skinTemplate = $this;
781 if ( !
Hooks::run(
'SkinTemplateTabAction', [ &$skinTemplate,
782 $title, $message, $selected, $checkEdit,
788 'class' => implode(
' ', $classes ),
792 if ( $linkClass !==
'' ) {
793 $result[
'link-class'] = $linkClass;
801 if ( !is_object(
$title ) ) {
802 throw new MWException( __METHOD__ .
" given invalid pagename $name" );
807 'href' =>
$title->getLocalURL( $urlaction ),
808 'exists' =>
$title->isKnown(),
823 'href' =>
$title->getLocalURL( $urlaction ),
824 'exists' =>
$title->exists(),
873 $content_navigation = [
881 $action =
$request->getVal(
'action',
'view' );
883 $userCanRead =
$title->quickUserCan(
'read',
$user );
886 $skinTemplate = $this;
887 $preventActiveTabs =
false;
888 Hooks::run(
'SkinTemplatePreventOtherActiveTabs', [ &$skinTemplate, &$preventActiveTabs ] );
891 if (
$title->canExist() ) {
893 $subjectPage =
$title->getSubjectPage();
894 $talkPage =
$title->getTalkPage();
897 $isTalk =
$title->isTalkPage();
900 $subjectId =
$title->getNamespaceKey(
'' );
902 if ( $subjectId ==
'main' ) {
905 $talkId =
"{$subjectId}_talk";
911 $subjectMsg = [
"nstab-$subjectId" ];
912 if ( $subjectPage->isMainPage() ) {
913 array_unshift( $subjectMsg,
'mainpage-nstab' );
915 $content_navigation[
'namespaces'][$subjectId] = $this->
tabAction(
916 $subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs,
'', $userCanRead
918 $content_navigation[
'namespaces'][$subjectId][
'context'] =
'subject';
919 $content_navigation[
'namespaces'][$talkId] = $this->
tabAction(
920 $talkPage, [
"nstab-$talkId",
'talk' ], $isTalk && !$preventActiveTabs,
'', $userCanRead
922 $content_navigation[
'namespaces'][$talkId][
'context'] =
'talk';
924 if ( $userCanRead ) {
926 if (
$title->isKnown() ) {
927 $content_navigation[
'views'][
'view'] = $this->
tabAction(
928 $isTalk ? $talkPage : $subjectPage,
929 [
"$skname-view-view",
'view' ],
930 ( $onPage && ( $action ==
'view' || $action ==
'purge' ) ),
'',
true
933 $content_navigation[
'views'][
'view'][
'redundant'] =
true;
937 $isRemoteContent = $page && !$page->isLocal();
941 if ( $isRemoteContent ) {
942 $content_navigation[
'views'][
'view-foreign'] = [
946 params( $page->getWikiDisplayName() )->
text(),
947 'href' => $page->getSourceURL(),
957 $isTalkClass = $isTalk ?
' istalk' :
'';
959 $isEditing = $onPage && ( $action ==
'edit' || $action ==
'submit' );
962 $showNewSection = !
$out->forceHideNewSectionLink()
971 $msgKey = $isRemoteContent ?
'edit-local' :
'edit';
973 $msgKey = $isRemoteContent ?
'create-local' :
'create';
975 $content_navigation[
'views'][
'edit'] = [
976 'class' => ( $isEditing && (
$section !==
'new' || !$showNewSection )
983 'primary' => !$isRemoteContent,
987 if ( $showNewSection ) {
990 $content_navigation[
'views'][
'addsection'] = [
991 'class' => ( $isEditing &&
$section ==
'new' ) ?
'selected' :
false,
994 'href' =>
$title->getLocalURL(
'action=edit§ion=new' )
998 } elseif (
$title->hasSourceText() ) {
1000 $content_navigation[
'views'][
'viewsource'] = [
1001 'class' => ( $onPage && $action ==
'edit' ) ?
'selected' :
false,
1010 if (
$title->exists() ) {
1012 $content_navigation[
'views'][
'history'] = [
1013 'class' => ( $onPage && $action ==
'history' ) ?
'selected' :
false,
1016 'href' =>
$title->getLocalURL(
'action=history' ),
1020 $content_navigation[
'actions'][
'delete'] = [
1021 'class' => ( $onPage && $action ==
'delete' ) ?
'selected' :
false,
1024 'href' =>
$title->getLocalURL(
'action=delete' )
1030 $content_navigation[
'actions'][
'move'] = [
1031 'class' => $this->
getTitle()->isSpecial(
'Movepage' ) ?
'selected' :
false,
1034 'href' => $moveTitle->getLocalURL()
1039 if (
$user->isAllowed(
'deletedhistory' ) ) {
1040 $n =
$title->isDeleted();
1045 $msgKey =
$user->isAllowed(
'undelete' ) ?
'undelete' :
'viewdeleted';
1046 $content_navigation[
'actions'][
'undelete'] = [
1047 'class' => $this->
getTitle()->isSpecial(
'Undelete' ) ?
'selected' :
false,
1049 ->setContext( $this->
getContext() )->numParams( $n )->text(),
1050 'href' => $undelTitle->getLocalURL()
1056 if (
$title->quickUserCan(
'protect',
$user ) &&
$title->getRestrictionTypes() &&
1059 $mode =
$title->isProtected() ?
'unprotect' :
'protect';
1060 $content_navigation[
'actions'][$mode] = [
1061 'class' => ( $onPage && $action == $mode ) ?
'selected' :
false,
1064 'href' =>
$title->getLocalURL(
"action=$mode" )
1069 if ( $this->loggedin &&
$user->isAllowedAll(
'viewmywatchlist',
'editmywatchlist' ) ) {
1079 $mode =
$user->isWatched(
$title ) ?
'unwatch' :
'watch';
1080 $content_navigation[
'actions'][$mode] = [
1081 'class' =>
'mw-watchlink ' . (
1082 $onPage && ( $action ==
'watch' || $action ==
'unwatch' ) ?
'selected' :
''
1085 'text' => $this->
msg( $mode )->text(),
1086 'href' =>
$title->getLocalURL( [
'action' => $mode ] ),
1090 'mw' =>
'interface',
1097 $skinTemplate = $this;
1098 Hooks::run(
'SkinTemplateNavigation', [ &$skinTemplate, &$content_navigation ] );
1101 $pageLang =
$title->getPageLanguage();
1103 $variants = $pageLang->getVariants();
1106 if (
count( $variants ) > 1 ) {
1109 $preferred = $pageLang->getPreferredVariant();
1117 foreach ( $variants
as $code ) {
1119 $varname = $pageLang->getVariantname(
$code );
1121 $content_navigation[
'variants'][] = [
1122 'class' => (
$code == $preferred ) ?
'selected' :
false,
1133 $content_navigation[
'namespaces'][
'special'] = [
1134 'class' =>
'selected',
1135 'text' => $this->
msg(
'nstab-special' )->text(),
1136 'href' =>
$request->getRequestURL(),
1137 'context' =>
'subject'
1141 $skinTemplate = $this;
1142 Hooks::run(
'SkinTemplateNavigation::SpecialPage',
1143 [ &$skinTemplate, &$content_navigation ] );
1147 $skinTemplate = $this;
1149 Hooks::run(
'SkinTemplateNavigation::Universal', [ &$skinTemplate, &$content_navigation ] );
1152 foreach ( $content_navigation
as $section => &$links ) {
1153 foreach ( $links
as $key => &
$link ) {
1155 if ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'subject' ) {
1156 $xmlID =
'ca-nstab-' . $xmlID;
1157 } elseif ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'talk' ) {
1159 $link[
'rel'] =
'discussion';
1160 } elseif (
$section ==
'variants' ) {
1161 $xmlID =
'ca-varlang-' . $xmlID;
1163 $xmlID =
'ca-' . $xmlID;
1165 $link[
'id'] = $xmlID;
1169 # We don't want to give the watch tab an accesskey if the
1170 # page is being edited, because that conflicts with the
1171 # accesskey on the watch checkbox. We also don't want to
1172 # give the edit tab an accesskey, because that's fairly
1173 # superfluous and conflicts with an accesskey (Ctrl-E) often
1174 # used for editing in Safari.
1175 if ( in_array( $action, [
'edit',
'submit' ] ) ) {
1176 if ( isset( $content_navigation[
'views'][
'edit'] ) ) {
1177 $content_navigation[
'views'][
'edit'][
'tooltiponly'] =
true;
1179 if ( isset( $content_navigation[
'actions'][
'watch'] ) ) {
1180 $content_navigation[
'actions'][
'watch'][
'tooltiponly'] =
true;
1182 if ( isset( $content_navigation[
'actions'][
'unwatch'] ) ) {
1183 $content_navigation[
'actions'][
'unwatch'][
'tooltiponly'] =
true;
1187 return $content_navigation;
1200 $content_actions = [];
1202 foreach ( $content_navigation
as $links ) {
1203 foreach ( $links
as $key =>
$value ) {
1204 if ( isset(
$value[
'redundant'] ) &&
$value[
'redundant'] ) {
1213 if ( isset(
$value[
'id'] ) && substr(
$value[
'id'], 0, 3 ) ==
'ca-' ) {
1214 $key = substr(
$value[
'id'], 3 );
1217 if ( isset( $content_actions[$key] ) ) {
1218 wfDebug( __METHOD__ .
": Found a duplicate key for $key while flattening " .
1219 "content_navigation into content_actions.\n" );
1223 $content_actions[$key] =
$value;
1227 return $content_actions;
1244 } elseif ( UploadBase::isEnabled() && UploadBase::isAllowed( $this->
getUser() ) ===
true ) {
1247 $nav_urls[
'upload'] =
false;
1251 $nav_urls[
'print'] =
false;
1252 $nav_urls[
'permalink'] =
false;
1253 $nav_urls[
'info'] =
false;
1254 $nav_urls[
'whatlinkshere'] =
false;
1255 $nav_urls[
'recentchangeslinked'] =
false;
1256 $nav_urls[
'contributions'] =
false;
1257 $nav_urls[
'log'] =
false;
1258 $nav_urls[
'blockip'] =
false;
1259 $nav_urls[
'emailuser'] =
false;
1260 $nav_urls[
'userrights'] =
false;
1264 if ( !
$out->isPrintable() && (
$out->isArticle() || $this->
getTitle()->isSpecialPage() ) ) {
1265 $nav_urls[
'print'] = [
1266 'text' => $this->
msg(
'printableversion' )->text(),
1267 'href' => $this->
getTitle()->getLocalURL(
1268 $request->appendQueryValue(
'printable',
'yes' ) )
1272 if (
$out->isArticle() ) {
1276 $nav_urls[
'permalink'] = [
1277 'text' => $this->
msg(
'permalink' )->text(),
1278 'href' => $this->
getTitle()->getLocalURL(
"oldid=$revid" )
1283 $skinTemplate = $this;
1285 Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
1286 [ &$skinTemplate, &$nav_urls, &$revid, &$revid ] );
1289 if (
$out->isArticleRelated() ) {
1290 $nav_urls[
'whatlinkshere'] = [
1294 $nav_urls[
'info'] = [
1295 'text' => $this->
msg(
'pageinfo-toolboxlink' )->text(),
1296 'href' => $this->
getTitle()->getLocalURL(
"action=info" )
1300 $nav_urls[
'recentchangeslinked'] = [
1308 $rootUser =
$user->getName();
1310 $nav_urls[
'contributions'] = [
1311 'text' => $this->
msg(
'contributions', $rootUser )->text(),
1313 'tooltip-params' => [ $rootUser ],
1316 $nav_urls[
'log'] = [
1320 if ( $this->
getUser()->isAllowed(
'block' ) ) {
1321 $nav_urls[
'blockip'] = [
1322 'text' => $this->
msg(
'blockip', $rootUser )->text(),
1328 $nav_urls[
'emailuser'] = [
1329 'text' => $this->
msg(
'tool-link-emailuser', $rootUser )->text(),
1331 'tooltip-params' => [ $rootUser ],
1335 if ( !
$user->isAnon() ) {
1338 $canChange = $sur->userCanChangeRights(
$user );
1339 $nav_urls[
'userrights'] = [
1340 'text' => $this->
msg(
1341 $canChange ?
'tool-link-userrights' :
'tool-link-userrights-readonly',
1357 return $this->
getTitle()->getNamespaceKey();
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
$wgJsMimeType
Previously used as content type in HTML script tags.
getConfig()
Get the Config object.
useCombinedLoginLink()
Output a boolean indicating if buildPersonalUrls should output separate login and create account link...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
editUrlOptions()
Return URL options for the 'edit page' link.
$wgMaxCredits
Set this to the number of authors that you want to be credited below an article text.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static makeUrlDetails( $name, $urlaction='')
these return an array with the 'href' and boolean 'exists'
getContext()
Get the base IContextSource object.
getSiteNotice()
Get the site notice.
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
processing should stop and the error should be shown to the user * false
$wgMimeType
The default Content-Type header.
buildContentNavigationUrls()
a structured array of links usually used for the tabs in a skin
getPoweredBy()
Gets the powered by MediaWiki icon.
static instance()
Singleton.
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
$wgScript
The URL path to index.php.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
$wgHideInterlanguageLinks
Hide interlanguage links from the sidebar.
lastModified()
Get the timestamp of the latest revision, formatted in user language.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
$wgShowCreditsIfMax
If there are more than $wgMaxCredits authors, show $wgMaxCredits of them.
static checkTitle(&$title, $name)
make sure we have some title to operate on
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static makeSpecialUrl( $name, $urlaction='', $proto=null)
Make a URL for a Special Page using the given query and protocol.
aboutLink()
Gets the link to the wiki's about page.
static makeSpecialUrlSubpage( $name, $subpage, $urlaction='')
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Allows to change the fields on the form that will be generated $name
getRequest()
Get the WebRequest object.
setupSkinUserCss(OutputPage $out)
Add specific styles for this skin.
wrapHTML( $title, $html)
Wrap the body text with language information and identifiable element.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
getUser()
Get the User object.
getTitle()
Get the Title object.
wfMessageFallback()
This function accepts multiple message keys and returns a message instance for the first message whic...
$wgLogo
The URL path of the wiki logo.
$wgStylePath
The URL path of the skins directory.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
bottomScripts()
This gets called shortly before the "</body>" tag.
afterContentHook()
This runs a hook to allow extensions placing their stuff after content and article metadata (e....
getLanguage()
Get the Language object.
null for the 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
Special page to allow managing user group membership.
getPersonalToolsList()
Get the HTML for the p-personal list.
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
namespace and then decline to actually register it file or subcat img or subcat $title
string $skinname
Name of our skin, it probably needs to be all lower case.
buildSidebar()
Build an array that represents the sidebar(s), the navigation bar among them.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
privacyLink()
Gets the link to the wiki's privacy policy page.
buildNavUrls()
build array of common navigation links
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
generateDebugHTML()
Generate debug data HTML for displaying at the bottom of the main content area.
tabAction( $title, $message, $selected, $query='', $checkEdit=false)
Builds an array with tab definition.
formatLanguageName( $name)
Format language name for use in sidebar interlanguage links list.
buildContentActionUrls( $content_navigation)
an array of edit links by default used for the tabs
getOutput()
Get the OutputPage object.
getWikiPage()
Get the WikiPage object.
isRevisionCurrent()
Whether the revision displayed is the latest revision of the page.
$wgUseCombinedLoginLink
Login / create account link behavior when it's possible for anonymous users to create an account.
when a variable name is used in a it is silently declared as a new masking the global
disclaimerLink()
Gets the link to the wiki's general disclaimers page.
static getRestrictionLevels( $index, User $user=null)
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a use...
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
$wgDisableLangConversion
Whether to enable language variant conversion.
setContext(IContextSource $context)
Set the IContextSource object.
This class should be covered by a general architecture document which does not exist as of January 20...
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
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
prepareQuickTemplate()
initialize various variables and generate the template
getRelevantTitle()
Return the "relevant" title.
string $template
For QuickTemplate, the name of the subclass which will actually fill the template.
$wgServer
URL of the server.
$wgSitename
Name of the site.
printSource()
Text with the permalink to the source page, usually shown on the footer of a printed page.
makeArticleUrlDetails( $name, $urlaction='')
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
static fetchLanguageName( $code, $inLanguage=null, $include='all')
makeTalkUrlDetails( $name, $urlaction='')
$wgUploadNavigationUrl
Point the upload navigation link to an external URL Useful if you want to use a shared repository by ...
wfReportTime()
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in millis...
getLanguages()
Generates array of language links for the current page.
getNewtalks()
Gets new talk page messages for the current user and returns an appropriate alert message (or an empt...
getNameSpaceKey()
Generate strings used for xml 'id' names.
Represents a title within MediaWiki.
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
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
isSpecialPage()
Returns true if this is a special page.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getCopyright( $type='detect')
outputPage(OutputPage $out=null)
initialize various variables and generate the template
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
setContext( $context)
Sets the context this SpecialPage is executed in.
getRelevantUser()
Return the "relevant" user.
subPageSubtitle( $out=null)
usually copyright or history_copyright This message must be in HTML not wikitext & $link
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
static makeKnownUrlDetails( $name, $urlaction='')
Make URL details where the article exists (or at least it's convenient to think so)
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 "<
static makeMainPageUrl( $urlaction='')
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
The main skin class which provides methods and properties for all other skins.
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
initPage(OutputPage $out)
$wgScriptPath
The path we should point to.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getRevisionId()
Get the current revision ID.
Base class for template-based skins.
static factory( $action, Page $page, IContextSource $context=null)
Get an appropriate Action subclass for the given action.
printOrError( $str)
Output the string, or print error message if it's an error object of the appropriate type.
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 content language as $wgContLang
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.
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
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
buildPersonalUrls()
build array of urls for personal toolbar