51 public function msg( $str ) {
52 echo $this->
getMsg( $str )->escaped();
59 return $this->
getSkin()->getPersonalToolsForMakeListItem( $this->
get(
'personal_urls' ) );
69 $sidebar = $this->data[
'sidebar'];
70 if ( !isset( $sidebar[
'SEARCH'] ) ) {
72 $sidebar[
'SEARCH'] =
true;
74 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
75 $sidebar[
'TOOLBOX'] =
true;
77 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
78 $sidebar[
'LANGUAGES'] =
true;
81 if ( !isset( $options[
'search'] ) || $options[
'search'] !==
true ) {
82 unset( $sidebar[
'SEARCH'] );
84 if ( isset( $options[
'toolbox'] ) && $options[
'toolbox'] ===
false ) {
85 unset( $sidebar[
'TOOLBOX'] );
87 if ( isset( $options[
'languages'] ) && $options[
'languages'] ===
false ) {
88 unset( $sidebar[
'LANGUAGES'] );
92 foreach ( $sidebar as $boxName => $content ) {
93 if ( $content ===
false ) {
101 'header' => $this->
getMsg(
'search' )->text(),
102 'generated' =>
false,
107 $msgObj = $this->
getMsg(
'toolbox' );
110 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
111 'generated' =>
false,
112 'content' => $content,
116 if ( $this->data[
'language_urls'] !==
false ) {
117 $msgObj = $this->
getMsg(
'otherlanguages' );
120 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
121 'generated' =>
false,
122 'content' => $this->data[
'language_urls'] ?: [],
127 $msgObj = $this->
getMsg( $boxName );
129 'id' =>
"p-$boxName",
130 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
132 'content' => $content,
138 if ( isset( $options[
'htmlOnly'] ) && $options[
'htmlOnly'] ===
true ) {
139 foreach ( $boxes as $boxName => $box ) {
140 if ( is_array( $box[
'content'] ) ) {
142 foreach ( $box[
'content'] as $key => $val ) {
143 $content .=
"\n " . $this->
getSkin()->makeListItem( $key, $val );
145 $content .=
"\n</ul>\n";
146 $boxes[$boxName][
'content'] = $content;
162 protected function makeLink( $key, $item, $options = [] ) {
163 return $this->
getSkin()->makeLink( $key, $item, $options );
175 return $this->
getSkin()->makeListItem( $key, $item, $options );
185 return $this->
getSkin()->makeSearchInput( $attrs );
196 return $this->
getSkin()->makeSearchButton( $mode, $attrs );
209 $footerlinks = $this->
get(
'footerlinks' );
212 $validFooterLinks = [];
213 foreach ( $footerlinks as $category => $links ) {
214 $validFooterLinks[$category] = [];
215 foreach ( $links as $link ) {
216 if ( isset( $this->data[$link] ) && $this->data[$link] ) {
217 $validFooterLinks[$category][] = $link;
220 if ( count( $validFooterLinks[$category] ) <= 0 ) {
221 unset( $validFooterLinks[$category] );
225 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
227 $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
230 return $validFooterLinks;
250 $footericons = $this->
get(
'footericons' );
252 if ( $option ==
'icononly' ) {
254 $this->unsetIconsWithoutImages( $footericons );
255 } elseif ( $option ==
'nocopyright' ) {
256 unset( $footericons[
'copyright'] );
266 private function unsetIconsWithoutImages( array &$icons ) {
268 foreach ( $icons as $iconsKey => &$iconsBlock ) {
269 foreach ( $iconsBlock as $iconKey => $icon ) {
270 if ( !is_string( $icon ) && !isset( $icon[
'src'] ) ) {
271 unset( $iconsBlock[$iconKey] );
274 if ( $iconsBlock === [] ) {
275 unset( $icons[$iconsKey] );
290 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
291 $validFooterIcons = $this->
get(
'footericons' );
292 if ( $iconStyle ===
'icononly' ) {
293 $this->unsetIconsWithoutImages( $validFooterIcons );
302 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
303 $html .= Html::openElement(
'div', [
304 'id' =>
'footer-bottom',
305 'class' =>
'mw-footer',
306 'role' =>
'contentinfo',
307 'lang' => $this->
get(
'userlang' ),
308 'dir' => $this->
get(
'dir' )
310 $footerEnd = Html::closeElement(
'div' );
314 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
315 $html .= Html::openElement(
'div', [
316 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
317 'class' =>
'footer-icons'
319 foreach ( $footerIcons as $icon ) {
320 $html .= $this->
getSkin()->makeFooterIcon( $icon );
322 $html .= Html::closeElement(
'div' );
324 if ( count( $validFooterLinks ) > 0 ) {
325 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
326 foreach ( $validFooterLinks as $aLink ) {
327 $html .= Html::rawElement(
329 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
333 $html .= Html::closeElement(
'ul' );
336 $html .= $this->
getClear() . $footerEnd;
348 return Html::element(
'div', [
'class' =>
'visualClear' ] );
367 $out =
"<div class=\"mw-indicators\">\n";
368 foreach ( $this->data[
'indicators'] as $id => $content ) {
369 $out .= Html::rawElement(
372 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
373 'class' =>
'mw-indicator',
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
array $params
The job parameters.
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=[])
Wrapper for Skin method.
makeLink( $key, $item, $options=[])
Wrapper for Skin method.
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=[])
Wrapper for Skin method.
getMsg( $name,... $params)
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=[])
Wrapper for Skin method.
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
getClear()
Get a div with the core visualClear class, for clearing floats.
PHP-based skin template that holds data.
getSkin()
Get the Skin object related to this object.