more re-organisation for create_monolith / hiphop friendliness

This commit is contained in:
Shish 2012-06-18 01:06:36 +01:00
parent 553aad8a36
commit fd5b4c5910
2 changed files with 14 additions and 9 deletions

View file

@ -155,7 +155,5 @@ new UserClass("admin", "base", array(
"protected" => True,
));
if(file_exists("data/config/user-classes.conf.php")) {
require_once("data/config/user-classes.conf.php");
}
@include_once "data/config/user-classes.conf.php";
?>

View file

@ -821,6 +821,8 @@ $_included = array();
* Get the active contents of a .php file
*/
function manual_include($fname) {
if(!file_exists($fname)) return;
global $_included;
if(in_array($fname, $_included)) return;
$_included[] = $fname;
@ -828,15 +830,20 @@ function manual_include($fname) {
print "$fname\n";
$text = file_get_contents($fname);
$text = preg_replace('/^<\?php/', '', $text);
$text = preg_replace('/\?>$/', '', $text);
// we want one continuous file
$text = str_replace('<'.'?php', '', $text);
$text = str_replace('?'.'>', '', $text);
// most requires are built-in, but we want /lib separately
$text = str_replace('require_', '// require_', $text);
$text = str_replace('function _d(', '// function _messed_d(', $text);
$text = str_replace('// require_once "lib', 'require_once "lib', $text);
#if(RECURSE_INCLUDE) {
# text = preg_replace('/require_once "(.*)";/e', "manual_include('$1')", $text);
#}
// @include_once is used for user-creatable config files
$text = preg_replace('/@include_once "(.*)";/e', "manual_include('$1')", $text);
// wibble the defines for HipHop's sake
#$text = str_replace('function _d(', '// function _messed_d(', $text);
#$text = preg_replace('/_d\(([^,]*), (.*)\);/', 'if(!defined(\1)) define(\1, \2);', $text);
return $text;