Source for file block.textformat.php
Documentation is available at block.textformat.php
* Smarty {textformat}{/textformat} block plugin
* Type: block function<br>
* Purpose: format text a certain way with preset styles
* or custom wrap/indent settings<br>
* @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
* Params: style: string (email)
* wrap_char string ("\n")
* indent_char: string (" ")
* wrap_boundary: boolean (true)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string contents of the block
* @param Smarty clever simulation of a method
* @return string string $content re-formatted
foreach ($params as $_key =>
$_val) {
$_paragraphs =
preg_split('![\r\n][\r\n]!',$content);
for($_x =
0, $_y =
count($_paragraphs); $_x <
$_y; $_x++
) {
if ($_paragraphs[$_x] ==
'') {
// convert mult. spaces & special chars to single space
$_paragraphs[$_x] =
preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]);
$_paragraphs[$_x] =
str_repeat($indent_char, $indent_first) .
$_paragraphs[$_x];
$_paragraphs[$_x] =
wordwrap($_paragraphs[$_x], $wrap -
$indent, $wrap_char, $wrap_cut);
$_output =
implode($wrap_char .
$wrap_char, $_paragraphs);
return $assign ?
$smarty->assign($assign, $_output) :
$_output;
/* vim: set expandtab: */
Documentation generated on Sun, 09 Mar 2008 23:50:46 -0300 by phpDocumentor 1.4.0