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;
184 $this->thispage =
$title->getPrefixedDBkey();
185 $this->titletxt =
$title->getPrefixedText();
186 $this->userpage =
$user->getUserPage()->getPrefixedText();
191 unset(
$query[
'returnto'] );
192 unset(
$query[
'returntoquery'] );
195 $this->loggedin =
$user->isLoggedIn();
196 $this->username =
$user->getName();
198 if ( $this->loggedin ) {
201 # This won't be used in the standard skins, but we define it to preserve the interface
202 # To save time, we check for existence
215 Profiler::instance()->setTemplated(
true );
218 if (
$out !==
null ) {
230 $res = $tpl->execute();
248 # An ID that includes the actual body text; without categories, contentSub, ...
249 $realBodyAttribs = [
'id' =>
'mw-content-text' ];
251 # Add a mw-content-ltr/rtl class to be able to style based on text
252 # direction when the content is different from the UI language (only
254 # Most information on special pages and file pages is in user language,
255 # rather than content language, so those will not get this
256 if ( Action::getActionName( $this ) ===
'view' &&
258 $pageLang =
$title->getPageViewLanguage();
259 $realBodyAttribs[
'lang'] = $pageLang->getHtmlCode();
260 $realBodyAttribs[
'dir'] = $pageLang->getDir();
261 $realBodyAttribs[
'class'] =
'mw-content-' . $pageLang->getDir();
264 return Html::rawElement(
'div', $realBodyAttribs,
$html );
284 $tpl->set(
'title',
$out->getPageTitle() );
285 $tpl->set(
'pagetitle',
$out->getHTMLTitle() );
286 $tpl->set(
'displaytitle',
$out->mPageLinkTitle );
288 $tpl->set(
'thispage', $this->thispage );
289 $tpl->set(
'titleprefixeddbkey', $this->thispage );
290 $tpl->set(
'titletext',
$title->getText() );
291 $tpl->set(
'articleid',
$title->getArticleID() );
293 $tpl->set(
'isarticle',
$out->isArticle() );
296 if ( $subpagestr !==
'' ) {
297 $subpagestr =
'<span class="subpages">' . $subpagestr .
'</span>';
299 $tpl->set(
'subtitle', $subpagestr .
$out->getSubtitle() );
302 if ( $undelete ===
'' ) {
303 $tpl->set(
'undelete',
'' );
305 $tpl->set(
'undelete',
'<span class="subpages">' . $undelete .
'</span>' );
309 if (
$out->isSyndicated() ) {
311 foreach (
$out->getSyndicationLinks()
as $format =>
$link ) {
314 'text' => $this->
msg(
"feed-$format" )->text(),
318 $tpl->set(
'feeds', $feeds );
320 $tpl->set(
'feeds',
false );
325 $tpl->set(
'charset',
'UTF-8' );
327 $tpl->set(
'skinname', $this->skinname );
328 $tpl->set(
'skinclass', static::class );
329 $tpl->set(
'skin', $this );
330 $tpl->set(
'stylename', $this->stylename );
331 $tpl->set(
'printable',
$out->isPrintable() );
332 $tpl->set(
'handheld',
$request->getBool(
'handheld' ) );
333 $tpl->set(
'loggedin', $this->loggedin );
334 $tpl->set(
'notspecialpage', !
$title->isSpecialPage() );
336 $tpl->set(
'searchtitle', SpecialPage::getTitleFor(
'Search' )->getPrefixedDBkey() );
337 $tpl->set(
'search', trim(
$request->getVal(
'search' ) ) );
342 $tpl->set(
'logopath',
$wgLogo );
346 $userLangCode = $userLang->getHtmlCode();
347 $userLangDir = $userLang->getDir();
349 $tpl->set(
'lang', $userLangCode );
350 $tpl->set(
'dir', $userLangDir );
351 $tpl->set(
'rtl', $userLang->isRTL() );
353 $tpl->set(
'capitalizeallnouns', $userLang->capitalizeAllNouns() ?
' capitalize-all-nouns' :
'' );
354 $tpl->set(
'showjumplinks',
true );
355 $tpl->set(
'username', $this->loggedin ? $this->username :
null );
356 $tpl->set(
'userpage', $this->userpage );
357 $tpl->set(
'userpageurl', $this->userpageUrlDetails[
'href'] );
358 $tpl->set(
'userlang', $userLangCode );
363 $tpl->set(
'userlangattributes',
'' );
364 $tpl->set(
'specialpageattributes',
'' ); # obsolete
367 $tpl->set(
'prebodyhtml',
'' );
369 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
371 $userLangCode !== $contLang->getHtmlCode() ||
372 $userLangDir !== $contLang->getDir()
374 $escUserlang = htmlspecialchars( $userLangCode );
375 $escUserdir = htmlspecialchars( $userLangDir );
378 $attrs =
" lang=\"$escUserlang\" dir=\"$escUserdir\"";
379 $tpl->set(
'userlangattributes', $attrs );
383 $tpl->set(
'logo', $this->
logoText() );
385 $tpl->set(
'copyright',
false );
387 $tpl->set(
'viewcount',
false );
388 $tpl->set(
'lastmod',
false );
389 $tpl->set(
'credits',
false );
390 $tpl->set(
'numberofwatchingusers',
false );
392 if (
$out->isArticle() && $this->isRevisionCurrent() ) {
395 $action = Action::factory(
397 $tpl->set(
'credits',
403 if (
$out->showsCopyright() ) {
412 $tpl->set(
'about', $this->
aboutLink() );
414 $tpl->set(
'footerlinks', [
417 'numberofwatchingusers',
430 foreach ( $tpl->data[
'footericons']
as $footerIconsKey => &$footerIconsBlock ) {
431 if ( count( $footerIconsBlock ) > 0 ) {
432 foreach ( $footerIconsBlock
as &$footerIcon ) {
433 if ( isset( $footerIcon[
'src'] ) ) {
434 if ( !isset( $footerIcon[
'width'] ) ) {
435 $footerIcon[
'width'] = 88;
437 if ( !isset( $footerIcon[
'height'] ) ) {
438 $footerIcon[
'height'] = 31;
443 unset( $tpl->data[
'footericons'][$footerIconsKey] );
447 $tpl->set(
'indicators',
$out->getIndicators() );
453 $tpl->set(
'bodytext',
$out->mBodytext );
456 if ( count( $language_urls ) ) {
457 $tpl->set(
'language_urls', $language_urls );
459 $tpl->set(
'language_urls',
false );
466 $tpl->set(
'content_navigation', $content_navigation );
467 $tpl->set(
'content_actions', $content_actions );
476 $tpl->set(
'headelement',
$out->headElement( $this ) );
478 $tpl->set(
'debug',
'' );
483 $skinTemplate = $this;
485 if ( !Hooks::run(
'SkinTemplateOutputPageBeforeExec', [ &$skinTemplate, &$tpl ] ) ) {
486 wfDebug( __METHOD__ .
": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
491 $tpl->set(
'bodycontent', $tpl->data[
'bodytext'] );
496 $tpl->data[
'bodytext'] .= Html::rawElement(
498 [
'class' =>
'printfooter' ],
499 "\n{$tpl->data['printfooter']}"
501 $tpl->data[
'bodytext'] .= $tpl->data[
'debughtml'];
532 if ( $personalTools ===
null ) {
534 ? $tpl->getPersonalTools()
538 foreach ( $personalTools
as $key => $item ) {
556 return ( $tpl instanceof
BaseTemplate ) ? $tpl->getPersonalTools() : [];
604 $pageurl =
$title->getLocalURL();
605 $authManager = AuthManager::singleton();
610 # Due to T34276, if a user does not have read permissions,
611 # $this->getTitle() will just give Special:Badtitle, which is
612 # not especially useful as a returnto parameter. Use the title
613 # from the request instead, if there was one.
614 if ( $this->
getUser()->isAllowed(
'read' ) ) {
617 $page = Title::newFromText(
$request->getVal(
'title',
'' ) );
619 $page =
$request->getVal(
'returnto', $page );
621 if ( strval( $page ) !==
'' ) {
622 $returnto[
'returnto'] = $page;
625 unset( $paramsArray[
'logoutToken'] );
628 $returnto[
'returntoquery'] =
$query;
632 if ( $this->loggedin ) {
633 $personal_urls[
'userpage'] = [
635 'href' => &$this->userpageUrlDetails[
'href'],
636 'class' => $this->userpageUrlDetails[
'exists'] ?
false :
'new',
637 'exists' => $this->userpageUrlDetails[
'exists'],
638 'active' => ( $this->userpageUrlDetails[
'href'] == $pageurl ),
642 $personal_urls[
'mytalk'] = [
643 'text' => $this->
msg(
'mytalk' )->text(),
644 'href' => &$usertalkUrlDetails[
'href'],
645 'class' => $usertalkUrlDetails[
'exists'] ?
false :
'new',
646 'exists' => $usertalkUrlDetails[
'exists'],
647 'active' => ( $usertalkUrlDetails[
'href'] == $pageurl )
650 $personal_urls[
'preferences'] = [
651 'text' => $this->
msg(
'mypreferences' )->text(),
653 'active' => ( $href == $pageurl )
656 if ( $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
658 $personal_urls[
'watchlist'] = [
659 'text' => $this->
msg(
'mywatchlist' )->text(),
661 'active' => ( $href == $pageurl )
665 # We need to do an explicit check for Special:Contributions, as we
666 # have to match both the title, and the target, which could come
667 # from request values (Special:Contributions?target=Jimbo_Wales)
668 # or be specified in "sub page" form
669 # (Special:Contributions/Jimbo_Wales). The plot
670 # thickens, because the Title object is altered for special pages,
671 # so it doesn't contain the original alias-with-subpage.
672 $origTitle = Title::newFromText(
$request->getText(
'title' ) );
674 list( $spName, $spPar ) =
675 MediaWikiServices::getInstance()->getSpecialPageFactory()->
676 resolveAlias( $origTitle->getText() );
677 $active = $spName ==
'Contributions'
685 $personal_urls[
'mycontris'] = [
686 'text' => $this->
msg(
'mycontris' )->text(),
692 if (
$request->getSession()->canSetUser() ) {
693 $personal_urls[
'logout'] = [
694 'text' => $this->
msg(
'pt-userlogout' )->text(),
698 (
$title->isSpecial(
'Preferences' ) ? [] : $returnto )
699 + [
'logoutToken' => $this->
getUser()->getEditToken(
'logoutToken', $this->
getRequest() ) ] ),
705 if ( !$authManager->canCreateAccounts() || !$authManager->canAuthenticateNow() ) {
707 $useCombinedLoginLink =
false;
710 $loginlink = $this->
getUser()->isAllowed(
'createaccount' ) && $useCombinedLoginLink
711 ?
'nav-login-createaccount'
715 'text' => $this->
msg( $loginlink )->text(),
717 'active' =>
$title->isSpecial(
'Userlogin' )
718 ||
$title->isSpecial(
'CreateAccount' ) && $useCombinedLoginLink,
720 $createaccount_url = [
721 'text' => $this->
msg(
'pt-createaccount' )->text(),
723 'active' =>
$title->isSpecial(
'CreateAccount' ),
734 $personal_urls[
'anontalk'] = [
735 'text' => $this->
msg(
'anontalk' )->text(),
739 $personal_urls[
'anoncontribs'] = [
740 'text' => $this->
msg(
'anoncontribs' )->text(),
747 $authManager->canCreateAccounts()
748 && $this->getUser()->isAllowed(
'createaccount' )
749 && !$useCombinedLoginLink
751 $personal_urls[
'createaccount'] = $createaccount_url;
754 if ( $authManager->canAuthenticateNow() ) {
758 $personal_urls[$key] = $login_url;
762 Hooks::runWithoutAbort(
'PersonalUrls', [ &$personal_urls, &
$title, $this ] );
763 return $personal_urls;
780 $classes[] =
'selected';
783 if ( $checkEdit && !
$title->isKnown() ) {
789 $query =
'action=edit&redlink=1';
793 $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses(
$title );
798 if ( is_array( $message ) ) {
800 $message = end( $message );
802 if ( $msg->exists() ) {
803 $text = $msg->text();
805 $text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()->
806 convertNamespace( MWNamespace::getSubject(
$title->getNamespace() ) );
810 $skinTemplate = $this;
812 if ( !Hooks::run(
'SkinTemplateTabAction', [ &$skinTemplate,
813 $title, $message, $selected, $checkEdit,
819 'class' => implode(
' ', $classes ),
824 if ( $linkClass !==
'' ) {
825 $result[
'link-class'] = $linkClass;
833 if ( !is_object(
$title ) ) {
834 throw new MWException( __METHOD__ .
" given invalid pagename $name" );
839 'href' =>
$title->getLocalURL( $urlaction ),
840 'exists' =>
$title->isKnown(),
855 'href' =>
$title->getLocalURL( $urlaction ),
856 'exists' =>
$title->exists(),
905 $content_navigation = [
913 $action =
$request->getVal(
'action',
'view' );
915 $userCanRead =
$title->quickUserCan(
'read',
$user );
918 $skinTemplate = $this;
919 $preventActiveTabs =
false;
920 Hooks::run(
'SkinTemplatePreventOtherActiveTabs', [ &$skinTemplate, &$preventActiveTabs ] );
923 if (
$title->canExist() ) {
925 $subjectPage =
$title->getSubjectPage();
926 $talkPage =
$title->getTalkPage();
929 $isTalk =
$title->isTalkPage();
932 $subjectId =
$title->getNamespaceKey(
'' );
934 if ( $subjectId ==
'main' ) {
937 $talkId =
"{$subjectId}_talk";
943 $subjectMsg = [
"nstab-$subjectId" ];
944 if ( $subjectPage->isMainPage() ) {
945 array_unshift( $subjectMsg,
'mainpage-nstab' );
947 $content_navigation[
'namespaces'][$subjectId] = $this->
tabAction(
948 $subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs,
'', $userCanRead
950 $content_navigation[
'namespaces'][$subjectId][
'context'] =
'subject';
951 $content_navigation[
'namespaces'][$talkId] = $this->
tabAction(
952 $talkPage, [
"nstab-$talkId",
'talk' ], $isTalk && !$preventActiveTabs,
'', $userCanRead
954 $content_navigation[
'namespaces'][$talkId][
'context'] =
'talk';
956 if ( $userCanRead ) {
958 if (
$title->isKnown() ) {
959 $content_navigation[
'views'][
'view'] = $this->
tabAction(
960 $isTalk ? $talkPage : $subjectPage,
961 [
"$skname-view-view",
'view' ],
962 ( $onPage && ( $action ==
'view' || $action ==
'purge' ) ),
'',
true
965 $content_navigation[
'views'][
'view'][
'redundant'] =
true;
969 $isRemoteContent = $page && !$page->isLocal();
973 if ( $isRemoteContent ) {
974 $content_navigation[
'views'][
'view-foreign'] = [
978 params( $page->getWikiDisplayName() )->text(),
979 'href' => $page->getSourceURL(),
989 $isTalkClass = $isTalk ?
' istalk' :
'';
991 $isEditing = $onPage && ( $action ==
'edit' || $action ==
'submit' );
994 $showNewSection = !
$out->forceHideNewSectionLink()
1003 $msgKey = $isRemoteContent ?
'edit-local' :
'edit';
1005 $msgKey = $isRemoteContent ?
'create-local' :
'create';
1007 $content_navigation[
'views'][
'edit'] = [
1008 'class' => ( $isEditing && (
$section !==
'new' || !$showNewSection )
1015 'primary' => !$isRemoteContent,
1019 if ( $showNewSection ) {
1022 $content_navigation[
'views'][
'addsection'] = [
1023 'class' => ( $isEditing &&
$section ==
'new' ) ?
'selected' :
false,
1026 'href' =>
$title->getLocalURL(
'action=edit§ion=new' )
1030 } elseif (
$title->hasSourceText() ) {
1032 $content_navigation[
'views'][
'viewsource'] = [
1033 'class' => ( $onPage && $action ==
'edit' ) ?
'selected' :
false,
1042 if (
$title->exists() ) {
1044 $content_navigation[
'views'][
'history'] = [
1045 'class' => ( $onPage && $action ==
'history' ) ?
'selected' :
false,
1048 'href' =>
$title->getLocalURL(
'action=history' ),
1052 $content_navigation[
'actions'][
'delete'] = [
1053 'class' => ( $onPage && $action ==
'delete' ) ?
'selected' :
false,
1056 'href' =>
$title->getLocalURL(
'action=delete' )
1061 $moveTitle = SpecialPage::getTitleFor(
'Movepage',
$title->getPrefixedDBkey() );
1062 $content_navigation[
'actions'][
'move'] = [
1063 'class' => $this->
getTitle()->isSpecial(
'Movepage' ) ?
'selected' :
false,
1066 'href' => $moveTitle->getLocalURL()
1071 if (
$title->quickUserCan(
'deletedhistory',
$user ) ) {
1072 $n =
$title->isDeleted();
1074 $undelTitle = SpecialPage::getTitleFor(
'Undelete',
$title->getPrefixedDBkey() );
1077 $msgKey =
$title->quickUserCan(
'undelete',
$user ) ?
'undelete' :
'viewdeleted';
1078 $content_navigation[
'actions'][
'undelete'] = [
1079 'class' => $this->
getTitle()->isSpecial(
'Undelete' ) ?
'selected' :
false,
1081 ->setContext( $this->
getContext() )->numParams( $n )->text(),
1082 'href' => $undelTitle->getLocalURL()
1088 if (
$title->quickUserCan(
'protect',
$user ) &&
$title->getRestrictionTypes() &&
1089 MWNamespace::getRestrictionLevels(
$title->getNamespace(),
$user ) !== [
'' ]
1091 $mode =
$title->isProtected() ?
'unprotect' :
'protect';
1092 $content_navigation[
'actions'][$mode] = [
1093 'class' => ( $onPage && $action == $mode ) ?
'selected' :
false,
1096 'href' =>
$title->getLocalURL(
"action=$mode" )
1101 if ( $this->loggedin &&
$user->isAllowedAll(
'viewmywatchlist',
'editmywatchlist' ) ) {
1111 $mode =
$user->isWatched(
$title ) ?
'unwatch' :
'watch';
1112 $content_navigation[
'actions'][$mode] = [
1113 'class' =>
'mw-watchlink ' . (
1114 $onPage && ( $action ==
'watch' || $action ==
'unwatch' ) ?
'selected' :
''
1117 'text' => $this->
msg( $mode )->text(),
1118 'href' =>
$title->getLocalURL( [
'action' => $mode ] ),
1122 'mw' =>
'interface',
1129 $skinTemplate = $this;
1130 Hooks::runWithoutAbort(
1131 'SkinTemplateNavigation',
1132 [ &$skinTemplate, &$content_navigation ]
1136 $pageLang =
$title->getPageLanguage();
1139 if ( $pageLang->hasVariants() ) {
1141 $variants = $pageLang->getVariants();
1144 $preferred = $pageLang->getPreferredVariant();
1145 if ( Action::getActionName( $this ) ===
'view' ) {
1152 foreach ( $variants
as $code ) {
1154 $varname = $pageLang->getVariantname(
$code );
1156 $content_navigation[
'variants'][] = [
1157 'class' => (
$code == $preferred ) ?
'selected' :
false,
1160 'lang' => LanguageCode::bcp47(
$code ),
1161 'hreflang' => LanguageCode::bcp47(
$code ),
1168 $content_navigation[
'namespaces'][
'special'] = [
1169 'class' =>
'selected',
1170 'text' => $this->
msg(
'nstab-special' )->text(),
1171 'href' =>
$request->getRequestURL(),
1172 'context' =>
'subject'
1176 $skinTemplate = $this;
1177 Hooks::runWithoutAbort(
'SkinTemplateNavigation::SpecialPage',
1178 [ &$skinTemplate, &$content_navigation ] );
1182 $skinTemplate = $this;
1184 Hooks::runWithoutAbort(
'SkinTemplateNavigation::Universal',
1185 [ &$skinTemplate, &$content_navigation ] );
1188 foreach ( $content_navigation
as $section => &$links ) {
1189 foreach ( $links
as $key => &
$link ) {
1191 if ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'subject' ) {
1192 $xmlID =
'ca-nstab-' . $xmlID;
1193 } elseif ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'talk' ) {
1195 $link[
'rel'] =
'discussion';
1196 } elseif (
$section ==
'variants' ) {
1197 $xmlID =
'ca-varlang-' . $xmlID;
1199 $xmlID =
'ca-' . $xmlID;
1201 $link[
'id'] = $xmlID;
1205 # We don't want to give the watch tab an accesskey if the
1206 # page is being edited, because that conflicts with the
1207 # accesskey on the watch checkbox. We also don't want to
1208 # give the edit tab an accesskey, because that's fairly
1209 # superfluous and conflicts with an accesskey (Ctrl-E) often
1210 # used for editing in Safari.
1211 if ( in_array( $action, [
'edit',
'submit' ] ) ) {
1212 if ( isset( $content_navigation[
'views'][
'edit'] ) ) {
1213 $content_navigation[
'views'][
'edit'][
'tooltiponly'] =
true;
1215 if ( isset( $content_navigation[
'actions'][
'watch'] ) ) {
1216 $content_navigation[
'actions'][
'watch'][
'tooltiponly'] =
true;
1218 if ( isset( $content_navigation[
'actions'][
'unwatch'] ) ) {
1219 $content_navigation[
'actions'][
'unwatch'][
'tooltiponly'] =
true;
1223 return $content_navigation;
1236 $content_actions = [];
1238 foreach ( $content_navigation
as $links ) {
1239 foreach ( $links
as $key =>
$value ) {
1240 if ( isset(
$value[
'redundant'] ) &&
$value[
'redundant'] ) {
1249 if ( isset(
$value[
'id'] ) && substr(
$value[
'id'], 0, 3 ) ==
'ca-' ) {
1250 $key = substr(
$value[
'id'], 3 );
1253 if ( isset( $content_actions[$key] ) ) {
1254 wfDebug( __METHOD__ .
": Found a duplicate key for $key while flattening " .
1255 "content_navigation into content_actions.\n" );
1259 $content_actions[$key] =
$value;
1263 return $content_actions;
1283 $nav_urls[
'upload'] =
false;
1287 $nav_urls[
'print'] =
false;
1288 $nav_urls[
'permalink'] =
false;
1289 $nav_urls[
'info'] =
false;
1290 $nav_urls[
'whatlinkshere'] =
false;
1291 $nav_urls[
'recentchangeslinked'] =
false;
1292 $nav_urls[
'contributions'] =
false;
1293 $nav_urls[
'log'] =
false;
1294 $nav_urls[
'blockip'] =
false;
1295 $nav_urls[
'emailuser'] =
false;
1296 $nav_urls[
'userrights'] =
false;
1300 if ( !
$out->isPrintable() && (
$out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
1301 $nav_urls[
'print'] = [
1302 'text' => $this->
msg(
'printableversion' )->text(),
1303 'href' => $this->
getTitle()->getLocalURL(
1304 $request->appendQueryValue(
'printable',
'yes' ) )
1308 if (
$out->isArticle() ) {
1312 $nav_urls[
'permalink'] = [
1313 'text' => $this->
msg(
'permalink' )->text(),
1314 'href' => $this->
getTitle()->getLocalURL(
"oldid=$revid" )
1319 $skinTemplate = $this;
1321 Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
1322 [ &$skinTemplate, &$nav_urls, &$revid, &$revid ] );
1325 if (
$out->isArticleRelated() ) {
1326 $nav_urls[
'whatlinkshere'] = [
1327 'href' => SpecialPage::getTitleFor(
'Whatlinkshere', $this->thispage )->getLocalURL()
1330 $nav_urls[
'info'] = [
1331 'text' => $this->
msg(
'pageinfo-toolboxlink' )->text(),
1332 'href' => $this->
getTitle()->getLocalURL(
"action=info" )
1336 $nav_urls[
'recentchangeslinked'] = [
1337 'href' => SpecialPage::getTitleFor(
'Recentchangeslinked', $this->thispage )->getLocalURL()
1344 $rootUser =
$user->getName();
1346 $nav_urls[
'contributions'] = [
1347 'text' => $this->
msg(
'contributions', $rootUser )->text(),
1349 'tooltip-params' => [ $rootUser ],
1352 $nav_urls[
'log'] = [
1356 if ( $this->
getUser()->isAllowed(
'block' ) ) {
1357 $nav_urls[
'blockip'] = [
1358 'text' => $this->
msg(
'blockip', $rootUser )->text(),
1364 $nav_urls[
'emailuser'] = [
1365 'text' => $this->
msg(
'tool-link-emailuser', $rootUser )->text(),
1367 'tooltip-params' => [ $rootUser ],
1371 if ( !
$user->isAnon() ) {
1374 $canChange = $sur->userCanChangeRights(
$user );
1375 $nav_urls[
'userrights'] = [
1376 'text' => $this->
msg(
1377 $canChange ?
'tool-link-userrights' :
'tool-link-userrights-readonly',
1393 return $this->
getTitle()->getNamespaceKey();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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.
New base template for a skin's template extended from QuickTemplate this class features helper method...
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.
getContext()
Get the base IContextSource 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.
string $template
For QuickTemplate, the name of the subclass which will actually fill the template.
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...
static makeMainPageUrl( $urlaction='')
static makeKnownUrlDetails( $name, $urlaction='')
Make URL details where the article exists (or at least it's convenient to think so)
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.
static makeUrlDetails( $name, $urlaction='')
these return an array with the 'href' and boolean 'exists'
static makeSpecialUrlSubpage( $name, $subpage, $urlaction='')
getRelevantUser()
Return the "relevant" user.
static checkTitle(&$title, $name)
make sure we have some title to operate on
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.
static makeSpecialUrl( $name, $urlaction='', $proto=null)
Make a URL for a Special Page using the given query and protocol.
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
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
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
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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. '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 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name '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. '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 '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 since 1.28! 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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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 & $options
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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
Allows to change the fields on the form that will be generated $name
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
return true to allow those checks to and false if checking is done & $user
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
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