46 foreach ($params as $_key => $_val) {
52 $$_key = (string)$_val;
66 $smarty->trigger_error(
"textformat: unknown attribute '$_key'");
70 if ($style ==
'email') {
75 $_paragraphs = preg_split(
'![\r\n][\r\n]!',
$content);
78 for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
79 if ($_paragraphs[$_x] ==
'') {
83 $_paragraphs[$_x] = preg_replace(array(
'!\s+!',
'!(^\s+)|(\s+$)!'), array(
' ',
''), $_paragraphs[$_x]);
85 if($indent_first > 0) {
86 $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
89 $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
92 $_paragraphs[$_x] = preg_replace(
'!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
95 $_output = implode($wrap_char . $wrap_char, $_paragraphs);
97 return $assign ? $smarty->assign($assign, $_output) : $_output;