Merge "BaseTemplate: Handle `$this->data['language_urls'] === false` specially"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 13 Aug 2017 20:19:19 +0000 (20:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 13 Aug 2017 20:19:19 +0000 (20:19 +0000)
1  2 
includes/skins/BaseTemplate.php

@@@ -29,7 -29,7 +29,7 @@@ abstract class BaseTemplate extends Qui
         * Get a Message object with its context set
         *
         * @param string $name Message name
 -       * @param ... $params Message params
 +       * @param mixed $params,... Message params
         * @return Message
         */
        public function getMsg( $name /* ... */ ) {
                                ];
                                break;
                        case 'LANGUAGES':
-                               if ( $this->data['language_urls'] ) {
+                               if ( $this->data['language_urls'] !== false ) {
                                        $msgObj = $this->getMsg( 'otherlanguages' );
                                        $boxes[$boxName] = [
                                                'id' => 'p-lang',
                                                'header' => $msgObj->exists() ? $msgObj->text() : 'otherlanguages',
                                                'generated' => false,
-                                               'content' => $this->data['language_urls'],
+                                               'content' => $this->data['language_urls'] ?: [],
                                        ];
                                }
                                break;
                        'type' => 'search',
                        'name' => 'search',
                        'placeholder' => wfMessage( 'searchsuggest-search' )->text(),
 -                      'value' => $this->get( 'search', '' ),
                ];
                $realAttrs = array_merge( $realAttrs, Linker::tooltipAndAccesskeyAttribs( 'search' ), $attrs );
                return Html::element( 'input', $realAttrs );
                }
                foreach ( $validFooterIcons as $blockName => $footerIcons ) {
                        $html .= Html::openElement( 'div', [
 -                              'id' => 'f-' . Sanitizer::escapeId( $blockName ) . 'ico',
 +                              'id' => Sanitizer::escapeIdForAttribute( "f-{$blockName}ico" ),
                                'class' => 'footer-icons'
                        ] );
                        foreach ( $footerIcons as $icon ) {
                        foreach ( $validFooterLinks as $aLink ) {
                                $html .= Html::rawElement(
                                        'li',
 -                                      [ 'id' => Sanitizer::escapeId( $aLink ) ],
 +                                      [ 'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
                                        $this->get( $aLink )
                                );
                        }
                        $out .= Html::rawElement(
                                'div',
                                [
 -                                      'id' => Sanitizer::escapeId( "mw-indicator-$id" ),
 +                                      'id' => Sanitizer::escapeIdForAttribute( "mw-indicator-$id" ),
                                        'class' => 'mw-indicator',
                                ],
                                $content