aboutsummaryrefslogtreecommitdiffstats
path: root/include/smarty/libs/plugins/block.textformat.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-30 16:21:32 +0100
committerplegall <plg@piwigo.org>2015-12-30 16:21:32 +0100
commit3ec3cbe6cec5968d29cb11af139123191f4cb4ee (patch)
tree34aecd51071d63f8df1862a1a11898d8c43fe68a /include/smarty/libs/plugins/block.textformat.php
parent6ba0148e646b2a193dc4111bb0a443d8c193e646 (diff)
parent1681b02ee98c2deb740d394280a2a685170bc72e (diff)
Merge branch 'bug/385-php7'
Diffstat (limited to 'include/smarty/libs/plugins/block.textformat.php')
-rw-r--r--include/smarty/libs/plugins/block.textformat.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/smarty/libs/plugins/block.textformat.php b/include/smarty/libs/plugins/block.textformat.php
index b22b104a5..abf544939 100644
--- a/include/smarty/libs/plugins/block.textformat.php
+++ b/include/smarty/libs/plugins/block.textformat.php
@@ -2,13 +2,12 @@
/**
* 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
@@ -23,12 +22,14 @@
* - 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>
*/
@@ -53,17 +54,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:
@@ -76,8 +77,6 @@ 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) {
@@ -102,12 +101,10 @@ 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