Booster for WooCommerce - Version 3.0.1

Version Description

  • 03/08/2017 =
  • Dev - CART & CHECKOUT - Cart Customization - "Change Empty Cart Return to shop Button Link" option added.
  • Dev - PAYMENT GATEWAYS - Custom Gateways - required attribute added to [wcj_input_field] shortcode.
  • Fix - Plus message fixed.
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

includes/class-wcj-cart-customization.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Cart Customization
4
  *
5
- * @version 2.8.0
6
  * @since 2.7.0
7
  * @author Algoritmika Ltd.
8
  */
@@ -16,7 +16,7 @@ class WCJ_Cart_Customization extends WCJ_Module {
16
  /**
17
  * Constructor.
18
  *
19
- * @version 2.8.0
20
  * @since 2.7.0
21
  */
22
  function __construct() {
@@ -36,13 +36,28 @@ class WCJ_Cart_Customization extends WCJ_Module {
36
  if ( 'yes' === get_option( 'wcj_cart_hide_item_remove_link', 'no' ) ) {
37
  add_filter( 'woocommerce_cart_item_remove_link', '__return_empty_string', PHP_INT_MAX );
38
  }
39
- // Customize "Return to shop" button
40
  if ( 'yes' === get_option( 'wcj_cart_customization_return_to_shop_button_enabled', 'no' ) ) {
41
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
42
  }
 
 
 
 
43
  }
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * enqueue_scripts.
48
  *
2
  /**
3
  * Booster for WooCommerce - Module - Cart Customization
4
  *
5
+ * @version 3.0.1
6
  * @since 2.7.0
7
  * @author Algoritmika Ltd.
8
  */
16
  /**
17
  * Constructor.
18
  *
19
+ * @version 3.0.1
20
  * @since 2.7.0
21
  */
22
  function __construct() {
36
  if ( 'yes' === get_option( 'wcj_cart_hide_item_remove_link', 'no' ) ) {
37
  add_filter( 'woocommerce_cart_item_remove_link', '__return_empty_string', PHP_INT_MAX );
38
  }
39
+ // Customize "Return to shop" button text
40
  if ( 'yes' === get_option( 'wcj_cart_customization_return_to_shop_button_enabled', 'no' ) ) {
41
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
42
  }
43
+ // Customize "Return to shop" button link
44
+ if ( 'yes' === get_option( 'wcj_cart_customization_return_to_shop_button_link_enabled', 'no' ) ) {
45
+ add_action( 'woocommerce_return_to_shop_redirect', array( $this, 'change_empty_cart_return_to_shop_link' ) );
46
+ }
47
  }
48
  }
49
 
50
+ /**
51
+ * change_empty_cart_return_to_shop_link.
52
+ *
53
+ * @version 3.0.1
54
+ * @since 3.0.1
55
+ * @todo (maybe) check if link is not empty
56
+ */
57
+ function change_empty_cart_return_to_shop_link( $link ) {
58
+ return ( is_cart() ? get_option( 'wcj_cart_customization_return_to_shop_button_link', '' ) : $link );
59
+ }
60
+
61
  /**
62
  * enqueue_scripts.
63
  *
includes/class-wcj-payment-gateways.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Custom Gateways
4
  *
5
- * @version 2.8.0
6
  * @author Algoritmika Ltd.
7
  */
8
 
@@ -15,7 +15,7 @@ class WCJ_Payment_Gateways extends WCJ_Module {
15
  /**
16
  * Constructor.
17
  *
18
- * @version 2.8.0
19
  */
20
  function __construct() {
21
 
@@ -26,11 +26,33 @@ class WCJ_Payment_Gateways extends WCJ_Module {
26
  parent::__construct();
27
 
28
  if ( $this->is_enabled() ) {
29
- // Include custom payment gateway
30
  include_once( 'gateways/class-wc-gateway-wcj-custom.php' );
31
-
32
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_payment_gateways_fields_order_meta' ), PHP_INT_MAX, 2 );
33
- add_action( 'add_meta_boxes', array( $this, 'add_custom_payment_gateways_fields_admin_order_meta_box' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
  }
36
 
2
  /**
3
  * Booster for WooCommerce - Module - Custom Gateways
4
  *
5
+ * @version 3.0.1
6
  * @author Algoritmika Ltd.
7
  */
8
 
15
  /**
16
  * Constructor.
17
  *
18
+ * @version 3.0.1
19
  */
20
  function __construct() {
21
 
26
  parent::__construct();
27
 
28
  if ( $this->is_enabled() ) {
 
29
  include_once( 'gateways/class-wc-gateway-wcj-custom.php' );
30
+ add_action( 'woocommerce_after_checkout_validation', array( $this, 'check_required_wcj_input_fields' ), PHP_INT_MAX, 2 );
31
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_payment_gateways_fields_order_meta' ), PHP_INT_MAX, 2 );
32
+ add_action( 'add_meta_boxes', array( $this, 'add_custom_payment_gateways_fields_admin_order_meta_box' ) );
33
+ }
34
+ }
35
+
36
+ /**
37
+ * check_required_wcj_input_fields.
38
+ *
39
+ * @version 3.0.1
40
+ * @since 3.0.1
41
+ */
42
+ function check_required_wcj_input_fields( $data, $errors ) {
43
+ $payment_method = $data['payment_method'];
44
+ if ( 'jetpack_custom_gateway' === substr( $payment_method, 0, 22 ) ) {
45
+ foreach ( $_POST as $key => $value ) {
46
+ if ( 'wcj_input_field_' === substr( $key, 0, 16 ) ) {
47
+ if ( isset( $_POST[ 'for_' . $key ] ) && $payment_method === $_POST[ 'for_' . $key ] ) {
48
+ $is_required_set = ( isset( $_POST[ $key . '_required' ] ) && 'yes' === $_POST[ $key . '_required' ] );
49
+ if ( $is_required_set && '' == $value ) {
50
+ $label = ( isset( $_POST[ 'label_for_' . $key ] ) ? $_POST[ 'label_for_' . $key ] : substr( $key, 16 ) );
51
+ $errors->add( 'booster', sprintf( __( '<strong>%s</strong> is a required field.', 'woocommerce-jetpack' ), $label ) );
52
+ }
53
+ }
54
+ }
55
+ }
56
  }
57
  }
58
 
includes/settings/wcj-settings-cart-customization.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Cart Customization
4
  *
5
- * @version 2.8.0
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  */
@@ -41,6 +41,19 @@ return array(
41
  'default' => __( 'Return to shop', 'woocommerce' ),
42
  'type' => 'text',
43
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  array(
45
  'type' => 'sectionend',
46
  'id' => 'wcj_cart_customization_options',
2
  /**
3
  * Booster for WooCommerce - Settings - Cart Customization
4
  *
5
+ * @version 3.0.1
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  */
41
  'default' => __( 'Return to shop', 'woocommerce' ),
42
  'type' => 'text',
43
  ),
44
+ array(
45
+ 'title' => __( 'Change Empty Cart "Return to shop" Button Link', 'woocommerce-jetpack' ),
46
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
47
+ 'id' => 'wcj_cart_customization_return_to_shop_button_link_enabled',
48
+ 'default' => 'no',
49
+ 'type' => 'checkbox',
50
+ ),
51
+ array(
52
+ 'id' => 'wcj_cart_customization_return_to_shop_button_link',
53
+ 'default' => '',
54
+ 'type' => 'text',
55
+ 'css' => 'width:300px;',
56
+ ),
57
  array(
58
  'type' => 'sectionend',
59
  'id' => 'wcj_cart_customization_options',
includes/shortcodes/class-wcj-input-field-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Input Field
4
  *
5
- * @version 2.5.2
6
  * @since 2.5.2
7
  * @author Algoritmika Ltd.
8
  */
@@ -16,7 +16,7 @@ class WCJ_Input_Field_Shortcodes extends WCJ_Shortcodes {
16
  /**
17
  * Constructor.
18
  *
19
- * @version 2.5.2
20
  * @since 2.5.2
21
  */
22
  function __construct() {
@@ -33,6 +33,7 @@ class WCJ_Input_Field_Shortcodes extends WCJ_Shortcodes {
33
  'name' => '',
34
  'attach_to' => '',
35
  'label' => '',
 
36
  );
37
 
38
  parent::__construct();
@@ -42,7 +43,7 @@ class WCJ_Input_Field_Shortcodes extends WCJ_Shortcodes {
42
  /**
43
  * wcj_input_field.
44
  *
45
- * @version 2.5.2
46
  * @since 2.5.2
47
  */
48
  function wcj_input_field( $atts, $content ) {
@@ -63,6 +64,9 @@ class WCJ_Input_Field_Shortcodes extends WCJ_Shortcodes {
63
  if ( '' != $atts['label'] ) {
64
  $the_field .= '<input type="hidden" name="label_for_wcj_input_field_' . $atts['name'] . '" value="' . $atts['label'] . '">';
65
  }
 
 
 
66
  return $the_field;
67
  }
68
 
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Input Field
4
  *
5
+ * @version 3.0.1
6
  * @since 2.5.2
7
  * @author Algoritmika Ltd.
8
  */
16
  /**
17
  * Constructor.
18
  *
19
+ * @version 3.0.1
20
  * @since 2.5.2
21
  */
22
  function __construct() {
33
  'name' => '',
34
  'attach_to' => '',
35
  'label' => '',
36
+ 'required' => 'no',
37
  );
38
 
39
  parent::__construct();
43
  /**
44
  * wcj_input_field.
45
  *
46
+ * @version 3.0.1
47
  * @since 2.5.2
48
  */
49
  function wcj_input_field( $atts, $content ) {
64
  if ( '' != $atts['label'] ) {
65
  $the_field .= '<input type="hidden" name="label_for_wcj_input_field_' . $atts['name'] . '" value="' . $atts['label'] . '">';
66
  }
67
+ if ( 'yes' == $atts['required'] ) {
68
+ $the_field .= '<input type="hidden" name="wcj_input_field_' . $atts['name'] . '_required" value="yes">';
69
+ }
70
  return $the_field;
71
  }
72
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: algoritmika,anbinder
3
  Tags: woocommerce,booster for woocommerce,woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
- Stable tag: 3.0.0
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -167,6 +167,11 @@ You can see the differences between versions in this [table](https://booster.io/
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
170
  = 3.0.0 - 31/07/2017 =
171
  * Dev - Plugin update checker added.
172
  * Dev - `wcj_modules` filter added.
3
  Tags: woocommerce,booster for woocommerce,woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
+ Stable tag: 3.0.1
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
167
 
168
  == Changelog ==
169
 
170
+ = 3.0.1 - 03/08/2017 =
171
+ * Dev - CART & CHECKOUT - Cart Customization - "Change Empty Cart Return to shop Button Link" option added.
172
+ * Dev - PAYMENT GATEWAYS - Custom Gateways - `required` attribute added to `[wcj_input_field]` shortcode.
173
+ * Fix - Plus message fixed.
174
+
175
  = 3.0.0 - 31/07/2017 =
176
  * Dev - Plugin update checker added.
177
  * Dev - `wcj_modules` filter added.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 3.0.0
7
  Author: Algoritmika Ltd
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
@@ -74,7 +74,7 @@ final class WC_Jetpack {
74
  * @var string
75
  * @since 2.4.7
76
  */
77
- public $version = '3.0.0';
78
 
79
  /**
80
  * @var WC_Jetpack The single instance of the class
@@ -127,7 +127,7 @@ final class WC_Jetpack {
127
  /**
128
  * init_settings.
129
  *
130
- * @version 2.9.0
131
  * @since 2.9.0
132
  */
133
  function init_settings() {
@@ -137,14 +137,16 @@ final class WC_Jetpack {
137
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
138
  add_action( 'admin_menu', array( $this, 'booster_menu' ), 100 );
139
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
140
- add_action( 'admin_notices', array( $this, 'check_plus_version' ) );
 
 
141
  }
142
  }
143
 
144
  /**
145
  * check_plus_version.
146
  *
147
- * @version 2.8.2
148
  * @since 2.5.9
149
  */
150
  function check_plus_version() {
@@ -152,27 +154,31 @@ final class WC_Jetpack {
152
  return;
153
  }
154
  // Check if Plus is installed and activated
155
- $is_plus_active = false;
 
156
  $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
157
  if ( is_multisite() ) {
158
  $active_plugins = array_merge( $active_plugins, array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) );
159
  }
160
  foreach ( $active_plugins as $active_plugin ) {
161
  $active_plugin = explode( '/', $active_plugin );
162
- if ( isset( $active_plugin[1] ) && ( 'woocommerce-jetpack-plus.php' === $active_plugin[1] || 'woocommerce-booster-plus.php' === $active_plugin[1] ) ) {
163
- $is_plus_active = true;
164
- break;
 
 
 
 
165
  }
166
  }
167
  // Check Plus version
168
- if ( $is_plus_active ) {
169
  $plus_version = get_option( 'booster_plus_version', false );
170
  $required_plus_version = '1.1.0';
171
  if ( version_compare( $plus_version, $required_plus_version, '<' ) ) {
172
  $class = 'notice notice-error';
173
  $message = sprintf(
174
- __( 'Please upgrade <strong>Booster Plus for WooCommerce</strong> plugin to version %s. Please visit <a href="%s">your account</a> on booster.io to download the latest Booster Plus version.', 'woocommerce-jetpack' ),
175
- $required_plus_version,
176
  'https://booster.io/my-account/?utm_source=plus_update'
177
  );
178
  echo '<div class="' . $class . '"><p>' . $message . '</p></div>';
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 3.0.1
7
  Author: Algoritmika Ltd
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
74
  * @var string
75
  * @since 2.4.7
76
  */
77
+ public $version = '3.0.1';
78
 
79
  /**
80
  * @var WC_Jetpack The single instance of the class
127
  /**
128
  * init_settings.
129
  *
130
+ * @version 3.0.1
131
  * @since 2.9.0
132
  */
133
  function init_settings() {
137
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
138
  add_action( 'admin_menu', array( $this, 'booster_menu' ), 100 );
139
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
140
+ if ( 'woocommerce-jetpack.php' === basename( __FILE__ ) ) {
141
+ add_action( 'admin_notices', array( $this, 'check_plus_version' ) );
142
+ }
143
  }
144
  }
145
 
146
  /**
147
  * check_plus_version.
148
  *
149
+ * @version 3.0.1
150
  * @since 2.5.9
151
  */
152
  function check_plus_version() {
154
  return;
155
  }
156
  // Check if Plus is installed and activated
157
+ $is_plus_active = false;
158
+ $is_plus_v3_active = false;
159
  $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
160
  if ( is_multisite() ) {
161
  $active_plugins = array_merge( $active_plugins, array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) );
162
  }
163
  foreach ( $active_plugins as $active_plugin ) {
164
  $active_plugin = explode( '/', $active_plugin );
165
+ if ( isset( $active_plugin[1] ) ) {
166
+ if ( 'booster-plus-for-woocommerce.php' === $active_plugin[1] ) {
167
+ $is_plus_v3_active = true;
168
+ break;
169
+ } elseif ( 'woocommerce-jetpack-plus.php' === $active_plugin[1] || 'woocommerce-booster-plus.php' === $active_plugin[1] ) {
170
+ $is_plus_active = true;
171
+ }
172
  }
173
  }
174
  // Check Plus version
175
+ if ( ! $is_plus_v3_active && $is_plus_active ) {
176
  $plus_version = get_option( 'booster_plus_version', false );
177
  $required_plus_version = '1.1.0';
178
  if ( version_compare( $plus_version, $required_plus_version, '<' ) ) {
179
  $class = 'notice notice-error';
180
  $message = sprintf(
181
+ __( 'Please upgrade <strong>Booster Plus for WooCommerce</strong> plugin. Please visit <a target="_blank" href="%s">your account page</a> on booster.io to download the latest Booster Plus version.', 'woocommerce-jetpack' ),
 
182
  'https://booster.io/my-account/?utm_source=plus_update'
183
  );
184
  echo '<div class="' . $class . '"><p>' . $message . '</p></div>';