static function create($type, $content, $debug) { $feature = ''; if ($type == 'FILE') { $feature = dirname($content); if (substr($feature, strlen($feature) - 1, 1) == '/') { // strip tailing /, if any, so that the following strrpos works in any situation $feature = substr($feature, 0, strlen($feature) - 1); } $feature = substr($feature, strrpos($feature, '/') + 1); $content = JsLibrary::loadData($content, $type, $debug); } return new JsLibrary($type, $content, $feature); }
public function getContent() { if (!$this->loaded && $this->type == 'FILE') { if (Config::get('compress_javascript')) { $dataCache = Config::get('data_cache'); $dataCache = new $dataCache(); if (!($content = $dataCache->get(md5($this->content)))) { $content = JsMin::minify(JsLibrary::loadData($this->content, $this->type)); $dataCache->set(md5($this->content), $content); $this->content = $content; } else { $this->content = $content; } } else { $this->content = JsLibrary::loadData($this->content, $this->type); } $this->loaded = true; } return $this->content; }