Пример #1
0
 public function __construct($path)
 {
     $realPath = FileSystem::getRealPath($path);
     if (!FileSystem::exists($realPath)) {
         FileSystem::makeDirectory($realPath);
     }
     if (FileSystem::exists($realPath) && FileSystem::isDirectory($realPath)) {
         $this->path = $realPath;
     } else {
         die("Invalid Directory " . $realPath);
     }
 }
Пример #2
0
 public function printView($filePath)
 {
     if (!FileSystem::exists(BASE_DIR . "/Views/.cache")) {
         FileSystem::makeDirectory(BASE_DIR . "/Views/.cache");
     }
     $razr = new Engine(new FileSystemLoader(), BASE_DIR . "/Views/.cache");
     $page = new \stdClass();
     $page->title = $this->title;
     $page->author = $this->author;
     $page->metaContent = $this->metaContent;
     $this->registeredVariables["MetaPageDetails"] = $page;
     echo $razr->render($filePath, $this->registeredVariables);
 }
Пример #3
0
 private function saveTempImage($thumbnail)
 {
     if (!FileSystem::exists($this->tempDirectory)) {
         FileSystem::makeDirectory($this->tempDirectory);
     }
     $fileName = $this->tempDirectory . $this->tempFileName();
     switch ($this->imageType) {
         case "image/jpeg":
             imagejpeg($thumbnail, $fileName);
             break;
         case "image/png":
             imagepng($thumbnail, $fileName);
             break;
         case "image/gif":
             imagegif($thumbnail, $fileName);
             break;
         default:
             die("Invalid Image Type");
             break;
     }
 }
Пример #4
0
 public static function copy($from, $to)
 {
     $from = self::getRealPath($from);
     $to = self::getRealPath($to);
     $directory = dirname($from);
     if (!FileSystem::exists($directory) || !FileSystem::isDirectory($directory)) {
         FileSystem::makeDirectory($directory);
     }
     $directory = dirname($to);
     if (!FileSystem::exists($directory) || !FileSystem::isDirectory($directory)) {
         FileSystem::makeDirectory($directory);
     }
     return copy($from, $to);
 }