diff options
author | Pascal Kriete <pascal@pascalkriete.com> | 2011-11-14 21:15:15 +0100 |
---|---|---|
committer | Pascal Kriete <pascal@pascalkriete.com> | 2011-11-14 21:15:15 +0100 |
commit | f525f10c850399700a4cce183aef55656ff44d31 (patch) | |
tree | d0250655551d773c9347573e594997e07d7280a5 /system/helpers | |
parent | 44cdece942c310f5520497dbde4febc26e96c27e (diff) | |
parent | 917c3455cc70d5117daa7359f345a820154ada3e (diff) |
Merge branch 'release/2.1.0'
Conflicts:
user_guide/helpers/url_helper.html
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/date_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 8 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 17 |
3 files changed, 22 insertions, 5 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 553e8d7ee..0aeb7fafb 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -116,7 +116,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 2925d3c7c..d9305c00b 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -64,8 +64,8 @@ if ( ! function_exists('form_open')) $form .= '>'; - // CSRF - if ($CI->config->item('csrf_protection') === TRUE) + // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites + if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"'))) { $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } @@ -94,7 +94,7 @@ if ( ! function_exists('form_open')) */ if ( ! function_exists('form_open_multipart')) { - function form_open_multipart($action, $attributes = array(), $hidden = array()) + function form_open_multipart($action = '', $attributes = array(), $hidden = array()) { if (is_string($attributes)) { @@ -249,7 +249,7 @@ if ( ! function_exists('form_textarea')) { function form_textarea($data = '', $value = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12'); + $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '40', 'rows' => '10'); if ( ! is_array($data) OR ! isset($data['value'])) { diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 7765bba31..9fa69f46c 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -243,6 +243,23 @@ if ( ! function_exists('random_string')) // ------------------------------------------------------------------------ /** + * Add's _1 to a string or increment the ending number to allow _2, _3, etc + * + * @param string $str required + * @param string $separator What should the duplicate number be appended with + * @param string $first Which number should be used for the first dupe increment + * @return string + */ +function increment_string($str, $separator = '_', $first = 1) +{ + preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match); + + return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first; +} + +// ------------------------------------------------------------------------ + +/** * Alternator * * Allows strings to be alternated. See docs... |