]> git.joonet.de Git - adminer.git/commitdiff
Compile inline HTML to echo
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 30 Jul 2009 16:29:38 +0000 (16:29 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 30 Jul 2009 16:29:38 +0000 (16:29 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@953 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/design.inc.php
compile.php

index 9b7c751d026a6ef4a190829d2aed72e4fa31c7c3..48b88bb0f64c5ee011487b1ca2bb2c991d8db73f 100644 (file)
@@ -63,7 +63,7 @@ function page_footer($missing = false) {
 <?php switch_lang(); ?>
 <div id="menu">
 <h1><a href="http://www.adminer.org/" class="h1"><?php echo $adminer->name(); ?></a> &nbsp; <?php echo $VERSION; ?> &nbsp;
-<a href='http://www.adminer.org/#download' id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
+<a href="http://www.adminer.org/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
 </h1>
 <?php $adminer->navigation($missing); ?>
 </div>
index 7a3704124d3d04ebe11ed0a6b425fcd1ff91b2f9..318a74cea2a70fdecebcebd89e18e6a7330c2b42 100644 (file)
@@ -109,6 +109,14 @@ function php_shrink($input) {
                        if ($token[0] == T_DOC_COMMENT) {
                                $doc_comment = true;
                        }
+                       if ($token[0] == T_CLOSE_TAG && $tokens[$i+1][0] == T_INLINE_HTML && $tokens[$i+2][0] == T_OPEN_TAG
+                       && strlen(addcslashes($tokens[$i+1][1], "'\\")) < strlen($tokens[$i+1][1]) + 4
+                       ) {
+                               $tokens[$i] = array(T_ECHO, 'echo');
+                               $tokens[$i+1] = array(T_CONSTANT_ENCAPSED_STRING, "'" . addcslashes($tokens[$i+1][1], "'\\") . "'");
+                               $tokens[$i+2] = array(0, ';');
+                               $token = $tokens[$i];
+                       }
                        if ($token[0] == T_VAR) {
                                $shortening = false;
                        } elseif (!$shortening) {
@@ -120,8 +128,11 @@ function php_shrink($input) {
                        } elseif ($token[1] == ';' && $in_echo) {
                                $in_echo = false;
                                if ($tokens[$i+1][0] === T_WHITESPACE && $tokens[$i+2][0] === T_ECHO) {
-                                       // join two consecutive echos
                                        next($tokens);
+                                       $i++;
+                               }
+                               if ($tokens[$i+1][0] === T_ECHO) {
+                                       // join two consecutive echos
                                        next($tokens);
                                        $token[1] = '.'; //! join ''.'' and "".""
                                }