Update Text and Inflector helpers to utilize mbstring, if available

Text: word_wrap(), ellipsize()
Inflector: humanize(), underscore() (rel #2855)
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 210d0fd..b44594e 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -188,7 +188,7 @@
 	 */
 	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 @@
 	 */
 	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 @@
 	 */
 	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'
+			)
+		);
 	}
 }
 
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 45e8ae7..76e1735 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -445,14 +445,14 @@
 		{
 			// Is the line within the allowed character count?
 			// If so we'll join it to the output and continue
-			if (strlen($line) <= $charlim)
+			if (mb_strlen($line) <= $charlim)
 			{
 				$output .= $line."\n";
 				continue;
 			}
 
 			$temp = '';
-			while ((strlen($line)) > $charlim)
+			while (mb_strlen($line) > $charlim)
 			{
 				// If the over-length word is a URL we won't wrap it
 				if (preg_match('!\[url.+\]|://|wwww.!', $line))
@@ -461,8 +461,8 @@
 				}
 
 				// Trim the word down
-				$temp .= substr($line, 0, $charlim - 1);
-				$line = substr($line, $charlim - 1);
+				$temp .= mb_substr($line, 0, $charlim - 1);
+				$line = mb_substr($line, $charlim - 1);
 			}
 
 			// If $temp contains data it means we had to split up an over-length
@@ -512,21 +512,21 @@
 		$str = trim(strip_tags($str));
 
 		// Is the string long enough to ellipsize?
-		if (strlen($str) <= $max_length)
+		if (mb_strlen($str) <= $max_length)
 		{
 			return $str;
 		}
 
-		$beg = substr($str, 0, floor($max_length * $position));
+		$beg = mb_substr($str, 0, floor($max_length * $position));
 		$position = ($position > 1) ? 1 : $position;
 
 		if ($position === 1)
 		{
-			$end = substr($str, 0, -($max_length - strlen($beg)));
+			$end = mb_substr($str, 0, -($max_length - mb_strlen($beg)));
 		}
 		else
 		{
-			$end = substr($str, -($max_length - strlen($beg)));
+			$end = mb_substr($str, -($max_length - mb_strlen($beg)));
 		}
 
 		return $beg.$ellipsis.$end;