public static function getInstance($handler = null, $options = array()) { static $now = null; MCacheStorage::addIncludePath(MPATH_WP_CNT . '/miwi/framework/cache/storage'); if (!isset($handler)) { $conf = MFactory::getConfig(); $handler = $conf->get('cache_handler'); if (empty($handler)) { return MError::raiseWarning(500, MText::_('MLIB_CACHE_ERROR_CACHE_HANDLER_NOT_SET')); } } if (is_null($now)) { $now = time(); } $options['now'] = $now; $handler = strtolower(preg_replace('/[^A-Z0-9_\\.-]/i', '', $handler)); $class = 'MCacheStorage' . ucfirst($handler); if (!class_exists($class)) { mimport('joomla.filesystem.path'); if ($path = MPath::find(MCacheStorage::addIncludePath(), strtolower($handler) . '.php')) { include_once $path; } else { return MError::raiseWarning(500, MText::sprintf('MLIB_CACHE_ERROR_CACHE_STORAGE_LOAD', $handler)); } } return new $class($options); }