private function __construct() { if (is_readable(absolute_from_script('settings.json'))) { $this->settingsArray = json_decode(file_get_contents(absolute_from_script('settings.json')), true); } else { $errRet = array("error" => array("message" => "settings file not found", "code" => "500")); http_response_code(500); echo json_encode($errRet); } }
public static function setUp() { if (!Log::$configured) { self::$logDir = absolute_from_script(Settings::getInstance()->getPar('logsDir')); self::$debugMode = Settings::getInstance()->getPar('debug') === true; if (self::$debugMode && file_exists(Log::$logDir)) { rrmdir(Log::$logDir); } if (!file_exists(Log::$logDir)) { mkdir(Log::$logDir); } Log::$configured = true; } }
function autol_models($name) { $expl = explode('\\', $name); if (($mod = Graphene::getInstance()->getModule($expl[0])) === false) { return; } if (($modelDir = $mod->getModelDirectory($expl[1])) === null) { return; } Log::debug($modelDir); if (is_readable(G_path($modelDir))) { $modelDir = G_path($modelDir); } else { if (is_readable(absolute_from_script($modelDir))) { $modelDir = absolute_from_script($modelDir); } else { return; } } G_Require($modelDir); }
protected function getMediaDir() { $mdir = absolute_from_script($this->getOwnerModule()->getModuleDir() . DIRECTORY_SEPARATOR . 'media'); if (!file_exists($mdir)) { mkdir($mdir); } return $mdir; }
private function cleanUrl($url, $modulePath) { if (!is_absolute_path($url)) { $url = absolute_from_script($modulePath) . DIRECTORY_SEPARATOR . trim($url, DIRECTORY_SEPARATOR); } $expl = explode(DIRECTORY_SEPARATOR, $url); $urlArr = []; foreach ($expl as $dir) { if ($dir !== '') { $urlArr[] = $dir; } } return DIRECTORY_SEPARATOR . join(DIRECTORY_SEPARATOR, $urlArr); }