Ejemplo n.º 1
0
 function __construct()
 {
     $log = new Log(self::TAG);
     $this->loadedClasses = new HashMap();
     ResourceManager::addResource(self::RES_NAME, System::getClassStorage(__CLASS__), self::RES_FILETYPE);
     $res = ResourceManager::getResource(self::RES_NAME, true);
     foreach ($res->getIndex() as $fileName => $fileInfo) {
         $className = str_replace(".", "\\", $fileName);
         if (class_exists($className)) {
             new $className();
             $log->i(self::TAG . ".load({$className}) loaded.");
             $this->loadedClasses->add($className);
         } else {
             $log->e(self::TAG . ".load({$className}) process failed");
         }
     }
 }
Ejemplo n.º 2
0
* © 2015 - Genonbeta Open Source Project
*/
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    die("<html>\n<title>Oppps!!!</title>\n\tWe're sorry but your PHP version is not supported anymore. You're currently running on " . PHP_VERSION . " <i>(< 5.3.0)</i>. Please get more information about this error <a href=\"https://github.com/genonbeta/gframework/issues\">https://github.com/genonbeta/gframework/issues</a> \n</html>");
}
define("G_LOAD_TIME", microtime());
// unix current microtime saved as constant
define("G_DOCUMENT_ROOT", dirname(__FILE__));
define("G_FRAMEWORK_ROOT", substr(G_DOCUMENT_ROOT, strlen($_SERVER['DOCUMENT_ROOT'])));
define("G_WORKER_URL", $_SERVER['SCRIPT_NAME']);
define("G_WORKER_PATH", dirname($_SERVER['SCRIPT_NAME']));
if (!file_exists("configuration.php")) {
    die("No configuration file is available");
}
include_once "configuration.php";
if (!class_exists("Configuration")) {
    die("Configuration class was not found");
}
if (!file_exists($file = Configuration::LIBRARY_PATH . "/genonbeta/system/System." . Configuration::CLASS_EXTENSION)) {
    die("<b>{$file}</b> was not found. Exited.");
}
include_once Configuration::LIBRARY_PATH . "/genonbeta/system/System." . Configuration::CLASS_EXTENSION;
if (!class_exists("genonbeta\\system\\System")) {
    die("System class was not found. Exited.");
}
use genonbeta\system\System;
try {
    System::setup();
} catch (Exception $e) {
    die("<h1>Error on Start</h1><br />\n<b>Message:</b> " . $e->getMessage() . "\n<br /><b>Thrown in:</b> " . $e->getFile() . ":" . $e->getLine());
}
Ejemplo n.º 3
0
 protected function onDestroy()
 {
     System::getService("DestructionHook")->load();
 }
Ejemplo n.º 4
0
 public static function sendServiceIntent($serviceName, Intent $intent)
 {
     if (!System::serviceExists($serviceName)) {
         return null;
     }
     return System::getService($serviceName)->send($intent);
 }
Ejemplo n.º 5
0
 function __construct()
 {
     if (version_compare(PHP_VERSION, "7.0.0", "<")) {
         System::getService("ErrorHandler")->putHandlerController($this);
     }
 }
Ejemplo n.º 6
0
 function onLoad()
 {
     System::getService("DestructionHook")->put($this);
 }
Ejemplo n.º 7
0
 protected function onLoad()
 {
     $this->findPars();
     System::getService("AutoLoader")->putAutoLoader($this);
 }
Ejemplo n.º 8
0
 public static function getViewIndex()
 {
     return System::getLoadedManifest()['view']['index'];
 }