/**
 * Prepares the contents of the export file.
 *
 * @author Gary Jones
 * @since 0.9.6
 * @return array $output multi-dimensional array holding CSS data
 * @uses prose_get_mapping()
 * @version 1.0
 */
function prose_prepare_export()
{
    $mapping = prose_get_mapping();
    foreach ($mapping as $selector => $declaration) {
        if (!is_array($declaration)) {
            $output[$selector] = prose_get_design_option($declaration);
        } else {
            foreach ($declaration as $property => $value) {
                if (!is_array($value)) {
                    $output[$selector][$property] = prose_get_design_option($value);
                } else {
                    foreach ($value as $index => $composite_value) {
                        $val = $composite_value[0];
                        $type = $composite_value[1];
                        if ('fixed_string' == $type) {
                            $output[$selector][$property][$index]['value'] = $val;
                        } else {
                            $output[$selector][$property][$index]['value'] = prose_get_design_option($val);
                        }
                        $output[$selector][$property][$index]['type'] = $type;
                    }
                }
            }
        }
    }
    // Add in contents of custom stylesheet
    $css = file_get_contents(prose_get_custom_stylesheet_path());
    $output['custom_css'] = $css;
    return apply_filters('prose_prepare_export', $output);
}
/**
 * Ensure Custom stylesheet for this site is editable in Theme Editor.
 * 
 * @author Ron Rennick
 * @global array $wp_themes
 * @global string $theme
 * @since 1.0
 */
function prose_add_custom_stylesheet_to_theme_editor()
{
    global $parent_file;
    if ('themes.php' == $parent_file && current_user_can('edit_themes')) {
        global $wp_themes, $theme;
        if (empty($wp_themes)) {
            $wp_themes = get_themes();
        }
        if (empty($theme)) {
            $theme = get_current_theme();
        }
        $wp_themes[$theme]['Stylesheet Files'][] = prose_get_custom_stylesheet_path();
    }
}
Exemple #3
0
 /**
  * CSS to edit.
  *
  * @author StudioPress
  * @since 1.5.0
  */
 function custom_css()
 {
     $custom_css = file_get_contents(prose_get_custom_stylesheet_path());
     printf('<textarea name="%s" id="%s" cols="80" rows="22">%s</textarea>', $this->get_field_name('css'), $this->get_field_id('css'), esc_textarea($custom_css));
 }
Exemple #4
0
/**
 * Merges style.css, settings stylesheet and custom.css, then minifies it into
 * one minified.css file. Also creates individual beautified settings stylesheet
 * so they are in sync, and attempts to create custom stylesheet if it doesn't
 * exist.
 *
 * @author StudioPress
 * @since 1.0.0
 */
function prose_create_stylesheets()
{
    prose_make_stylesheet_path_writable();
    $css_prefix = '/* ' . __('This file is auto-generated from the style.css, the settings page and custom.css. Any direct edits here will be lost if the settings page is saved', 'prose') . ' */' . "\n";
    $css = file_get_contents(CHILD_DIR . '/style.css');
    $css .= prose_prepare_settings_stylesheet();
    //    if ( file_exists(prose_get_custom_stylesheet_path() ) ) {
    if (prose_is_custom_stylesheet_used()) {
        $css .= file_get_contents(prose_get_custom_stylesheet_path());
    }
    $css = $css_prefix . prose_minify_css($css);
    $handle = @fopen(prose_get_minified_stylesheet_path(), 'w');
    @fwrite($handle, $css);
    @fclose($handle);
    prose_create_settings_stylesheet();
    prose_create_custom_stylesheet();
}