Пример #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);
 }
Пример #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;
 }
Пример #3
0
 /**
  * Gets a block node from the specified tag command by searching for the
  * tag class, instructing the tag to process the supplied data, and
  * returning the resulting {@link \hydrogen\view\engines\hydrogen\Node}.
  *
  * Note that "BlockNode" can refer to two different things.  This function
  * produces a node from any generic block tag; it does not retrieve an
  * instance of {@link \hydrogen\view\engines\hydrogen\nodes\BlockNode}
  * unless such a result would be appropriate given the tag command.
  *
  * @param string $origin The template name in which the block tag was
  * 		found.
  * @param string $cmd The tag command for which to produce a node.
  */
 protected function getBlockNode($origin, $cmd, $args)
 {
     $class = HydrogenEngine::getTagClass($cmd, $origin);
     if ($class::mustBeFirst() && $this->originHasNodes($origin)) {
         throw new TemplateSyntaxException("Tag must be first in template: {$cmd}");
     }
     return $class::getNode($cmd, $args, $this, $origin);
 }
//Config::setVal("view", "autoescape", false);
/***  FOR THE 'hydrogen' VIEW ENGINE ONLY:
 ***  Custom filter declarations
 ***
 ***  The following methods can be used to add custom filters to the Hydrogen
 ***  templating engine without them physically existing in the Hydrogen
 ***  library folder or namespace.  The first method declares classes
 ***  individually (with optional file path if it won't be autoloaded), while
 ***  the second adds a namespace from which filters can be autoloaded.  See
 ***  the documentation in hydrogen/view/engines/hydrogen/HydrogenEngine.php
 ***  for details and usage.
 ***/
/*HydrogenEngine::addFilter('swedishchef', '\myapp\filters\BorkFilter',
	'lib/myapp/filters/BorkFilter.php'); */
//HydrogenEngine::addFilterNamespace('\myapp\filters');
HydrogenEngine::addFilterNamespace('\\awesomeircbotweb\\filters');
/***  FOR THE 'hydrogen' VIEW ENGINE ONLY:
 ***  Custom tag declarations
 ***
 ***  The following methods can be used to add custom tags to the Hydrogen
 ***  templating engine without them physically existing in the Hydrogen
 ***  library folder or namespace.  The first method declares classes
 ***  individually (with optional file path if it won't be autoloaded), while
 ***  the second adds a namespace from which tags can be autoloaded.  See
 ***  the documentation in hydrogen/view/engines/hydrogen/HydrogenEngine.php
 ***  for details and usage.
 ***/
/*HydrogenEngine::addTag('onweekdays', '\myapp\tags\OnweekdaysTag',
	'lib/myapp/tags/OnweekdaysTag.php'); */
//HydrogenEngine::addTagNamespace('\myapp\tags');
/***  [view] -> use_cache