Пример #1
0
 function generateExpression($code)
 {
     parent::generateExpression($code);
     $code->writePHP('lmb_ucfirst(');
     $this->base->generateExpression($code);
     $code->writePHP(')');
 }
Пример #2
0
 /**
  * @param WactCodeWriter
  */
 function generatePreStatement($code_writer)
 {
     parent::generatePreStatement($code_writer);
     $this->input = $code_writer->getTempVarRef();
     $code_writer->writePHP($this->input . '=');
     $this->base->generateExpression($code_writer);
     $code_writer->writePHP(';');
 }
Пример #3
0
 /**
  * Generate setup code for an expression reference
  * @param WactCodeWriter
  * @return void
  */
 function generatePreStatement($code_writer)
 {
     parent::generatePreStatement($code_writer);
     switch (count($this->parameters)) {
         case 3:
             $this->str = $code_writer->getTempVarRef();
             $this->strlen = $code_writer->getTempVarRef();
             $this->len = $code_writer->getTempVarRef();
             $this->start = $code_writer->getTempVarRef();
             $this->suffix = $code_writer->getTempVarRef();
             $code_writer->writePHP($this->str . '=');
             $this->base->generateExpression($code_writer);
             $code_writer->writePHP(';');
             $code_writer->writePHP($this->strlen . '=strlen(' . $this->str . ');');
             $code_writer->writePHP($this->len . '=');
             $this->parameters[0]->generateExpression($code_writer);
             $code_writer->writePHP(';');
             $code_writer->writePHP($this->start . '=');
             $this->parameters[1]->generateExpression($code_writer);
             $code_writer->writePHP(';');
             $code_writer->writePHP($this->suffix . '=(' . $this->strlen . '>' . $this->start . '+' . $this->len . ')?');
             $this->parameters[2]->generateExpression($code_writer);
             $code_writer->writePHP(':\'\';');
             break;
         case 4:
             $this->str = $code_writer->getTempVarRef();
             $this->strlen = $code_writer->getTempVarRef();
             $this->len = $code_writer->getTempVarRef();
             $this->start = $code_writer->getTempVarRef();
             $this->suffix = $code_writer->getTempVarRef();
             $this->match = $code_writer->getTempVarRef();
             $code_writer->writePHP($this->str . '=');
             $this->base->generateExpression($code_writer);
             $code_writer->writePHP(';' . $this->strlen . '=strlen(' . $this->str . ');');
             $code_writer->writePHP($this->len . '=');
             $this->parameters[0]->generateExpression($code_writer);
             $code_writer->writePHP(';' . $this->start . '=');
             $this->parameters[1]->generateExpression($code_writer);
             $code_writer->writePHP(';if (strtoupper(substr(');
             $this->parameters[3]->generateExpression($code_writer);
             $code_writer->writePHP(',0,1))!="N") {');
             $code_writer->writePHP('preg_match("~^(.{0,' . $this->len . '}\\w*)\\b~ims", substr(' . $this->str . ',' . $this->start . '), ' . $this->match . ');');
             $code_writer->writePHP('}else{');
             $code_writer->writePHP('preg_match("~^(.{0,' . $this->len . '})~ims", substr(' . $this->str . ',' . $this->start . '), ' . $this->match . ');}');
             $code_writer->writePHP($this->str . '=' . $this->match . '[1];');
             $code_writer->writePHP($this->strlen . '=strlen(' . $this->str . ');');
             $code_writer->writePHP($this->suffix . '=(' . $this->strlen . '>=' . $this->len . ')?');
             $this->parameters[2]->generateExpression($code_writer);
             $code_writer->writePHP(':"";');
             break;
         default:
             //okay
     }
 }
Пример #4
0
 function generatePreStatement($code)
 {
     parent::generatePreStatement($code);
     $this->params_var = $code->getTempVarRef();
     $code->writePhp($this->params_var . ' = array();');
     for ($i = 1; $i < sizeof($this->parameters); $i += 2) {
         $var = $this->parameters[$i]->getValue();
         $code->writePhp($this->params_var . '["' . $this->parameters[$i]->getValue() . '"] = ');
         $code->writePhp($this->parameters[$i + 1]->generateExpression($code));
         $code->writePhp(';' . "\n");
     }
 }
Пример #5
0
 function generatePreStatement($code)
 {
     parent::generatePreStatement($code);
     switch (count($this->parameters)) {
         case 1:
             $this->_generateBaseVars($code);
             break;
         case 2:
             $this->_generateBaseVars($code);
             $this->_generateOffset($code);
             break;
         case 3:
         case 4:
             $this->_generateBaseVars($code);
             $this->_generateOffset($code);
             $this->_generateSuffix($code);
             break;
         default:
             throw new WactException('Wrong number of filter parameters(1..4)');
     }
 }
Пример #6
0
 function generateExpression($code)
 {
     parent::generateExpression($code);
     $code->writePHP($this->date_var . '->localeStrftime(');
     $this->_getDBEFormat($code);
     $code->writePHP(' ,' . $this->locale_var . ')');
 }
Пример #7
0
 function prepare()
 {
     self::$calls['prepare']++;
     parent::prepare();
 }