コード例 #1
0
ファイル: View.php プロジェクト: techart/tao
 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);
 }
コード例 #2
0
ファイル: Minify.php プロジェクト: techart/tao
 protected function base_dir()
 {
     $paths = Templates_HTML::option('paths');
     return $paths['js'];
 }
コード例 #3
0
ファイル: Join.php プロジェクト: techart/tao
 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}";
 }
コード例 #4
0
ファイル: HTML.php プロジェクト: techart/tao
 protected function add_timestamp($path, $link)
 {
     $ts = @filemtime('./' . ltrim($path, '/'));
     return !empty($ts) ? sprintf(Templates_HTML::option('timestamp_pattern'), $link, $ts) : $link;
 }