/** * getter singleton instance * @param string $type type to load * @param array $paths paths where to search * @param array $prefixes explicit file prefixes * @return LBoxLoaderConfig * @throws LBoxExceptionLoader */ public static function getInstance($paths = array(), $pathsIgnore = array(), $prefixes = array()) { $className = __CLASS__; try { if (!isset(self::$instance)) { self::$instance = new $className($paths, $pathsIgnore, $prefixes); } return self::$instance; } catch (Exception $e) { throw $e; } }
/* DEFINE("LBOX_REQUEST_URL", $url); DEFINE("LBOX_REQUEST_URL_VIRTUAL", LBoxUtil::fixURLSlash($urlArrayParts[0])); DEFINE("LBOX_REQUEST_URL_PARAMS", array_key_exists(1, $urlArrayParts) ? $urlArrayParts[1] : ""); DEFINE("LBOX_REQUEST_URL_QUERY", urldecode($urlArray["query"])); DEFINE("LBOX_REQUEST_URL_PATH", strlen(LBOX_REQUEST_URL_PARAMS) > 0 ? LBOX_REQUEST_URL_VIRTUAL .":". LBOX_REQUEST_URL_PARAMS : LBOX_REQUEST_URL_VIRTUAL); // virtual:params DEFINE("LBOX_REQUEST_URL_SCHEME", $scheme); DEFINE("LBOX_REQUEST_URL_HOST", array_key_exists("HTTP_HOST", $_SERVER) ? $_SERVER['HTTP_HOST'] : "");*/ DEFINE("LBOX_REQUEST_IP", array_key_exists("HTTP_HOST", $_SERVER) ? $_SERVER["REMOTE_ADDR"] : "0.0.0.0"); DEFINE("LBOX_REQUEST_IP_MY", array_key_exists("SERVER_ADDR", $_SERVER) ? $_SERVER["SERVER_ADDR"] : "127.0.0.1"); DEFINE("LBOX_REQUEST_AGENT", "terminal"); DEFINE("LBOX_REQUEST_REFERER", array_key_exists("HTTP_REFERER", $_SERVER) ? $_SERVER["HTTP_REFERER"] : ""); DEFINE("LBOX_REQUEST_REQUEST_TIME", date('Y-m-d H:i:s')); // nacist config loader s nadefinovanymi cestami LBoxLoaderConfig::getInstance($pathsConfig); // nastavit DbControl config file cestu DbCfg::$cfgFilepath = LBoxLoaderConfig::getInstance()->getPathOf("db"); // pokud nemame pearovsky firePHP pouzivame lokani LBOXovy @(include "FirePHPCore/fb.php"); if (!class_exists("FirePHP")) { require LBOX_PATH_CORE . $slash . "firephp" . $slash . "0.3.1" . $slash . "lib" . $slash . "FirePHPCore" . $slash . "fb.php"; } // disable firePHP on remote mashines (enabled on localhost only!!!) if (LBOX_REQUEST_IP != LBOX_REQUEST_IP_MY) { FirePHP::getInstance(true)->setEnabled(false); FB::setEnabled(false); } $firePHPOptions = array('maxObjectDepth' => 10, 'maxArrayDepth' => 20, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); FirePHP::getInstance(true)->getOptions(); FirePHP::getInstance(true)->setOptions($firePHPOptions); FB::setOptions($firePHPOptions); // log exclude of:
/** * uklada dokument zpet do filu */ public function store() { try { if (strlen($path = LBoxLoaderConfig::getInstance()->getPathOf($this->configName)) < 1) { throw new LBoxExceptionConfig("'" . $this->configName . "' " . LBoxExceptionConfig::MSG_TYPE_NOT_FOUND, LBoxExceptionConfig::CODE_TYPE_NOT_FOUND); } if (strlen($classNameManager = $this->classNameManager) < 1) { throw new LBoxExceptionConfig(LBoxExceptionConfig::MSG_ABSTRACT_CLASSNAME_NOT_DEFINED, LBoxExceptionConfig::CODE_ABSTRACT_CLASSNAME_NOT_DEFINED); } if ($this->getDOM()->save($path) === FALSE) { throw new LBoxExceptionConfig("{$path}: " . LBoxExceptionConfig::MSG_DOCUMENT_CANNOT_SAVE, LBoxExceptionConfig::CODE_DOCUMENT_CANNOT_SAVE); } $this->dom = NULL; $this->rootIterator = NULL; self::$xPath = NULL; $classNameMe = get_class($this); eval("return {$classNameManager}::resetInstance();"); eval("return {$classNameMe}::resetInstance();"); } catch (Exception $e) { throw $e; } }