summaryrefslogtreecommitdiffstats
path: root/system/helpers/form_helper.php
diff options
context:
space:
mode:
authorAdrian Voicu <avenir.ro@gmail.com>2015-02-05 11:14:55 +0100
committerAdrian Voicu <avenir.ro@gmail.com>2015-02-05 11:14:55 +0100
commit11bf768f557e7c63f8702648705536773b37c9b8 (patch)
tree936bb47f5772704fb83263dc15c2466129f1a1ff /system/helpers/form_helper.php
parent6d0ae773fe211df0eecb90e827e883610b8b23aa (diff)
Allow not-escaping the value in set_value()
Wouldn't it be a good idea to allow for not escaped html in set_value()?
Diffstat (limited to 'system/helpers/form_helper.php')
-rw-r--r--system/helpers/form_helper.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index fb235291e..f6d6b433e 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -676,17 +676,18 @@ if ( ! function_exists('set_value'))
*
* @param string $field Field name
* @param string $default Default value
+ * @param bool $escaped Escaped value
* @return string
*/
- function set_value($field, $default = '')
+ function set_value($field, $default = '',$escaped = 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);
+ $value = ($value === NULL) ? $default : $value;
+ return $escaped ? html_escape($value) : $value;
}
}