diff options
author | Greg Aker <greg.aker@ellislab.com> | 2011-04-27 08:47:47 +0200 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2011-04-27 08:47:47 +0200 |
commit | a6507905578f1cf209776ae3d53099a005a06823 (patch) | |
tree | 9f23bb557f920034cf65c86059c84e37efd34d79 /system/helpers/inflector_helper.php | |
parent | 60ef4ea72e169e174ff8dbb421609a178a3c0c48 (diff) | |
parent | 25d495b4a2598f771a858108a2cd2e96f0130412 (diff) |
merging in changes
Diffstat (limited to 'system/helpers/inflector_helper.php')
-rw-r--r-- | system/helpers/inflector_helper.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index c7c113b8a..2352b642e 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -43,9 +43,9 @@ if ( ! function_exists('singular')) { $str = trim($str); $end = substr($str, -3); - - $str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str); - + + $str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str); + if (strtolower($end) == 'ies') { $str = substr($str, 0, strlen($str)-3).(preg_match('/[a-z]/',$end) ? 'y' : 'Y'); @@ -83,8 +83,8 @@ if ( ! function_exists('singular')) if ( ! function_exists('plural')) { function plural($str, $force = FALSE) - { - $str = trim($str); + { + $str = trim($str); $end = substr($str, -1); if (preg_match('/y/i',$end)) @@ -95,7 +95,7 @@ if ( ! function_exists('plural')) } elseif (preg_match('/h/i',$end)) { - if(preg_match('/^[c|s]h$/i',substr($str, -2))) + if(preg_match('/^[c|s]h$/i',substr($str, -2))) { $str .= 'es'; } |