Ejemplo n.º 1
0
 /**
  * Loads in the config and sets the variables
  */
 public static function _init()
 {
     // Prevent multiple initializations
     if (static::$initialized) {
         return;
     }
     \Config::load('casset', true);
     $paths = \Config::get('casset.paths', static::$asset_paths);
     foreach ($paths as $key => $path) {
         static::add_path($key, $path);
     }
     static::$asset_url = \Config::get('casset.url', \Config::get('base_url'));
     static::$default_folders = array('css' => \Config::get('casset.css_dir', static::$default_folders['css']), 'js' => \Config::get('casset.js_dir', static::$default_folders['js']), 'img' => \Config::get('casset.img_dir', static::$default_folders['img']));
     static::$cache_path = \Config::get('casset.cache_path', static::$cache_path);
     static::$min_default = \Config::get('casset.min', static::$min_default);
     static::$combine_default = \Config::get('casset.combine', static::$combine_default);
     $group_sets = \Config::get('casset.groups', array());
     foreach ($group_sets as $group_type => $groups) {
         foreach ($groups as $group_name => $group) {
             $enabled = array_key_exists('enabled', $group) ? $group['enabled'] : true;
             $combine = array_key_exists('combine', $group) ? $group['combine'] : null;
             $min = array_key_exists('min', $group) ? $group['min'] : null;
             static::add_group($group_type, $group_name, $enabled, $combine, $min);
             foreach ($group['files'] as $files) {
                 if (!is_array($files)) {
                     $files = array($files, false);
                 }
                 static::add_asset($group_type, $files[0], $files[1], $group_name);
             }
         }
     }
     static::$show_files = \Config::get('casset.show_files', static::$show_files);
     static::$show_files_inline = \Config::get('casset.show_files_inline', static::$show_files_inline);
     static::$initialized = true;
 }
Ejemplo n.º 2
0
 /**
  * Loads in the config and sets the variables
  */
 public static function _init()
 {
     // Prevent multiple initializations
     if (static::$initialized) {
         return;
     }
     \Config::load('casset', true);
     static::$asset_url = \Config::get('casset.url');
     if (!static::$asset_url) {
         static::$asset_url = preg_replace('#^https?://#', '//', \Uri::base(false));
     }
     static::$asset_url = rtrim(static::$asset_url, '/') . '/';
     static::$root_path = \Config::get('casset.root_path', DOCROOT);
     static::$default_folders = array('css' => \Config::get('casset.css_dir', static::$default_folders['css']), 'js' => \Config::get('casset.js_dir', static::$default_folders['js']), 'img' => \Config::get('casset.img_dir', static::$default_folders['img']));
     $paths = \Config::get('casset.paths', static::$asset_paths);
     foreach ($paths as $key => $path) {
         static::add_path($key, $path);
     }
     static::$cache_path = \Config::get('casset.cache_path', static::$cache_path);
     static::$default_options['min'] = \Config::get('casset.min', static::$default_options['min']);
     static::$default_options['combine'] = \Config::get('casset.combine', static::$default_options['combine']);
     static::$deps_max_depth = \Config::get('casset.deps_max_depth', static::$deps_max_depth);
     $group_sets = \Config::get('casset.groups', array());
     foreach ($group_sets as $group_type => $groups) {
         foreach ($groups as $group_name => $group) {
             $options = static::prep_new_group_options($group);
             static::add_group($group_type, $group_name, $group['files'], $options);
         }
     }
     // Add the global group if it doesn't already exist.
     // This is so that set_group_option() can be used on it. This function will
     // throw an exception if the named group doesn't exist.
     if (!static::group_exists('js', 'global')) {
         static::add_group_base('js', 'global');
     }
     if (!static::group_exists('css', 'global')) {
         static::add_group_base('css', 'global');
     }
     static::$show_files = \Config::get('casset.show_files', static::$show_files);
     static::$show_files_inline = \Config::get('casset.show_files_inline', static::$show_files_inline);
     static::$post_load_callback = \Config::get('casset.post_load_callback', static::$post_load_callback);
     static::$filepath_callback = \Config::get('casset.filepath_callback', static::$filepath_callback);
     static::$css_uri_rewriter = \Config::get('casset.css_uri_rewriter', static::$css_uri_rewriter);
     static::$move_imports_to_top = \Config::get('casset.move_imports_to_top', static::$move_imports_to_top);
     static::$initialized = true;
 }