예제 #1
0
function rss_scheme_stylesheets($theme = null, $media = null)
{
    if ($theme === null) {
        list($theme, $media) = getActualTheme();
    }
    $ret = getProperty(rss_theme_option_ref_obj_from_theme($theme, $media), rss_theme_config_override_option_name_mangle('rss.output.theme.scheme'));
    if ($ret === null) {
        return "";
    }
    $arr = explode(',', $ret);
    $ret = "";
    $idx = array_pop($arr);
    foreach (loadSchemeList(false, $theme, $media) as $i => $val) {
        if ($i == $idx) {
            if ($i > 0) {
                if (file_exists(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}") && is_dir(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}")) {
                    foreach (glob(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/*.css") as $file) {
                        $file = substr($file, strlen(GREGARIUS_HOME . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/"));
                        $file = getPath() . RSS_THEME_DIR . "/{$theme}/{$media}/schemes/{$val}/{$file}";
                        $ret .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"{$file}\" />\n";
                    }
                }
            }
            break;
        }
    }
    return $ret;
}
예제 #2
0
function theme_options_fill_override_array($theme, $media, $array_input, $key = null)
{
    $ret = array();
    if (!is_array($array_input)) {
        $array_input = explode(",", $array_input);
    }
    foreach ($array_input as $inp) {
        if (!is_array($inp) && isset($inp)) {
            $inp = array('key_' => $inp);
        }
        if (isset($inp['key_'])) {
            $thisret = array();
            if ($key === null || $key === $inp['key_']) {
                $thisret = $inp;
                if ($inp['key_'] == 'rss.output.theme.scheme') {
                    $schemes = loadSchemeList(true, $theme, $media);
                    if (!isset($inp['default_'])) {
                        $thisret['default_'] = implode(',', $schemes) . ",0";
                    }
                    $thisret['type_'] = 'enum';
                    if (!isset($inp['desc_'])) {
                        $thisret['desc_'] = 'The color scheme to use.';
                    }
                    if (!isset($inp['export_'])) {
                        $thisret['export_'] = '';
                    }
                    $value = rss_theme_config_override_option($thisret['key_'], $thisret['default_'], $theme, $media);
                    $value = array_pop(explode(',', $value));
                    $thisret['value_'] = implode(',', $schemes) . "," . $value;
                } else {
                    $sql = "select * from " . getTable("config") . " where key_ like\n                           '" . $inp['key_'] . "'";
                    $res = rss_query($sql);
                    if ($row = rss_fetch_assoc($res)) {
                        foreach ($row as $rowkey => $rowval) {
                            if ($rowkey !== 'value_') {
                                if (!isset($inp[$rowkey])) {
                                    $thisret[$rowkey] = $rowval;
                                } else {
                                    $thisret[$rowkey] = $inp[$rowkey];
                                }
                            }
                        }
                    }
                    $thisret['value_'] = rss_theme_config_override_option($thisret['key_'], $thisret['default_'], $theme, $media);
                }
                if ($key === null) {
                    $ret[] = $thisret;
                } else {
                    $ret = $thisret;
                }
            }
        } else {
            rss_error('rss_theme_options_configure_overrides was passed an item with no key_', RSS_ERROR_ERROR, true);
        }
    }
    return $ret;
}