21use Wikimedia\WrappedString;
22use Wikimedia\WrappedStringList;
43 $footerIcons = $config->
get(
'FooterIcons' );
44 $copyright = $footerIcons[
'copyright'][
'copyright'] ??
null;
46 if ( $copyright !==
null ) {
48 } elseif ( $config->
get(
'RightsIcon' ) ) {
49 $icon = htmlspecialchars( $config->
get(
'RightsIcon' ) );
50 $url = $config->
get(
'RightsUrl' );
52 $out .=
'<a href="' . htmlspecialchars( $url ) .
'">';
54 $text = htmlspecialchars( $config->
get(
'RightsText' ) );
55 $out .=
"<img src=\"$icon\" alt=\"$text\" width=\"88\" height=\"31\" />";
69 $resourceBasePath = $config->get(
'ResourceBasePath' );
70 $url1 = htmlspecialchars(
71 "$resourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
73 $url1_5 = htmlspecialchars(
74 "$resourceBasePath/resources/assets/poweredby_mediawiki_132x47.png"
76 $url2 = htmlspecialchars(
77 "$resourceBasePath/resources/assets/poweredby_mediawiki_176x62.png"
79 $text =
'<a href="https://www.mediawiki.org/"><img src="' . $url1
80 .
'" srcset="' . $url1_5 .
' 1.5x, ' . $url2 .
' 2x" '
81 .
'height="31" width="88" alt="Powered by MediaWiki" loading="lazy" /></a>';
92 public function getMsg( $name, ...$params ) {
93 return $this->getSkin()->msg( $name, ...$params );
96 public function msg( $str ) {
97 echo $this->getMsg( $str )->escaped();
114 $toolbox = $this->getSkin()->makeToolbox(
115 $this->data[
'nav_urls'],
120 if ( isset( $this->data[
'sidebar'][
'TOOLBOX'] ) ) {
121 $toolbox = array_merge( $toolbox, $this->data[
'sidebar'][
'TOOLBOX'] ?? [] );
132 return $this->getSkin()->getPersonalToolsForMakeListItem( $this->
get(
'personal_urls' ) );
142 $sidebar = $this->data[
'sidebar'];
143 if ( !isset( $sidebar[
'SEARCH'] ) ) {
144 $sidebar[
'SEARCH'] =
true;
146 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
147 $sidebar[
'TOOLBOX'] =
true;
149 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
150 $sidebar[
'LANGUAGES'] =
true;
153 if ( !isset( $options[
'search'] ) || $options[
'search'] !==
true ) {
154 unset( $sidebar[
'SEARCH'] );
156 if ( isset( $options[
'toolbox'] ) && $options[
'toolbox'] ===
false ) {
157 unset( $sidebar[
'TOOLBOX'] );
159 if ( isset( $options[
'languages'] ) && $options[
'languages'] ===
false ) {
160 unset( $sidebar[
'LANGUAGES'] );
164 foreach ( $sidebar as $boxName =>
$content ) {
168 switch ( $boxName ) {
173 'header' => $this->getMsg(
'search' )->text(),
174 'generated' =>
false,
179 $msgObj = $this->getMsg(
'toolbox' );
182 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
183 'generated' =>
false,
188 if ( $this->data[
'language_urls'] !==
false ) {
189 $msgObj = $this->getMsg(
'otherlanguages' );
192 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
193 'generated' =>
false,
194 'content' => $this->data[
'language_urls'] ?: [],
199 $msgObj = $this->getMsg( $boxName );
201 'id' =>
"p-$boxName",
202 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
210 if ( isset( $options[
'htmlOnly'] ) && $options[
'htmlOnly'] ===
true ) {
211 foreach ( $boxes as $boxName => $box ) {
212 if ( is_array( $box[
'content'] ) ) {
214 foreach ( $box[
'content'] as $key => $val ) {
215 $content .=
"\n " . $this->getSkin()->makeListItem( $key, $val );
218 $boxes[$boxName][
'content'] =
$content;
232 echo $this->getAfterPortlet( $name );
249 $this->getHookRunner()->onBaseTemplateAfterPortlet( $this, $name,
$content );
250 $content .= $this->getSkin()->getAfterPortlet( $name );
253 $html = Html::rawElement(
255 [
'class' => [
'after-portlet',
'after-portlet-' . $name ] ],
267 protected function makeLink( $key, $item, $options = [] ) {
268 return $this->getSkin()->makeLink( $key, $item, $options );
276 return $this->getSkin()->makeListItem( $key, $item, $options );
283 return $this->getSkin()->makeSearchInput( $attrs );
290 return $this->getSkin()->makeSearchButton( $mode, $attrs );
303 $footerlinks = $this->
get(
'footerlinks' );
306 $validFooterLinks = [];
307 foreach ( $footerlinks as $category => $links ) {
308 $validFooterLinks[$category] = [];
309 foreach ( $links as $link ) {
310 if ( isset( $this->data[$link] ) && $this->data[$link] ) {
311 $validFooterLinks[$category][] = $link;
314 if ( count( $validFooterLinks[$category] ) <= 0 ) {
315 unset( $validFooterLinks[$category] );
319 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
321 $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
324 return $validFooterLinks;
344 $footericons = $this->
get(
'footericons' );
346 if ( $option ==
'icononly' ) {
348 foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
349 foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
350 if ( !is_string( $footerIcon ) && !isset( $footerIcon[
'src'] ) ) {
351 unset( $footerIconsBlock[$footerIconKey] );
354 if ( $footerIconsBlock === [] ) {
355 unset( $footericons[$footerIconsKey] );
358 } elseif ( $option ==
'nocopyright' ) {
359 unset( $footericons[
'copyright'] );
374 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
375 $validFooterIcons = $this->getFooterIcons( $iconStyle );
376 $validFooterLinks = $this->getFooterLinks( $linkStyle );
380 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
381 $html .= Html::openElement(
'div', [
382 'id' =>
'footer-bottom',
383 'class' =>
'mw-footer',
384 'role' =>
'contentinfo',
385 'lang' => $this->
get(
'userlang' ),
386 'dir' => $this->
get(
'dir' )
388 $footerEnd = Html::closeElement(
'div' );
392 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
393 $html .= Html::openElement(
'div', [
394 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
395 'class' =>
'footer-icons'
397 foreach ( $footerIcons as $icon ) {
398 $html .= $this->getSkin()->makeFooterIcon( $icon );
400 $html .= Html::closeElement(
'div' );
402 if ( count( $validFooterLinks ) > 0 ) {
403 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
404 foreach ( $validFooterLinks as $aLink ) {
405 $html .= Html::rawElement(
407 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
411 $html .= Html::closeElement(
'ul' );
414 $html .= $this->getClear() . $footerEnd;
426 return Html::element(
'div', [
'class' =>
'visualClear' ] );
445 $out =
"<div class=\"mw-indicators\">\n";
446 foreach ( $this->data[
'indicators'] as $id =>
$content ) {
447 $out .= Html::rawElement(
450 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
451 'class' =>
'mw-indicator',
467 echo $this->getTrail();
479 return WrappedString::join(
"\n", [
480 MWDebug::getDebugHTML( $this->getSkin()->
getContext() ),
481 $this->
get(
'bottomscripts' ),
482 $this->
get(
'reporttime' )
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Extended QuickTemplate with additional MediaWiki-specific helper methods.
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 and...
getTrail()
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.
printTrail()
Output getTrail.
makeLink( $key, $item, $options=[])
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=[])
getMsg( $name,... $params)
Get a Message object with its context set.
static getCopyrightIconHTML(Config $config, Skin $skin)
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.
static getPoweredByHTML(Config $config)
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.
PHP-based skin template that holds data.
The main skin class which provides methods and properties for all other skins.
makeFooterIcon( $icon, $withImage='withImage')
Renders a $wgFooterIcons icon according to the method's arguments.
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".