36 return call_user_func_array( [ $this->
getSkin(),
'msg' ], func_get_args() );
39 function msg( $str ) {
40 echo $this->
getMsg( $str )->escaped();
44 echo $this->
getMsg( $str )->text();
48 echo $this->
getMsg( $str )->parseAsBlock();
60 if ( isset( $this->
data[
'nav_urls'][
'whatlinkshere'] )
61 && $this->
data[
'nav_urls'][
'whatlinkshere']
63 $toolbox[
'whatlinkshere'] = $this->
data[
'nav_urls'][
'whatlinkshere'];
64 $toolbox[
'whatlinkshere'][
'id'] =
't-whatlinkshere';
66 if ( isset( $this->
data[
'nav_urls'][
'recentchangeslinked'] )
67 && $this->
data[
'nav_urls'][
'recentchangeslinked']
69 $toolbox[
'recentchangeslinked'] = $this->
data[
'nav_urls'][
'recentchangeslinked'];
70 $toolbox[
'recentchangeslinked'][
'msg'] =
'recentchangeslinked-toolbox';
71 $toolbox[
'recentchangeslinked'][
'id'] =
't-recentchangeslinked';
72 $toolbox[
'recentchangeslinked'][
'rel'] =
'nofollow';
74 if ( isset( $this->
data[
'feeds'] ) && $this->
data[
'feeds'] ) {
75 $toolbox[
'feeds'][
'id'] =
'feedlinks';
76 $toolbox[
'feeds'][
'links'] = [];
77 foreach ( $this->
data[
'feeds']
as $key => $feed ) {
78 $toolbox[
'feeds'][
'links'][$key] = $feed;
79 $toolbox[
'feeds'][
'links'][$key][
'id'] =
"feed-$key";
80 $toolbox[
'feeds'][
'links'][$key][
'rel'] =
'alternate';
81 $toolbox[
'feeds'][
'links'][$key][
'type'] =
"application/{$key}+xml";
82 $toolbox[
'feeds'][
'links'][$key][
'class'] =
'feedlink';
85 foreach ( [
'contributions',
'log',
'blockip',
'emailuser',
86 'userrights',
'upload',
'specialpages' ]
as $special
90 $toolbox[
$special][
'id'] =
"t-$special";
93 if ( isset( $this->
data[
'nav_urls'][
'print'] ) && $this->
data[
'nav_urls'][
'print'] ) {
94 $toolbox[
'print'] = $this->
data[
'nav_urls'][
'print'];
95 $toolbox[
'print'][
'id'] =
't-print';
96 $toolbox[
'print'][
'rel'] =
'alternate';
97 $toolbox[
'print'][
'msg'] =
'printableversion';
99 if ( isset( $this->
data[
'nav_urls'][
'permalink'] ) && $this->
data[
'nav_urls'][
'permalink'] ) {
100 $toolbox[
'permalink'] = $this->
data[
'nav_urls'][
'permalink'];
101 if ( $toolbox[
'permalink'][
'href'] ===
'' ) {
102 unset( $toolbox[
'permalink'][
'href'] );
103 $toolbox[
'ispermalink'][
'tooltiponly'] =
true;
104 $toolbox[
'ispermalink'][
'id'] =
't-ispermalink';
105 $toolbox[
'ispermalink'][
'msg'] =
'permalink';
107 $toolbox[
'permalink'][
'id'] =
't-permalink';
110 if ( isset( $this->
data[
'nav_urls'][
'info'] ) && $this->
data[
'nav_urls'][
'info'] ) {
111 $toolbox[
'info'] = $this->
data[
'nav_urls'][
'info'];
112 $toolbox[
'info'][
'id'] =
't-info';
117 Hooks::run(
'BaseTemplateToolbox', [ &
$template, &$toolbox ] );
132 $personal_tools = [];
133 foreach ( $this->
get(
'personal_urls' )
as $key => $plink ) {
134 # The class on a personal_urls item is meant to go on the <a> instead
135 # of the <li> so we have to use a single item "links" array instead
136 # of using most of the personal_url's keys directly.
139 [
'single-id' =>
"pt-$key" ],
143 if ( isset( $plink[
'active'] ) ) {
144 $ptool[
'active'] = $plink[
'active'];
146 foreach ( [
'href',
'class',
'text',
'dir',
'data' ]
as $k ) {
147 if ( isset( $plink[$k] ) ) {
148 $ptool[
'links'][0][$k] = $plink[$k];
151 $personal_tools[$key] = $ptool;
153 return $personal_tools;
158 $sidebar = $this->
data[
'sidebar'];
159 if ( !isset( $sidebar[
'SEARCH'] ) ) {
160 $sidebar[
'SEARCH'] =
true;
162 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
163 $sidebar[
'TOOLBOX'] =
true;
165 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
166 $sidebar[
'LANGUAGES'] =
true;
170 unset( $sidebar[
'SEARCH'] );
173 unset( $sidebar[
'TOOLBOX'] );
176 unset( $sidebar[
'LANGUAGES'] );
180 foreach ( $sidebar
as $boxName => $content ) {
181 if ( $content ===
false ) {
184 switch ( $boxName ) {
189 'header' => $this->
getMsg(
'search' )->text(),
190 'generated' =>
false,
195 $msgObj = $this->
getMsg(
'toolbox' );
198 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
199 'generated' =>
false,
204 if ( $this->
data[
'language_urls'] !==
false ) {
205 $msgObj = $this->
getMsg(
'otherlanguages' );
208 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
209 'generated' =>
false,
210 'content' => $this->
data[
'language_urls'] ?: [],
215 $msgObj = $this->
getMsg( $boxName );
217 'id' =>
"p-$boxName",
218 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
220 'content' => $content,
227 $hookContents =
null;
228 if ( isset( $boxes[
'TOOLBOX'] ) ) {
234 Hooks::run(
'SkinTemplateToolboxEnd', [ &
$template,
true ] );
235 $hookContents = ob_get_contents();
237 if ( !trim( $hookContents ) ) {
238 $hookContents =
null;
244 foreach ( $boxes
as $boxName => $box ) {
245 if ( is_array( $box[
'content'] ) ) {
247 foreach ( $box[
'content']
as $key => $val ) {
251 if ( $hookContents ) {
252 $content .=
"\n $hookContents";
255 $content .=
"\n</ul>\n";
256 $boxes[$boxName][
'content'] = $content;
260 if ( $hookContents ) {
261 $boxes[
'TOOLBOXEND'] = [
262 'id' =>
'p-toolboxend',
263 'header' => $boxes[
'TOOLBOX'][
'header'],
264 'generated' =>
false,
265 'content' =>
"<ul>{$hookContents}</ul>",
269 foreach ( $boxes
as $key => $box ) {
270 if ( $key ===
'TOOLBOXEND' ) {
273 $boxes2[$key] = $box;
274 if ( $key ===
'TOOLBOX' ) {
275 $boxes2[
'TOOLBOXEND'] = $boxes[
'TOOLBOXEND'];
304 Hooks::run(
'BaseTemplateAfterPortlet', [ $this,
$name, &$content ] );
306 if ( $content !==
'' ) {
307 $html = Html::rawElement(
309 [
'class' => [
'after-portlet',
'after-portlet-' .
$name ] ],
370 if ( isset( $item[
'text'] ) ) {
371 $text = $item[
'text'];
373 $text = $this->translator->translate( isset( $item[
'msg'] ) ? $item[
'msg'] : $key );
376 $html = htmlspecialchars( $text );
378 if ( isset(
$options[
'text-wrapper'] ) ) {
379 $wrapper =
$options[
'text-wrapper'];
380 if ( isset( $wrapper[
'tag'] ) ) {
381 $wrapper = [ $wrapper ];
383 while ( count( $wrapper ) > 0 ) {
384 $element = array_pop( $wrapper );
385 $html = Html::rawElement( $element[
'tag'], isset( $element[
'attributes'] )
386 ? $element[
'attributes']
391 if ( isset( $item[
'href'] ) || isset(
$options[
'link-fallback'] ) ) {
393 foreach ( [
'single-id',
'text',
'msg',
'tooltiponly',
'context',
'primary',
394 'tooltip-params' ]
as $k ) {
398 if ( isset( $attrs[
'data'] ) ) {
399 foreach ( $attrs[
'data']
as $key =>
$value ) {
400 $attrs[
'data-' . $key ] =
$value;
402 unset( $attrs[
'data' ] );
405 if ( isset( $item[
'id'] ) && !isset( $item[
'single-id'] ) ) {
406 $item[
'single-id'] = $item[
'id'];
410 if ( isset( $item[
'tooltip-params'] ) ) {
411 $tooltipParams = $item[
'tooltip-params'];
414 if ( isset( $item[
'single-id'] ) ) {
415 if ( isset( $item[
'tooltiponly'] ) && $item[
'tooltiponly'] ) {
422 if ( isset( $tip[
'title'] ) && $tip[
'title'] !==
false ) {
423 $attrs[
'title'] = $tip[
'title'];
425 if ( isset( $tip[
'accesskey'] ) && $tip[
'accesskey'] !==
false ) {
426 $attrs[
'accesskey'] = $tip[
'accesskey'];
430 if ( isset(
$options[
'link-class'] ) ) {
431 if ( isset( $attrs[
'class'] ) ) {
432 $attrs[
'class'] .=
" {$options['link-class']}";
434 $attrs[
'class'] =
$options[
'link-class'];
437 $html = Html::rawElement( isset( $attrs[
'href'] )
475 if ( isset( $item[
'links'] ) ) {
477 foreach ( $item[
'links']
as $linkKey =>
$link ) {
480 $html = implode(
' ', $links );
484 foreach ( [
'id',
'class',
'active',
'tag',
'itemtitle' ]
as $k ) {
487 if ( isset( $item[
'id'] ) && !isset( $item[
'single-id'] ) ) {
491 $link[
'single-id'] = $item[
'id'];
493 if ( isset(
$link[
'link-class'] ) ) {
497 unset(
$link[
'link-class'] );
503 foreach ( [
'id',
'class' ]
as $attr ) {
504 if ( isset( $item[$attr] ) ) {
505 $attrs[$attr] = $item[$attr];
508 if ( isset( $item[
'active'] ) && $item[
'active'] ) {
509 if ( !isset( $attrs[
'class'] ) ) {
510 $attrs[
'class'] =
'';
512 $attrs[
'class'] .=
' active';
513 $attrs[
'class'] = trim( $attrs[
'class'] );
515 if ( isset( $item[
'itemtitle'] ) ) {
516 $attrs[
'title'] = $item[
'itemtitle'];
525 'placeholder' =>
wfMessage(
'searchsuggest-search' )->text(),
528 return Html::element(
'input', $realAttrs );
538 'value' => $this->translator->translate(
539 $mode ==
'go' ?
'searcharticle' :
'searchbutton' ),
541 $realAttrs = array_merge(
546 return Html::element(
'input', $realAttrs );
552 $buttonAttrs = array_merge(
557 unset( $buttonAttrs[
'src'] );
558 unset( $buttonAttrs[
'alt'] );
559 unset( $buttonAttrs[
'width'] );
560 unset( $buttonAttrs[
'height'] );
562 'src' => $attrs[
'src'],
563 'alt' => isset( $attrs[
'alt'] )
565 : $this->translator->translate(
'searchbutton' ),
566 'width' => isset( $attrs[
'width'] ) ? $attrs[
'width'] :
null,
567 'height' => isset( $attrs[
'height'] ) ? $attrs[
'height'] :
null,
569 return Html::rawElement(
'button', $buttonAttrs, Html::element(
'img', $imgAttrs ) );
571 throw new MWException(
'Unknown mode passed to BaseTemplate::makeSearchButton' );
585 $footerlinks = $this->
get(
'footerlinks' );
588 $validFooterLinks = [];
589 foreach ( $footerlinks
as $category => $links ) {
590 $validFooterLinks[$category] = [];
593 $validFooterLinks[$category][] =
$link;
596 if ( count( $validFooterLinks[$category] ) <= 0 ) {
597 unset( $validFooterLinks[$category] );
601 if ( $option ==
'flat' ) {
603 $validFooterLinks = call_user_func_array(
605 array_values( $validFooterLinks )
609 return $validFooterLinks;
626 $footericons = $this->
get(
'footericons' );
628 if ( $option ==
'icononly' ) {
630 foreach ( $footericons
as &$footerIconsBlock ) {
631 foreach ( $footerIconsBlock
as $footerIconKey => $footerIcon ) {
632 if ( !is_string( $footerIcon ) && !isset( $footerIcon[
'src'] ) ) {
633 unset( $footerIconsBlock[$footerIconKey] );
638 foreach ( $footericons
as $footerIconsKey => &$footerIconsBlock ) {
639 if ( count( $footerIconsBlock ) <= 0 ) {
640 unset( $footericons[$footerIconsKey] );
643 } elseif ( $option ==
'nocopyright' ) {
644 unset( $footericons[
'copyright'][
'copyright'] );
645 if ( count( $footericons[
'copyright'] ) <= 0 ) {
646 unset( $footericons[
'copyright'] );
662 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
668 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
669 $html .= Html::openElement(
'div', [
670 'id' =>
'footer-bottom',
671 'role' =>
'contentinfo',
672 'lang' => $this->
get(
'userlang' ),
673 'dir' => $this->
get(
'dir' )
675 $footerEnd = Html::closeElement(
'div' );
679 foreach ( $validFooterIcons
as $blockName => $footerIcons ) {
680 $html .= Html::openElement(
'div', [
681 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
682 'class' =>
'footer-icons'
684 foreach ( $footerIcons
as $icon ) {
687 $html .= Html::closeElement(
'div' );
689 if ( count( $validFooterLinks ) > 0 ) {
690 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
691 foreach ( $validFooterLinks
as $aLink ) {
692 $html .= Html::rawElement(
694 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
698 $html .= Html::closeElement(
'ul' );
713 return Html::element(
'div', [
'class' =>
'visualClear' ] );
732 $out =
"<div class=\"mw-indicators mw-body-content\">\n";
733 foreach ( $this->
data[
'indicators']
as $id => $content ) {
734 $out .= Html::rawElement(
737 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
738 'class' =>
'mw-indicator',
764 $html .= $this->
get(
'bottomscripts' );
765 $html .= $this->
get(
'reporttime' );
New base template for a skin's template extended from QuickTemplate this class features helper method...
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
makeSearchButton( $mode, $attrs=[])
renderAfterPortlet( $name)
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
getTrail()
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.
printTrail()
Output getTrail.
makeLink( $key, $item, $options=[])
Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigatio...
msgWiki( $str)
An ugly, ugly hack.
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar... list.
getMsg( $name)
Get a Message object with its context set.
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
makeSearchInput( $attrs=[])
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
getClear()
Get a div with the core visualClear class, for clearing floats.
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[])
Returns the attributes for the tooltip and access key.
Generic wrapper for template functions, with interface compatible with what we use of PHPTAL 0....
getSkin()
Get the Skin object related to this object.
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
namespace and then decline to actually register it file or subcat img or subcat $title
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
this hook is for auditing only RecentChangesLinked and Watchlist $special
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
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN boolean columns are always mapped to as the code does not always treat the column as a and VARBINARY columns should simply be TEXT The only exception is when VARBINARY is used to store true binary data