Exemplo n.º 1
0
function wppb_publish_save_export()
{
    global $wppb_options, $css;
    // Save options
    if ('save' == $_GET['generator-css'] || 'export' == $_GET['generator-css'] || 'publish' == $_GET['generator-css']) {
        update_option(WPPB_DESIGNER_SETTINGS, $wppb_options);
    }
    // Publishing and Export options
    if ('publish' == $_GET['generator-css'] || 'export' == $_GET['generator-css']) {
        wppb_publish_options($wppb_options, $wppb_options['css']);
    }
    // Export zip file (creates redirect to serve zip file - required for loading zip via AJAX)
    if ('export' == $_GET['generator-css']) {
        echo '</style><meta http-equiv="refresh" content="0;url=' . home_url() . '/?generator-export=' . esc_attr($_POST['wppb_nonce']) . '"><style type="text/css">';
    }
}
Exemplo n.º 2
0
/**
 * Utilized within child themes for changing to a new design
 * @since 1.0.6
 */
function wppb_theme_setup($autoload = '')
{
    global $pagenow;
    // Spit error out if child theme requires newer version of WP Paintbrush (and on themes page)
    if ('' != WPPB_CHILD_VERSION && 'themes.php' == $pagenow) {
        $wppb_theme_data = get_theme_data(get_template_directory_uri() . '/style.css');
        if ($wppb_theme_data['Version'] < WPPB_CHILD_VERSION) {
            add_action('admin_notices', 'wppb_childtheme_version_error');
        }
    }
    $css = get_wppb_option('css');
    // Used for checking if data stored
    if (is_admin() && isset($_GET['activated']) && $pagenow == 'themes.php' && !isset($css) || 'autoload' == $autoload) {
        // Grab design
        if (defined('WPPB_CHILD_THEME')) {
            $wppb_design = wppb_grab_design(WPPB_CHILD_THEME);
        } else {
            $wppb_design = wppb_grab_design('wppaintbrush');
        }
        // Grab default design
        // Change the design to the one specified (alters front-end editor settings)
        wppb_change_design($wppb_design);
        // Publish theme
        wppb_publish_options($wppb_design, $wppb_design['css']);
    }
}