Пример #1
0
function xt_show_themes()
{
    global $tpl, $xtf, $xoopsSecurity, $xtAssembler, $xtFunctions;
    $current = $xtAssembler->theme();
    // Read all available themes
    $dh = opendir(XOOPS_THEME_PATH);
    $i = 0;
    while (false !== ($dir = readdir($dh))) {
        if ($dir == '.' || $dir == '..' || is_file(XOOPS_THEME_PATH . '/' . $dir)) {
            continue;
        }
        if (!is_file(XOOPS_THEME_PATH . '/' . $dir . '/theme.html')) {
            continue;
        }
        // Supported themes
        $theme_path = XOOPS_THEME_PATH . '/' . $dir;
        if (is_file($theme_path . '/assemble/' . strtolower($dir) . '.theme.php')) {
            include_once $theme_path . '/assemble/' . strtolower($dir) . '.theme.php';
            $class = ucfirst(strtolower($dir));
            $theme = new $class();
        } else {
            $theme = new StandardTheme();
            $theme->set_dir($dir);
        }
        $themes[$i] = $theme->getInfo();
        $themes[$i]['url'] = $theme->url();
        $themes[$i]['installed'] = !$theme->isNew();
        $i++;
    }
    $tpl->add_style("themes.css", 'xthemes');
    $tpl->add_script('masonry.pkgd.min.js', 'xthemes');
    $tpl->add_script('xthemes.js', 'xthemes');
    $tpl->add_head_script("var xoops_url = '" . XOOPS_URL . "';");
    $tpl->assign('xoops_pagetitle', __('Themes Manager', 'xthemes'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Themes', 'xthemes'));
    xoops_cp_header();
    include $tpl->get_template("xt_themes.php", 'module', 'xthemes');
    xoops_cp_footer();
}