Esempio n. 1
0
/**
 * Write the minified Dynamik stylesheet file.
 *
 * @since 1.0
 */
function dynamik_write_minified_styles()
{
    $css_prefix = '/* ' . __('This file is auto-generated from the Dynamik Options settings and custom.css content (if file exists). Any direct edits here will be lost if the settings page is saved', 'dynamik') . ' */' . "\n";
    $css = dynamik_build_design_styles();
    if (file_exists(dynamik_get_custom_stylesheet_path())) {
        $css .= file_get_contents(dynamik_get_custom_stylesheet_path());
    }
    $css = $css_prefix . dynamik_minify_css($css);
    $door = @fopen(dynamik_get_minified_stylesheet_path(), 'w');
    @fwrite($door, $css);
    @fclose($door);
    if (substr(sprintf('%o', fileperms(dynamik_get_minified_stylesheet_path())), -4) != '0644' && substr(sprintf('%o', fileperms(dynamik_get_minified_stylesheet_path())), -4) != '0666') {
        @chmod(dynamik_get_minified_stylesheet_path(), 0644);
    }
}
Esempio n. 2
0
/**
 * Determine which stylesheet should be displayed and where
 * based on the Dynamik options.
 *
 * @since 1.0
 */
function dynamik_add_stylesheets()
{
    global $dynamik_css_builder_popup;
    if (!dynamik_get_design('minify_css') || $dynamik_css_builder_popup) {
        if (file_exists(dynamik_get_design_stylesheet_path())) {
            wp_enqueue_style('dynamik_design_stylesheet', dynamik_get_design_stylesheet_url(), false, filemtime(dynamik_get_design_stylesheet_path()));
        } else {
            wp_enqueue_style('dynamik_genesis_stylesheet', PARENT_URL . '/style.css', false, filemtime(PARENT_DIR . '/style.css'));
        }
        if (dynamik_get_custom_css('custom_css') != '' && file_exists(dynamik_get_custom_stylesheet_path()) && !$dynamik_css_builder_popup) {
            wp_enqueue_style('dynamik_custom_stylesheet', dynamik_get_custom_stylesheet_url(), false, filemtime(dynamik_get_custom_stylesheet_path()));
        }
        remove_action('genesis_meta', 'genesis_load_stylesheet');
    } elseif (dynamik_get_design('minify_css')) {
        if (file_exists(dynamik_get_minified_stylesheet_path())) {
            wp_enqueue_style('dynamik_minified_stylesheet', dynamik_get_minified_stylesheet_url(), false, filemtime(dynamik_get_minified_stylesheet_path()));
        } else {
            wp_enqueue_style('dynamik_genesis_stylesheet', PARENT_URL . '/style.css', false, filemtime(PARENT_DIR . '/style.css'));
        }
        remove_action('genesis_meta', 'genesis_load_stylesheet');
    }
}