From: Steve Sutton Date: Thu, 25 Mar 2010 16:53:58 +0000 (+0000) Subject: sorting for scripts X-Git-Tag: v1.0.0~51 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=f0979f46cc220fa5a3e53c70f2220f0c1dcfd4e6;p=web%2FTroutCreek.git sorting for scripts --- diff --git a/Toolkit/Common.php b/Toolkit/Common.php index 7f3eafb..fd7ebf2 100644 --- a/Toolkit/Common.php +++ b/Toolkit/Common.php @@ -826,30 +826,6 @@ class Toolkit_Common } } - // }}} - // {{{ scriptsCompare() - - /** - * make sure jquery lib is loaded first - * - * @param string $i script 1 to compare against script 2 ($j) - * @param string $j script 2 to compare against script 1 ($i) - * - * @return integer result of comparison - * @access public - * @static - */ - public static function scriptsCompare($i, $j) - { - if ($i == GLM_APP_BASE_URL . 'libjs/jquery-1.3.2.min.js') { - return -1; - } elseif ($j == GLM_APP_BASE_URL . 'libjs/jquery-1.3.2.min.js') { - return 1; - } else { - return 0; - } - } - // }}} // {{{ getScripts() @@ -870,7 +846,15 @@ class Toolkit_Common } $uniqueScripts = array_unique($GLOBALS['scripts']); - usort($uniqueScripts, array(self, 'scriptsCompare')); + // Get the main jquery file + $jquery = GLM_APP_BASE_URL . 'libjs/jquery-1.3.2.min.js'; + $key = array_search($jquery, $uniqueScripts); + // If it exists, remove it from its current location + // and put at front of array. + if ($key !== false) { + unset($uniqueScripts[$key]); + array_unshift($uniqueScripts, $jquery); + } $format = ''; $ret = '';