Skip to content

Commit

Permalink
WooBuilder ready for wp.org
Browse files Browse the repository at this point in the history
  • Loading branch information
shramee committed Dec 28, 2016
1 parent 0e369f9 commit a2ec881
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 67 deletions.
10 changes: 5 additions & 5 deletions README.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ==

Expand Down Expand Up @@ -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.
Expand All @@ -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.

Expand Down
20 changes: 10 additions & 10 deletions assets/front-end.css
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
/**
* 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%;
}

.single-product .ppb-product.product {
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;
}
*/
2 changes: 1 addition & 1 deletion assets/front-end.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Plugin front end scripts
*
* @package PPB_Product_Builder
* @package WooBuilder
* @version 1.0.0
*/
jQuery(function ($) {
Expand Down
34 changes: 17 additions & 17 deletions inc/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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() {
Expand All @@ -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()

/**
Expand All @@ -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' ) );
}

/**
Expand All @@ -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' );

?>
<div class="clear misc-pub-section">
<label for="ppb-product-builder"><b><?php _e( 'Enable Product builder', $this->token ); ?></b></label>
<input type="checkbox" class="checkbox" style="" name="ppb-product-builder" id="ppb-product-builder" value="1" <?php
checked( get_post_meta( get_the_ID(), 'ppb-product-builder', 'single' ), 1 );
<label for="woobuilder"><b><?php _e( 'Enable Product builder', $this->token ); ?></b></label>
<input type="checkbox" class="checkbox" style="" name="woobuilder" id="woobuilder" value="1" <?php
checked( get_post_meta( get_the_ID(), 'woobuilder', 'single' ), 1 );
?>>
<span class="description">
<?php
if ( PPB_Product_Builder::is_ppb_product( get_the_ID() ) ) {
if ( WooBuilder::is_ppb_product( get_the_ID() ) ) {
_e( 'Uncheck this to disable', $this->token );
} else {
_e( 'Check this to enable', $this->token );
Expand All @@ -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 );

Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions inc/class-modules.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
class PPB_Product_Builder_Modules {
class WooBuilder_Modules {

public $class = 'PPB_Product_Builder';
public $class = 'WooBuilder';

/** @var PPB_Product_Builder_Modules Instance */
/** @var WooBuilder_Modules Instance */
private static $_instance = null;

/**
* Gets PPB_Product_Builder_Modules instance
* @return PPB_Product_Builder_Modules instance
* Gets WooBuilder_Modules instance
* @return WooBuilder_Modules instance
* @since 1.0.0
*/
public static function instance() {
Expand All @@ -30,9 +30,9 @@ function __construct() {

public function module( $mods ) {

$token = PPB_Product_Builder::$token;
$token = WooBuilder::$token;

if ( ! PPB_Product_Builder::is_ppb_product() ) {
if ( ! WooBuilder::is_ppb_product() ) {
return $mods;
}

Expand Down Expand Up @@ -90,4 +90,4 @@ public function module( $mods ) {
}
}

PPB_Product_Builder_Modules::instance();
WooBuilder_Modules::instance();
30 changes: 15 additions & 15 deletions inc/class-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* @property string $path Plugin root dir path
* @property string $version Plugin version
*/
class PPB_Product_Builder_Public{
class WooBuilder_Public{

/**
* @var PPB_Product_Builder_Public Instance
* @var WooBuilder_Public Instance
* @access private
* @since 1.0.0
*/
Expand All @@ -20,7 +20,7 @@ class PPB_Product_Builder_Public{
* Main Pootle Pagebuilder Product Builder Instance
* Ensures only one instance of Storefront_Extension_Boilerplate is loaded or can be loaded.
* @since 1.0.0
* @return PPB_Product_Builder_Public instance
* @return WooBuilder_Public instance
*/
public static function instance() {
if ( null == self::$_instance ) {
Expand All @@ -35,10 +35,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;

add_shortcode( 'ppb_product_short_description', function() {
ob_start();
Expand Down Expand Up @@ -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';
}
Expand All @@ -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 ) ) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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()
};

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
) {
Expand All @@ -249,7 +249,7 @@ public function process_shortcode( $data ) {
$code = explode( $code, ' ' )[0]; // Get shortcode name
$shortcode = str_replace( '%id%', get_the_ID(), $shortcode );
?>
<div id="ppb-product-builder-<?php echo $code ?>" class="ppb-product-builder-module">
<div id="woobuilder-<?php echo $code ?>" class="woobuilder-module">
<!--<?php echo $settings[ $this->token ] ?>-->
<?php echo do_shortcode( $shortcode ); ?>
</div>
Expand Down
Loading

0 comments on commit a2ec881

Please sign in to comment.