/** * Instantiate the specified theme * * @param array $options options array * * @return XoopsTheme */ public function createInstance($options = array()) { $xoops = \Xoops::getInstance(); // Grab the theme folder from request vars if present if (empty($options['folderName'])) { if (($req = @$_REQUEST['xoops_theme_select']) && $this->isThemeAllowed($req)) { $options['folderName'] = $req; if (isset($_SESSION) && $this->allowUserSelection) { $_SESSION[$this->xoBundleIdentifier]['defaultTheme'] = $req; } } else { if (isset($_SESSION[$this->xoBundleIdentifier]['defaultTheme'])) { $options['folderName'] = $_SESSION[$this->xoBundleIdentifier]['defaultTheme']; } else { if (empty($options['folderName']) || !$this->isThemeAllowed($options['folderName'])) { $options['folderName'] = $this->defaultTheme; } } } $xoops->setConfig('theme_set', $options['folderName']); } $options['path'] = \XoopsBaseConfig::get('themes-path') . '/' . $options['folderName']; $inst = new XoopsTheme(); foreach ($options as $k => $v) { $inst->{$k} = $v; } $inst->xoInit(); return $inst; }