Update Smarty und RedBean
Smarty: 3.1.30 - Redbean: 5.0.0
This commit is contained in:
parent
eb0835ff74
commit
0795a87ecd
193 changed files with 22035 additions and 14455 deletions
|
@ -26,13 +26,14 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||
// Unify Line-Breaks to \n
|
||||
$source = preg_replace("/\015\012|\015|\012/", "\n", $source);
|
||||
|
||||
// capture Internet Explorer Conditional Comments
|
||||
if (preg_match_all('#<!--\[[^\]]+\]>.*?<!\[[^\]]+\]-->#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
// capture Internet Explorer and KnockoutJS Conditional Comments
|
||||
if (preg_match_all('#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches,
|
||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[0][0];
|
||||
$_length = strlen($match[0][0]);
|
||||
$store[] = $match[ 0 ][ 0 ];
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
$replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
|
||||
$source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
|
||||
$source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
|
||||
|
||||
$_offset += $_length - strlen($replace);
|
||||
$_store ++;
|
||||
|
@ -45,29 +46,27 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||
|
||||
// capture html elements not to be messed with
|
||||
$_offset = 0;
|
||||
if (preg_match_all('#<(script|pre|textarea)[^>]*>.*?</\\1>#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
||||
$source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[0][0];
|
||||
$_length = strlen($match[0][0]);
|
||||
$store[] = $match[ 0 ][ 0 ];
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
$replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
|
||||
$source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
|
||||
$source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
|
||||
|
||||
$_offset += $_length - strlen($replace);
|
||||
$_store ++;
|
||||
}
|
||||
}
|
||||
|
||||
$expressions = array(
|
||||
// replace multiple spaces between tags by a single space
|
||||
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
||||
// remove spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4',
|
||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||
// maybe a \0 byte or something is interfering?
|
||||
'#^\s+<#Ss' => '<',
|
||||
'#>\s+$#Ss' => '>',
|
||||
);
|
||||
$expressions = array(// replace multiple spaces between tags by a single space
|
||||
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
||||
// remove spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||
// maybe a \0 byte or something is interfering?
|
||||
'#^\s+<#Ss' => '<', '#>\s+$#Ss' => '>',);
|
||||
|
||||
$source = preg_replace(array_keys($expressions), array_values($expressions), $source);
|
||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||
|
@ -77,9 +76,9 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||
$_offset = 0;
|
||||
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$_length = strlen($match[0][0]);
|
||||
$replace = $store[$match[1][0]];
|
||||
$source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length);
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
$replace = $store[ $match[ 1 ][ 0 ] ];
|
||||
$source = substr_replace($source, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
|
||||
|
||||
$_offset += strlen($replace) - $_length;
|
||||
$_store ++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue