/** * 初期定義 * * @param string $path * @param string $lib * @param string $url */ public static function init($path, $url = null, $lib = null, $work = null) { self::$inited = true; if (is_file($path)) { $path = dirname($path); } self::$PATH = preg_replace("/^(.+)\\/\$/", "\\1", str_replace("\\", "/", $path)) . "/"; if (isset($lib)) { if (is_file($lib)) { $lib = dirname($lib); } self::$LIB = preg_replace("/^(.+)\\/\$/", "\\1", str_replace("\\", "/", $lib)) . "/"; } else { self::$LIB = self::$PATH . "lib/"; } if (isset($work)) { if (is_file($work)) { $work = dirname($work); } self::$WORK = preg_replace("/^(.+)\\/\$/", "\\1", str_replace("\\", "/", $work)) . "/"; } else { self::$WORK = self::$PATH . "work/"; } self::$URL = preg_replace("/^(.+)\\/\$/", "\\1", $url) . "/"; Rhaco::add(self::$LIB); }
public static function __import__() { $path = str_replace("\\", "/", Rhaco::def("core.Lib@path", Rhaco::work("extlib"))); self::$PATH = $path . (substr($path, -1) == "/" ? "" : "/"); Rhaco::add(self::$PATH); if (strpos(get_include_path(), self::$PATH) === false) { set_include_path(get_include_path() . PATH_SEPARATOR . self::$PATH); } $server = Rhaco::def("core.Lib@server"); if (!empty($server)) { if (is_array($server)) { foreach ($server as $s) { self::add($s); } } else { self::add($server); } } }
<?php ini_set("display_errors", "On"); ini_set("display_startup_errors", "On"); ini_set("html_errors", "Off"); set_error_handler("error_handler", E_ALL); $zone = @date_default_timezone_get(); date_default_timezone_set(empty($zone) ? "Asia/Tokyo" : $zone); require dirname(__FILE__) . "/Object.php"; require dirname(__FILE__) . "/Exceptions.php"; require dirname(__FILE__) . "/Rhaco.php"; register_shutdown_function("Rhaco::shutdown"); Rhaco::add(dirname(__FILE__)); Rhaco::textdomain(); function error_handler($errno, $errstr, $errfile, $errline) { if (strpos($errstr, "Use of undefined constant") !== false && preg_match("/\\'(.+?)\\'/", $errstr, $m) && class_exists($m[1])) { define($m[1], $m[1]); return true; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); return true; } /** * extensionを読み込む * * @param string $module_name * @param string $doc */ function extension_load($module_name, $doc = null) {