X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fskins%2FBaseTemplate.php;h=0b7fc2f5d34023acc57a91bf6ef729ad4edb008f;hp=e571c58c32d65dcb0d5a5295977811b1e63f70f8;hb=7f3d6713e7191c476adb3d3c30344a0327b853d3;hpb=47d2b3d82af55538167174bbb6f1f98371953298 diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index e571c58c32..0b7fc2f5d3 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -287,12 +287,31 @@ abstract class BaseTemplate extends QuickTemplate { * @param string $name */ protected function renderAfterPortlet( $name ) { + echo $this->getAfterPortlet( $name ); + } + + /** + * Allows extensions to hook into known portlets and add stuff to them + * + * @param string $name + * + * @return string html + * @since 1.29 + */ + protected function getAfterPortlet( $name ) { + $html = ''; $content = ''; Hooks::run( 'BaseTemplateAfterPortlet', [ $this, $name, &$content ] ); if ( $content !== '' ) { - echo "
$content
"; + $html = Html::rawElement( + 'div', + [ 'class' => [ 'after-portlet', 'after-portlet-' . $name ] ], + $content + ); } + + return $html; } /** @@ -504,7 +523,6 @@ abstract class BaseTemplate extends QuickTemplate { '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 ); @@ -632,6 +650,69 @@ abstract class BaseTemplate extends QuickTemplate { return $footericons; } + /** + * Renderer for getFooterIcons and getFooterLinks + * + * @param string $iconStyle $option for getFooterIcons: "icononly", "nocopyright" + * @param string $linkStyle $option for getFooterLinks: "flat" + * + * @return string html + * @since 1.29 + */ + protected function getFooter( $iconStyle = 'icononly', $linkStyle = 'flat' ) { + $validFooterIcons = $this->getFooterIcons( $iconStyle ); + $validFooterLinks = $this->getFooterLinks( $linkStyle ); + + $html = ''; + + if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { + $html .= Html::openElement( 'div', [ + 'id' => 'footer-bottom', + 'role' => 'contentinfo', + 'lang' => $this->get( 'userlang' ), + 'dir' => $this->get( 'dir' ) + ] ); + $footerEnd = Html::closeElement( 'div' ); + } else { + $footerEnd = ''; + } + foreach ( $validFooterIcons as $blockName => $footerIcons ) { + $html .= Html::openElement( 'div', [ + 'id' => 'f-' . Sanitizer::escapeId( $blockName ) . 'ico', + 'class' => 'footer-icons' + ] ); + foreach ( $footerIcons as $icon ) { + $html .= $this->getSkin()->makeFooterIcon( $icon ); + } + $html .= Html::closeElement( 'div' ); + } + if ( count( $validFooterLinks ) > 0 ) { + $html .= Html::openElement( 'ul', [ 'id' => 'f-list', 'class' => 'footer-places' ] ); + foreach ( $validFooterLinks as $aLink ) { + $html .= Html::rawElement( + 'li', + [ 'id' => Sanitizer::escapeId( $aLink ) ], + $this->get( $aLink ) + ); + } + $html .= Html::closeElement( 'ul' ); + } + + $html .= $this->getClear() . $footerEnd; + + return $html; + } + + /** + * Get a div with the core visualClear class, for clearing floats + * + * @return string html + * @since 1.29 + */ + protected function getClear() { + return Html::element( 'div', [ 'class' => 'visualClear' ] ); + } + /** * Get the suggested HTML for page status indicators: icons (or short text snippets) usually * displayed in the top-right corner of the page, outside of the main content. @@ -664,15 +745,25 @@ abstract class BaseTemplate extends QuickTemplate { } /** - * Output the basic end-page trail including bottomscripts, reporttime, and + * Output getTrail + */ + function printTrail() { + echo $this->getTrail(); + } + + /** + * Get the basic end-page trail including bottomscripts, reporttime, and * debug stuff. This should be called right before outputting the closing * body and html tags. + * + * @return string + * @since 1.29 */ - function printTrail() { -?> -getSkin()->getContext() ); ?> -html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?> -html( 'reporttime' ) ?> -getSkin()->getContext() ); + $html .= $this->get( 'bottomscripts' ); + $html .= $this->get( 'reporttime' ); + + return $html; } }