From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/helpers/inflector_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/inflector_helper.php') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 7c5082192..f093dd921 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From 1e6b72cca80354619cf7ddceb2b5f23d37b972e9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Jan 2012 19:09:22 +0200 Subject: Improve html, inflector & language helpers --- system/helpers/inflector_helper.php | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'system/helpers/inflector_helper.php') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index f093dd921..0bd1e112f 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -1,4 +1,4 @@ - '\1', ); - foreach ($singular_rules as $rule => $replacement) - { - if (preg_match($rule, $result)) - { - $result = preg_replace($rule, $replacement, $result); - break; - } - } - - return $result; + return preg_replace(array_keys($singular_values), $singular_values, $result); } } @@ -138,16 +129,7 @@ if ( ! function_exists('plural')) '/$/' => 's', ); - foreach ($plural_rules as $rule => $replacement) - { - if (preg_match($rule, $result)) - { - $result = preg_replace($rule, $replacement, $result); - break; - } - } - - return $result; + return preg_replace(array_keys($plural_rules), $plural_rules, $result); } } @@ -166,9 +148,7 @@ if ( ! function_exists('camelize')) { function camelize($str) { - $str = 'x'.strtolower(trim($str)); - $str = ucwords(preg_replace('/[\s_]+/', ' ', $str)); - return substr(str_replace(' ', '', $str), 1); + return substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); } } @@ -212,4 +192,4 @@ if ( ! function_exists('humanize')) } /* End of file inflector_helper.php */ -/* Location: ./system/helpers/inflector_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/inflector_helper.php */ -- cgit v1.2.3-24-g4f1b