Permalink
Browse files

Compile inline HTML to echo

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@953 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 28b2b8d commit c030c163227d3753b808b7beedce10b4ab05d593 jakubvrana committed Jul 30, 2009
Showing with 13 additions and 2 deletions.
  1. +1 −1 adminer/include/design.inc.php
  2. +12 −1 compile.php
@@ -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>
View
@@ -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 "".""
}

0 comments on commit c030c16

Please sign in to comment.