mirror of
https://github.com/vrana/adminer.git
synced 2026-07-07 01:28:31 +02:00
Decomposition
New functions git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@2 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
20
_compile.php
Normal file
20
_compile.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
function put_file($match) {
|
||||
//! exit on error with require, _once
|
||||
$return = file_get_contents($match[4]);
|
||||
$return = preg_replace("~\\?>?\n?\$~", '', $return);
|
||||
if (substr_count($return, "<?php") - substr_count($return, "?>") <= 0 && !$match[5]) {
|
||||
$return .= "<?php\n";
|
||||
}
|
||||
$return = preg_replace('~^<\\?php\\s+~', '', $return, 1, $count);
|
||||
if (!$count && !$match[1]) {
|
||||
$return = "?>\n$return";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
$file = file_get_contents("index.php");
|
||||
$file = preg_replace_callback('~(<\\?php\\s*)?(include|require)(_once)? "([^"]*)";(\\s*\\?>)?~', 'put_file', $file);
|
||||
//! remove spaces and comments
|
||||
file_put_contents("phpMinAdmin.php", $file);
|
||||
echo "phpMinAdmin.php created.\n";
|
||||
Reference in New Issue
Block a user