mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 22:56:46 +02:00
Compile: Move ?><? removal to php_shrink
This commit is contained in:
@@ -350,7 +350,6 @@ $file = preg_replace('~\.\./adminer/static/(default\.css|favicon\.ico)~', '<?php
|
|||||||
$file = preg_replace('~"\.\./adminer/static/(functions\.js)"~', $replace, $file);
|
$file = preg_replace('~"\.\./adminer/static/(functions\.js)"~', $replace, $file);
|
||||||
$file = preg_replace('~\.\./adminer/static/([^\'"]*)~', '" . h(' . $replace . ') . "', $file);
|
$file = preg_replace('~\.\./adminer/static/([^\'"]*)~', '" . h(' . $replace . ') . "', $file);
|
||||||
$file = preg_replace('~"\.\./externals/jush/modules/(jush\.js)"~', $replace, $file);
|
$file = preg_replace('~"\.\./externals/jush/modules/(jush\.js)"~', $replace, $file);
|
||||||
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
|
|
||||||
$file = php_shrink($file);
|
$file = php_shrink($file);
|
||||||
|
|
||||||
$filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
|
$filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
function php_shrink($input) {
|
function php_shrink($input) {
|
||||||
// based on http://latrine.dgx.cz/jak-zredukovat-php-skripty
|
// based on http://latrine.dgx.cz/jak-zredukovat-php-skripty
|
||||||
|
$input = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $input);
|
||||||
$special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER', '$http_response_header', '$php_errormsg'));
|
$special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER', '$http_response_header', '$php_errormsg'));
|
||||||
$short_variables = array();
|
$short_variables = array();
|
||||||
$shortening = true;
|
$shortening = true;
|
||||||
|
@@ -33,3 +33,4 @@ check('$ab = 1; echo "$ab";', '$a=1;echo"$a";');
|
|||||||
check('echo 1; echo 3;', 'echo 1,3;');
|
check('echo 1; echo 3;', 'echo 1,3;');
|
||||||
check('echo 1; ?>2<?php echo 3;', "echo 1,'2',3;");
|
check('echo 1; ?>2<?php echo 3;', "echo 1,'2',3;");
|
||||||
check('/** preserve*/ $a; /** ignore */ /* also ignore */ // ignore too', '/** preserve*/$a;');
|
check('/** preserve*/ $a; /** ignore */ /* also ignore */ // ignore too', '/** preserve*/$a;');
|
||||||
|
check('$a = 1; ?><?php ?><?php $a = 2;', '$a=1;$a=2;');
|
||||||
|
Reference in New Issue
Block a user