From 3241d73d55649893cea7c55d1d24b2981088b0d1 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 17 Sep 2009 12:17:45 +0000 Subject: modified the way accept-charset is added --- system/helpers/form_helper.php | 54 +++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) (limited to 'system/helpers/form_helper.php') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 5917d1016..02e2edd3e 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -44,30 +44,9 @@ if ( ! function_exists('form_open')) { $CI =& get_instance(); - $charset = strtolower($CI->config->item('charset')); - if ($attributes == '') { - $attributes = 'method="post" accept-charset="'.$charset.'"'; - } - else - { - if ( is_string($attributes)) - { - if(strpos('accept-charset=') === FALSE) - { - $attributes .= ' accept-charset="'.$charset.'"'; - } - } - else - { - $attributes = (array) $attributes; - - if ( ! in_array('accept-charset', $attributes)) - { - $attributes['accept-charset'] = $charset; - } - } + $attributes = 'method="post"'; } $action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action; @@ -87,6 +66,7 @@ if ( ! function_exists('form_open')) } } + // ------------------------------------------------------------------------ /** @@ -978,6 +958,11 @@ if ( ! function_exists('_attributes_to_string')) $attributes .= ' method="post"'; } + if ($formtag == TRUE AND strpos($attributes, 'accept-charset=') === FALSE) + { + $attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"'; + } + return ' '.$attributes; } @@ -988,19 +973,24 @@ if ( ! function_exists('_attributes_to_string')) if (is_array($attributes) AND count($attributes) > 0) { - $atts = ''; + $atts = ''; - if ( ! isset($attributes['method']) AND $formtag === TRUE) - { - $atts .= ' method="post"'; - } + if ( ! isset($attributes['method']) AND $formtag === TRUE) + { + $atts .= ' method="post"'; + } - foreach ($attributes as $key => $val) - { - $atts .= ' '.$key.'="'.$val.'"'; - } + if ( ! isset($attributes['accept-charset']) AND $formtag === TRUE) + { + $atts .= ' accept-charset="'.strtolower(config_item('charset')).'"'; + } + + foreach ($attributes as $key => $val) + { + $atts .= ' '.$key.'="'.$val.'"'; + } - return $atts; + return $atts; } } } -- cgit v1.2.3-24-g4f1b