42 function msg( $str ) {
43 echo $this->
getMsg( $str )->escaped();
55 echo $this->
getMsg( $str )->text();
63 echo $this->
getMsg( $str )->parseAsBlock();
75 if (
isset( $this->data[
'nav_urls'][
'whatlinkshere'] )
76 && $this->data[
'nav_urls'][
'whatlinkshere']
78 $toolbox[
'whatlinkshere'] = $this->data[
'nav_urls'][
'whatlinkshere'];
79 $toolbox[
'whatlinkshere'][
'id'] =
't-whatlinkshere';
81 if (
isset( $this->data[
'nav_urls'][
'recentchangeslinked'] )
82 && $this->data[
'nav_urls'][
'recentchangeslinked']
84 $toolbox[
'recentchangeslinked'] = $this->data[
'nav_urls'][
'recentchangeslinked'];
85 $toolbox[
'recentchangeslinked'][
'msg'] =
'recentchangeslinked-toolbox';
86 $toolbox[
'recentchangeslinked'][
'id'] =
't-recentchangeslinked';
87 $toolbox[
'recentchangeslinked'][
'rel'] =
'nofollow';
89 if (
isset( $this->data[
'feeds'] ) && $this->data[
'feeds'] ) {
90 $toolbox[
'feeds'][
'id'] =
'feedlinks';
91 $toolbox[
'feeds'][
'links'] = [];
92 foreach ( $this->data[
'feeds'] as $key => $feed ) {
93 $toolbox[
'feeds'][
'links'][$key] =
$feed;
94 $toolbox[
'feeds'][
'links'][$key][
'id'] =
"feed-$key";
95 $toolbox[
'feeds'][
'links'][$key][
'rel'] =
'alternate';
96 $toolbox[
'feeds'][
'links'][$key][
'type'] =
"application/{$key}+xml";
97 $toolbox[
'feeds'][
'links'][$key][
'class'] =
'feedlink';
100 foreach ( [
'contributions',
'log',
'blockip',
'emailuser',
101 'userrights',
'upload',
'specialpages' ] as $special
103 if (
isset( $this->data[
'nav_urls'][$special] ) && $this->data[
'nav_urls'][$special] ) {
104 $toolbox[$special] = $this->data[
'nav_urls'][$special];
105 $toolbox[$special][
'id'] =
"t-$special";
108 if (
isset( $this->data[
'nav_urls'][
'print'] ) && $this->data[
'nav_urls'][
'print'] ) {
109 $toolbox[
'print'] = $this->data[
'nav_urls'][
'print'];
110 $toolbox[
'print'][
'id'] =
't-print';
111 $toolbox[
'print'][
'rel'] =
'alternate';
112 $toolbox[
'print'][
'msg'] =
'printableversion';
114 if (
isset( $this->data[
'nav_urls'][
'permalink'] ) && $this->data[
'nav_urls'][
'permalink'] ) {
115 $toolbox[
'permalink'] = $this->data[
'nav_urls'][
'permalink'];
116 $toolbox[
'permalink'][
'id'] =
't-permalink';
118 if (
isset( $this->data[
'nav_urls'][
'info'] ) && $this->data[
'nav_urls'][
'info'] ) {
119 $toolbox[
'info'] = $this->data[
'nav_urls'][
'info'];
120 $toolbox[
'info'][
'id'] =
't-info';
125 Hooks::run(
'BaseTemplateToolbox', [ &
$template, &$toolbox ] );
140 $personal_tools = [];
141 foreach ( $this->
get(
'personal_urls' ) as $key => $plink ) {
142 # The class on a personal_urls item is meant to go on the <a> instead
143 # of the <li> so we have to use a single item "links" array instead
144 # of using most of the personal_url's keys directly.
147 [
'single-id' =>
"pt-$key" ],
151 if (
isset( $plink[
'active'] ) ) {
152 $ptool[
'active'] = $plink[
'active'];
154 foreach ( [
'href',
'class',
'text',
'dir',
'data',
'exists' ] as $k ) {
155 if (
isset( $plink[$k] ) ) {
156 $ptool[
'links'][0][
$k] = $plink[
$k];
159 $personal_tools[$key] =
$ptool;
166 $sidebar = $this->data[
'sidebar'];
167 if ( !
isset( $sidebar[
'SEARCH'] ) ) {
168 $sidebar[
'SEARCH'] =
true;
170 if ( !
isset( $sidebar[
'TOOLBOX'] ) ) {
171 $sidebar[
'TOOLBOX'] =
true;
173 if ( !
isset( $sidebar[
'LANGUAGES'] ) ) {
174 $sidebar[
'LANGUAGES'] =
true;
178 unset( $sidebar[
'SEARCH'] );
181 unset( $sidebar[
'TOOLBOX'] );
184 unset( $sidebar[
'LANGUAGES'] );
188 foreach ( $sidebar as $boxName =>
$content ) {
192 switch ( $boxName ) {
197 'header' => $this->
getMsg(
'search' )->text(),
198 'generated' =>
false,
203 $msgObj = $this->
getMsg(
'toolbox' );
206 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
207 'generated' =>
false,
212 if ( $this->data[
'language_urls'] !==
false ) {
213 $msgObj = $this->
getMsg(
'otherlanguages' );
216 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
217 'generated' =>
false,
218 'content' => $this->data[
'language_urls'] ?: [],
223 $msgObj = $this->
getMsg( $boxName );
225 'id' =>
"p-$boxName",
226 'header' => $msgObj->exists() ? $msgObj->text() :
$boxName,
235 $hookContents =
null;
236 if (
isset( $boxes[
'TOOLBOX'] ) ) {
242 Hooks::run(
'SkinTemplateToolboxEnd', [ &
$template,
true ] );
245 if ( !
trim( $hookContents ) ) {
246 $hookContents =
null;
252 foreach ( $boxes as $boxName => $box ) {
253 if (
is_array( $box[
'content'] ) ) {
255 foreach ( $box[
'content'] as $key => $val ) {
259 if ( $hookContents ) {
267 }
elseif ( $hookContents ) {
268 $boxes[
'TOOLBOXEND'] = [
269 'id' =>
'p-toolboxend',
270 'header' => $boxes[
'TOOLBOX'][
'header'],
271 'generated' =>
false,
272 'content' =>
"<ul>{$hookContents}</ul>",
276 foreach ( $boxes as $key => $box ) {
277 if ( $key ===
'TOOLBOXEND' ) {
280 $boxes2[$key] =
$box;
281 if ( $key ===
'TOOLBOX' ) {
282 $boxes2[
'TOOLBOXEND'] = $boxes[
'TOOLBOXEND'];
310 Hooks::run(
'BaseTemplateAfterPortlet', [ $this, $name, &
$content ] );
313 $html = Html::rawElement(
315 [
'class' => [
'after-portlet',
'after-portlet-' . $name ] ],
376 $text = $item[
'text'] ??
wfMessage( $item[
'msg'] ?? $key )->text();
381 $wrapper =
$options[
'text-wrapper'];
382 if (
isset( $wrapper[
'tag'] ) ) {
385 while ( count( $wrapper ) > 0 ) {
387 $html = Html::rawElement( $element[
'tag'], $element[
'attributes'] ??
null,
$html );
393 foreach ( [
'single-id',
'text',
'msg',
'tooltiponly',
'context',
'primary',
394 'tooltip-params',
'exists' ] 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 $tooltipOption =
isset( $item[
'exists'] ) && $item[
'exists'] ===
false ?
'nonexisting' :
null;
417 if (
isset( $item[
'tooltiponly'] ) && $item[
'tooltiponly'] ) {
419 if ( $title !==
false ) {
428 if (
isset( $tip[
'title'] ) && $tip[
'title'] !==
false ) {
429 $attrs[
'title'] = $tip[
'title'];
431 if (
isset( $tip[
'accesskey'] ) && $tip[
'accesskey'] !==
false ) {
432 $attrs[
'accesskey'] = $tip[
'accesskey'];
437 if (
isset( $attrs[
'class'] ) ) {
438 $attrs[
'class'] .=
" {$options['link-class']}";
440 $attrs[
'class'] =
$options[
'link-class'];
443 $html = Html::rawElement(
isset( $attrs[
'href'] )
481 if (
isset( $item[
'links'] ) ) {
483 foreach ( $item[
'links'] as $linkKey =>
$link ) {
486 $html = implode(
' ', $links );
490 foreach ( [
'id',
'class',
'active',
'tag',
'itemtitle' ] as $k ) {
493 if (
isset( $item[
'id'] ) && !
isset( $item[
'single-id'] ) ) {
497 $link[
'single-id'] = $item[
'id'];
509 foreach ( [
'id',
'class' ] as $attr ) {
510 if (
isset( $item[$attr] ) ) {
514 if (
isset( $item[
'active'] ) && $item[
'active'] ) {
515 if ( !
isset( $attrs[
'class'] ) ) {
516 $attrs[
'class'] =
'';
518 $attrs[
'class'] .=
' active';
519 $attrs[
'class'] =
trim( $attrs[
'class'] );
521 if (
isset( $item[
'itemtitle'] ) ) {
522 $attrs[
'title'] = $item[
'itemtitle'];
524 return Html::rawElement(
$options[
'tag'] ??
'li', $attrs,
$html );
531 'placeholder' =>
wfMessage(
'searchsuggest-search' )->text(),
534 return Html::element(
'input', $realAttrs );
544 'value' =>
wfMessage( $mode ==
'go' ?
'searcharticle' :
'searchbutton' )->
text(),
551 return Html::element(
'input', $realAttrs );
562 unset( $buttonAttrs[
'src'] );
563 unset( $buttonAttrs[
'alt'] );
564 unset( $buttonAttrs[
'width'] );
565 unset( $buttonAttrs[
'height'] );
567 'src' => $attrs[
'src'],
568 'alt' => $attrs[
'alt'] ??
wfMessage(
'searchbutton' )->text(),
569 'width' => $attrs[
'width'] ??
null,
570 'height' => $attrs[
'height'] ??
null,
572 return Html::rawElement(
'button', $buttonAttrs, Html::element(
'img', $imgAttrs ) );
574 throw new MWException(
'Unknown mode passed to BaseTemplate::makeSearchButton' );
588 $footerlinks = $this->
get(
'footerlinks' );
591 $validFooterLinks = [];
592 foreach ( $footerlinks as $category => $links ) {
593 $validFooterLinks[$category] = [];
594 foreach ( $links as
$link ) {
596 $validFooterLinks[$category][] =
$link;
599 if ( count( $validFooterLinks[$category] ) <= 0 ) {
600 unset( $validFooterLinks[$category] );
604 if ( $option ==
'flat' ) {
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',
763 return WrappedString::join(
"\n", [
765 $this->
get(
'bottomscripts' ),
766 $this->
get(
'reporttime' )
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
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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...
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...
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=[], $options=null)
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 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 $template
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
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