adminerevo/_compile.php
jakubvrana 667bfec47d Decomposition
New functions

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@2 7c3ca157-0c34-0410-bff1-cbf682f78f5c
2007-07-02 05:51:26 +00:00

21 lines
698 B
PHP

<?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";