Ejemplo n.º 1
0
Archivo: Join.php Proyecto: 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}";
 }
Ejemplo n.º 2
0
 protected function join_files($files)
 {
     if (empty($files)) {
         return null;
     }
     $filename = $this->joins_dir($this->files_hash($files) . ".{$this->type}");
     $filepath = '.' . $filename;
     if (!is_file($filepath)) {
         $out = '';
         foreach ($files as $file) {
             $path = '.' . $file;
             $out .= "\n\n";
             $out .= file_exists($path) ? file_get_contents($path) : '';
             if ($this->type == 'js') {
                 $out .= ';';
             }
         }
         $this->postprocess($filepath, $out);
         file_put_contents($filepath, $out);
         IO_FS::chmod($filepath, IO_FS::option('file_mod'));
     }
     return $filename;
 }