Align {{foo}}
escaping logic with handlebars.js. This causes '
, =
and `
be escaped in different way.
The default escaping is by htmlentities only.
array(
"foo" => "Love & <b>Peace</b>"
)
Love & <b>Peace</b>
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Love & <b>Peace</b>"
);
echo $render($data);
Escaping '
:
array(
"foo" => "Single Quote is '"
)
Single Quote is '
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Single Quote is '"
);
echo $render($data);
Escaping '
:
Used option: FLAG_HBESCAPE
array(
"foo" => "Single Quote is '"
)
Single Quote is '
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Single Quote is '"
);
echo $render($data);
Escaping `
:
array(
"foo" => "Backtick is `"
)
Backtick is `
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Backtick is `"
);
echo $render($data);
Escaping `
:
Used option: FLAG_HBESCAPE
array(
"foo" => "Backtick is `"
)
Backtick is `
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Backtick is `"
);
echo $render($data);
Escaping =
:
array(
"foo" => "Equal is ="
)
Equal is =
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Equal is ="
);
echo $render($data);
Escaping =
:
Used option: FLAG_HBESCAPE
array(
"foo" => "Equal is ="
)
Equal is =
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Equal is ="
);
echo $render($data);