diff options
author | Andrey Andreev <narf@devilix.net> | 2017-09-25 18:44:51 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2017-09-25 18:44:51 +0200 |
commit | e76217041ddcae80f11b50b44a7d409b6722ad40 (patch) | |
tree | 6f7dd444bfc5b4206a6e07169ad3c05b9b63fa4d /system/helpers | |
parent | 9c07c3697bab0bf43e10daf59068497dd3a0a9fd (diff) | |
parent | cf728703b5852591c160cbd9566a0e508dd5759a (diff) |
Merge branch '3.1-stable'
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/cookie_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/inflector_helper.php | 1 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 7 |
6 files changed, 11 insertions, 15 deletions
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index bb90cba1e..b943edbae 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -67,7 +67,7 @@ if ( ! function_exists('set_cookie')) * @param bool true makes the cookie accessible via http(s) only (no javascript) * @return void */ - function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE) + function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) { // Set the config file options get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index a49eea803..13f196318 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -597,7 +597,7 @@ if ( ! function_exists('form_label')) * * @param string The text to appear onscreen * @param string The id the label applies to - * @param array Additional attributes + * @param mixed Additional attributes * @return string */ function form_label($label_text = '', $id = '', $attributes = array()) @@ -610,13 +610,7 @@ if ( ! function_exists('form_label')) $label .= ' for="'.$id.'"'; } - if (is_array($attributes) && count($attributes) > 0) - { - foreach ($attributes as $key => $val) - { - $label .= ' '.$key.'="'.$val.'"'; - } - } + $label .= _attributes_to_string($attributes); return $label.'>'.$label_text.'</label>'; } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index de1b92cde..87a5f9b23 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -192,7 +192,7 @@ if ( ! function_exists('img')) foreach ($src as $k => $v) { - if ($k === 'src' && ! preg_match('#^([a-z]+:)?//#i', $v)) + if ($k === 'src' && ! preg_match('#^(data:[a-z,;])|(([a-z]+:)?(?<!data:)//)#i', $v)) { if ($index_page === TRUE) { diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 26a5a5ca9..4a6805fbb 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -95,6 +95,7 @@ if ( ! function_exists('singular')) '/(s)tatuses$/' => '\1\2tatus', '/(c)hildren$/' => '\1\2hild', '/(n)ews$/' => '\1\2ews', + '/(quiz)zes$/' => '\1', '/([^us])s$/' => '\1' ); diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 23608e5f4..93446b82f 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -195,9 +195,7 @@ if ( ! function_exists('reduce_multiples')) if ( ! function_exists('random_string')) { /** - * Create a Random String - * - * Useful for generating passwords or hashes. + * Create a "Random" String * * @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1 * @param int number of characters diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 07c01c3af..217729b70 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -138,7 +138,10 @@ if ( ! function_exists('ascii_to_entities')) function ascii_to_entities($str) { $out = ''; - for ($i = 0, $s = strlen($str) - 1, $count = 1, $temp = array(); $i <= $s; $i++) + $length = defined('MB_OVERLOAD_STRING') + ? mb_strlen($str, '8bit') - 1 + : strlen($str) - 1; + for ($i = 0, $count = 1, $temp = array(); $i <= $length; $i++) { $ordinal = ord($str[$i]); @@ -176,7 +179,7 @@ if ( ! function_exists('ascii_to_entities')) $temp = array(); } // If this is the last iteration, just output whatever we have - elseif ($i === $s) + elseif ($i === $length) { $out .= '&#'.implode(';', $temp).';'; } |