diff options
author | kenjis <kenji@codeigniter.jp> | 2011-08-25 03:51:44 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-10-28 16:08:00 +0200 |
commit | 55027807e4826dfe722598172ab7ffbd9dc0b48c (patch) | |
tree | fd9e3c4b10f34c02688cead2825920960fecaff7 /system | |
parent | 426ff851c2164651228a9a9bc10869301b19dbcc (diff) |
add html_escape() function to escape HTML.
Diffstat (limited to 'system')
-rw-r--r-- | system/core/Common.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/system/core/Common.php b/system/core/Common.php index db9fbeb9f..3d6931bc0 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 |