/** * 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; }
/** * XoopsThemeBlocksPlugin::generateCacheId() * * @param string $cache_id * @return string */ public function generateCacheId($cache_id) { if ($this->theme) { $cache_id = $this->theme->generateCacheId($cache_id); } return $cache_id; }
/** * @param XoopsTheme $theme * * @return bool */ public static function loadThemeLocale(XoopsTheme $theme) { $xoops = Xoops::getInstance(); $locales = self::getUserLocales(); foreach ($locales as $locale) { $fullPath = $xoops->path($theme->resourcePath("locale/{$locale}/locale.php")); $fullPath2 = $xoops->path($theme->resourcePath("locale/{$locale}/{$locale}.php")); if (XoopsLoad::fileExists($fullPath)) { XoopsLoad::addMap(array(strtolower($theme->folderName . 'ThemeLocale') => $fullPath)); if (XoopsLoad::fileExists($fullPath2)) { XoopsLoad::addMap(array(strtolower($theme->folderName . "ThemeLocale{$locale}") => $fullPath2)); } return true; } } return false; }