diff options
Diffstat (limited to 'Widgets/smarty/libs/plugins/block.textformat.php')
-rw-r--r-- | Widgets/smarty/libs/plugins/block.textformat.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Widgets/smarty/libs/plugins/block.textformat.php b/Widgets/smarty/libs/plugins/block.textformat.php index abf54493..b22b104a 100644 --- a/Widgets/smarty/libs/plugins/block.textformat.php +++ b/Widgets/smarty/libs/plugins/block.textformat.php @@ -2,12 +2,13 @@ /** * Smarty plugin to format text blocks * - * @package Smarty + * @package Smarty * @subpackage PluginsBlock */ /** * Smarty {textformat}{/textformat} block plugin + * * Type: block function<br> * Name: textformat<br> * Purpose: format text a certain way with preset styles @@ -22,14 +23,12 @@ * - wrap_boundary - boolean (true) * </pre> * - * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} - * (Smarty online manual) - * + * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} + * (Smarty online manual) * @param array $params parameters * @param string $content contents of the block * @param Smarty_Internal_Template $template template object * @param boolean &$repeat repeat flag - * * @return string content re-formatted * @author Monte Ohrt <monte at ohrt dot com> */ @@ -54,17 +53,17 @@ function smarty_block_textformat($params, $content, $template, &$repeat) case 'indent_char': case 'wrap_char': case 'assign': - $$_key = (string) $_val; + $$_key = (string)$_val; break; case 'indent': case 'indent_first': case 'wrap': - $$_key = (int) $_val; + $$_key = (int)$_val; break; case 'wrap_cut': - $$_key = (bool) $_val; + $$_key = (bool)$_val; break; default: @@ -77,6 +76,8 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } // split into paragraphs $_paragraphs = preg_split('![\r\n]{2}!', $content); + $_output = ''; + foreach ($_paragraphs as &$_paragraph) { if (!$_paragraph) { @@ -101,10 +102,12 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } } $_output = implode($wrap_char . $wrap_char, $_paragraphs); - + if ($assign) { $template->assign($assign, $_output); } else { return $_output; } } + +?>
\ No newline at end of file |