public function use_file(array $file, $type = null) { $path = $file['name']; if (!Templates_HTML::path($type, $path)) { if (!is_null($type)) { $paths = Templates_HTML::option('paths'); $prefix = $paths[$type]; if (!Core_Strings::starts_with($path, $prefix)) { $path = $prefix . '/' . ltrim($path, '/'); } } $component = false; if ($file['component']) { $component = $file['component']; } $component_url = CMS::component_static_path($path, $component); $component_path = str_replace('file://', '', $component_url); if (is_file($component_path)) { $file['name'] = $component_url; } } return parent::use_file($file, $type); }
protected function base_dir() { $paths = Templates_HTML::option('paths'); return $paths['js']; }
protected function dir($file = '') { $dir = Templates_HTML_Assets_Join::option('dir'); $ext = pathinfo($file, PATHINFO_EXTENSION); $paths = Templates_HTML::option('paths'); if (!empty($ext) && isset($paths[$ext])) { $dir = '/' . trim($paths[$ext] . '/' . trim($dir, PATH_SEPARATOR), '/'); } if (!is_dir('.' . $dir)) { IO_FS::mkdir('.' . $dir, IO_FS::option('dir_mod'), true); } return "{$dir}/{$file}"; }
protected function add_timestamp($path, $link) { $ts = @filemtime('./' . ltrim($path, '/')); return !empty($ts) ? sprintf(Templates_HTML::option('timestamp_pattern'), $link, $ts) : $link; }