]> git.joonet.de Git - adminer.git/commitdiff
php_shrink: Preprocess ?>HTML<?php
authorJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2025 06:33:47 +0000 (07:33 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2025 06:33:47 +0000 (07:33 +0100)
php_shrink.inc.php

index a15ffd0f3c5a1e49fd9fd25303e60fb09873ff92..875c46143feba205b522664880cb73236beea45c 100644 (file)
@@ -50,6 +50,14 @@ function php_shrink($input) {
                if ($token[0] === T_VARIABLE && !isset($special_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);
@@ -72,14 +80,6 @@ function php_shrink($input) {
                if (!is_array($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)) {
                        $space = "\n";
                } else {