Пример #1
0
 /**
  * Set a different assets path
  * @param string $path
  */
 public static function set_path($path = null)
 {
     self::init();
     if ($path) {
         self::$assets_dir = $path;
     }
     self::_paths();
 }
Пример #2
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     /*
      * Instanciar codeigniter
      */
     $this->ci =& get_instance();
     /*
      * Cragar helper url
      */
     $this->ci->load->helper('url');
     /*
      * Cargar variable global CSRF
      */
     self::agregar_var_js(array('tkn' => $this->ci->security->get_csrf_hash()));
     $config = $this->ci->load->config('minify', TRUE, TRUE);
     /**
      * Inicializar
      * Minify LibraryClass.
      */
     // user specified settings from config file
     self::$assets_dir = $this->ci->config->item('assets_dir', 'minify') ?: self::$assets_dir;
     self::$css_dir = $this->ci->config->item('css_dir', 'minify') ?: self::$css_dir;
     self::$js_dir = $this->ci->config->item('js_dir', 'minify') ?: self::$js_dir;
     self::$css_file = $this->ci->config->item('css_file', 'minify') ?: self::$css_file;
     self::$js_file = $this->ci->config->item('js_file', 'minify') ?: self::$js_file;
     self::$auto_names = $this->ci->config->item('auto_names', 'minify') ?: self::$auto_names;
     self::$compress = $this->ci->config->item('compress', 'minify') ?: self::$compress;
     self::$compression_engine = $this->ci->config->item('compression_engine', 'minify') ?: self::$compression_engine;
     //$this->closurecompiler = $this->ci->config->item('closurecompiler', 'minify');
     if (count($config) > 0) {
         // custom config array
         foreach ($config as $key => $val) {
             if (isset($this->{$key})) {
                 $this->{$key} = $val;
             }
         }
     }
     // perform checks
     $this->_config_checks();
 }
Пример #3
0
 /**
  * Sets path to the assets directory
  * @param string $path
  * @return bool
  * @throws \Assets\AssetsException
  * @internal param string $dir
  */
 public static function setPath($path = '')
 {
     // Directory Exist?
     if (!is_dir($path)) {
         throw new Assets\AssetsException('The provided directory "' . $path . '" does not exist.');
     }
     // Set path
     self::$assets_dir = $path;
 }