Ejemplo n.º 1
0
 public function render($phpFile)
 {
     $content = $this->nodes->render();
     $var = '$temp';
     foreach ($this->filters as $filter) {
         $class = HydrogenEngine::getFilterClass($filter->filter, $this->origin);
         $escape = false;
         $var = $class::applyTo($var, $filter->args, $escape, $phpFile);
         if ($escape) {
             $var = 'htmlentities(' . $var . ')';
         }
     }
     $phpFile->addPageContent(PHPFile::PHP_OPENTAG . 'ob_start();' . PHPFile::PHP_CLOSETAG . $content . PHPFile::PHP_OPENTAG . '$temp = ob_get_contents(); ob_end_clean(); echo ' . $var . ';' . PHPFile::PHP_CLOSETAG);
 }
Ejemplo n.º 2
0
 public function getVariablePHP($phpFile, $forSetting = false, $nullIfNotFound = false)
 {
     $var = '$context';
     if ($nullIfNotFound) {
         $var .= '->getWrapped(\'' . array_shift($this->varLevels) . '\', true)';
     }
     foreach ($this->varLevels as $level) {
         $var .= "->" . $level;
     }
     if (!$forSetting) {
         $var .= "->getValue()";
     }
     $escape = $this->escape;
     foreach ($this->filters as $filter) {
         $class = HydrogenEngine::getFilterClass($filter->filter, $this->origin);
         $var = $class::applyTo($var, $filter->args, $escape, $phpFile);
     }
     if ($escape) {
         $var = 'htmlentities(' . $var . ')';
     }
     return $var;
 }