From b5236a7765f81dd81b4e076d59bc388df7efd1a7 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 4 Aug 2009 15:02:45 -0600 Subject: [PATCH] Finer-grained control of script loading order --- framework/Core/lib/Horde.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 //