mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
- bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
===== 3.1.33-dev-4 =====
|
||||
17.05.2018
|
||||
- Smarty::compileAllTemplates ignores `$extension` parameter https://github.com/smarty-php/smarty/issues/437
|
||||
- bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436
|
||||
- bugfix Smarty::compileAllTemplates ignores `$extension` parameter https://github.com/smarty-php/smarty/issues/437
|
||||
https://github.com/smarty-php/smarty/pull/438
|
||||
- improvement do not compute total property in {foreach} if not needed https://github.com/smarty-php/smarty/issues/443
|
||||
- bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435
|
||||
|
@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.33-dev-4';
|
||||
const SMARTY_VERSION = '3.1.33-dev-5';
|
||||
/**
|
||||
* define variable scopes
|
||||
*/
|
||||
|
@@ -618,7 +618,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
*/
|
||||
public function processText($text)
|
||||
{
|
||||
if ((string)$text !== '') {
|
||||
if ((string) $text != '') {
|
||||
$store = array();
|
||||
$_store = 0;
|
||||
if ($this->parser->strip) {
|
||||
@@ -626,16 +626,15 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
// capture html elements not to be messed with
|
||||
$_offset = 0;
|
||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
||||
$text,
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
$text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[ 0 ][ 0 ];
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
$replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
|
||||
$text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
|
||||
|
||||
$_offset += $_length - strlen($replace);
|
||||
++$_store;
|
||||
$_store ++;
|
||||
}
|
||||
}
|
||||
$expressions = array(// replace multiple spaces between tags by a single space
|
||||
@@ -644,21 +643,20 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
'#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2',
|
||||
// remove multiple spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||
'#>[\040\011]+$#Ss' => '> ',
|
||||
'#>[\040\011]*[\n]\s*$#Ss' => '>',
|
||||
'#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>',
|
||||
$this->stripRegEx => '',);
|
||||
|
||||
$text = preg_replace(array_keys($expressions), array_values($expressions), $text);
|
||||
$_offset = 0;
|
||||
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is',
|
||||
$text,
|
||||
$matches,
|
||||
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches,
|
||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
$replace = $store[ $match[ 1 ][ 0 ] ];
|
||||
$text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
|
||||
|
||||
$_offset += strlen($replace) - $_length;
|
||||
++$_store;
|
||||
$_store ++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user