summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Aker <greg.aker@ellislab.com>2009-11-04 18:23:32 +0100
committerGreg Aker <greg.aker@ellislab.com>2009-11-04 18:23:32 +0100
commita3f47180e3885fca82599e90c95ce6e5c26072d6 (patch)
tree160bb9535e0dc0a18710dd2cdfe725b634c70492
parent172e16191889558ca6f6710cf34755200d3e6334 (diff)
Modified inflector helper to properly pluralize words that end in 'ch' or 'sh'
http://codeigniter.com/bug_tracker/bug/9384/
-rw-r--r--system/helpers/inflector_helper.php11
-rw-r--r--user_guide/changelog.html3
2 files changed, 13 insertions, 1 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index e65968a9d..8db4f3d75 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -91,6 +91,17 @@ if ( ! function_exists('plural'))
$vowels = array('a', 'e', 'i', 'o', 'u');
$str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
}
+ elseif ($end == 'h')
+ {
+ if (substr($str, -2) == 'ch' || substr($str, -2) == 'sh')
+ {
+ $str .= 'es';
+ }
+ else
+ {
+ $str .= 's';
+ }
+ }
elseif ($end == 's')
{
if ($force == TRUE)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 791b1ddef..89d779ebf 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -70,7 +70,7 @@ SVN Revision: </p>
<li>Helpers
<ul>
<li>Added accept-charset to the list of inserted attributes of <kbd>form_open()</kbd> in the <a href="helpers/form_helper.html">Form Helper</a>.</li>
- <li>Deprecated the <kbd>dohash()</kbd> function in favour of <kbd>do_hash()</kbd> for naming consistency.</li>
+ <li>Deprecated the <kbd>dohash()</kbd> function in favur of <kbd>do_hash()</kbd> for naming consistency.</li>
</ul>
</li>
</ul>
@@ -82,6 +82,7 @@ SVN Revision: </p>
<li>Made <kbd>get_mime_by_extension()</kbd> case insensitive.</li>
<li>Fixed a bug in the Form Validation library where fields passed as rule parameters were not being translated (#9132)</li>
<li>Switched some DIR_WRITE_MODE constant uses to FILE_WRITE_MODE where files and not directories are being operated on.</li>
+ <li>Modified inflector helper to properly pluralize words that end in 'ch' or 'sh'</li>
</ul>
<h2>Version 1.7.2</h2>