Commit 27f6df37 by Seldaek

* Changed {reverse} handling of strings; fixed mb strings

git-svn-id: svn://dwoo.org/dwoo/trunk@90 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent 3cbed7fd
......@@ -658,6 +658,8 @@ class Dwoo
/**
* returns the character set used by the string manipulation plugins
*
* the charset is automatically lowercased
*
* @return string
*/
public function getCharset()
......
......@@ -26,7 +26,14 @@ function Dwoo_Plugin_reverse(Dwoo $dwoo, $value, $preserve_keys=false)
{
if (is_array($value)) {
return array_reverse($value, $preserve_keys);
} elseif(($charset=$dwoo->getCharset()) === 'iso-8859-1') {
return strrev((string) $value);
} else {
return implode('', array_reverse(str_split((string) $value, 1)));
$strlen = mb_strlen($value);
$out = '';
while ($strlen--) {
$out .= mb_substr($value, $strlen, 1, $charset);
}
return $out;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment