mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
php_shrink: Preprocess ?>HTML<?php
This commit is contained in:
@@ -50,6 +50,14 @@ function php_shrink($input) {
|
|||||||
if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
|
if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
|
||||||
$short_variables[$token[1]]++;
|
$short_variables[$token[1]]++;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
$tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
|
||||||
|
&& strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3
|
||||||
|
) {
|
||||||
|
$tokens[$i+2] = array(T_ECHO, 'echo');
|
||||||
|
$tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . add_apo_slashes($tokens[$i+3][1]) . "'");
|
||||||
|
$tokens[$i+4] = array(0, ';');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arsort($short_variables);
|
arsort($short_variables);
|
||||||
@@ -72,14 +80,6 @@ function php_shrink($input) {
|
|||||||
if (!is_array($token)) {
|
if (!is_array($token)) {
|
||||||
$token = array(0, $token);
|
$token = array(0, $token);
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
$tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
|
|
||||||
&& strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3
|
|
||||||
) {
|
|
||||||
$tokens[$i+2] = array(T_ECHO, 'echo');
|
|
||||||
$tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . add_apo_slashes($tokens[$i+3][1]) . "'");
|
|
||||||
$tokens[$i+4] = array(0, ';');
|
|
||||||
}
|
|
||||||
if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
|
if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
|
||||||
$space = "\n";
|
$space = "\n";
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user