public function enterInsert(Insert $node) { $content = $node->getContent(); $content = $this->trimInlineComments($content); if ($this->isEchoMode()) { $fmt = '<?php echo %s; ?>'; if ($node->getEscaping()->isEnabled()) { if ($node->getEscaping()->isOnce()) { $fmt = "<?php echo htmlspecialchars(%s,ENT_QUOTES,'%s',false); ?>"; } else { $fmt = "<?php echo htmlspecialchars(%s,ENT_QUOTES,'%s'); ?>"; } } $this->addDebugInfos($node); $this->raw(sprintf($fmt, $content, $this->charset)); } else { $content = $node->getContent(); if (!preg_match('~^\\$?[a-zA-Z0-9_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$~', $content)) { $this->raw('(' . $content . ')'); } else { $this->raw($content); } } }
public function enterInsert(Insert $node) { $content = $node->getContent(); $escaping = $node->getEscaping(); if (true === $escaping->isEnabled()) { $flag = '&'; if ($node->getEscaping()->isOnce()) { $flag .= '!'; } $content = $flag . $content; } elseif (false === $escaping->isEnabled()) { $content = '!' . $content; } $this->raw('insert(' . $content . ')'); }