diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index b5f1fc0a..d9c405c9 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -122,19 +122,25 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { $this->meta = new meta; View::bind_global('meta',$this->meta); - // Our default style sheet - Style::add(array( - 'type'=>'file', - 'data'=>'css/default.css', - )); + // Our default style sheet(s) + foreach (array('file'=>array_reverse(array( + 'css/default.css', + ))) as $type => $datas) { - // Our default scripts - // This is in a reverse list, since we push them to the beginging of the scripts to render. - foreach (array('file'=>array( - 'js/jquery.cookie.js', - 'js/jquery.jstree-1.0rc3.js', + foreach ($datas as $data) { + Style::add(array( + 'type'=>$type, + 'data'=>$data, + ),TRUE); + } + } + + // Our default script(s) + foreach (array('file'=>array_reverse(array( 'js/jquery-1.6.4.min.js', - )) as $type => $datas) { + 'js/jquery.jstree-1.0rc3.js', + 'js/jquery.cookie.js', + ))) as $type => $datas) { foreach ($datas as $data) { Script::add(array( diff --git a/application/classes/lnapp/script.php b/application/classes/lnapp/script.php index 2e991498..103c2321 100644 --- a/application/classes/lnapp/script.php +++ b/application/classes/lnapp/script.php @@ -34,18 +34,13 @@ class lnApp_Script extends HTMLRender { $foutput = $soutput = ''; $mediapath = Route::get(static::$_media_path); - $i = $j = 0; foreach (static::$_data as $value) { switch ($value['type']) { case 'file': $foutput .= HTML::script($mediapath->uri(array('file'=>$value['data']))); - if ($i++) - $foutput .= static::$_spacer; break; case 'stdin': $soutput .= sprintf("",$value['data']); - if ($j++) - $soutput .= static::$_spacer; break; default: throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type'])); diff --git a/application/classes/lnapp/style.php b/application/classes/lnapp/style.php index 5b0d20a8..dad08310 100644 --- a/application/classes/lnapp/style.php +++ b/application/classes/lnapp/style.php @@ -14,6 +14,7 @@ class lnApp_Style extends HTMLRender { protected static $_data = array(); protected static $_spacer = "\n"; protected static $_required_keys = array('type','data'); + protected static $_unique_vals = array('file'=>'type'); /** * Return an instance of this class @@ -33,7 +34,6 @@ class lnApp_Style extends HTMLRender { $foutput = $soutput = ''; $mediapath = Route::get(static::$_media_path); - $i = $j = 0; foreach (static::$_data as $value) { switch ($value['type']) { case 'file': @@ -42,8 +42,6 @@ class lnApp_Style extends HTMLRender { break; case 'stdin': $soutput .= sprintf("",$value['data']); - if ($j++) - $soutput .= static::$_spacer; break; default: throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));