summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-08-25 05:58:10 +0200
committerGreg Aker <greg@gregaker.net>2011-08-25 05:58:10 +0200
commit9ff6336415f3da2a81142cb23343060df6196ebe (patch)
tree850711b8f4e981fcd1bf51151b1d71d53f630076 /system
parent073d2c6effd134e36f7e5ed69d1398cbe09d383b (diff)
parentfbac8b4553942db4be52e872d9fd68717e5006e4 (diff)
Merge pull request #291 from kenjis/html_escape
add html_escape() function to escape HTML.
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 3c62403ac..d79375475 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -536,5 +536,29 @@ if ( ! function_exists('remove_invisible_characters'))
}
}
+// ------------------------------------------------------------------------
+
+/**
+* Returns HTML escaped variable
+*
+* @access public
+* @param mixed
+* @return mixed
+*/
+if ( ! function_exists('html_escape'))
+{
+ function html_escape($var)
+ {
+ if (is_array($var))
+ {
+ return array_map('html_escape', $var);
+ }
+ else
+ {
+ return htmlspecialchars($var, ENT_QUOTES, config_item('charset'));
+ }
+ }
+}
+
/* End of file Common.php */
/* Location: ./system/core/Common.php */ \ No newline at end of file