Example #1
0
 /**
  * Write content to file
  * @param string $path
  * @param string $content
  */
 protected function writeFile($path, $content)
 {
     if (!in_array(SafeStream::PROTOCOL, stream_get_wrappers())) {
         SafeStream::register();
     }
     file_put_contents("safe://" . $path, $content);
 }
Example #2
0
 /**
  * Load content and save file
  * @param array files
  * @return string filename of generated file
  */
 protected function generate($files)
 {
     $name = $this->getGeneratedFilename($files);
     $path = $this->tempPath . "/" . $name;
     $lastModified = $this->getLastModified($files);
     if (!file_exists($path) || $lastModified > filemtime($path)) {
         if (!in_array(SafeStream::PROTOCOL, stream_get_wrappers())) {
             SafeStream::register();
         }
         file_put_contents("safe://" . $path, $this->getContent($files));
     }
     return $name . "?" . $lastModified;
 }