mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-03 13:51:36 +01:00
- performance store flag for already required shared plugin functions in static variable or
Smarty's $_cache to improve performance when plugins are often called
51e0d5cd40 (commitcomment-22280086)
This commit is contained in:
@@ -38,8 +38,9 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
if (is_null($content)) {
|
||||
return;
|
||||
}
|
||||
if (Smarty::$_MBSTRING && !is_callable('smarty_mb_wordwrap')) {
|
||||
if (!isset($template->smarty->_cache[ '_required_smw' ])) {
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
|
||||
$template->smarty->_cache[ '_required_smw' ] = true;
|
||||
}
|
||||
|
||||
$style = null;
|
||||
@@ -87,8 +88,10 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
}
|
||||
// convert mult. spaces & special chars to single space
|
||||
$_paragraph =
|
||||
preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
|
||||
array(' ', ''), $_paragraph);
|
||||
preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER,
|
||||
'!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
|
||||
array(' ',
|
||||
''), $_paragraph);
|
||||
// indent first line
|
||||
if ($indent_first > 0) {
|
||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||
|
||||
Reference in New Issue
Block a user