49 public function getMsg( $name, ...$params ) {
50 return $this->
getSkin()->msg( $name, ...$params );
53 public function msg( $str ) {
54 echo $this->
getMsg( $str )->escaped();
61 return $this->
getSkin()->getPersonalToolsForMakeListItem( $this->
get(
'personal_urls' ) );
71 $sidebar = $this->data[
'sidebar'];
72 if ( !isset( $sidebar[
'SEARCH'] ) ) {
74 $sidebar[
'SEARCH'] =
true;
76 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
77 $sidebar[
'TOOLBOX'] =
true;
79 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
80 $sidebar[
'LANGUAGES'] =
true;
83 if ( !isset( $options[
'search'] ) || $options[
'search'] !==
true ) {
84 unset( $sidebar[
'SEARCH'] );
86 if ( isset( $options[
'toolbox'] ) && $options[
'toolbox'] ===
false ) {
87 unset( $sidebar[
'TOOLBOX'] );
89 if ( isset( $options[
'languages'] ) && $options[
'languages'] ===
false ) {
90 unset( $sidebar[
'LANGUAGES'] );
94 foreach ( $sidebar as $boxName => $content ) {
95 if ( $content ===
false ) {
103 'header' => $this->
getMsg(
'search' )->text(),
104 'generated' =>
false,
109 $msgObj = $this->
getMsg(
'toolbox' );
112 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
113 'generated' =>
false,
114 'content' => $content,
118 if ( $this->data[
'language_urls'] !==
false ) {
119 $msgObj = $this->
getMsg(
'otherlanguages' );
122 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
123 'generated' =>
false,
124 'content' => $this->data[
'language_urls'] ?: [],
129 $msgObj = $this->
getMsg( $boxName );
131 'id' =>
"p-$boxName",
132 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
134 'content' => $content,
140 if ( isset( $options[
'htmlOnly'] ) && $options[
'htmlOnly'] ===
true ) {
141 foreach ( $boxes as $boxName => $box ) {
142 if ( is_array( $box[
'content'] ) ) {
144 foreach ( $box[
'content'] as $key => $val ) {
145 $content .=
"\n " . $this->
getSkin()->makeListItem( $key, $val );
147 $content .=
"\n</ul>\n";
148 $boxes[$boxName][
'content'] = $content;
164 protected function makeLink( $key, $item, $options = [] ) {
165 return $this->
getSkin()->makeLink( $key, $item, $options );
177 return $this->
getSkin()->makeListItem( $key, $item, $options );
187 return $this->
getSkin()->makeSearchInput( $attrs );
198 return $this->
getSkin()->makeSearchButton( $mode, $attrs );
211 $footerlinks = $this->
get(
'footerlinks' );
214 $validFooterLinks = [];
215 foreach ( $footerlinks as $category => $links ) {
216 $validFooterLinks[$category] = [];
217 foreach ( $links as $link ) {
218 if ( isset( $this->data[$link] ) && $this->data[$link] ) {
219 $validFooterLinks[$category][] = $link;
222 if ( count( $validFooterLinks[$category] ) <= 0 ) {
223 unset( $validFooterLinks[$category] );
227 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
229 $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
232 return $validFooterLinks;
239 private function unsetIconsWithoutImages( array &$icons ) {
241 foreach ( $icons as $iconsKey => &$iconsBlock ) {
242 foreach ( $iconsBlock as $iconKey => $icon ) {
243 if ( !is_string( $icon ) && !isset( $icon[
'src'] ) ) {
244 unset( $iconsBlock[$iconKey] );
247 if ( $iconsBlock === [] ) {
248 unset( $icons[$iconsKey] );
263 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
264 $validFooterIcons = $this->
get(
'footericons' );
265 if ( $iconStyle ===
'icononly' ) {
266 $this->unsetIconsWithoutImages( $validFooterIcons );
272 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
273 $html .= Html::openElement(
'div', [
274 'id' =>
'footer-bottom',
275 'class' =>
'mw-footer',
276 'role' =>
'contentinfo',
277 'lang' => $this->
get(
'userlang' ),
278 'dir' => $this->
get(
'dir' )
280 $footerEnd = Html::closeElement(
'div' );
284 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
285 $html .= Html::openElement(
'div', [
286 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
287 'class' =>
'footer-icons'
289 foreach ( $footerIcons as $icon ) {
290 $html .= $this->
getSkin()->makeFooterIcon( $icon );
292 $html .= Html::closeElement(
'div' );
294 if ( count( $validFooterLinks ) > 0 ) {
295 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
296 foreach ( $validFooterLinks as $aLink ) {
297 $html .= Html::rawElement(
299 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
303 $html .= Html::closeElement(
'ul' );
306 $html .= $this->
getClear() . $footerEnd;
337 $out =
"<div class=\"mw-indicators\">\n";
338 foreach ( $this->data[
'indicators'] as $id => $content ) {
339 $out .= Html::rawElement(
342 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
343 'class' =>
'mw-indicator',
357class_alias( BaseTemplate::class,
'BaseTemplate' );