Exemplo n.º 1
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->addIndent();
     $compiler->raw("\$this->setValue(" . $this->compileAttributesArray() . ", ");
     $this->right->compile($compiler);
     $compiler->raw(");\n");
 }
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->raw('floor(');
     $this->left->compile($compiler);
     $compiler->raw(' / ');
     $this->right->compile($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 3
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->raw(' !in_array(');
     $this->left->compile($compiler);
     $compiler->raw(', ');
     $this->right->compile($compiler);
     $compiler->raw(') ');
 }
Exemplo n.º 4
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Escape):Value for filtering must be callable.');
     }
     $compiler->raw('htmlspecialchars(');
     $value($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 5
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Json_encode):Value for filtering must be callable.');
     }
     $compiler->raw('json_encode(');
     $value($compiler);
     $compiler->raw(', JSON_FORCE_OBJECT)');
 }
Exemplo n.º 6
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");
 }
Exemplo n.º 7
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Show):Value for filtering must be callable.');
     }
     $compiler->raw("'<pre>' . print_r(");
     $value($compiler);
     $compiler->raw(", true) . '<pre>'");
 }
Exemplo n.º 8
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Urldecode):Value for filtering must be callable.');
     }
     $compiler->raw('urldecode(');
     $value($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 9
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");
 }
Exemplo n.º 10
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);
     }
 }
Exemplo n.º 11
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->raw("Fps_Viewer_FunctionsStorage::run('{$this->func}', ");
     while (count($this->params) > 0) {
         $node = array_shift($this->params);
         $compiler->raw($node->compile($compiler));
         if (count($this->params) > 0) {
             $compiler->raw(", ");
         }
     }
     $compiler->raw(")");
 }
Exemplo n.º 12
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Bbcode):Value for filtering must be callable.');
     }
     $compiler->raw('Register::getInstance()->PrintText->parseBBCodes(');
     $value($compiler);
     if (!empty($this->params[0])) {
         $compiler->raw(', ');
         $this->params[0]->compile($compiler);
     }
     $compiler->raw(')');
 }
Exemplo n.º 13
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Lang):Value for filtering must be callable.');
     }
     $compiler->raw('__(');
     $value($compiler);
     if (!empty($this->params[0])) {
         $compiler->raw(', ');
         $this->params[0]->compile($compiler);
     }
     $compiler->raw(')');
 }
Exemplo n.º 14
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('Regexp string is not exists in "Match" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Match):Value for filtering must be callable.');
     }
     $compiler->raw('preg_match(');
     $this->params[0]->compile($compiler);
     $compiler->raw(', ');
     $value($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 15
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Replace" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Replace):Value for filtering must be callable.');
     }
     $compiler->raw('strtr(');
     $value($compiler);
     $compiler->raw(', ');
     $this->params[0]->compile($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 16
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Append" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Append):Value for filtering must be callable.');
     }
     $compiler->raw('call_user_func(function($arr, $value) {$arr[] = $value;return $arr;},');
     $value($compiler);
     $compiler->raw(',');
     $this->params[0]->compile($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 17
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (!is_callable($value)) {
         throw new Exception('(Filter_Join):Value for filtering must be callable.');
     }
     $compiler->raw('implode(');
     if (isset($this->params[0])) {
         $this->params[0]->compile($compiler);
     } else {
         $compiler->raw('""');
     }
     $compiler->raw(', ');
     $value($compiler);
     $compiler->raw(')');
 }
Exemplo n.º 18
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Slice" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Slice):Value for filtering must be callable.');
     }
     $compiler->raw('array_slice(');
     $value($compiler);
     $compiler->raw(', ');
     $this->params[0]->compile($compiler);
     if (!empty($this->params[1]) && is_object($this->params[1])) {
         $compiler->raw(', ');
         $this->params[1]->compile($compiler);
     }
     $compiler->raw(')');
 }
Exemplo n.º 19
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Split" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Split):Value for filtering must be callable.');
     }
     $compiler->raw('explode(');
     $this->params[0]->compile($compiler);
     $compiler->raw(', ');
     $value($compiler);
     if (isset($this->params[1])) {
         $compiler->raw(', ');
         $this->params[1]->compile($compiler);
     }
     $compiler->raw(')');
 }
Exemplo n.º 20
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Substr" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Substr):Value for cuting must be callable.');
     }
     $compiler->raw('mb_substr(');
     $value($compiler);
     $compiler->raw(', ');
     $this->params[0]->compile($compiler);
     if (!empty($this->params[1])) {
         $compiler->raw(', ');
         $this->params[1]->compile($compiler);
     }
     $compiler->raw(')');
 }
Exemplo n.º 21
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "NumFormat" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_NumFormat):Value for filtering must be callable.');
     }
     $compiler->raw('number_format(');
     $value($compiler);
     $compiler->raw(', ');
     foreach ($this->params as $k => $param) {
         $param->compile($compiler);
         if ($k + 1 < count($this->params)) {
             $compiler->raw(', ');
         }
     }
     $compiler->raw(')');
 }
Exemplo n.º 22
0
 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");
 }
Exemplo n.º 23
0
 public function compile($value, Fps_Viewer_CompileParser $compiler)
 {
     if (empty($this->params[0])) {
         throw new Exception('First parameter is not exists in "Batch" filter.');
     }
     if (empty($this->params[1])) {
         throw new Exception('Second parameter is not exists in "Batch" filter.');
     }
     if (!is_callable($value)) {
         throw new Exception('(Filter_Batch):Value for filtering must be callable.');
     }
     $compiler->raw('array_map(function($n, $size = ');
     $this->params[0]->compile($compiler);
     $compiler->indent()->raw(', $def = ');
     $this->params[1]->compile($compiler);
     $compiler->indent()->raw(') {' . "\n");
     $compiler->indent()->write('return array_pad($n, $size, $def);' . "\n");
     $compiler->outdent()->write('}, array_chunk(');
     $value($compiler);
     $compiler->raw(', ');
     $this->params[0]->compile($compiler);
     $compiler->raw('))');
 }
Exemplo n.º 24
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('echo ')->raw($this->value->compile($compiler))->raw(";\n");
 }
Exemplo n.º 25
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write("/** Comment block\n")->write($this->value)->raw("\n")->write("*/ \n");
 }