stashing PCRE modifications

This commit is contained in:
rodneyrehm
2011-12-18 17:21:44 +00:00
parent d0b6b69f7c
commit 75c271079d
15 changed files with 731 additions and 688 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ if(!function_exists('smarty_mb_wordwrap')) {
function smarty_mb_wordwrap($str, $width=75, $break="\n", $cut=false)
{
// break words into tokens using white space as a delimiter
$tokens = preg_split('!(\s)!uS', $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
$tokens = preg_split('!(\s)!S' . SMARTY_PREG_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
$length = 0;
$t = '';
$_previous = false;
@@ -37,14 +37,14 @@ if(!function_exists('smarty_mb_wordwrap')) {
$length = 0;
if ($cut) {
$_tokens = preg_split('!(.{' . $width . '})!uS', $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
$_tokens = preg_split('!(.{' . $width . '})!S' . SMARTY_PREG_MODIFIER, $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
// broken words go on a new line
$t .= $break;
}
}
foreach ($_tokens as $token) {
$_space = !!preg_match('!^\s$!uS', $token);
$_space = !!preg_match('!^\s$!S' . SMARTY_PREG_MODIFIER, $token);
$token_length = mb_strlen($token, SMARTY_RESOURCE_CHAR_SET);
$length += $token_length;