summaryrefslogtreecommitdiffstats
path: root/system/helpers/form_helper.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2009-09-17 14:17:45 +0200
committerDerek Allard <derek.allard@ellislab.com>2009-09-17 14:17:45 +0200
commit3241d73d55649893cea7c55d1d24b2981088b0d1 (patch)
treec3cc17b3e87c6f466e0977201076ef490bce7c23 /system/helpers/form_helper.php
parent292dcd83359db59a60564cf7ceb1890e5395ac36 (diff)
modified the way accept-charset is added
Diffstat (limited to 'system/helpers/form_helper.php')
-rw-r--r--system/helpers/form_helper.php54
1 files changed, 22 insertions, 32 deletions
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;
}
}
}