- Trimmed the echo and echo raw printed PHP code
This commit is contained in:
parent
92e304daf3
commit
cfc2f5d9af
|
@ -11,7 +11,9 @@ class EchoRawToken implements Syntax {
|
||||||
public function parse(/*\Picae\Compiler\Context*/ &$content, string &$sourceCode)
|
public function parse(/*\Picae\Compiler\Context*/ &$content, string &$sourceCode)
|
||||||
{
|
{
|
||||||
$sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) {
|
$sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) {
|
||||||
return "<?php echo {$matches[2]} ?>";
|
$line = trim($matches[2], " \t\n\r\0\x0B;");
|
||||||
|
|
||||||
|
return "<?php echo {$line} ?>";
|
||||||
}, $sourceCode);
|
}, $sourceCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@ class EchoSafeToken implements Syntax {
|
||||||
public function parse(/*\Picae\Compiler\Context*/ &$context, string &$sourceCode)
|
public function parse(/*\Picae\Compiler\Context*/ &$context, string &$sourceCode)
|
||||||
{
|
{
|
||||||
$sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) {
|
$sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) {
|
||||||
return "<?php echo htmlspecialchars({$matches[2]}, {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>";
|
$line = trim($matches[2], " \t\n\r\0\x0B;");
|
||||||
|
|
||||||
|
return "<?php echo htmlspecialchars({$line}, {$this->flag}, '{$this->encoding}', " . ($this->doubleEncode ? "true" : "false") . ") ?>";
|
||||||
}, $sourceCode);
|
}, $sourceCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue