public static function createMail() { $className = nameToClass(Config::getInstance()->mail->transport . "Mail"); if (!class_exists($className)) { throw new MailException("Cannot find class {$className}"); } return new mailObject(new $className()); }
static function init() { $processor = Config::getInstance()->language->processor; $classname = nameToClass($processor) . 'LanguageProcessor'; Autoload::addVendor('language', $processor); self::$processor = new $classname(); self::$processor->init(); }
public function __construct() { $config = Config::getInstance(); $this->trigger("BeforeInit", $this); $this->params2save += array("id", "user_id", "cast", "ip", "remember_me"); $sessionEngine = Config::getInstance()->session->engine; $classname = nameToClass($sessionEngine); Autoload::addVendor("session", $sessionEngine); $classname .= "Session"; $this->engine = new $classname(); if (!$this->engine instanceof SessionEngine) { throw new SessionException("Class '{$classname}' is not valid session engine"); } $this->engine->init(); Controller::getInstance()->onBeforeHeadBodyTail = array($this, "save"); $this->trigger("AfterInit", $this); register_shutdown_function(array($this, "save")); }
/** * Initialize storage-subsystem. Class to be used as * a storage engine is chosen on the base of config file. * * So, if in config string <code>storage_engine='foo'</code> * exists, file/class FooStorage will be looked up * int the vendors/storage directory. * * @param null * @return null */ static function init() { $storageEngine = Config::get('STORAGE_ENGINE'); self::$classname = nameToClass($storageEngine) . 'Storage'; Autoload::addVendor('storage', $storageEngine); }
/** * Tries to calculate name of the class from config and add to vendor lookup * paths list retrieved directory. * * For performance reasons, obtained classname is memorized in internal private variable. * * @param null * @return string class name of the profile. */ private static function getProfileClass() { if (self::$profile_classname) { return self::$profile_classname; } try { if ($_t = Config::getInstance()->profile->name != "cassea") { //for compatibility self::$profile_classname = $_t; } } catch (ConfigException $e) { //just normal. Using default profile class } Autoload::addVendor(self::$profile_classname); return self::$profile_classname = nameToClass($profile_classname); }