mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-06 01:31:14 -04:00
Refactor PHP code.
This commit is contained in:
parent
6258c40a24
commit
06b9232552
1 changed files with 3 additions and 8 deletions
|
@ -17,7 +17,7 @@ class Bootstrap {
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$this->once('../config');
|
require __DIR__ . '/../config.php';
|
||||||
|
|
||||||
$session = new Session($_SESSION);
|
$session = new Session($_SESSION);
|
||||||
$request = new Request($_REQUEST);
|
$request = new Request($_REQUEST);
|
||||||
|
@ -29,7 +29,7 @@ class Bootstrap {
|
||||||
} else {
|
} else {
|
||||||
define('APP_HREF', $setup->get('APP_HREF'));
|
define('APP_HREF', $setup->get('APP_HREF'));
|
||||||
define('FALLBACK', (new Fallback($app))->get_html());
|
define('FALLBACK', (new Fallback($app))->get_html());
|
||||||
$this->once('page');
|
require __DIR__ . '/page.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,14 +40,9 @@ class Bootstrap {
|
||||||
foreach (Bootstrap::$autopaths as $path) {
|
foreach (Bootstrap::$autopaths as $path) {
|
||||||
$file = __DIR__ . '/' . $path . '/' . $filename;
|
$file = __DIR__ . '/' . $path . '/' . $filename;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require_once $file;
|
require $file;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function once($lib) {
|
|
||||||
|
|
||||||
require_once __DIR__ . '/' . $lib . '.php';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue