35 public function getMsg( $name, ...$params ) {
36 return $this->
getSkin()->msg( $name, ...$params );
45 public function msg( $str ) {
46 echo $this->
getMsg( $str )->escaped();
54 wfDeprecated( __METHOD__,
'Call $this->getSkin()->getPersonalToolsForMakeListItem instead (T422975)',
'1.46' );
55 return $this->
getSkin()->getPersonalToolsForMakeListItem( $this->
get(
'personal_urls' ) );
65 $sidebar = $this->data[
'sidebar'];
66 if ( !isset( $sidebar[
'SEARCH'] ) ) {
68 $sidebar[
'SEARCH'] =
true;
70 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
71 $sidebar[
'TOOLBOX'] =
true;
73 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
74 $sidebar[
'LANGUAGES'] =
true;
77 if ( !isset( $options[
'search'] ) || $options[
'search'] !==
true ) {
78 unset( $sidebar[
'SEARCH'] );
80 if ( isset( $options[
'toolbox'] ) && $options[
'toolbox'] ===
false ) {
81 unset( $sidebar[
'TOOLBOX'] );
83 if ( isset( $options[
'languages'] ) && $options[
'languages'] ===
false ) {
84 unset( $sidebar[
'LANGUAGES'] );
88 foreach ( $sidebar as $boxName => $content ) {
89 if ( $content ===
false ) {
97 'header' => $this->
getMsg(
'search' )->text(),
103 $msgObj = $this->
getMsg(
'toolbox' );
106 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
107 'generated' =>
false,
108 'content' => $content,
112 if ( $this->data[
'language_urls'] !==
false ) {
113 $msgObj = $this->
getMsg(
'otherlanguages' );
116 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
117 'generated' =>
false,
118 'content' => $this->data[
'language_urls'] ?: [],
123 $msgObj = $this->
getMsg( $boxName );
125 'id' =>
"p-$boxName",
126 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
128 'content' => $content,
134 if ( isset( $options[
'htmlOnly'] ) && $options[
'htmlOnly'] ===
true ) {
135 foreach ( $boxes as $boxName => $box ) {
136 if ( is_array( $box[
'content'] ) ) {
138 foreach ( $box[
'content'] as $key => $val ) {
139 $content .=
"\n " . $this->
getSkin()->makeListItem( $key, $val );
141 $content .=
"\n</ul>\n";
142 $boxes[$boxName][
'content'] = $content;
158 protected function makeLink( $key, $item, $options = [] ) {
159 return $this->
getSkin()->makeLink( $key, $item, $options );
171 return $this->
getSkin()->makeListItem( $key, $item, $options );
181 return $this->
getSkin()->makeSearchInput( $attrs );
192 return $this->
getSkin()->makeSearchButton( $mode, $attrs );
205 $footerlinks = $this->
get(
'footerlinks' );
208 $validFooterLinks = [];
209 foreach ( $footerlinks as $category => $links ) {
210 $validFooterLinks[$category] = [];
211 foreach ( $links as $link ) {
212 if ( isset( $this->data[$link] ) && $this->data[$link] ) {
213 $validFooterLinks[$category][] = $link;
216 if ( count( $validFooterLinks[$category] ) <= 0 ) {
217 unset( $validFooterLinks[$category] );
221 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
223 $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
226 return $validFooterLinks;
233 private function unsetIconsWithoutImages( array &$icons ) {
235 foreach ( $icons as $iconsKey => &$iconsBlock ) {
236 foreach ( $iconsBlock as $iconKey => $icon ) {
237 if ( !is_string( $icon ) && !isset( $icon[
'src'] ) ) {
238 unset( $iconsBlock[$iconKey] );
241 if ( $iconsBlock === [] ) {
242 unset( $icons[$iconsKey] );
257 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
258 $validFooterIcons = $this->
get(
'footericons' );
259 if ( $iconStyle ===
'icononly' ) {
260 $this->unsetIconsWithoutImages( $validFooterIcons );
266 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
267 $html .= Html::openElement(
'div', [
268 'id' =>
'footer-bottom',
269 'class' =>
'mw-footer',
270 'role' =>
'contentinfo',
271 'lang' => $this->
get(
'userlang' ),
272 'dir' => $this->
get(
'dir' )
274 $footerEnd = Html::closeElement(
'div' );
278 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
279 $html .= Html::openElement(
'div', [
280 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
281 'class' =>
'footer-icons'
283 foreach ( $footerIcons as $icon ) {
284 $html .= $this->
getSkin()->makeFooterIcon( $icon );
286 $html .= Html::closeElement(
'div' );
288 if ( count( $validFooterLinks ) > 0 ) {
289 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
290 foreach ( $validFooterLinks as $aLink ) {
291 $html .= Html::rawElement(
293 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
297 $html .= Html::closeElement(
'ul' );
300 $html .= $this->
getClear() . $footerEnd;
331 $out =
"<div class=\"mw-indicators\">\n";
332 foreach ( $this->data[
'indicators'] as $id => $content ) {
333 $out .= Html::rawElement(
336 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
337 'class' =>
'mw-indicator',
351class_alias( BaseTemplate::class,
'BaseTemplate' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.