47 public function msg( $str ) {
48 echo $this->
getMsg( $str )->escaped();
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;
246 $footericons = $this->
get(
'footericons' );
248 if ( $option ==
'icononly' ) {
250 $this->unsetIconsWithoutImages( $footericons );
251 } elseif ( $option ==
'nocopyright' ) {
252 unset( $footericons[
'copyright'] );
264 private function unsetIconsWithoutImages( array &$icons ) {
266 foreach ( $icons as $iconsKey => &$iconsBlock ) {
267 foreach ( $iconsBlock as $iconKey => $icon ) {
268 if ( !is_string( $icon ) && !isset( $icon[
'src'] ) ) {
269 unset( $iconsBlock[$iconKey] );
272 if ( $iconsBlock === [] ) {
273 unset( $icons[$iconsKey] );
288 protected function getFooter( $iconStyle =
'icononly', $linkStyle =
'flat' ) {
289 $validFooterIcons = $this->
get(
'footericons' );
290 if ( $iconStyle ===
'icononly' ) {
291 $this->unsetIconsWithoutImages( $validFooterIcons );
300 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
301 $html .= Html::openElement(
'div', [
302 'id' =>
'footer-bottom',
303 'class' =>
'mw-footer',
304 'role' =>
'contentinfo',
305 'lang' => $this->
get(
'userlang' ),
306 'dir' => $this->
get(
'dir' )
308 $footerEnd = Html::closeElement(
'div' );
312 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
313 $html .= Html::openElement(
'div', [
314 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
315 'class' =>
'footer-icons'
317 foreach ( $footerIcons as $icon ) {
318 $html .= $this->
getSkin()->makeFooterIcon( $icon );
320 $html .= Html::closeElement(
'div' );
322 if ( count( $validFooterLinks ) > 0 ) {
323 $html .= Html::openElement(
'ul', [
'id' =>
'f-list',
'class' =>
'footer-places' ] );
324 foreach ( $validFooterLinks as $aLink ) {
325 $html .= Html::rawElement(
327 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
331 $html .= Html::closeElement(
'ul' );
334 $html .= $this->
getClear() . $footerEnd;
346 return Html::element(
'div', [
'class' =>
'visualClear' ] );
365 $out =
"<div class=\"mw-indicators\">\n";
366 foreach ( $this->data[
'indicators'] as $id => $content ) {
367 $out .= Html::rawElement(
370 'id' => Sanitizer::escapeIdForAttribute(
"mw-indicator-$id" ),
371 '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.