Example #1
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('// If block node')->raw("\n");
     /*
     $compiler->write('var_dump($this->getValue($this->context, \'fps_user_id\'));');
     $compiler->write('var_dump((');
     $compiler->subcompile($this->tests[0]);
     $compiler->write('));')->raw("\n");
     */
     for ($i = 0; $i < count($this->tests); $i += 2) {
         if ($i > 0) {
             $compiler->outdent()->write('} else if (');
         } else {
             $compiler->write('if (');
         }
         //pr($this->tests);
         $compiler->subcompile($this->tests[$i])->raw(") {\n")->indent();
         foreach ($this->tests[$i + 1] as $k => $v) {
             $compiler->subcompile($v);
         }
     }
     if (!empty($this->else)) {
         $compiler->outdent()->write("} else {\n")->indent();
         foreach ($this->else as $key => $val) {
             $compiler->subcompile($val);
         }
     }
     $compiler->outdent()->write("}\n");
 }
Example #2
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     if (isset($compiler->loader->createPageUrlCallback) && is_callable($compiler->loader->createPageUrlCallback)) {
         $this->callback($compiler->loader->createPageUrlCallback);
     }
     if (is_callable(self::$callback)) {
         $url = self::$callback($this->value);
         $compiler->write('"' . $url . '"');
     } else {
         $compiler->write($this->value);
     }
 }
Example #3
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('// For block node')->raw("\n")->write('foreach (');
     $compiler->subcompile($this->expr)->raw(") {\n")->indent();
     foreach ($this->body as $key => $val) {
         $val->compile($compiler);
     }
     $compiler->outdent()->write("}\n");
 }
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $path = strtr($this->path, array('//' => '/', '\\\\' => '\\'));
     $compiler->write("\n");
     $compiler->write("\$this->includeFile('{$path}', ");
     if (is_array($this->context) && count($this->context)) {
         $compiler->raw("array(");
         foreach ($this->context as $key => $row) {
             $compiler->raw("'{$row}' => (isset(\${$row})) ? \${$row} : ''");
             if ($key + 1 < count($this->context)) {
                 $compiler->raw(", ");
             }
         }
         $compiler->raw(")");
     } else {
         $compiler->raw("array()");
     }
     $compiler->raw(");");
     $compiler->write("\n");
 }
Example #5
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('echo ')->raw($this->value->compile($compiler))->raw(";\n");
 }
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write("/** Comment block\n")->write($this->value)->raw("\n")->write("*/ \n");
 }