From 6ce4746474ddf050f7f4df61b7a22b7f5854d533 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 13 Feb 2014 03:28:00 +0200 Subject: Update Text and Inflector helpers to utilize mbstring, if available Text: word_wrap(), ellipsize() Inflector: humanize(), underscore() (rel #2855) --- system/helpers/inflector_helper.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'system/helpers/inflector_helper.php') 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' + ) + ); } } -- cgit v1.2.3-24-g4f1b