예제 #1
0
 /**
  * Get the evaluated contents of the view template.
  *
  * @param   string  $path         The path to the view template
  * @param   array   $forceParams  Any additional information to pass to the view template engine
  *
  * @return  array  Content evaluation information
  */
 public function get($path, array $forceParams = array())
 {
     // If it's cached return the path to the cached file's path
     if ($this->isCached($path)) {
         return array('type' => 'path', 'content' => $this->getCachePath($path));
     }
     // Not cached or caching not really allowed. Compile it and cache it.
     $content = $this->compile($path, $forceParams);
     $cachePath = $this->putToCache($path, $content);
     // If we could cache it, return the cached file's path
     if ($cachePath !== false) {
         return array('type' => 'path', 'content' => $cachePath);
     }
     // We could not write to the cache. Hm, can I use a stream wrapper?
     $canUseStreams = Buffer::canRegisterWrapper();
     if ($canUseStreams) {
         $id = $this->getIdentifier($path);
         $streamPath = 'fof://' . $this->view->getContainer()->componentName . '/compiled_templates/' . $id . '.php';
         return array('type' => 'path', 'content' => $streamPath);
     }
     // I couldn't use a stream wrapper. I have to give up.
     throw new PossiblySuhosin();
 }
예제 #2
0
파일: BufferTest.php 프로젝트: Joal01/fof
 /**
  * @return Buffer
  */
 protected function buildBuffer()
 {
     $buffer = new Buffer();
     $dummy = null;
     $buffer->stream_open('buffer://path/to/some/file', 'w', null, $dummy);
     return $buffer;
 }