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(")");
 }
示例#2
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(')');
 }
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->raw(' !in_array(');
     $this->left->compile($compiler);
     $compiler->raw(', ');
     $this->right->compile($compiler);
     $compiler->raw(') ');
 }
示例#5
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(')');
 }
 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)');
 }
示例#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>'");
 }
 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(')');
 }
示例#9
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(')');
 }
示例#10
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(')');
 }
示例#11
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(')');
 }
示例#12
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(')');
 }
示例#13
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(')');
 }
示例#14
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(')');
 }
示例#15
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(')');
 }
示例#16
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(')');
 }
示例#17
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(')');
 }
示例#18
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(')');
 }
示例#19
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('))');
 }
示例#20
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");
 }