static function parse($tree) { extract($tree); $code = addcslashes($code, '"'); $code = replaceFunc('<?= "%s" ?>', $code); $lang = $lang == 'js' ? 'script' : 'style'; return "<{$lang}>\n{$code}\n\n</{$lang}>"; }
protected static function formatted($var, $text, $escaped) { $output = $var ? $escaped ? "e({$var})" : $var : null; if (is_null($text)) { return "<?= {$output} ?>"; } $text = addcslashes($text, '"'); $text = $escaped ? replaceFunc('e("%s")', $text) : replaceFunc('"%s"', $text); if (is_null($output)) { return "<?= {$text} ?>"; } if (starts_with($var, '$')) { return "<?= isset({$var}) ? {$output} : {$text} ?>"; } return "<?= {$output} ?: {$text} ?>"; }
static function parse($tree) { extract($tree); $text = addcslashes($text, '"'); return replaceFunc('<?= e("%s") ?>', $text); }