35 public function getMsg( $name, ...$params ) {
36 return $this->
getSkin()->msg( $name, ...$params );
42 public function msg( $str ) {
43 echo $this->
getMsg( $str )->escaped();
50 return $this->
getSkin()->getPersonalToolsForMakeListItem( $this->
get(
'personal_urls' ) );
60 $sidebar = $this->data[
'sidebar'];
61 if ( !isset( $sidebar[
'SEARCH'] ) ) {
63 $sidebar[
'SEARCH'] =
true;
65 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
66 $sidebar[
'TOOLBOX'] =
true;
68 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
69 $sidebar[
'LANGUAGES'] =
true;
72 if ( !isset( $options[
'search'] ) || $options[
'search'] !==
true ) {
73 unset( $sidebar[
'SEARCH'] );
75 if ( isset( $options[
'toolbox'] ) && $options[
'toolbox'] ===
false ) {
76 unset( $sidebar[
'TOOLBOX'] );
78 if ( isset( $options[
'languages'] ) && $options[
'languages'] ===
false ) {
79 unset( $sidebar[
'LANGUAGES'] );
83 foreach ( $sidebar as $boxName => $content ) {
84 if ( $content ===
false ) {
92 'header' => $this->
getMsg(
'search' )->text(),
98 $msgObj = $this->
getMsg(
'toolbox' );
101 'header' => $msgObj->exists() ? $msgObj->text() :
'toolbox',
102 'generated' =>
false,
103 'content' => $content,
107 if ( $this->data[
'language_urls'] !==
false ) {
108 $msgObj = $this->
getMsg(
'otherlanguages' );
111 'header' => $msgObj->exists() ? $msgObj->text() :
'otherlanguages',
112 'generated' =>
false,
113 'content' => $this->data[
'language_urls'] ?: [],
118 $msgObj = $this->
getMsg( $boxName );
120 'id' =>
"p-$boxName",
121 'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
123 'content' => $content,
129 if ( isset( $options[
'htmlOnly'] ) && $options[
'htmlOnly'] ===
true ) {
130 foreach ( $boxes as $boxName => $box ) {
131 if ( is_array( $box[
'content'] ) ) {
133 foreach ( $box[
'content'] as $key => $val ) {
134 $content .=
"\n " . $this->
getSkin()->makeListItem( $key, $val );
136 $content .=
"\n</ul>\n";
137 $boxes[$boxName][
'content'] = $content;
153 protected function makeLink( $key, $item, $options = [] ) {
154 return $this->
getSkin()->makeLink( $key, $item, $options );
166 return $this->
getSkin()->makeListItem( $key, $item, $options );
176 return $this->
getSkin()->makeSearchInput( $attrs );
187 return $this->
getSkin()->makeSearchButton( $mode, $attrs );
200 $footerlinks = $this->
get(
'footerlinks' );
203 $validFooterLinks = [];
204 foreach ( $footerlinks as $category => $links ) {
205 $validFooterLinks[$category] = [];
206 foreach ( $links as $link ) {
207 if ( isset( $this->data[$link] ) && $this->data[$link] ) {
208 $validFooterLinks[$category][] = $link;
211 if ( count( $validFooterLinks[$category] ) <= 0 ) {
212 unset( $validFooterLinks[$category] );
216 if ( $option ==
'flat' && count( $validFooterLinks ) ) {
218 $validFooterLinks = array_merge( ...array_values( $validFooterLinks ) );
221 return $validFooterLinks;
228 private function unsetIconsWithoutImages( array &$icons ) {
230 foreach ( $icons as $iconsKey => &$iconsBlock ) {
231 foreach ( $iconsBlock as $iconKey => $icon ) {
232 if ( !is_string( $icon ) && !isset( $icon[
'src'] ) ) {
233 unset( $iconsBlock[$iconKey] );
236 if ( $iconsBlock === [] ) {
237 unset( $icons[$iconsKey] );
252 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
253 $validFooterIcons = $this->
get(
'footericons' );
254 if ( $iconStyle ===
'icononly' ) {
255 $this->unsetIconsWithoutImages( $validFooterIcons );
261 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
262 $html .= Html::openElement(
'div', [
263 'id' =>
'footer-bottom',
264 'class' =>
'mw-footer',
265 'role' =>
'contentinfo',
266 'lang' => $this->
get(
'userlang' ),
267 'dir' => $this->
get(
'dir' )
269 $footerEnd = Html::closeElement(
'div' );
273 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
274 $html .= Html::openElement(
'div', [
275 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
276 'class' =>
'footer-icons'
278 foreach ( $footerIcons as $icon ) {
279 $html .= $this->
getSkin()->makeFooterIcon( $icon );
281 $html .= Html::closeElement(
'div' );
283 if ( count( $validFooterLinks ) > 0 ) {
284 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
285 foreach ( $validFooterLinks as $aLink ) {
286 $html .= Html::rawElement(
288 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
292 $html .= Html::closeElement(
'ul' );
295 $html .= $this->
getClear() . $footerEnd;
326 $out =
"<div class=\"mw-indicators\">\n";
327 foreach ( $this->data[
'indicators'] as $id => $content ) {
328 $out .= Html::rawElement(
331 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
332 'class' =>
'mw-indicator',
346class_alias( BaseTemplate::class,
'BaseTemplate' );