/** * load a js like a view * SmartLoaderJS try to get this file into the configurated js folder * @param string $js_file the js file to load without .js extension */ public function loadView($js_file) { if (is_array($js_file)) { $data = ''; foreach ($js_file as $js) { $file = $this->config->getStaticDirectory() . '/' . $this->config->getTemplatesDirectory() . '/' . $this->config->getDefaultTemplateName() . '/' . $this->config->getJsViewsDirectory() . '/' . $js . '.js'; $data .= file_get_contents($file) . "\n"; } } else { $file = $this->config->getStaticDirectory() . '/' . $this->config->getTemplatesDirectory() . '/' . $this->config->getDefaultTemplateName() . '/' . $this->config->getJsViewsDirectory() . '/' . $js_file . '.js'; $data = file_get_contents($file); } $this->js($data); }
/** * verify if yes or not, we have to recompile file * @param string $compiled_name * @return boolean */ private function verify_version($compiled_name) { $tpl_folder = $this->config->getStaticDirectory() . '/' . $this->config->getTemplatesDirectory() . '/' . $this->config->getDefaultTemplateName(); $file = $tpl_folder . '/css/compiled/' . $compiled_name . '.css'; if (filemtime($file) < filemtime($tpl_folder . '/css/' . $this->config->getConcatenedCSSFilename())) { return true; } foreach ($this->_link as $link) { if (filemtime($file) < filemtime($tpl_folder . '/css/views/' . $link . '.css')) { return true; } } return false; }