if ( !$modules ) {
return '';
}
- // Support: PHP 5.3 ("$this" for anonymous functions was added in PHP 5.4.0)
- // http://php.net/functions.anonymous
- $rl = $this;
- $hashes = array_map( function ( $module ) use ( $rl, $context ) {
- return $rl->getModule( $module )->getVersionHash( $context );
+ $hashes = array_map( function ( $module ) use ( $context ) {
+ return $this->getModule( $module )->getVersionHash( $context );
}, $modules );
return self::makeHash( implode( $hashes ) );
}
* @return string
*/
public static function makeLoaderConditionalScript( $script ) {
- return "window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n" .
+ return "(window.RLQ = window.RLQ || []).push(function () {\n" .
trim( $script ) . "\n} );";
}
$js = self::makeLoaderConditionalScript( $script );
return new WrappedString(
Html::inlineScript( $js ),
- "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n",
+ "<script>(window.RLQ = window.RLQ || []).push(function () {\n",
"\n} );</script>"
);
}