- performance require_once should be called only once for shared plugins https://github.com/smarty-php/smarty/issues/280

This commit is contained in:
uwetews
2016-09-02 01:08:50 +02:00
parent 5580857d9b
commit e1d27d68d7
13 changed files with 50 additions and 41 deletions

View File

@@ -38,6 +38,9 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
if (is_null($content)) {
return;
}
if (Smarty::$_MBSTRING && !is_callable('smarty_mb_wordwrap')) {
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
}
$style = null;
$indent = 0;
@@ -92,7 +95,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
}
// wordwrap sentences
if (Smarty::$_MBSTRING) {
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
$_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
} else {
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);