1 | <?php |
||
12 | class Plain extends Text { |
||
13 | protected $s; |
||
14 | protected $type; |
||
15 | |||
16 | function __construct($s, $type = self::TOKEN_HTML) { |
||
17 | $this->s = str_replace('\\$', "$", $s); |
||
18 | $this->type = $type; |
||
19 | } |
||
20 | |||
21 | function toPHP() { |
||
22 | return Text::varToCode($this->s); |
||
23 | } |
||
24 | |||
25 | function toHTML($escape = false) { |
||
26 | if ($this->type == self::TOKEN_CODE) |
||
27 | return $this->s; |
||
28 | return htmlspecialchars($this->s); |
||
29 | } |
||
30 | } |