Ejemplo n.º 1
0
function wppb_load_styles()
{
    // If designer pane is not being loaded, then bail out
    if ('on' != get_option('wppb_designer_pane') || !current_user_can('manage_options') || is_admin()) {
        return;
    }
    // Grab from original designer settings from database
    $wppb_designer_settings = get_option(WPPB_DESIGNER_SETTINGS);
    // Grab and sanitize inputs
    if (isset($_POST['positions'])) {
        $wppb_design_settings = wppb_sanitize_inputs($_POST);
    } else {
        $wppb_design_settings = $wppb_designer_settings;
    }
    // Insert CSS in (so that the current page can be quickly styled without dragging CSS from external server)
    $wppb_design_settings['css'] = $wppb_designer_settings['css'];
    $css = $wppb_design_settings['css'];
    $css = wppb_convert_css_on_load($css);
    // Fixing image urls
    $css = str_replace("\t", '', $css);
    // Stripping tabs out
    $css = str_replace("\n", '', $css);
    // Stripping carriage returns out
    $css = str_replace(': ', ':', $css);
    // Stripping spaces after colons out
    // Display CSS
    echo '<style id="wppb-css" type="text/css">';
    echo $css;
    // Adding CSS
    //do_action( 'wppb_load_css' ); // Hook for allowing plugins to append CSS - should be a filter
    echo '</style>';
}
Ejemplo n.º 2
0
/**
 * Init options to white list our options
 * Store initial settings in DB
 * 
 * @since 0.1
 */
function wppb_options_init()
{
    // Register settings
    register_setting('wppb_settings_import', 'wppb_settings_theme_import', 'wppb_settings_import_validate');
    $wppb_design = wppb_grab_design('wppaintbrush');
    // Grab default design
    // Adding initial settings
    add_option(WPPB_SETTINGS, $wppb_design);
    add_option('wppb_designer_pane', 'on');
    $wppb_templates = $wppb_design;
    // Set Paintbrush template options
    $wppb_templates['paintbrush_designer'] = '';
    // Remove 'paintbrush_designer' since needs to be stored separately
    $wppb_designer_settings = explode(']]', $wppb_design['paintbrush_designer']);
    foreach ($wppb_designer_settings as $tmp => $setting) {
        $setting = explode('|', $setting);
        $name = $setting[0];
        if (!isset($setting[1])) {
            $setting[1] = '';
        }
        $option = $setting[1];
        $wppb_designer_array[$name] = $option;
    }
    $wppb_designer_array = wppb_sanitize_inputs($wppb_designer_array);
    $wppb_designer_array['css'] = $wppb_templates['css'];
    // Storing CSS in designer array so that can be used on page load (otherwise need to make server call on initial page load)
    add_option(WPPB_DESIGNER_SETTINGS, $wppb_designer_array);
}
Ejemplo n.º 3
0
function wppb_load_stuff()
{
    global $wppb_options, $css;
    // Grab and sanitize data
    $wppb_options = wppb_sanitize_inputs();
    // Grabbing raw CSS before addition of URLs (urls are needed for internal CSS file, but cause problems when exporting themes etc. as they need to be removed)
    //$wppb_options['css'] = $css;
    // Processing CSS on an external server
    $css = wppb_load_processed_css($css);
    $wppb_options['css'] = $css;
    // Serve CSS
    $css = wppb_convert_css_on_load($css);
    // Hook for extra functionality at this point
    do_action('wppb_load_stuff_hook');
    echo $css;
    exit;
}