More refactorings.

This commit is contained in:
Lars Jung 2014-05-15 13:04:37 +02:00
parent fc8a0589dd
commit c40fac67d0
9 changed files with 279 additions and 332 deletions

View file

@ -1,10 +1,14 @@
<?php
function normalize_path($path, $trailing_slash = false) {
$path = preg_replace("#\\+|/+#", "/", $path);
return preg_match("#^(\w:)?/$#", $path) ? $path : (rtrim($path, "/") . ($trailing_slash ? "/" : ""));
}
function normalized_require_once($lib) {
$path = dirname(__FILE__) . "/inc/" . $lib;
$path = preg_replace("#\\+|/+#", "/", $path);
require_once($path);
require_once(normalize_path(dirname(__FILE__) . "/inc/" . $lib, false));
}
normalized_require_once("main.php");