Ejemplo n.º 1
0
 /**
  * Process partial section
  *
  * @param Context $context current context
  * @param array              $current section node data
  * @param boolean            $escaped escape result or not
  *
  * @return string the result
  */
 private function _variables($context, $current, $escaped)
 {
     $value = $context->get($current[Tokenizer::NAME]);
     if ($escaped) {
         $args = $this->handlebars->getEscapeArgs();
         array_unshift($args, $value);
         $value = call_user_func_array($this->handlebars->getEscape(), array_values($args));
     }
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * Process variable
  *
  * @param Handlebars_Context $context current context
  * @param array   $current section node data
  * @param boolean $escaped escape result or not
  *
  * @return {string} the result
  */
 private function _getVariable(Handlebars_Context $context, $current, $escaped)
 {
     $name = $current[Handlebars_Tokenizer::NAME];
     $value = $context->get($name);
     if (is_array($value)) {
         return 'Array';
     }
     if ($escaped) {
         $args = $this->handlebars->getEscapeArgs();
         array_unshift($args, $value);
         $value = call_user_func_array($this->handlebars->getEscape(), array_values($args));
     }
     return $value;
 }
Ejemplo n.º 3
0
 /**
  * Process variable
  *
  * @param Context $context current context
  * @param array   $current section node data
  * @param boolean $escaped escape result or not
  *
  * @return string the result
  */
 private function _getVariable(Context $context, $current, $escaped)
 {
     $name = $current[Tokenizer::NAME];
     $value = $context->get($name);
     if ($name == '@index') {
         return $context->lastIndex();
     }
     if ($name == '@key') {
         return $context->lastKey();
     }
     if ($escaped) {
         $args = $this->handlebars->getEscapeArgs();
         array_unshift($args, $value);
         $value = call_user_func_array($this->handlebars->getEscape(), array_values($args));
     }
     return $value;
 }