summaryrefslogtreecommitdiffstats
path: root/system/helpers/form_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-02-05 14:49:47 +0100
committerAndrey Andreev <narf@devilix.net>2015-02-05 14:49:47 +0100
commitfa76607c7b5e5414b50680be512dd23920f52e9b (patch)
tree9460d2cbaaadff6d4608d14e8860e05f17a192af /system/helpers/form_helper.php
parent79533cac482a9d8f9211c8ff607968de3b27d1e4 (diff)
parentfa61fb236654fbd3eea82d437da28c9aab33e559 (diff)
Merge pull request #3562 from avenirer/patch-1
Allow not escaping the value in set_value()
Diffstat (limited to 'system/helpers/form_helper.php')
-rw-r--r--system/helpers/form_helper.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index fb235291e..70c40a9c3 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -676,17 +676,19 @@ if ( ! function_exists('set_value'))
*
* @param string $field Field name
* @param string $default Default value
+ * @param bool $html_escape Whether to escape HTML special characters or not
* @return string
*/
- function set_value($field, $default = '')
+ function set_value($field, $default = '', $html_escape = TRUE)
{
$CI =& get_instance();
$value = (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field))
? $CI->form_validation->set_value($field, $default)
: $CI->input->post($field, FALSE);
-
- return html_escape($value === NULL ? $default : $value);
+
+ isset($value) OR $value = $default;
+ return ($html_escape) ? html_escape($value) : $value;
}
}