From 9b8cb828a896aaf9d7a3d918b4ee2c1cf1f5143a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 28 Feb 2013 14:29:16 -0600 Subject: [PATCH] added entities and decode method. --- HtmlBuilder.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/HtmlBuilder.php b/HtmlBuilder.php index 42ea738..12132d5 100644 --- a/HtmlBuilder.php +++ b/HtmlBuilder.php @@ -2,6 +2,28 @@ class HtmlBuilder { + /** + * Convert an HTML string to entities. + * + * @param string $value + * @return string + */ + public static function entities($value) + { + return htmlentities($value, ENT_QUOTES, 'UTF-8', false); + } + + /** + * Convert entities to HTML characters. + * + * @param string $value + * @return string + */ + public static function decode($value) + { + return html_entity_decode($value, ENT_QUOTES, 'UTF-8'); + } + /** * Generate an ordered list of items. *