Changeset 2971
- Timestamp:
- 07/06/2008 06:46:21 PM (5 months ago)
- Files:
-
- 1 modified
-
trunk/system/helpers/inflector.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/inflector.php
r2923 r2971 80 80 $str = $irregular; 81 81 } 82 elseif (substr($str, -3) === 'ies') 83 { 84 $str = substr($str, 0, strlen($str) - 3).'y'; 85 } 86 elseif (substr($str, -4) === 'sses' OR substr($str, -3) === 'xes') 87 { 88 $str = substr($str, 0, strlen($str) - 2); 82 elseif (preg_match('/[sxz]es$/i', $str) OR preg_match('/[^aeioudgkprt]hes$/i', $str)) 83 { 84 // Remove "es" 85 $str = substr($str, 0, -2); 86 } 87 elseif (preg_match('/[^aeiou]ies$/i', $str)) 88 { 89 // Remove "ies" 90 $str = substr($str, 0, -3).'y'; 89 91 } 90 92 elseif (substr($str, -1) === 's') 91 93 { 94 // Remove "s" 92 95 $str = substr($str, 0, strlen($str) - 1); 93 96 }
