* hostname of the server handling the request.
*
* @param string $nonce Value from OutputPage::getCSPNonce
- * @return string
+ * @return string|WrappedString HTML
*/
function wfReportTime( $nonce = null ) {
global $wgShowHostnames;
*
* @param string $script JavaScript code
* @param string $nonce [optional] Content-Security-Policy nonce (from OutputPage::getCSPNonce)
- * @return WrappedString HTML
+ * @return string|WrappedString HTML
*/
public static function makeInlineScript( $script, $nonce = null ) {
$js = self::makeLoaderConditionalScript( $script );
* @file
*/
+use Wikimedia\WrappedString;
use Wikimedia\WrappedStringList;
/**
$startupQuery
);
- return WrappedStringList::join( "\n", $chunks );
+ return WrappedString::join( "\n", $chunks );
}
/**
);
}
- return WrappedStringList::join( "\n", $chunks );
+ return WrappedString::join( "\n", $chunks );
}
private function getContext( $group, $type ) {
* @file
*/
+use Wikimedia\WrappedString;
+use Wikimedia\WrappedStringList;
+
/**
* New base template for a skin's template extended from QuickTemplate
* this class features helper methods that provide common ways of interacting
* debug stuff. This should be called right before outputting the closing
* body and html tags.
*
- * @return string
+ * @return string|WrappedStringList HTML
* @since 1.29
*/
- function getTrail() {
- $html = MWDebug::getDebugHTML( $this->getSkin()->getContext() );
- $html .= $this->get( 'bottomscripts' );
- $html .= $this->get( 'reporttime' );
-
- return $html;
+ public function getTrail() {
+ return WrappedString::join( "\n", [
+ MWDebug::getDebugHTML( $this->getSkin()->getContext() ),
+ $this->get( 'bottomscripts' ),
+ $this->get( 'reporttime' )
+ ] );
}
}
*/
use MediaWiki\MediaWikiServices;
+use Wikimedia\WrappedString;
+use Wikimedia\WrappedStringList;
/**
* @defgroup Skins Skins
/**
* @param array $data
* @param string $nonce OutputPage::getCSPNonce()
- * @return string
+ * @return string|WrappedString HTML
*/
static function makeVariablesScript( $data, $nonce = null ) {
if ( $data ) {
/**
* This gets called shortly before the "</body>" tag.
*
- * @return string HTML-wrapped JS code to be put before "</body>"
+ * @return string|WrappedStringList HTML containing scripts to put before `</body>`
*/
function bottomScripts() {
// TODO and the suckage continues. This function is really just a wrapper around
// OutputPage::getBottomScripts() which takes a Skin param. This should be cleaned
// up at some point
- $bottomScriptText = $this->getOutput()->getBottomScripts();
- Hooks::run( 'SkinAfterBottomScripts', [ $this, &$bottomScriptText ] );
-
- return $bottomScriptText;
+ $chunks = [ $this->getOutput()->getBottomScripts() ];
+
+ // Keep the hook appendage separate to preserve WrappedString objects.
+ // This enables BaseTemplate::getTrail() to merge them where possible.
+ $extraHtml = '';
+ Hooks::run( 'SkinAfterBottomScripts', [ $this, &$extraHtml ] );
+ if ( $extraHtml !== '' ) {
+ $chunks[] = $extraHtml;
+ }
+ return WrappedString::join( "\n", $chunks );
}
/**