Пример #1
0
/**
 * Returns the default theme.
 * If the default theme is not available it returns the first available one.
 *
 * @return string
 */
function get_default_theme()
{
    $theme = get_default_user_value('theme', PHPWG_DEFAULT_TEMPLATE);
    if (check_theme_installed($theme)) {
        return $theme;
    }
    // let's find the first available theme
    $active_themes = array_keys(get_pwg_themes());
    return $active_themes[0];
}
Пример #2
0
/**
 * returns available themes
 *
 * @param bool $show_mobile
 * @return array
 */
function get_pwg_themes($show_mobile = false)
{
    global $conf;
    $themes = array();
    $query = '
SELECT
    id,
    name
  FROM ' . THEMES_TABLE . '
  ORDER BY name ASC
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        if ($row['id'] == $conf['mobile_theme']) {
            if (!$show_mobile) {
                continue;
            }
            $row['name'] .= ' (' . l10n('Mobile') . ')';
        }
        if (check_theme_installed($row['id'])) {
            $themes[$row['id']] = $row['name'];
        }
    }
    // plugins want remove some themes based on user status maybe?
    $themes = trigger_change('get_pwg_themes', $themes);
    return $themes;
}