Beispiel #1
0
 public static function init($current_dir)
 {
     self::$location = $current_dir;
     self::$config = $config = new stdClass();
     $config->file = '.' . __CLASS__;
     $config->data = null;
     $config->path = null;
     $config->baseDir = null;
     $config->baseURL = null;
     // Get normalized document root reference: no symlink, forward slashes, no trailing slashes
     $docRoot = null;
     if (isset($_SERVER['DOCUMENT_ROOT'])) {
         $docRoot = realpath($_SERVER['DOCUMENT_ROOT']);
     } else {
         // Probably IIS
         $scriptname = $_SERVER['SCRIPT_NAME'];
         $fullpath = realpath(basename($scriptname));
         $docRoot = substr($fullpath, 0, stripos($fullpath, $scriptname));
     }
     $config->docRoot = rtrim(str_replace('\\', '/', $docRoot), '/');
     // Casting to objects for ease of use
     self::$regex = (object) self::$regex;
     self::$regex->token = (object) self::$regex->token;
     self::$regex->function = (object) self::$regex->function;
 }