5 * -------------------------------------------------------------
8 * Purpose: format text a certain way with preset styles
9 * or custom wrap/indent settings
10 * Params: style: string (email)
13 * wrap_char string ("\n")
14 * indent_char: string (" ")
15 * wrap_boundary: boolean (true)
16 * Taken from the original Smarty
17 * http://smarty.php.net
18 * -------------------------------------------------------------
20 function tpl_block_textformat($params, $content, &$template_object)
42 // split into paragraphs
43 $paragraphs = preg_split('![\r\n][\r\n]!',$content);
45 foreach($paragraphs as $paragraph)
51 // convert mult. spaces & special chars to single space
52 $paragraph = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'),array(' ',''),$paragraph);
56 $paragraph = str_repeat($indent_char,$indent_first) . $paragraph;
59 $paragraph = wordwrap($paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
63 $paragraph = preg_replace('!^!m',str_repeat($indent_char,$indent),$paragraph);
65 $output .= $paragraph . $wrap_char . $wrap_char;
69 $template_object->assign($assign,$output);