summaryrefslogtreecommitdiffstats
path: root/system/helpers/inflector_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-13 02:28:00 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-13 02:28:00 +0100
commit6ce4746474ddf050f7f4df61b7a22b7f5854d533 (patch)
tree42d6cbca7b03c4dca040b42768c779def90217fb /system/helpers/inflector_helper.php
parentdbcd12d48024fc70a464e96f9e90bf1f341d0a11 (diff)
Update Text and Inflector helpers to utilize mbstring, if available
Text: word_wrap(), ellipsize() Inflector: humanize(), underscore() (rel #2855)
Diffstat (limited to 'system/helpers/inflector_helper.php')
-rw-r--r--system/helpers/inflector_helper.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 210d0fdfd..b44594e2a 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -188,7 +188,7 @@ if ( ! function_exists('underscore'))
*/
function underscore($str)
{
- return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
+ return preg_replace('/[\s]+/', '_', trim(MB_ENABLED ? mb_strtolower($str) : strtolower($str)));
}
}
@@ -207,7 +207,7 @@ if ( ! function_exists('humanize'))
*/
function humanize($str, $separator = '_')
{
- return ucwords(preg_replace('/['.$separator.']+/', ' ', strtolower(trim($str))));
+ return ucwords(preg_replace('/['.$separator.']+/', ' ', trim(MB_ENABLED ? mb_strtolower($str) : strtolower($str))));
}
}
@@ -223,12 +223,13 @@ if ( ! function_exists('is_countable'))
*/
function is_countable($word)
{
- return ! in_array(strtolower($word),
- array(
- 'equipment', 'information', 'rice', 'money',
- 'species', 'series', 'fish', 'meta'
- )
- );
+ return ! in_array(
+ strtolower($word),
+ array(
+ 'equipment', 'information', 'rice', 'money',
+ 'species', 'series', 'fish', 'meta'
+ )
+ );
}
}