diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-10 14:38:49 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-10 14:38:49 +0100 |
commit | 52a31ba3acc5f5be16692ac25c70780775e548e0 (patch) | |
tree | 1b931123c24cdb48de55e63b2ae1c8faa68ca850 /system/helpers/inflector_helper.php | |
parent | 244d6741a1ecd8959887bc5d6612a69631390b3f (diff) |
Fix camelize()
Diffstat (limited to 'system/helpers/inflector_helper.php')
-rw-r--r-- | system/helpers/inflector_helper.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 2f6b40aa7..bbc75c747 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Inflector Helpers * @@ -37,7 +35,6 @@ * @link http://codeigniter.com/user_guide/helpers/inflector_helper.html */ - // -------------------------------------------------------------------- /** @@ -58,7 +55,7 @@ if ( ! function_exists('singular')) { return $result; } - + $singular_rules = array( '/(matr)ices$/' => '\1ix', '/(vert|ind)ices$/' => '\1ex', @@ -116,7 +113,7 @@ if ( ! function_exists('singular')) if ( ! function_exists('plural')) { function plural($str, $force = FALSE) - { + { $result = strval($str); if ( ! is_countable($result)) @@ -145,7 +142,7 @@ if ( ! function_exists('plural')) '/s$/' => 's', // no change (compatibility) '/$/' => 's', ); - + foreach ($plural_rules as $rule => $replacement) { if (preg_match($rule, $result)) @@ -173,7 +170,7 @@ if ( ! function_exists('camelize')) { function camelize($str) { - return substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); + return ucwords(str_replace(' ', '', preg_replace('/[\s_]+/', ' ', strtolower($str)))); } } @@ -232,4 +229,4 @@ if ( ! function_exists('is_countable')) } /* End of file inflector_helper.php */ -/* Location: ./system/helpers/inflector_helper.php */
\ No newline at end of file +/* Location: ./system/helpers/inflector_helper.php */ |