From a2ec881f18a40c3f68ceb84a06c0c7d69c5e1376 Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Wed, 28 Dec 2016 10:44:41 +0530 Subject: [PATCH] WooBuilder ready for wp.org --- README.txt | 10 +++++----- assets/front-end.css | 20 ++++++++++---------- assets/front-end.js | 2 +- inc/class-admin.php | 34 +++++++++++++++++----------------- inc/class-modules.php | 16 ++++++++-------- inc/class-public.php | 30 +++++++++++++++--------------- ppb-product-builder.php | 22 +++++++++++----------- 7 files changed, 67 insertions(+), 67 deletions(-) diff --git a/README.txt b/README.txt index d7a44d3..c24a66b 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ -=== WooCommerce Builder === +=== WooBuilder === Contributors: pootlepress, shramee -Plugin Name: WooCommerce Builder +Plugin Name: WooBuilder Plugin URI: http://www.pootlepress.com/woocommerce-builder Tags: product builder, product page builder, product pagebuilder, pootlepress, pootle page builder, pootlepagebuilder, pootle pagebuilder, product layout, product layouts, product layout builder, product layout customizer Author URI: http://www.pootlepress.com @@ -13,7 +13,7 @@ Stable tag: 1.0.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html -WooCommerce Builder let's you take complete control of your product layout, let's you create advanced, professional looking product page layouts. +WooBuilder let's you take complete control of your product layout, let's you create advanced, professional looking product page layouts. == Description == @@ -41,7 +41,7 @@ WooCommerce builder currently needs *Woocommerce addon* enabled in Pootle Pagebu == Installation == -Installing "WooCommerce Builder" can be done either by searching for "WooCommerce Builder" via the "Plugins > Add New" screen in your WordPress dashboard, or by using the following steps: +Installing "WooBuilder" can be done either by searching for "WooBuilder" via the "Plugins > Add New" screen in your WordPress dashboard, or by using the following steps: 1. Make sure WooCommerce addon is enabled in WordPress admin > 'Page Builder' > 'Modules'. 2. Upload the ZIP file through the 'Plugins' > 'Add New' > 'Upload' screen in your WordPress dashboard. @@ -63,7 +63,7 @@ Edit the product, uncheck "Enable Product builder" checkbox above `Update` butto == Screenshots == -1. WooCommerce product builder modules. +1. WooBuilder modules. 2. `Product Builder` button. diff --git a/assets/front-end.css b/assets/front-end.css index d5b5c3c..96448c7 100755 --- a/assets/front-end.css +++ b/assets/front-end.css @@ -1,20 +1,20 @@ /** * Plugin front end styles * - * @package PPB_Product_Builder + * @package WooBuilder * @version 1.0.0 */ -.single-product div.product .ppb-product-builder-module .images { +.single-product div.product .woobuilder-module .images { width: 100%; } -.single-product div.product .ppb-product-builder-module form.cart .button { +.single-product div.product .woobuilder-module form.cart .button { float: left; margin-left: 4.3em; } -.ppb-product-builder-module img.size-shop_single { +.woobuilder-module img.size-shop_single { width: 100%; } @@ -22,27 +22,27 @@ overflow: visible; } /* -.ppb-product-builder-module:after { +.woobuilder-module:after { display: block; content: ''; clear: both; } -.ppb-product-builder-module .variations td { +.woobuilder-module .variations td { padding: 1em; vertical-align: middle; text-transform: capitalize; } -.ppb-product-builder-module .variations td:last-child { +.woobuilder-module .variations td:last-child { text-align: right; } -.ppb-product-builder-module .variations td * { +.woobuilder-module .variations td * { display: inline-block; vertical-align: middle; } -.ppb-product-builder-module .quantity { +.woobuilder-module .quantity { float: left; } -.ppb-product-builder-module .single_add_to_cart_button { +.woobuilder-module .single_add_to_cart_button { float: right; } */ \ No newline at end of file diff --git a/assets/front-end.js b/assets/front-end.js index 41e3489..90c52c7 100755 --- a/assets/front-end.js +++ b/assets/front-end.js @@ -1,7 +1,7 @@ /** * Plugin front end scripts * - * @package PPB_Product_Builder + * @package WooBuilder * @version 1.0.0 */ jQuery(function ($) { diff --git a/inc/class-admin.php b/inc/class-admin.php index 33c048f..95b4354 100755 --- a/inc/class-admin.php +++ b/inc/class-admin.php @@ -6,10 +6,10 @@ * @property string $path Plugin root dir path * @property string $version Plugin version */ -class PPB_Product_Builder_Admin{ +class WooBuilder_Admin{ /** - * @var PPB_Product_Builder_Admin Instance + * @var WooBuilder_Admin Instance * @access private * @since 1.0.0 */ @@ -18,7 +18,7 @@ class PPB_Product_Builder_Admin{ /** * Main Pootle Pagebuilder Product Builder Instance * Ensures only one instance of Storefront_Extension_Boilerplate is loaded or can be loaded. - * @return PPB_Product_Builder_Admin instance + * @return WooBuilder_Admin instance * @since 1.0.0 */ public static function instance() { @@ -34,10 +34,10 @@ public static function instance() { * @since 1.0.0 */ private function __construct() { - $this->token = PPB_Product_Builder::$token; - $this->url = PPB_Product_Builder::$url; - $this->path = PPB_Product_Builder::$path; - $this->version = PPB_Product_Builder::$version; + $this->token = WooBuilder::$token; + $this->url = WooBuilder::$url; + $this->path = WooBuilder::$path; + $this->version = WooBuilder::$version; } // End __construct() /** @@ -54,12 +54,12 @@ public function admin_init() { public function save_post( $post_id ) { // Verify that the nonce is valid. if ( - ! wp_verify_nonce( filter_input( INPUT_POST, 'ppb-product-builder-nonce' ), 'ppb-product-builder-meta' ) || + ! wp_verify_nonce( filter_input( INPUT_POST, 'woobuilder-nonce' ), 'woobuilder-meta' ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) { return; } - update_post_meta( $post_id, 'ppb-product-builder', filter_input( INPUT_POST, 'ppb-product-builder' ) ); + update_post_meta( $post_id, 'woobuilder', filter_input( INPUT_POST, 'woobuilder' ) ); } /** @@ -68,17 +68,17 @@ public function save_post( $post_id ) { */ public function product_meta_fields() { // Add an nonce field so we can check for it later. - wp_nonce_field( 'ppb-product-builder-meta', 'ppb-product-builder-nonce' ); + wp_nonce_field( 'woobuilder-meta', 'woobuilder-nonce' ); ?>
- - token ); ?> + > token ); } else { _e( 'Check this to enable', $this->token ); @@ -97,7 +97,7 @@ public function enqueue() { $nonce_url = wp_nonce_url( get_the_permalink( $post->ID ), 'ppb-live-edit-nonce', 'ppbLiveEditor' ); - $nonce_url .= '&ppb-product-builder-nonce=' . wp_create_nonce( 'enable_ppb_product_builder' ); + $nonce_url .= '&woobuilder-nonce=' . wp_create_nonce( 'enable_ppb_product_builder' ); wp_localize_script( $this->token, 'wcProductBuilderLiveEditLink', $nonce_url ); @@ -135,7 +135,7 @@ public function remove_ppb_product( $post_types ) { * @since 1.0.0 */ public function content_block_tabs( $tabs ) { - if ( PPB_Product_Builder::is_ppb_product() ) { + if ( WooBuilder::is_ppb_product() ) { $tabs[ $this->token ] = array( 'label' => 'Product Builder', 'priority' => 5, @@ -152,7 +152,7 @@ public function content_block_tabs( $tabs ) { * @since 1.0.0 */ public function content_block_fields( $fields ) { - if ( PPB_Product_Builder::is_ppb_product() ) { + if ( WooBuilder::is_ppb_product() ) { $fields[ $this->token ] = array( 'name' => 'Display', 'type' => 'select', diff --git a/inc/class-modules.php b/inc/class-modules.php index 9c5cf93..df7d848 100644 --- a/inc/class-modules.php +++ b/inc/class-modules.php @@ -1,14 +1,14 @@ token = PPB_Product_Builder::$token; - $this->url = PPB_Product_Builder::$url; - $this->path = PPB_Product_Builder::$path; - $this->version = PPB_Product_Builder::$version; + $this->token = WooBuilder::$token; + $this->url = WooBuilder::$url; + $this->path = WooBuilder::$path; + $this->version = WooBuilder::$version; add_shortcode( 'ppb_product_short_description', function() { ob_start(); @@ -93,7 +93,7 @@ public function wc_get_template_part( $template, $slug, $name ) { if ( 'content' == $slug && 'single-product' == $name && - PPB_Product_Builder::is_ppb_product() + WooBuilder::is_ppb_product() ) { $template = dirname( __FILE__ ) . '/ppb-product-tpl.php'; } @@ -111,7 +111,7 @@ public function wc_get_template_part( $template, $slug, $name ) { public function set_ppb_product_builder_meta( $page_data, $post_id, $post_type ) { if ( 'product' == $post_type && - wp_verify_nonce( filter_input( INPUT_GET, 'ppb-product-builder-nonce' ), 'enable_ppb_product_builder' ) + wp_verify_nonce( filter_input( INPUT_GET, 'woobuilder-nonce' ), 'enable_ppb_product_builder' ) ) { if ( ! pootlepb_uses_pb( $post_id ) ) { @@ -142,7 +142,7 @@ public function set_ppb_product_builder_meta( $page_data, $post_id, $post_type ) update_post_meta( $post_id, 'panels_data', $ppb_data ); } - update_post_meta( $post_id, 'ppb-product-builder', 1 ); + update_post_meta( $post_id, 'woobuilder', 1 ); } return $page_data; } @@ -159,8 +159,8 @@ public function live_editor_scripts() { ppbProdbuilderSetting = function( $t, val ) { $t.find( '.ppb-edit-block .dashicons-edit' ).click(); - console.log( 'ppbProdBuilder', $t, $( 'select[dialog-field="ppb-product-builder"]' ) ); - $('select[dialog-field="ppb-product-builder"]').val( val ); + console.log( 'ppbProdBuilder', $t, $( 'select[dialog-field="woobuilder"]' ) ); + $('select[dialog-field="woobuilder"]').val( val ); $('#pootlepb-content-editor-panel + div button').click() }; @@ -199,7 +199,7 @@ public function live_editor_scripts() { * @return bool */ public function pootlepb_dump_ppb_content( $bool, $post_id ) { - if ( PPB_Product_Builder::is_ppb_product( $post_id ) ) { + if ( WooBuilder::is_ppb_product( $post_id ) ) { return false; } @@ -228,7 +228,7 @@ public function process_shortcode( $data ) { if ( ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) && // Not doing AJAX - ! PPB_Product_Builder::is_ppb_product( get_the_ID() ) // And not using product builder + ! WooBuilder::is_ppb_product( get_the_ID() ) // And not using product builder ) || empty( $data['info'] ) || empty( $data['info']['style'] ) // Or content block info or style ain't defined ) { @@ -249,7 +249,7 @@ public function process_shortcode( $data ) { $code = explode( $code, ' ' )[0]; // Get shortcode name $shortcode = str_replace( '%id%', get_the_ID(), $shortcode ); ?> -
+
diff --git a/ppb-product-builder.php b/ppb-product-builder.php index 357ff8a..3925453 100755 --- a/ppb-product-builder.php +++ b/ppb-product-builder.php @@ -1,6 +1,6 @@ admin = PPB_Product_Builder_Admin::instance(); + $this->admin = WooBuilder_Admin::instance(); add_action( 'admin_print_styles-post-new.php', array( $this->admin, 'enqueue' ) ); add_action( 'admin_print_styles-post.php', array( $this->admin, 'enqueue' ) ); @@ -174,7 +174,7 @@ private function _public() { require 'inc/class-modules.php'; //Instantiating public class - $this->public = PPB_Product_Builder_Public::instance(); + $this->public = WooBuilder_Public::instance(); add_filter( 'wc_get_template_part', array( $this->public, 'wc_get_template_part' ), 10, 3 ); add_action( 'pootlepb_live_editor_init', function () { @@ -206,4 +206,4 @@ public function add_on_active( $active ) { } /** Intantiating main plugin class */ -PPB_Product_Builder::instance( __FILE__ ); \ No newline at end of file +WooBuilder::instance( __FILE__ ); \ No newline at end of file