Exemplo n.º 1
0
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";
    }
}
if (isset($suffusion_unified_options['suf_custom_css_code']) && trim($suffusion_unified_options['suf_custom_css_code']) != "") {
    $included_code = stripslashes($suffusion_unified_options['suf_custom_css_code']);
    $included_code = wp_specialchars_decode($included_code, ENT_QUOTES);
    echo "\n/* Custom CSS code */\n";
    echo $included_code;
    echo "\n/* End Custom CSS code */";
Exemplo n.º 2
0
/**
 * Prints CSS directly into the source code. This is hooked via wp_head and not via wp_print_styles.
 *
 * @return void
 */
function suffusion_print_direct_styles()
{
    global $suf_autogen_css, $suf_custom_css_code, $suf_header_style_setting, $suf_header_image_type, $suf_header_background_rot_folder;
    if ($suf_autogen_css == 'nogen' || $suf_autogen_css == 'autogen-inline') {
        ?>
	<!-- CSS styles constructed using option definitions -->
	<style type="text/css">
	<!--/*--><![CDATA[/*><!--*/
<?php 
        if ($suf_autogen_css == 'nogen') {
            $suffusion_custom_css_string = suffusion_generate_all_custom_styles();
            echo $suffusion_custom_css_string;
        } else {
            $generated_css = get_option('suffusion_generated_css');
            if (isset($generated_css) && is_array($generated_css) && isset($generated_css['css'])) {
                echo $generated_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 ($suf_header_style_setting == "custom") {
            if ($suf_header_image_type == "rot-image" && isset($suf_header_background_rot_folder) && trim($suf_header_background_rot_folder) != '') {
                $header_bg_url = " url(" . suffusion_get_rotating_image($suf_header_background_rot_folder) . ") ";
                echo "#header-container { background-image: {$header_bg_url}; }\n";
            }
        }
        if (!suffusion_is_sidebar_empty(12)) {
            echo "#wrapper #nav {float: left;}\n";
        }
        ?>
	/*]]>*/-->
	</style>
<?php 
    } else {
        if (!suffusion_is_sidebar_empty(12)) {
            ?>
<!-- CSS styles constructed using option definitions -->
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
#wrapper #nav {float: left;}
/*]]>*/-->
</style>
		<?php 
        }
    }
    if (isset($suf_custom_css_code) && trim($suf_custom_css_code) != "") {
        ?>
		<!-- Custom CSS styles defined in options -->
		<style type="text/css">
			<!--/*--><![CDATA[/*><!--*/
<?php 
        $strip = stripslashes($suf_custom_css_code);
        $strip = wp_specialchars_decode($strip, ENT_QUOTES);
        echo $strip;
        ?>
			/*]]>*/-->
		</style>
		<!-- /Custom CSS styles defined in options -->
<?php 
    }
}
Exemplo n.º 3
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;
}