63 'mediawiki.legacy.shared',
64 'mediawiki.legacy.commonPrint',
65 'mediawiki.sectionAnchor'
67 if (
$out->isSyndicated() ) {
68 $moduleStyles[] =
'mediawiki.feedlink';
73 if ( strpos(
$out->getHTML(),
'mw-ui-button' ) !==
false ) {
74 $moduleStyles[] =
'mediawiki.ui.button';
77 $out->addModuleStyles( $moduleStyles );
91 function setupTemplate( $classname, $repository =
false, $cache_dir =
false ) {
92 return new $classname( $this->
getConfig() );
109 foreach ( $this->
getOutput()->getLanguageLinks()
as $languageLinkText ) {
110 $class =
'interlanguage-link interwiki-' . explode(
':', $languageLinkText, 2 )[0];
113 if ( $languageLinkTitle ) {
114 $ilInterwikiCode = $languageLinkTitle->getInterwiki();
115 $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
117 if ( strval( $ilLangName ) ===
'' ) {
118 $ilDisplayTextMsg =
wfMessage(
"interlanguage-link-$ilInterwikiCode" );
119 if ( !$ilDisplayTextMsg->isDisabled() ) {
121 $ilLangName = $ilDisplayTextMsg->text();
124 $ilLangName = $languageLinkText;
133 $ilLangLocalName = Language::fetchLanguageName(
138 $languageLinkTitleText = $languageLinkTitle->getText();
139 if ( $ilLangLocalName ===
'' ) {
140 $ilFriendlySiteName =
wfMessage(
"interlanguage-link-sitename-$ilInterwikiCode" );
141 if ( !$ilFriendlySiteName->isDisabled() ) {
142 if ( $languageLinkTitleText ===
'' ) {
144 'interlanguage-link-title-nonlangonly',
145 $ilFriendlySiteName->text()
149 'interlanguage-link-title-nonlang',
150 $languageLinkTitleText,
151 $ilFriendlySiteName->text()
158 $ilTitle = $languageLinkTitle->getInterwiki() .
159 ":$languageLinkTitleText";
161 } elseif ( $languageLinkTitleText ===
'' ) {
163 'interlanguage-link-title-langonly',
168 'interlanguage-link-title',
169 $languageLinkTitleText,
174 $ilInterwikiCodeBCP47 =
wfBCP47( $ilInterwikiCode );
176 'href' => $languageLinkTitle->getFullURL(),
177 'text' => $ilLangName,
180 'lang' => $ilInterwikiCodeBCP47,
181 'hreflang' => $ilInterwikiCodeBCP47,
184 'SkinTemplateGetLanguageLink',
187 $languageLinks[] = $languageLink;
191 return $languageLinks;
202 $this->thispage =
$title->getPrefixedDBkey();
203 $this->titletxt =
$title->getPrefixedText();
204 $this->userpage =
$user->getUserPage()->getPrefixedText();
209 unset(
$query[
'returnto'] );
210 unset(
$query[
'returntoquery'] );
213 $this->loggedin =
$user->isLoggedIn();
214 $this->username =
$user->getName();
216 if ( $this->loggedin ) {
219 # This won't be used in the standard skins, but we define it to preserve the interface
220 # To save time, we check for existence
236 if (
$out !==
null ) {
248 $res = $tpl->execute();
267 # An ID that includes the actual body text; without categories, contentSub, ...
268 $realBodyAttribs = [
'id' =>
'mw-content-text' ];
270 # Add a mw-content-ltr/rtl class to be able to style based on text direction
271 # when the content is different from the UI language, i.e.:
272 # not for special pages or file pages AND only when viewing
275 $pageLang =
$title->getPageViewLanguage();
276 $realBodyAttribs[
'lang'] = $pageLang->getHtmlCode();
277 $realBodyAttribs[
'dir'] = $pageLang->getDir();
278 $realBodyAttribs[
'class'] =
'mw-content-' . $pageLang->getDir();
301 $tpl->set(
'title',
$out->getPageTitle() );
302 $tpl->set(
'pagetitle',
$out->getHTMLTitle() );
303 $tpl->set(
'displaytitle',
$out->mPageLinkTitle );
305 $tpl->setRef(
'thispage', $this->thispage );
306 $tpl->setRef(
'titleprefixeddbkey', $this->thispage );
307 $tpl->set(
'titletext',
$title->getText() );
308 $tpl->set(
'articleid',
$title->getArticleID() );
310 $tpl->set(
'isarticle',
$out->isArticle() );
313 if ( $subpagestr !==
'' ) {
314 $subpagestr =
'<span class="subpages">' . $subpagestr .
'</span>';
316 $tpl->set(
'subtitle', $subpagestr .
$out->getSubtitle() );
319 if ( $undelete ===
'' ) {
320 $tpl->set(
'undelete',
'' );
322 $tpl->set(
'undelete',
'<span class="subpages">' . $undelete .
'</span>' );
326 if (
$out->isSyndicated() ) {
328 foreach (
$out->getSyndicationLinks()
as $format =>
$link ) {
331 'text' => $this->
msg(
"feed-$format" )->text(),
335 $tpl->setRef(
'feeds', $feeds );
337 $tpl->set(
'feeds',
false );
342 $tpl->set(
'charset',
'UTF-8' );
344 $tpl->setRef(
'skinname', $this->skinname );
345 $tpl->set(
'skinclass', get_class( $this ) );
346 $tpl->setRef(
'skin', $this );
347 $tpl->setRef(
'stylename', $this->stylename );
348 $tpl->set(
'printable',
$out->isPrintable() );
349 $tpl->set(
'handheld',
$request->getBool(
'handheld' ) );
350 $tpl->setRef(
'loggedin', $this->loggedin );
351 $tpl->set(
'notspecialpage', !
$title->isSpecialPage() );
354 $tpl->set(
'search', trim(
$request->getVal(
'search' ) ) );
359 $tpl->setRef(
'logopath',
$wgLogo );
363 $userLangCode = $userLang->getHtmlCode();
364 $userLangDir = $userLang->getDir();
366 $tpl->set(
'lang', $userLangCode );
367 $tpl->set(
'dir', $userLangDir );
368 $tpl->set(
'rtl', $userLang->isRTL() );
370 $tpl->set(
'capitalizeallnouns', $userLang->capitalizeAllNouns() ?
' capitalize-all-nouns' :
'' );
371 $tpl->set(
'showjumplinks',
true );
372 $tpl->set(
'username', $this->loggedin ? $this->username : null );
373 $tpl->setRef(
'userpage', $this->userpage );
374 $tpl->setRef(
'userpageurl', $this->userpageUrlDetails[
'href'] );
375 $tpl->set(
'userlang', $userLangCode );
380 $tpl->set(
'userlangattributes',
'' );
381 $tpl->set(
'specialpageattributes',
'' ); # obsolete
384 $tpl->set(
'prebodyhtml',
'' );
387 $escUserlang = htmlspecialchars( $userLangCode );
388 $escUserdir = htmlspecialchars( $userLangDir );
391 $attrs =
" lang=\"$escUserlang\" dir=\"$escUserdir\"";
392 $tpl->set(
'userlangattributes', $attrs );
396 $tpl->set(
'logo', $this->
logoText() );
398 $tpl->set(
'copyright',
false );
400 $tpl->set(
'viewcount',
false );
401 $tpl->set(
'lastmod',
false );
402 $tpl->set(
'credits',
false );
403 $tpl->set(
'numberofwatchingusers',
false );
404 if (
$out->isArticle() &&
$title->exists() ) {
406 if ( $wgMaxCredits != 0 ) {
420 $tpl->set(
'about', $this->
aboutLink() );
422 $tpl->set(
'footerlinks', [
425 'numberofwatchingusers',
438 foreach ( $tpl->data[
'footericons']
as $footerIconsKey => &$footerIconsBlock ) {
439 if ( count( $footerIconsBlock ) > 0 ) {
440 foreach ( $footerIconsBlock
as &$footerIcon ) {
441 if ( isset( $footerIcon[
'src'] ) ) {
442 if ( !isset( $footerIcon[
'width'] ) ) {
443 $footerIcon[
'width'] = 88;
445 if ( !isset( $footerIcon[
'height'] ) ) {
446 $footerIcon[
'height'] = 31;
451 unset( $tpl->data[
'footericons'][$footerIconsKey] );
455 $tpl->set(
'indicators',
$out->getIndicators() );
462 $tpl->setRef(
'bodytext',
$out->mBodytext );
465 if ( count( $language_urls ) ) {
466 $tpl->setRef(
'language_urls', $language_urls );
468 $tpl->set(
'language_urls',
false );
475 $tpl->setRef(
'content_navigation', $content_navigation );
476 $tpl->setRef(
'content_actions', $content_actions );
482 $tpl->set(
'headelement',
$out->headElement( $this ) );
484 $tpl->set(
'debug',
'' );
489 $skinTemplate = $this;
491 if ( !Hooks::run(
'SkinTemplateOutputPageBeforeExec', [ &$skinTemplate, &$tpl ] ) ) {
492 wfDebug( __METHOD__ .
": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
497 $tpl->set(
'bodycontent', $tpl->data[
'bodytext'] );
504 [
'class' =>
'printfooter' ],
505 "\n{$tpl->data['printfooter']}"
507 $tpl->data[
'bodytext'] .= $tpl->data[
'debughtml'];
524 foreach ( $tpl->getPersonalTools()
as $key => $item ) {
525 $html .= $tpl->makeListItem( $key, $item );
575 $pageurl =
$title->getLocalURL();
580 # Due to bug 32276, if a user does not have read permissions,
581 # $this->getTitle() will just give Special:Badtitle, which is
582 # not especially useful as a returnto parameter. Use the title
583 # from the request instead, if there was one.
584 if ( $this->
getUser()->isAllowed(
'read' ) ) {
591 if ( strval(
$page ) !==
'' ) {
592 $returnto[
'returnto'] =
$page;
595 unset( $paramsArray[
'logoutToken'] );
598 $returnto[
'returntoquery'] =
$query;
602 if ( $this->loggedin ) {
605 'href' => &$this->userpageUrlDetails[
'href'],
606 'class' => $this->userpageUrlDetails[
'exists'] ?
false :
'new',
607 'active' => ( $this->userpageUrlDetails[
'href'] == $pageurl ),
612 'text' => $this->
msg(
'mytalk' )->text(),
613 'href' => &$usertalkUrlDetails[
'href'],
614 'class' => $usertalkUrlDetails[
'exists'] ?
false :
'new',
615 'active' => ( $usertalkUrlDetails[
'href'] == $pageurl )
619 'text' => $this->
msg(
'mypreferences' )->text(),
621 'active' => ( $href == $pageurl )
624 if ( $this->
getUser()->isAllowed(
'viewmywatchlist' ) ) {
627 'text' => $this->
msg(
'mywatchlist' )->text(),
629 'active' => ( $href == $pageurl )
633 # We need to do an explicit check for Special:Contributions, as we
634 # have to match both the title, and the target, which could come
635 # from request values (Special:Contributions?target=Jimbo_Wales)
636 # or be specified in "sub page" form
637 # (Special:Contributions/Jimbo_Wales). The plot
638 # thickens, because the Title object is altered for special pages,
639 # so it doesn't contain the original alias-with-subpage.
643 $active = $spName ==
'Contributions'
652 'text' => $this->
msg(
'mycontris' )->text(),
657 'text' => $this->
msg(
'pt-userlogout' )->text(),
661 (
$title->isSpecial(
'Preferences' ) ? [] : $returnto )
662 + [
'logoutToken' => $this->
getUser()->getEditToken(
'logoutToken', $this->
getRequest() ) ]
668 $loginlink = $this->
getUser()->isAllowed(
'createaccount' ) && $useCombinedLoginLink
669 ?
'nav-login-createaccount'
673 'text' => $this->
msg( $loginlink )->text(),
675 'active' =>
$title->isSpecial(
'Userlogin' )
676 ||
$title->isSpecial(
'CreateAccount' ) && $useCombinedLoginLink,
678 $createaccount_url = [
679 'text' => $this->
msg(
'pt-createaccount' )->text(),
681 'active' =>
$title->isSpecial(
'CreateAccount' ),
685 if ( User::groupHasPermission(
'*',
'edit' ) ) {
693 'text' => $this->
msg(
'anontalk' )->text(),
698 'text' => $this->
msg(
'anoncontribs' )->text(),
704 if ( $this->
getUser()->isAllowed(
'createaccount' ) && !$useCombinedLoginLink ) {
729 $classes[] =
'selected';
731 if ( $checkEdit && !
$title->isKnown() ) {
736 $query =
'action=edit&redlink=1';
743 if ( is_array( $message ) ) {
745 $message = end( $message );
747 if ( $msg->exists() ) {
748 $text = $msg->text();
751 $text =
$wgContLang->getConverter()->convertNamespace(
756 $skinTemplate = $this;
758 if ( !Hooks::run(
'SkinTemplateTabAction', [ &$skinTemplate,
759 $title, $message, $selected, $checkEdit,
765 'class' => implode(
' ', $classes ),
773 if ( !is_object(
$title ) ) {
774 throw new MWException( __METHOD__ .
" given invalid pagename $name" );
779 'href' =>
$title->getLocalURL( $urlaction ),
780 'exists' =>
$title->isKnown(),
792 'href' =>
$title->getLocalURL( $urlaction ),
793 'exists' =>
$title->exists(),
842 $content_navigation = [
850 $action =
$request->getVal(
'action',
'view' );
852 $userCanRead =
$title->quickUserCan(
'read',
$user );
855 $skinTemplate = $this;
856 $preventActiveTabs =
false;
857 Hooks::run(
'SkinTemplatePreventOtherActiveTabs', [ &$skinTemplate, &$preventActiveTabs ] );
860 if (
$title->canExist() ) {
862 $subjectPage =
$title->getSubjectPage();
863 $talkPage =
$title->getTalkPage();
866 $isTalk =
$title->isTalkPage();
869 $subjectId =
$title->getNamespaceKey(
'' );
871 if ( $subjectId ==
'main' ) {
874 $talkId =
"{$subjectId}_talk";
880 $subjectMsg = [
"nstab-$subjectId" ];
881 if ( $subjectPage->isMainPage() ) {
882 array_unshift( $subjectMsg,
'mainpage-nstab' );
884 $content_navigation[
'namespaces'][$subjectId] = $this->
tabAction(
885 $subjectPage, $subjectMsg, !$isTalk && !$preventActiveTabs,
'', $userCanRead
887 $content_navigation[
'namespaces'][$subjectId][
'context'] =
'subject';
888 $content_navigation[
'namespaces'][$talkId] = $this->
tabAction(
889 $talkPage, [
"nstab-$talkId",
'talk' ], $isTalk && !$preventActiveTabs,
'', $userCanRead
891 $content_navigation[
'namespaces'][$talkId][
'context'] =
'talk';
893 if ( $userCanRead ) {
898 if (
$title->exists() || $isForeignFile ) {
899 $content_navigation[
'views'][
'view'] = $this->
tabAction(
900 $isTalk ? $talkPage : $subjectPage,
901 [
"$skname-view-view",
'view' ],
902 ( $onPage && ( $action ==
'view' || $action ==
'purge' ) ),
'',
true
905 $content_navigation[
'views'][
'view'][
'redundant'] =
true;
909 if ( $isForeignFile ) {
911 $content_navigation[
'views'][
'view-foreign'] = [
915 params( $file->getRepo()->getDisplayName() )->text(),
916 'href' => $file->getDescriptionUrl(),
926 $isTalkClass = $isTalk ?
' istalk' :
'';
928 $isEditing = $onPage && ( $action ==
'edit' || $action ==
'submit' );
931 $showNewSection = !
$out->forceHideNewSectionLink()
940 $msgKey = $isForeignFile ?
'edit-local' :
'edit';
942 $msgKey = $isForeignFile ?
'create-local' :
'create';
944 $content_navigation[
'views'][
'edit'] = [
945 'class' => ( $isEditing && (
$section !==
'new' || !$showNewSection )
952 'primary' => !$isForeignFile,
956 if ( $showNewSection ) {
959 $content_navigation[
'views'][
'addsection'] = [
960 'class' => ( $isEditing &&
$section ==
'new' ) ?
'selected' :
false,
963 'href' =>
$title->getLocalURL(
'action=edit§ion=new' )
967 } elseif (
$title->hasSourceText() ) {
969 $content_navigation[
'views'][
'viewsource'] = [
970 'class' => ( $onPage && $action ==
'edit' ) ?
'selected' :
false,
981 $content_navigation[
'views'][
'history'] = [
982 'class' => ( $onPage && $action ==
'history' ) ?
'selected' :
false,
985 'href' =>
$title->getLocalURL(
'action=history' ),
989 $content_navigation[
'actions'][
'delete'] = [
990 'class' => ( $onPage && $action ==
'delete' ) ?
'selected' :
false,
993 'href' =>
$title->getLocalURL(
'action=delete' )
999 $content_navigation[
'actions'][
'move'] = [
1000 'class' => $this->
getTitle()->isSpecial(
'Movepage' ) ?
'selected' :
false,
1003 'href' => $moveTitle->getLocalURL()
1008 if (
$user->isAllowed(
'deletedhistory' ) ) {
1009 $n =
$title->isDeleted();
1014 $msgKey =
$user->isAllowed(
'undelete' ) ?
'undelete' :
'viewdeleted';
1015 $content_navigation[
'actions'][
'undelete'] = [
1016 'class' => $this->
getTitle()->isSpecial(
'Undelete' ) ?
'selected' :
false,
1018 ->setContext( $this->
getContext() )->numParams( $n )->text(),
1019 'href' => $undelTitle->getLocalURL()
1025 if (
$title->quickUserCan(
'protect',
$user ) &&
$title->getRestrictionTypes() &&
1028 $mode =
$title->isProtected() ?
'unprotect' :
'protect';
1029 $content_navigation[
'actions'][$mode] = [
1030 'class' => ( $onPage && $action == $mode ) ?
'selected' :
false,
1033 'href' =>
$title->getLocalURL(
"action=$mode" )
1038 if ( $this->loggedin &&
$user->isAllowedAll(
'viewmywatchlist',
'editmywatchlist' ) ) {
1048 $mode =
$user->isWatched(
$title ) ?
'unwatch' :
'watch';
1049 $content_navigation[
'actions'][$mode] = [
1050 'class' =>
'mw-watchlink ' . (
1051 $onPage && ( $action ==
'watch' || $action ==
'unwatch' ) ?
'selected' :
''
1054 'text' => $this->
msg( $mode )->text(),
1055 'href' =>
$title->getLocalURL( [
'action' => $mode ] )
1061 $skinTemplate = $this;
1062 Hooks::run(
'SkinTemplateNavigation', [ &$skinTemplate, &$content_navigation ] );
1065 $pageLang =
$title->getPageLanguage();
1067 $variants = $pageLang->getVariants();
1070 if ( count( $variants ) > 1 ) {
1073 $preferred = $pageLang->getPreferredVariant();
1081 foreach ( $variants
as $code ) {
1083 $varname = $pageLang->getVariantname(
$code );
1085 $content_navigation[
'variants'][] = [
1086 'class' => (
$code == $preferred ) ?
'selected' :
false,
1097 $content_navigation[
'namespaces'][
'special'] = [
1098 'class' =>
'selected',
1099 'text' => $this->
msg(
'nstab-special' )->text(),
1100 'href' =>
$request->getRequestURL(),
1101 'context' =>
'subject'
1105 $skinTemplate = $this;
1106 Hooks::run(
'SkinTemplateNavigation::SpecialPage',
1107 [ &$skinTemplate, &$content_navigation ] );
1111 $skinTemplate = $this;
1113 Hooks::run(
'SkinTemplateNavigation::Universal', [ &$skinTemplate, &$content_navigation ] );
1116 foreach ( $content_navigation
as $section => &$links ) {
1117 foreach ( $links
as $key => &
$link ) {
1119 if ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'subject' ) {
1120 $xmlID =
'ca-nstab-' . $xmlID;
1121 } elseif ( isset(
$link[
'context'] ) &&
$link[
'context'] ==
'talk' ) {
1123 $link[
'rel'] =
'discussion';
1124 } elseif (
$section ==
'variants' ) {
1125 $xmlID =
'ca-varlang-' . $xmlID;
1127 $xmlID =
'ca-' . $xmlID;
1129 $link[
'id'] = $xmlID;
1133 # We don't want to give the watch tab an accesskey if the
1134 # page is being edited, because that conflicts with the
1135 # accesskey on the watch checkbox. We also don't want to
1136 # give the edit tab an accesskey, because that's fairly
1137 # superfluous and conflicts with an accesskey (Ctrl-E) often
1138 # used for editing in Safari.
1139 if ( in_array( $action, [
'edit',
'submit' ] ) ) {
1140 if ( isset( $content_navigation[
'views'][
'edit'] ) ) {
1141 $content_navigation[
'views'][
'edit'][
'tooltiponly'] =
true;
1143 if ( isset( $content_navigation[
'actions'][
'watch'] ) ) {
1144 $content_navigation[
'actions'][
'watch'][
'tooltiponly'] =
true;
1146 if ( isset( $content_navigation[
'actions'][
'unwatch'] ) ) {
1147 $content_navigation[
'actions'][
'unwatch'][
'tooltiponly'] =
true;
1151 return $content_navigation;
1165 $content_actions = [];
1167 foreach ( $content_navigation
as $links ) {
1168 foreach ( $links
as $key =>
$value ) {
1169 if ( isset(
$value[
'redundant'] ) &&
$value[
'redundant'] ) {
1178 if ( isset(
$value[
'id'] ) && substr(
$value[
'id'], 0, 3 ) ==
'ca-' ) {
1179 $key = substr(
$value[
'id'], 3 );
1182 if ( isset( $content_actions[$key] ) ) {
1183 wfDebug( __METHOD__ .
": Found a duplicate key for $key while flattening " .
1184 "content_navigation into content_actions.\n" );
1188 $content_actions[$key] =
$value;
1192 return $content_actions;
1212 $nav_urls[
'upload'] =
false;
1216 $nav_urls[
'print'] =
false;
1217 $nav_urls[
'permalink'] =
false;
1218 $nav_urls[
'info'] =
false;
1219 $nav_urls[
'whatlinkshere'] =
false;
1220 $nav_urls[
'recentchangeslinked'] =
false;
1221 $nav_urls[
'contributions'] =
false;
1222 $nav_urls[
'log'] =
false;
1223 $nav_urls[
'blockip'] =
false;
1224 $nav_urls[
'emailuser'] =
false;
1225 $nav_urls[
'userrights'] =
false;
1229 if ( !
$out->isPrintable() && (
$out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
1230 $nav_urls[
'print'] = [
1231 'text' => $this->
msg(
'printableversion' )->text(),
1232 'href' => $this->
getTitle()->getLocalURL(
1233 $request->appendQueryValue(
'printable',
'yes' ) )
1237 if (
$out->isArticle() ) {
1241 $nav_urls[
'permalink'] = [
1242 'text' => $this->
msg(
'permalink' )->text(),
1243 'href' => $this->
getTitle()->getLocalURL(
"oldid=$revid" )
1248 $skinTemplate = $this;
1250 Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
1251 [ &$skinTemplate, &$nav_urls, &$revid, &$revid ] );
1254 if (
$out->isArticleRelated() ) {
1255 $nav_urls[
'whatlinkshere'] = [
1259 $nav_urls[
'info'] = [
1260 'text' => $this->
msg(
'pageinfo-toolboxlink' )->text(),
1261 'href' => $this->
getTitle()->getLocalURL(
"action=info" )
1264 if ( $this->
getTitle()->exists() ) {
1265 $nav_urls[
'recentchangeslinked'] = [
1273 $rootUser =
$user->getName();
1275 $nav_urls[
'contributions'] = [
1276 'text' => $this->
msg(
'contributions', $rootUser )->text(),
1278 'tooltip-params' => [ $rootUser ],
1281 $nav_urls[
'log'] = [
1285 if ( $this->
getUser()->isAllowed(
'block' ) ) {
1286 $nav_urls[
'blockip'] = [
1287 'text' => $this->
msg(
'blockip', $rootUser )->text(),
1293 $nav_urls[
'emailuser'] = [
1295 'tooltip-params' => [ $rootUser ],
1299 if ( !
$user->isAnon() ) {
1302 if ( $sur->userCanExecute( $this->getUser() ) ) {
1303 $nav_urls[
'userrights'] = [
1318 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.
wfBCP47( $code)
Get the normalised IETF language tag See unit test for examples.
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...
getUser()
Get the User object.
getRequest()
Get the WebRequest object.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getConfig()
Get the Config object.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getTitle()
Get the Title object.
getOutput()
Get the OutputPage object.
getWikiPage()
Get the WikiPage object.
getLanguage()
Get the Language object.
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Set the IContextSource object.
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
static getRestrictionLevels( $index, User $user=null)
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a use...
This class should be covered by a general architecture document which does not exist as of January 20...
static instance()
Singleton.
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...
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
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)
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.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Represents a title within MediaWiki.
isSpecialPage()
Returns true if this is a special page.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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...
Special page to allow managing user group membership.
Special handling for file pages.
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
when a variable name is used in a it is silently declared as a new local masking the global
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
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
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 local account $user
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
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:Associative array mapping language codes to prefixed links of the form "language:title". & $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':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
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 after processing 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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc & $personal_urls
namespace and then decline to actually register it file or subcat img or subcat $title
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
error also a ContextSource 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 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
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
Allows to change the fields on the form that will be generated $name
processing should stop and the error should be shown to the user * false
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
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
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