Exemple #1
0
<?php

/**
 * Dynamically generated styles
 *
 * @package Suffusion
 * @subpackage Templates
 */
header("Content-type: text/css; charset=UTF-8");
header("Cache-Control: must-revalidate");
global $suffusion_unified_options, $suffusion_theme_name, $content_width;
global $suf_size_options, $suf_sidebar_count, $suf_autogen_css;
$suffusion_unified_options = suffusion_get_unified_options();
if ($suffusion_unified_options['suf_autogen_css'] == 'autogen' || $suffusion_unified_options['suf_autogen_css'] == 'autogen-inline') {
    $custom_css = get_option('suffusion_generated_css');
    if (!isset($custom_css) || isset($custom_css) && !is_array($custom_css) || is_array($custom_css) && !isset($custom_css['css'])) {
        $custom_css = suffusion_update_generated_css();
        echo "/* CSS generated on the fly */\n";
    } else {
        echo "/* CSS retrieved from cache */\n";
    }
    $suffusion_custom_css_string = $custom_css['css'];
} else {
    $suffusion_custom_css_string = suffusion_generate_all_custom_styles();
}
echo $suffusion_custom_css_string;
// Ensure that if your header background image is a rotating image, it is printed dynamically...
if ($suffusion_unified_options['suf_header_style_setting'] == "custom") {
    if ($suffusion_unified_options['suf_header_image_type'] == "rot-image" && isset($suffusion_unified_options['suf_header_background_rot_folder']) && trim($suffusion_unified_options['suf_header_background_rot_folder']) != '') {
        $header_bg_url = " url(" . suffusion_get_rotating_image($suffusion_unified_options['suf_header_background_rot_folder']) . ") ";
        echo "#header-container { background-image: {$header_bg_url}; }\n";
Exemple #2
0
/**
 * Updates the generated CSS upon saving.
 *
 * @return mixed|string|void
 */
function suffusion_update_generated_css()
{
    global $suffusion_unified_options;
    if (!isset($suffusion_unified_options['option-date'])) {
        $suffusion_unified_options = suffusion_get_unified_options();
    }
    foreach ($suffusion_unified_options as $option => $value) {
        global ${$option};
        ${$option} = $value;
    }
    $custom_css = get_option('suffusion_generated_css');
    if (!isset($custom_css) || isset($custom_css) && !is_array($custom_css) || is_array($custom_css) && !isset($custom_css['theme-version']) || is_array($custom_css) && isset($custom_css['theme-version']) && $custom_css['theme-version'] != SUFFUSION_THEME_VERSION || is_array($custom_css) && !isset($custom_css['option-date']) || is_array($custom_css) && isset($custom_css['option-date']) && $custom_css['option-date'] != $suffusion_unified_options['option-date']) {
        $custom_css = array();
        $custom_css['css'] = suffusion_generate_all_custom_styles();
        $custom_css['option-date'] = $suffusion_unified_options['option-date'];
        $custom_css['theme-version'] = SUFFUSION_THEME_VERSION;
        update_option('suffusion_generated_css', $custom_css);
    }
    return $custom_css;
}