mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
More PHP refactorings. Fixes text preview.
This commit is contained in:
parent
838a346c29
commit
029872a212
8 changed files with 141 additions and 134 deletions
24
src/_h5ai/server/php/inc/init.php
Normal file
24
src/_h5ai/server/php/inc/init.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
function normalize_path($path, $trailing_slash = false) {
|
||||
|
||||
$path = str_replace("\\", "/", $path);
|
||||
return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($trailing_slash ? "/" : ""));
|
||||
}
|
||||
|
||||
define("APP_ABS_PATH", normalize_path(dirname(dirname(dirname(dirname(__FILE__))))));
|
||||
define("APP_ABS_HREF", normalize_path(dirname(dirname(dirname(getenv("SCRIPT_NAME")))), true));
|
||||
|
||||
function normalized_require_once($lib) {
|
||||
|
||||
require_once(APP_ABS_PATH . $lib);
|
||||
}
|
||||
|
||||
normalized_require_once("/conf/config.php");
|
||||
normalized_require_once("/server/php/inc/App.php");
|
||||
normalized_require_once("/server/php/inc/Entry.php");
|
||||
normalized_require_once("/server/php/inc/util.php");
|
||||
|
||||
$APP = new H5ai(APP_ABS_PATH, APP_ABS_HREF);
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue