/** * Aplicar template de um arquivo único. * * @param $file * @param $target */ public function file($file, $target) { // Verificar se template existe na lista if ($this->files->exists($file) != true) { error('Template %s não foi encontrado', $file); } $this->outpath = ''; $this->filters = [$target]; // Criar diretório destino $path = $this->files->path($target); $this->files->force($path); // Copiar arquivo $this->files->copy($file, $target); return $this; }
/** * Return URL with fingerprint * @param type $sRootPath Path from root */ public static function getStaticProperUrl($sRootPath) { $sFilePath = Filesystem::path($sRootPath); $sFileName = Filesystem::name($sRootPath); $sFileExtension = Filesystem::extension($sRootPath); $sFileLastModificationDate = filemtime($sRootPath); $sUrl = Config::get('app.url') . $sFilePath . Config::get('format.dir.slash') . $sFileName . '_' . $sFileLastModificationDate . '_.' . $sFileExtension; return $sUrl; }
public function element($element, $data = array()) { $element_path = Filesystem::path('app/views/') . $this->elementName($element); if (Filesystem::exists($element_path)) { return $this->renderView($element_path, $data); } else { throw new MissingViewException($this->filename($element) . ' could not be found'); } }
public function renderTemplate($source, $destination, $data = array()) { if (!Filesystem::exists($destination)) { $view = new View(); $content = $view->renderView(Filesystem::path($source), $data); Filesystem::write($destination, $content); $this->log('created', $destination); } else { $this->log('exists', $destination); } }
public function upload($file, $name = null, $path = '') { $path = Filesystem::path('public/' . $path); if (is_null($name)) { $name = $file['name']; } if ($this->validates($file)) { if (!is_dir($path)) { Filesystem::createDir($path, 0777); } if (move_uploaded_file($file['tmp_name'], $path . '/' . $name)) { return true; } else { return $this->error('CantMoveFile'); } } return false; }
/** * Adiciona arquivos ao zip * * @param mixed Um arquivo ou array de arquivos para serem adicionados * @param string Diretório interno do arquivo zip. Caso não seja informado, os arquivos serão adicionados na raiz do arquivo zip. * @return */ public function addFiles($file, $path = '') { $path = empty($path) ? '' : trim($path, '/') . '/'; if (is_array($file)) { foreach ($file as $f) { $filename = $path . basename($f); pr($filename); $this->object->addFile(Filesystem::path($f), $filename); } } else { $filename = $path . basename($file); $this->object->addFile(Filesystem::path($file), $filename); } return $this; }
public function save($filename) { $this->render(); $filename = Filesystem::path($filename); $this->mPDF->Output($filename, 'F'); }
public function dsn() { return 'sqlite:' . Filesystem::path($this->config['path']); }
/** * Força o download do arquivo * * @version 1.0 * - Initial * * @param $file O nome do arquivo, relativo a /SPAGHETTI_ROOT */ public static function forceDownload($file) { $file = Filesystem::path($file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); }