1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18: if (!class_exists('PHPTAL')) { require_once 'PHPTAL.php'; }
19: if (!class_exists('PHPTAL_Namespace')) { require_once 'PHPTAL/Namespace.php'; }
20: if (!class_exists('PHPTAL_Php_Attribute_TAL_Replace')) { require_once 'PHPTAL/Php/Attribute/TAL/Replace.php'; }
21:
22: 23: 24: 25:
26: class Pinoco_PAL_ReplaceNl2br extends PHPTAL_Php_Attribute_TAL_Replace
27: {
28: protected function doEchoAttribute(PHPTAL_Php_CodeWriter $codewriter, $code)
29: {
30: if ($code !== "''") {
31: if ($this->_echoType === self::ECHO_TEXT) {
32: $codewriter->flush();
33: $codewriter->pushCode('echo nl2br('.$codewriter->escapeCode($code).')');
34: }
35: else {
36: $codewriter->pushCode('echo nl2br('.$codewriter->stringifyCode($codewriter->interpolateHTML($code)).')');
37: }
38: }
39: }
40: }
41:
42:
43: