예제 #1
0
 protected function doEchoAttribute(PHPTAL_Php_CodeWriter $codewriter, $code)
 {
     if ($this->_echoType === self::ECHO_TEXT) {
         $codewriter->doEcho($code);
     } else {
         $codewriter->doEchoRaw($code);
     }
 }
예제 #2
0
 public function generateCode(PHPTAL_Php_CodeWriter $codewriter)
 {
     if (preg_match('/^<\\?(?:php|[=\\s])/i', $this->getValueEscaped())) {
         // block will be executed as PHP
         $codewriter->pushHTML($this->getValueEscaped());
     } else {
         $codewriter->doEchoRaw("'<'");
         $codewriter->pushHTML(substr($codewriter->interpolateHTML($this->getValueEscaped()), 1));
     }
 }
예제 #3
0
 public function after(PHPTAL_Php_CodeWriter $codewriter)
 {
     $var = $codewriter->createTempVariable();
     $codewriter->pushCode('ob_end_flush()');
     $codewriter->doCatch('Exception ' . $var);
     $codewriter->pushCode('$tpl->addError(' . $var . ')');
     $codewriter->pushCode('ob_end_clean()');
     $expression = $this->extractEchoType($this->expression);
     $code = $codewriter->evaluateExpression($expression);
     switch ($code) {
         case PHPTAL_Php_TalesInternal::NOTHING_KEYWORD:
             break;
         case PHPTAL_Php_TalesInternal::DEFAULT_KEYWORD:
             $codewriter->pushHTML('<pre class="phptalError"');
             $codewriter->doEchoRaw($var);
             $codewriter->pushHTML('</pre>');
             break;
         default:
             $this->doEchoAttribute($codewriter, $code);
             break;
     }
     $codewriter->doEnd();
     $codewriter->recycleTempVariable($var);
 }