Exemple #1
0
 public function talesChainPart(PHPTAL_Php_TalesChainExecutor $executor, $exp, $islast)
 {
     $codewriter = $executor->getCodeWriter();
     $escape = !($this->_echoType == PHPTAL_Php_Attribute::ECHO_STRUCTURE);
     $exp = $codewriter->getTranslatorReference() . "->translate({$exp}, " . ($escape ? 'true' : 'false') . ')';
     if (!$islast) {
         $var = $codewriter->createTempVariable();
         $executor->doIf('!phptal_isempty(' . $var . ' = ' . $exp . ')');
         $codewriter->pushCode("echo {$var}");
         $codewriter->recycleTempVariable($var);
     } else {
         $executor->doElse();
         $codewriter->pushCode("echo {$exp}");
     }
 }
Exemple #2
0
 public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
 {
     $executor->doElse();
     $this->bufferizeContent();
     $executor->breakChain();
 }
Exemple #3
0
 public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
 {
     $codewriter = $executor->getCodeWriter();
     $executor->doElse();
     $attr_str = $this->_default_escaped !== false ? ' ' . $this->_attribute . '=' . $codewriter->quoteAttributeValue($this->_default_escaped) : '';
     // do not print attribute
     $codewriter->doSetVar($this->_attkey, $codewriter->str($attr_str));
     $executor->breakChain();
 }
Exemple #4
0
 public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
 {
     if (!$this->_chainPartGenerated) {
         throw new PHPTAL_TemplateException("Invalid expression in tal:define", $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine());
     }
     $executor->doElse();
     $this->bufferizeContent($executor->getCodeWriter());
     $executor->breakChain();
 }
Exemple #5
0
 public function talesChainPart(PHPTAL_Php_TalesChainExecutor $executor, $exp, $islast)
 {
     if (!$islast) {
         $var = $executor->getCodeWriter()->createTempVariable();
         $executor->doIf('!phptal_isempty(' . $var . ' = ' . $exp . ')');
         $this->doEchoAttribute($executor->getCodeWriter(), $var);
         $executor->getCodeWriter()->recycleTempVariable($var);
     } else {
         $executor->doElse();
         $this->doEchoAttribute($executor->getCodeWriter(), $exp);
     }
 }
Exemple #6
0
 public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
 {
     $executor->doElse();
     $code = $this->_default !== false ? "' {$this->_attribute}=\"" . str_replace("'", '\\\'', $this->_default) . "\"'" : '\'\'';
     // do not print attribute
     $this->tag->generator->doSetVar($this->_attkey, $code);
     $executor->breakChain();
 }
Exemple #7
0
 public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
 {
     $executor->doElse();
     $this->generateDefault($executor->getCodeWriter());
     $executor->breakChain();
 }