예제 #1
0
 function should_apply_filter_if_available()
 {
     $name = 'taylor luk';
     $result = h2o::parseString('{{ name|capitalize }}')->render(compact('name'));
     expects($result)->should_be('Taylor Luk');
 }
예제 #2
0
파일: tags.php 프로젝트: hgezim/h2o-php
 function __construct($argstring, $parser, $position = 0)
 {
     if (!preg_match($this->syntax, $argstring, $matches)) {
         throw new TemplateSyntaxError();
     }
     $matches_count = count($matches);
     if ($matches_count > 2) {
         // "with" statement supplied.
         $with_vars = explode(' ', $matches[3]);
         foreach ($with_vars as $var_str) {
             $eq_pos = strpos($var_str, '=');
             $this->_additional_context[substr($var_str, 0, $eq_pos)] = substr($var_str, $eq_pos + 1);
         }
     }
     $this->filename = stripcslashes($matches[1]);
     $this->fname_tpl = h2o::parseString($this->filename, $parser->options);
     if ($this->fname_tpl->render() != $this->filename) {
         $this->dynamic = True;
         $this->loader = $parser->runtime;
     } else {
         $this->dynamic = False;
         $this->nodelist = $parser->runtime->loadSubTemplate($this->filename, $parser->options);
         $parser->storage['templates'] = array_merge($this->nodelist->parser->storage['templates'], $parser->storage['templates']);
         $parser->storage['templates'][] = $this->filename;
     }
 }