summaryrefslogtreecommitdiff
path: root/libs/plugins/modifier.spacify.php
diff options
context:
space:
mode:
Diffstat (limited to 'libs/plugins/modifier.spacify.php')
-rw-r--r--libs/plugins/modifier.spacify.php22
1 files changed, 6 insertions, 16 deletions
diff --git a/libs/plugins/modifier.spacify.php b/libs/plugins/modifier.spacify.php
index f14e026b..f7985add 100644
--- a/libs/plugins/modifier.spacify.php
+++ b/libs/plugins/modifier.spacify.php
@@ -14,24 +14,14 @@
*
* @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
- * @param string $
- * @param string $
- * @return string
+ * @param string $string input string
+ * @param string $spacify_char string to insert between characters.
+ * @return string
*/
function smarty_modifier_spacify($string, $spacify_char = ' ')
-{
- // mb_ functions available?
- if (function_exists('mb_strlen') && mb_detect_encoding($string, 'UTF-8, ISO-8859-1') === 'UTF-8') {
- $strlen = mb_strlen($string);
- while ($strlen) {
- $array[] = mb_substr($string, 0, 1, "UTF-8");
- $string = mb_substr($string, 1, $strlen, "UTF-8");
- $strlen = mb_strlen($string);
- }
- return implode($spacify_char, $array);
- } else {
- return implode($spacify_char, preg_split('//', $string, -1));
- }
+{
+ // well… what about charsets besides latin and UTF-8?
+ return implode($spacify_char, preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY));
}
?> \ No newline at end of file