mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- improvement removed some unnecessary count()s
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
- improvement testInstall() now showing resolved paths and checking the include_path if necessary
|
- improvement testInstall() now showing resolved paths and checking the include_path if necessary
|
||||||
- bugfix html_options plugin did not handle object values properly (Issue #49, Forum Topic 20049)
|
- bugfix html_options plugin did not handle object values properly (Issue #49, Forum Topic 20049)
|
||||||
- improvement html_checkboxes and html_radios to accept null- and object values, and label_ids attribute
|
- improvement html_checkboxes and html_radios to accept null- and object values, and label_ids attribute
|
||||||
|
- improvement removed some unnecessary count()s
|
||||||
|
|
||||||
06.10.2011
|
06.10.2011
|
||||||
- bugfix switch lexer internals depending on mbstring.func_overload
|
- bugfix switch lexer internals depending on mbstring.func_overload
|
||||||
|
@@ -78,26 +78,27 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
|||||||
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
||||||
$_output = '';
|
$_output = '';
|
||||||
|
|
||||||
for ($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
|
|
||||||
if ($_paragraphs[$_x] == '') {
|
foreach ($_paragraphs as &$_paragraph) {
|
||||||
|
if (!$_paragraph) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// convert mult. spaces & special chars to single space
|
// convert mult. spaces & special chars to single space
|
||||||
$_paragraphs[$_x] = preg_replace(array('!\s+!u', '!(^\s+)|(\s+$)!u'), array(' ', ''), $_paragraphs[$_x]);
|
$_paragraph = preg_replace(array('!\s+!u', '!(^\s+)|(\s+$)!u'), array(' ', ''), $_paragraph);
|
||||||
// indent first line
|
// indent first line
|
||||||
if ($indent_first > 0) {
|
if ($indent_first > 0) {
|
||||||
$_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
|
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||||
}
|
}
|
||||||
// wordwrap sentences
|
// wordwrap sentences
|
||||||
if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {
|
if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
|
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
|
||||||
$_paragraphs[$_x] = smarty_mb_wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
|
$_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||||
} else {
|
} else {
|
||||||
$_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
|
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||||
}
|
}
|
||||||
// indent lines
|
// indent lines
|
||||||
if ($indent > 0) {
|
if ($indent > 0) {
|
||||||
$_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
|
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
|
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
|
||||||
|
@@ -88,13 +88,10 @@ function smarty_function_mailto($params, $template)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_parm_vals = '';
|
if ($mail_parms) {
|
||||||
for ($i = 0, $_length = count($mail_parms); $i < $_length; $i++) {
|
$address .= '?' . join('&', $mail_parms);
|
||||||
$mail_parm_vals .= (0 == $i) ? '?' : '&';
|
|
||||||
$mail_parm_vals .= $mail_parms[$i];
|
|
||||||
}
|
}
|
||||||
$address .= $mail_parm_vals;
|
|
||||||
|
|
||||||
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
|
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
|
||||||
if (!isset($_allowed_encoding[$encode])) {
|
if (!isset($_allowed_encoding[$encode])) {
|
||||||
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING);
|
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING);
|
||||||
|
@@ -24,8 +24,10 @@ function smarty_modifiercompiler_default ($params, $compiler)
|
|||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = "''";
|
$params[1] = "''";
|
||||||
}
|
}
|
||||||
for ($i = 1, $cnt = count($params); $i < $cnt; $i++) {
|
|
||||||
$output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $params[$i] . ' : $tmp)';
|
array_shift($params);
|
||||||
|
foreach ($params as $param) {
|
||||||
|
$output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user