From: Michael M Slusarz Date: Tue, 4 Aug 2009 21:02:45 +0000 (-0600) Subject: Finer-grained control of script loading order X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b5236a7765f81dd81b4e076d59bc388df7efd1a7;p=horde.git Finer-grained control of script loading order --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index fdf9774eb..11f5aaf39 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -2095,8 +2095,10 @@ HTML; * array also). * @param string $onload Load the script after the page has loaded? * Either 'dom' (on dom:loaded), 'load'. + * @param boolean $top Add script to top of stack? */ - static public function addInlineScript($script, $onload = null) + static public function addInlineScript($script, $onload = null, + $top = false) { if (is_array($script)) { $script = implode(';', $script); @@ -2117,7 +2119,11 @@ HTML; break; } - self::$_inlineScript[] = $script; + if ($top) { + array_unshift(self::$_inlineScript, $script); + } else { + self::$_inlineScript[] = $script; + } // If headers have already been sent, we need to output a //