summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-09-05 09:20:43 +0200
committerAndrey Andreev <narf@bofh.bg>2012-09-05 09:20:43 +0200
commit26735395701fa4ec51bdb20814ae29649a5ded94 (patch)
treebb2e4cbf85d4b153342371eebc2b744432f354a1 /system
parentffeaf809d5d1fbb0a506ff2fcdc9cbe2c657e1e4 (diff)
parent62a5ee3e430bd18a8ca8afa0d704967e8bd25763 (diff)
Merge pull request #1750 from vlakoff/develop
Simplification in Text Helper's character_limiter()
Diffstat (limited to 'system')
-rw-r--r--system/helpers/text_helper.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 8a1f01b51..b592f3cc0 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -89,7 +89,8 @@ if ( ! function_exists('character_limiter'))
return $str;
}
- $str = preg_replace('/\s+/', ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
+ // a bit complicated, but faster than preg_replace with \s+
+ $str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\x0B", "\x0C"), ' ', $str));
if (strlen($str) <= $n)
{