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
88 if ( isset( $this->data[
'nav_urls'][$special] ) && $this->data[
'nav_urls'][$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 $toolbox[
'permalink'][
'id'] =
't-permalink';
103 if ( isset( $this->data[
'nav_urls'][
'info'] ) && $this->data[
'nav_urls'][
'info'] ) {
104 $toolbox[
'info'] = $this->data[
'nav_urls'][
'info'];
105 $toolbox[
'info'][
'id'] =
't-info';
110 Hooks::run(
'BaseTemplateToolbox', [ &
$template, &$toolbox ] );
125 $personal_tools = [];
126 foreach ( $this->
get(
'personal_urls' ) as $key => $plink ) {
127 # The class on a personal_urls item is meant to go on the <a> instead
128 # of the <li> so we have to use a single item "links" array instead
129 # of using most of the personal_url's keys directly.
132 [
'single-id' =>
"pt-$key" ],
136 if ( isset( $plink[
'active'] ) ) {
137 $ptool[
'active'] = $plink[
'active'];
139 foreach ( [
'href',
'class',
'text',
'dir',
'data',
'exists' ] as $k ) {
140 if ( isset( $plink[$k] ) ) {
141 $ptool[
'links'][0][$k] = $plink[$k];
144 $personal_tools[$key] = $ptool;
146 return $personal_tools;
151 $sidebar = $this->data[
'sidebar'];
152 if ( !isset( $sidebar[
'SEARCH'] ) ) {
153 $sidebar[
'SEARCH'] =
true;
155 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
156 $sidebar[
'TOOLBOX'] =
true;
158 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
159 $sidebar[
'LANGUAGES'] =
true;
163 unset( $sidebar[
'SEARCH'] );
166 unset( $sidebar[
'TOOLBOX'] );
169 unset( $sidebar[
'LANGUAGES'] );
173 foreach ( $sidebar as $boxName => $content ) {
174 if ( $content ===
false ) {
177 switch ( $boxName ) {
182 'header' => $this->
getMsg(
'search' )->text(),
183 'generated' =>
false,
188 $msgObj = $this->
getMsg(
'toolbox' );
191 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
192 'generated' =>
false,
197 if ( $this->data[
'language_urls'] !==
false ) {
198 $msgObj = $this->
getMsg(
'otherlanguages' );
201 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
202 'generated' =>
false,
203 'content' => $this->data[
'language_urls'] ?: [],
208 $msgObj = $this->
getMsg( $boxName );
210 'id' =>
"p-$boxName",
211 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
213 'content' => $content,
220 $hookContents =
null;
221 if ( isset( $boxes[
'TOOLBOX'] ) ) {
227 Hooks::run(
'SkinTemplateToolboxEnd', [ &
$template,
true ] );
228 $hookContents = ob_get_contents();
230 if ( !trim( $hookContents ) ) {
231 $hookContents =
null;
237 foreach ( $boxes as $boxName => $box ) {
238 if ( is_array( $box[
'content'] ) ) {
240 foreach ( $box[
'content'] as $key => $val ) {
244 if ( $hookContents ) {
245 $content .=
"\n $hookContents";
248 $content .=
"\n</ul>\n";
249 $boxes[$boxName][
'content'] = $content;
253 if ( $hookContents ) {
254 $boxes[
'TOOLBOXEND'] = [
255 'id' =>
'p-toolboxend',
256 'header' => $boxes[
'TOOLBOX'][
'header'],
257 'generated' =>
false,
258 'content' =>
"<ul>{$hookContents}</ul>",
262 foreach ( $boxes as $key => $box ) {
263 if ( $key ===
'TOOLBOXEND' ) {
266 $boxes2[$key] = $box;
267 if ( $key ===
'TOOLBOX' ) {
268 $boxes2[
'TOOLBOXEND'] = $boxes[
'TOOLBOXEND'];
297 Hooks::run(
'BaseTemplateAfterPortlet', [ $this, $name, &$content ] );
299 if ( $content !==
'' ) {
300 $html = Html::rawElement(
302 [
'class' => [
'after-portlet',
'after-portlet-' . $name ] ],
363 if ( isset( $item[
'text'] ) ) {
364 $text = $item[
'text'];
366 $text =
wfMessage( isset( $item[
'msg'] ) ? $item[
'msg'] : $key )->
text();
369 $html = htmlspecialchars( $text );
371 if ( isset(
$options[
'text-wrapper'] ) ) {
372 $wrapper =
$options[
'text-wrapper'];
373 if ( isset( $wrapper[
'tag'] ) ) {
374 $wrapper = [ $wrapper ];
376 while ( count( $wrapper ) > 0 ) {
377 $element = array_pop( $wrapper );
378 $html = Html::rawElement( $element[
'tag'], isset( $element[
'attributes'] )
379 ? $element[
'attributes']
384 if ( isset( $item[
'href'] ) || isset(
$options[
'link-fallback'] ) ) {
386 foreach ( [
'single-id',
'text',
'msg',
'tooltiponly',
'context',
'primary',
387 'tooltip-params',
'exists' ] as $k ) {
391 if ( isset( $attrs[
'data'] ) ) {
392 foreach ( $attrs[
'data'] as $key =>
$value ) {
393 $attrs[
'data-' . $key ] =
$value;
395 unset( $attrs[
'data' ] );
398 if ( isset( $item[
'id'] ) && !isset( $item[
'single-id'] ) ) {
399 $item[
'single-id'] = $item[
'id'];
403 if ( isset( $item[
'tooltip-params'] ) ) {
404 $tooltipParams = $item[
'tooltip-params'];
407 if ( isset( $item[
'single-id'] ) ) {
408 $tooltipOption = isset( $item[
'exists'] ) && $item[
'exists'] ===
false ?
'nonexisting' :
null;
410 if ( isset( $item[
'tooltiponly'] ) && $item[
'tooltiponly'] ) {
412 if ( $title !==
false ) {
421 if ( isset( $tip[
'title'] ) && $tip[
'title'] !==
false ) {
422 $attrs[
'title'] = $tip[
'title'];
424 if ( isset( $tip[
'accesskey'] ) && $tip[
'accesskey'] !==
false ) {
425 $attrs[
'accesskey'] = $tip[
'accesskey'];
429 if ( isset(
$options[
'link-class'] ) ) {
430 if ( isset( $attrs[
'class'] ) ) {
431 $attrs[
'class'] .=
" {$options['link-class']}";
433 $attrs[
'class'] =
$options[
'link-class'];
436 $html = Html::rawElement( isset( $attrs[
'href'] )
474 if ( isset( $item[
'links'] ) ) {
476 foreach ( $item[
'links'] as $linkKey =>
$link ) {
479 $html = implode(
' ', $links );
483 foreach ( [
'id',
'class',
'active',
'tag',
'itemtitle' ] as $k ) {
486 if ( isset( $item[
'id'] ) && !isset( $item[
'single-id'] ) ) {
490 $link[
'single-id'] = $item[
'id'];
492 if ( isset(
$link[
'link-class'] ) ) {
496 unset(
$link[
'link-class'] );
502 foreach ( [
'id',
'class' ] as $attr ) {
503 if ( isset( $item[$attr] ) ) {
504 $attrs[$attr] = $item[$attr];
507 if ( isset( $item[
'active'] ) && $item[
'active'] ) {
508 if ( !isset( $attrs[
'class'] ) ) {
509 $attrs[
'class'] =
'';
511 $attrs[
'class'] .=
' active';
512 $attrs[
'class'] = trim( $attrs[
'class'] );
514 if ( isset( $item[
'itemtitle'] ) ) {
515 $attrs[
'title'] = $item[
'itemtitle'];
524 'placeholder' =>
wfMessage(
'searchsuggest-search' )->text(),
527 return Html::element(
'input', $realAttrs );
537 'value' =>
wfMessage( $mode ==
'go' ?
'searcharticle' :
'searchbutton' )->
text(),
539 $realAttrs = array_merge(
544 return Html::element(
'input', $realAttrs );
550 $buttonAttrs = array_merge(
555 unset( $buttonAttrs[
'src'] );
556 unset( $buttonAttrs[
'alt'] );
557 unset( $buttonAttrs[
'width'] );
558 unset( $buttonAttrs[
'height'] );
560 'src' => $attrs[
'src'],
561 'alt' => isset( $attrs[
'alt'] )
564 'width' => isset( $attrs[
'width'] ) ? $attrs[
'width'] :
null,
565 'height' => isset( $attrs[
'height'] ) ? $attrs[
'height'] :
null,
567 return Html::rawElement(
'button', $buttonAttrs, Html::element(
'img', $imgAttrs ) );
569 throw new MWException(
'Unknown mode passed to BaseTemplate::makeSearchButton' );
583 $footerlinks = $this->
get(
'footerlinks' );
586 $validFooterLinks = [];
587 foreach ( $footerlinks as $category => $links ) {
588 $validFooterLinks[$category] = [];
589 foreach ( $links as
$link ) {
590 if ( isset( $this->data[
$link] ) && $this->data[
$link] ) {
591 $validFooterLinks[$category][] =
$link;
594 if ( count( $validFooterLinks[$category] ) <= 0 ) {
595 unset( $validFooterLinks[$category] );
599 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
601 $validFooterLinks = call_user_func_array(
603 array_values( $validFooterLinks )
607 return $validFooterLinks;
624 $footericons = $this->
get(
'footericons' );
626 if ( $option ==
'icononly' ) {
628 foreach ( $footericons as &$footerIconsBlock ) {
629 foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
630 if ( !is_string( $footerIcon ) && !isset( $footerIcon[
'src'] ) ) {
631 unset( $footerIconsBlock[$footerIconKey] );
636 foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
637 if ( count( $footerIconsBlock ) <= 0 ) {
638 unset( $footericons[$footerIconsKey] );
641 } elseif ( $option ==
'nocopyright' ) {
642 unset( $footericons[
'copyright'][
'copyright'] );
643 if ( count( $footericons[
'copyright'] ) <= 0 ) {
644 unset( $footericons[
'copyright'] );
660 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
666 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
667 $html .= Html::openElement(
'div', [
668 'id' =>
'footer-bottom',
669 'role' =>
'contentinfo',
670 'lang' => $this->
get(
'userlang' ),
671 'dir' => $this->
get(
'dir' )
673 $footerEnd = Html::closeElement(
'div' );
677 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
678 $html .= Html::openElement(
'div', [
679 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
680 'class' =>
'footer-icons'
682 foreach ( $footerIcons as $icon ) {
685 $html .= Html::closeElement(
'div' );
687 if ( count( $validFooterLinks ) > 0 ) {
688 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
689 foreach ( $validFooterLinks as $aLink ) {
690 $html .= Html::rawElement(
692 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
696 $html .= Html::closeElement(
'ul' );
711 return Html::element(
'div', [
'class' =>
'visualClear' ] );
730 $out =
"<div class=\"mw-indicators mw-body-content\">\n";
731 foreach ( $this->data[
'indicators'] as $id => $content ) {
732 $out .= Html::rawElement(
735 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
736 'class' =>
'mw-indicator',
762 $html .= $this->
get(
'bottomscripts' );
763 $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=[], $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.
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 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
this hook is for auditing only RecentChangesLinked and Watchlist $special