XaminProject / handlebars.php

Handlebars processor for php
331 stars 134 forks source link

Add \Handlebars\SafeString class #45

Closed JustBlackBird closed 10 years ago

JustBlackBird commented 10 years ago

Line helpers can return a result wrapped into Handlebars\safeString class to prevent auto escaping.

Example of usage:

$engine = new \Handlebars\Handlebars();

$engine->addHelper('copyrigth', function() {
    return new \Handlebars\SafeString('Copyright 2014 <a href="example.com">Example dot com</a>');
});
everplays commented 10 years ago

@fzerorubigd could you please review it? On Feb 3, 2014 12:34 PM, "Dmitriy S. Simushev" notifications@github.com wrote:

Line helpers can return a result wrapped into Handlebars\safeString class to prevent auto escaping.

Example of usage:

$engine = new \Handlebars\Handlebars(); $engine->addHelper('copyrigth', function() { return new \Handlebars\SafeString('Copyright 2014 Example dot com');});


You can merge this Pull Request by running

git pull https://github.com/Mibew/handlebars.php safe_string

Or view, comment on, or merge it at:

https://github.com/XaminProject/handlebars.php/pull/45 Commit Summary

  • Add \Handlebars\SafeString class

File Changes

  • A src/Handlebars/BaseString.phphttps://github.com/XaminProject/handlebars.php/pull/45/files#diff-0(78)
  • A src/Handlebars/SafeString.phphttps://github.com/XaminProject/handlebars.php/pull/45/files#diff-1(33)
  • M src/Handlebars/String.phphttps://github.com/XaminProject/handlebars.php/pull/45/files#diff-2(49)
  • M src/Handlebars/Template.phphttps://github.com/XaminProject/handlebars.php/pull/45/files#diff-3(2)
  • M tests/Xamin/HandlebarsTest.phphttps://github.com/XaminProject/handlebars.php/pull/45/files#diff-4(5)

Patch Links:

— Reply to this email directly or view it on GitHubhttps://github.com/XaminProject/handlebars.php/pull/45 .

fzerorubigd commented 10 years ago

@everplays This is handlebars.js behavior and I think we can have it here. @JustBlackBird thanks.