/** * 插件配置初始化 * @return bool * @throws Typecho_Plugin_Exception */ public static function init() { if (is_null(self::$sys_config)) { self::$sys_config = Helper::options(); } if (is_null(self::$plugin_config)) { self::$plugin_config = self::$sys_config->plugin('TpCache'); } if (self::$plugin_config->cache_driver == '0') { return false; } if (is_null(self::$cache)) { $driver_name = self::$plugin_config->cache_driver; $class_name = "typecho_{$driver_name}"; $file_path = "driver/{$class_name}.class.php"; require_once 'driver/cache.interface.php'; require_once $file_path; self::$cache = call_user_func(array($class_name, 'getInstance'), self::$plugin_config); } if (is_null(self::$request)) { self::$request = new Typecho_Request(); } return true; }
/** * 插件驱动初始化 * @return bool * @throws Typecho_Plugin_Exception */ public static function init_driver() { if (is_null(self::$cache)) { $driver_name = self::$plugin_config->cache_driver; $class_name = "typecho_{$driver_name}"; $file_path = "driver/{$class_name}.class.php"; require_once 'driver/cache.interface.php'; require_once $file_path; self::$cache = call_user_func(array($class_name, 'getInstance'), self::$plugin_config); } }