Booster for WooCommerce - Version 2.7.1

Version Description

  • 13/04/2017 =
  • Fix - WooCommerce v3.x.x compatibility - BUTTON & PRICE LABELS - Custom Price Labels - Per Product - "Variable products" visibility options fixed.
  • Fix - BUTTON & PRICE LABELS - Custom Price Labels - Per Product - "Hide on home page" visibility option fixed.
  • Dev - Code refactoring - add_settings_hook() - BUTTON & PRICE LABELS - Custom Price Labels.
  • Tweak - EMAILS & MISC. - Custom CSS - Description updated.
  • Tweak - EMAILS & MISC. - General - Description updated.
  • Tweak - readme.txt - Screenshots updated.
  • Tweak - Author URI changed.
Download this release

Release Info

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

Code changes from version 2.7.0 to 2.7.1

includes/class-wcj-custom-css.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Custom CSS class.
6
  *
7
- * @version 2.7.0
8
  * @since 2.7.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -18,7 +18,7 @@ class WCJ_Custom_CSS extends WCJ_Module {
18
  /**
19
  * Constructor.
20
  *
21
- * @version 2.7.0
22
  * @since 2.7.0
23
  * @todo wp_safe_redirect after saving settings
24
  * @todo automatically enable the module if v <= 2.6.0 and General module enabled and `wcj_general_custom_css` or `wcj_general_custom_admin_css` are not empty
@@ -28,7 +28,8 @@ class WCJ_Custom_CSS extends WCJ_Module {
28
 
29
  $this->id = 'custom_css';
30
  $this->short_desc = __( 'Custom CSS', 'woocommerce-jetpack' );
31
- $this->desc = __( 'Another custom CSS, if you need one.', 'woocommerce-jetpack' );
 
32
  $this->link = 'http://booster.io/features/woocommerce-booster-custom-css/';
33
  parent::__construct();
34
 
4
  *
5
  * The WooCommerce Jetpack Custom CSS class.
6
  *
7
+ * @version 2.7.1
8
  * @since 2.7.0
9
  * @author Algoritmika Ltd.
10
  */
18
  /**
19
  * Constructor.
20
  *
21
+ * @version 2.7.1
22
  * @since 2.7.0
23
  * @todo wp_safe_redirect after saving settings
24
  * @todo automatically enable the module if v <= 2.6.0 and General module enabled and `wcj_general_custom_css` or `wcj_general_custom_admin_css` are not empty
28
 
29
  $this->id = 'custom_css';
30
  $this->short_desc = __( 'Custom CSS', 'woocommerce-jetpack' );
31
+ $this->desc = __( 'Separate custom CSS for front and back end.', 'woocommerce-jetpack' );
32
+ // $this->desc = __( 'Another custom CSS, if you need one.', 'woocommerce-jetpack' );
33
  $this->link = 'http://booster.io/features/woocommerce-booster-custom-css/';
34
  parent::__construct();
35
 
includes/class-wcj-general.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
- * @version 2.7.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -17,13 +17,13 @@ class WCJ_General extends WCJ_Module {
17
  /**
18
  * Constructor.
19
  *
20
- * @version 2.7.0
21
  */
22
  function __construct() {
23
 
24
  $this->id = 'general';
25
  $this->short_desc = __( 'General', 'woocommerce-jetpack' );
26
- $this->desc = __( 'Separate custom CSS for front and back end. Shortcodes in WordPress text widgets. Custom roles tool.', 'woocommerce-jetpack' );
27
  $this->link = 'http://booster.io/features/woocommerce-booster-general-tools/';
28
  parent::__construct();
29
 
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
+ * @version 2.7.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
17
  /**
18
  * Constructor.
19
  *
20
+ * @version 2.7.1
21
  */
22
  function __construct() {
23
 
24
  $this->id = 'general';
25
  $this->short_desc = __( 'General', 'woocommerce-jetpack' );
26
+ $this->desc = __( 'Custom roles tool. Shortcodes in WordPress text widgets.', 'woocommerce-jetpack' );
27
  $this->link = 'http://booster.io/features/woocommerce-booster-general-tools/';
28
  parent::__construct();
29
 
includes/class-wcj-price-labels.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
- * @version 2.7.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -28,18 +28,18 @@ class WCJ_Price_Labels extends WCJ_Module {
28
  parent::__construct();
29
 
30
  // Custom Price Labels - fields array
31
- $this->custom_tab_group_name = 'wcj_price_labels';// for compatibility with Custom Price Label Pro plugin should use 'simple_is_custom_pricing_label'
32
  $this->custom_tab_sections = array( '_instead', '_before', '_between', '_after', );
33
  $this->custom_tab_sections_titles = array(
34
- '_instead' => __( 'Instead of the price', 'woocommerce-jetpack' ),// for compatibility with Custom Price Label Pro plugin should use ''
35
  '_before' => __( 'Before the price', 'woocommerce-jetpack' ),
36
  '_between' => __( 'Between regular and sale prices', 'woocommerce-jetpack' ),
37
  '_after' => __( 'After the price', 'woocommerce-jetpack' ),
38
  );
39
  $this->custom_tab_section_variations = array( '_text', '_enabled', '_home', '_products', '_single', '_page', '_cart', /*'_simple',*/ '_variable', '_variation', /*'_grouped',*/ );
40
  $this->custom_tab_section_variations_titles = array(
41
- '_text' => '',//'The label',
42
- '_enabled' => __( 'Enable', 'woocommerce-jetpack' ),// for compatibility with Custom Price Label Pro plugin should use ''
43
  '_home' => __( 'Hide on home page', 'woocommerce-jetpack' ),
44
  '_products' => __( 'Hide on products page', 'woocommerce-jetpack' ),
45
  '_single' => __( 'Hide on single', 'woocommerce-jetpack' ),
@@ -106,29 +106,22 @@ class WCJ_Price_Labels extends WCJ_Module {
106
  * save_custom_price_labels.
107
  */
108
  function save_custom_price_labels( $post_id, $post ) {
109
-
110
- // $product = get_product( $post );TODO - do I need it?
111
-
112
- if ( ! isset( $_POST['woojetpack_price_labels_save_post'] ) )
113
  return;
114
-
115
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
116
-
117
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
118
-
119
- // $option_name = $this->custom_tab_group_name;
120
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
121
-
122
- // if ( isset( $_POST[ $option_name ] ) ) update_post_meta( $post_id, '_' . $option_name, $_POST[ $option_name ] );
123
-
124
  if ( $custom_tab_section_variation == '_text' ) {
125
- //$option_name .= $custom_tab_section_variation . $custom_tab_section;
126
- if ( isset( $_POST[ $option_name ] ) ) update_post_meta( $post_id, '_' . $option_name, $_POST[ $option_name ] );
127
- }
128
- else {
129
- //$option_name .= $custom_tab_section . $custom_tab_section_variation;
130
- if ( isset( $_POST[ $option_name ] ) ) update_post_meta( $post_id, '_' . $option_name, $_POST[ $option_name ] );
131
- else update_post_meta( $post_id, '_' . $option_name, 'off' );
 
 
132
  }
133
  }
134
  }
@@ -156,82 +149,46 @@ class WCJ_Price_Labels extends WCJ_Module {
156
  * @version 2.4.8
157
  */
158
  function create_price_label_meta_box() {
159
-
160
  $current_post_id = get_the_ID();
161
  echo '<table style="width:100%;">';
162
-
163
  echo '<tr>';
164
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
165
  echo '<td style="width:25%;"><h4>' . $this->custom_tab_sections_titles[ $custom_tab_section ] . '</h4></td>';
166
  }
167
  echo '</tr>';
168
-
169
- /*
170
  echo '<tr>';
171
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
172
- if ( '_instead' != $custom_tab_section )
173
- $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'desc_below' );
174
- else
175
- $disabled_if_no_plus = '';
176
- echo '<td style="width:25%;">' . $disabled_if_no_plus . '</td>';
177
- }
178
- echo '</tr>';
179
- */
180
-
181
- echo '<tr>';
182
- foreach ( $this->custom_tab_sections as $custom_tab_section ) {
183
-
184
  echo '<td style="width:25%;">';
185
-
186
- /*if ( $custom_tab_section == '_before' ) $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'desc_below' );
187
- else $disabled_if_no_plus = '';
188
- echo '<p>' . $disabled_if_no_plus . '<ul><h4>' . $this->custom_tab_sections_titles[ $custom_tab_section ] . '</h4>';*/
189
-
190
- echo '<ul>';//<li><h4>' . $this->custom_tab_sections_titles[ $custom_tab_section ] . '</h4></li>';
191
-
192
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
193
-
194
- //$option_name = $this->custom_tab_group_name;
195
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
196
-
197
  if ( $custom_tab_section_variation == '_text' ) {
198
-
199
- //$option_name .= $custom_tab_section_variation . $custom_tab_section;
200
-
201
- if ( $custom_tab_section != '_instead' ) $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'readonly_string' );
202
- else $disabled_if_no_plus = '';
203
- //if ( $disabled_if_no_plus != '' ) $disabled_if_no_plus = 'readonly';
204
-
205
  $label_text = get_post_meta( $current_post_id, '_' . $option_name, true );
206
  $label_text = str_replace ( '"', '&quot;', $label_text );
207
-
208
- //echo '<li>' . $this->custom_tab_section_variations_titles[ $custom_tab_section_variation ] . ' <input style="width:50%;min-width:300px;" type="text" ' . $disabled_if_no_plus . ' name="' . $option_name . '" id="' . $option_name . '" value="' . $label_text . '" /></li>';
209
  echo '<li>' . $this->custom_tab_section_variations_titles[ $custom_tab_section_variation ] . '<textarea style="width:95%;min-width:100px;height:100px;" ' . $disabled_if_no_plus . ' name="' . $option_name . '">' . $label_text . '</textarea></li>';
210
-
211
- }
212
- else {
213
-
214
- if ( '_home' === $custom_tab_section_variation )
215
  echo '<li><h5>Hide by page type</h5></li>';
216
-
217
- if ( '_variable' === $custom_tab_section_variation )
218
  echo '<li><h5>Variable products</h5></li>';
219
-
220
- //$option_name .= $custom_tab_section . $custom_tab_section_variation;
221
-
222
- if ( '_instead' != $custom_tab_section ) $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'disabled_string' );
223
- else $disabled_if_no_plus = '';
224
- //if ( $disabled_if_no_plus != '' ) $disabled_if_no_plus = 'disabled';
225
-
226
  echo '<li><input class="checkbox" type="checkbox" ' . $disabled_if_no_plus . ' name="' . $option_name . '" id="' . $option_name . '" ' .
227
  checked( get_post_meta( $current_post_id, '_' . $option_name, true ), 'on', false ) . ' /> ' . $this->custom_tab_section_variations_titles[ $custom_tab_section_variation ] . '</li>';
228
  }
229
  }
230
-
231
- echo '</ul>';//</p>';
232
-
233
  echo '</td>';
234
-
235
  }
236
  echo '</tr>';
237
  echo '<tr>';
@@ -249,65 +206,62 @@ class WCJ_Price_Labels extends WCJ_Module {
249
 
250
  /*
251
  * customize_price
 
 
252
  */
253
  function customize_price( $price, $custom_tab_section, $custom_label ) {
254
-
255
  switch ( $custom_tab_section ) {
256
-
257
  case '_instead':
258
  $price = $custom_label;
259
  break;
260
-
261
  case '_before':
262
  $price = apply_filters( 'booster_get_option', $price, $custom_label . $price );
263
  break;
264
-
265
  case '_between':
266
  $price = apply_filters( 'booster_get_option', $price, str_replace( '</del> <ins>', '</del>' . $custom_label . '<ins>', $price ) );
267
  break;
268
-
269
  case '_after':
270
  $price = apply_filters( 'booster_get_option', $price, $price . $custom_label );
271
  break;
272
  }
273
-
274
- return str_replace( 'From: ', '', $price ); // TODO: recheck if this is necessary? Also this works only for English WP installs.
275
  }
276
 
277
  /*
278
  * custom_price - front end.
279
  *
280
- * @version 2.7.0
 
281
  */
282
  function custom_price( $price, $product ) {
283
 
284
- if ( ! wcj_is_frontend() ) return $price;
285
-
 
286
  $current_filter_name = current_filter();
287
-
288
  if ( 'woocommerce_cart_item_price' === $current_filter_name ) {
289
  $product = $product['data'];
290
  }
291
-
292
- $_product_id = wcj_get_product_id_or_variation_parent_id( $product );
293
  $_product_type = ( WCJ_IS_WC_VERSION_BELOW_3 ? $product->product_type : $product->get_type() );
294
-
295
  if ( WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_get_price_html' === $current_filter_name && ! in_array( $_product_type, apply_filters( 'wcj_price_labels_woocommerce_get_price_html_allowed_post_types', array( 'booking' ), $_product_type ) ) ) {
296
  return $price;
297
  }
298
-
299
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_variable_price_html' === $current_filter_name ) {
300
  return $price;
301
  }
302
-
 
 
 
 
 
303
  if ( 'subscription' === $_product_type && 'woocommerce_subscriptions_product_price_string' !== $current_filter_name ) {
304
  return $price;
305
  }
306
-
307
  if ( 'variable-subscription' === $_product_type && 'woocommerce_variable_subscription_price_html' !== $current_filter_name ) {
308
  return $price;
309
  }
310
-
311
  if ( 'subscription_variation' === $_product_type && 'woocommerce_subscriptions_product_price_string' !== $current_filter_name ) {
312
  return $price;
313
  }
@@ -315,11 +269,16 @@ class WCJ_Price_Labels extends WCJ_Module {
315
  $current_filter_name = 'woocommerce_variation_subscription_price_html';
316
  }
317
 
 
318
  $do_apply_global = true;
319
  $products_incl = get_option( 'wcj_global_price_labels_products_incl', array() );
320
- if ( ! empty( $products_incl ) ) $do_apply_global = ( in_array( $_product_id, $products_incl ) ) ? true : false;
 
 
321
  $products_excl = get_option( 'wcj_global_price_labels_products_excl', array() );
322
- if ( ! empty( $products_excl ) ) $do_apply_global = ( in_array( $_product_id, $products_excl ) ) ? false : true;
 
 
323
  $product_categories = get_the_terms( $_product_id, 'product_cat' );
324
  $product_categories_incl = get_option( 'wcj_global_price_labels_product_cats_incl', array() );
325
  if ( ! empty( $product_categories_incl ) ) {
@@ -373,21 +332,22 @@ class WCJ_Price_Labels extends WCJ_Module {
373
  $price = $price . $text_to_add_after;
374
  }
375
  }
376
-
377
  // Global price labels - Between regular and sale prices
378
  $text_to_add_between_regular_and_sale = get_option( 'wcj_global_price_labels_between_regular_and_sale_text' );
379
- if ( '' != $text_to_add_between_regular_and_sale )
380
  $price = apply_filters( 'booster_get_option', $price, str_replace( '</del> <ins>', '</del>' . $text_to_add_between_regular_and_sale . '<ins>', $price ) );
381
-
382
  // Global price labels - Remove text from price
383
  $text_to_remove = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_remove_text' ) );
384
- if ( '' != $text_to_remove )
385
  $price = str_replace( $text_to_remove, '', $price );
 
386
  // Global price labels - Replace in price
387
  $text_to_replace = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_replace_text' ) );
388
  $text_to_replace_with = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_replace_with_text' ) );
389
- if ( '' != $text_to_replace && '' != $text_to_replace_with )
390
  $price = str_replace( $text_to_replace, $text_to_replace_with, $price );
 
391
  // Global price labels - Instead of the price
392
  if ( '' != ( $text_instead = get_option( 'wcj_global_price_labels_instead_text', '' ) ) ) {
393
  $price = $text_instead;
@@ -396,76 +356,52 @@ class WCJ_Price_Labels extends WCJ_Module {
396
 
397
  // Per product
398
  if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
399
-
400
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
401
-
402
  $labels_array = array();
403
-
404
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
405
-
406
- //$option_name = $this->custom_tab_group_name;
407
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
408
  $labels_array[ 'variation' . $custom_tab_section_variation ] = get_post_meta( $_product_id, '_' . $option_name, true );
409
-
410
- /* if ( $custom_tab_section_variation == '_text' ) {
411
-
412
- //$option_name .= $custom_tab_section_variation . $custom_tab_section;
413
- $labels_array[ 'variation' . $custom_tab_section_variation ] = get_post_meta($product->post->ID, '_' . $option_name, true );
414
- }
415
- else {
416
-
417
- //$option_name .= $custom_tab_section . $custom_tab_section_variation;
418
- $labels_array[ 'variation' . $custom_tab_section_variation ] = get_post_meta($product->post->ID, '_' . $option_name, true);
419
- } */
420
-
421
- //$price .= print_r( $labels_array );
422
  }
423
-
424
  if ( 'on' === $labels_array[ 'variation_enabled' ] ) {
425
-
426
  if (
427
  ( ( 'off' === $labels_array['variation_home'] ) && ( is_front_page() ) ) ||
428
  ( ( 'off' === $labels_array['variation_products'] ) && ( is_archive() ) ) ||
429
  ( ( 'off' === $labels_array['variation_single'] ) && ( is_single() ) ) ||
430
- ( ( 'off' === $labels_array['variation_page'] ) && ( is_page() ) )
431
- )
432
- {
433
- //$current_filter_name = current_filter();
434
- if ( 'woocommerce_cart_item_price' === $current_filter_name && 'on' === $labels_array['variation_cart'] )
435
- continue;
436
-
437
- $variable_filters_array = array(
438
- 'woocommerce_variable_empty_price_html',
439
- 'woocommerce_variable_free_price_html',
440
- 'woocommerce_variable_free_sale_price_html',
441
- 'woocommerce_variable_price_html',
442
- 'woocommerce_variable_sale_price_html',
443
- 'woocommerce_variable_subscription_price_html',
444
- );
445
-
446
- $variation_filters_array = array(
447
- 'woocommerce_variation_empty_price_html',
448
- 'woocommerce_variation_free_price_html',
449
- //woocommerce_variation_option_name
450
- 'woocommerce_variation_price_html',
451
- 'woocommerce_variation_sale_price_html',
452
- 'woocommerce_variation_subscription_price_html', // pseudo filter!
453
- );
454
-
455
- if (
456
- ( in_array( $current_filter_name, $variable_filters_array ) && ( $labels_array['variation_variable'] == 'off' ) ) ||
457
- ( in_array( $current_filter_name, $variation_filters_array ) && ( $labels_array['variation_variation'] == 'off' ) ) ||
458
- ( ! in_array( $current_filter_name, $variable_filters_array ) && ! in_array( $current_filter_name, $variation_filters_array ) )
459
- )
460
- $price = $this->customize_price( $price, $custom_tab_section, $labels_array['variation_text'] );
461
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  }
463
-
464
- //unset( $labels_array );
465
  }
466
  }
467
 
 
468
  // return do_shortcode( $price . $current_filter_name . ( WCJ_IS_WC_VERSION_BELOW_3 ? $product->product_type : $product->get_type() ) . $labels_array['variation_variable'] . $labels_array['variation_variation'] );
 
469
  global $wcj_product_id_for_shortcode;
470
  $wcj_product_id_for_shortcode = wcj_get_product_id( $product );
471
  $result = do_shortcode( $price );
@@ -473,27 +409,6 @@ class WCJ_Price_Labels extends WCJ_Module {
473
  return $result;
474
  }
475
 
476
- /**
477
- * get_settings.
478
- *
479
- * @version 2.5.0
480
- */
481
- function get_settings() {
482
- $settings = array();
483
- $settings = apply_filters( 'wcj_price_labels_settings', $settings );
484
- return $this->add_standard_settings( $settings );
485
- }
486
-
487
- /*
488
- * add_settings_hook.
489
- *
490
- * @version 2.3.7
491
- * @since 2.3.7
492
- */
493
- function add_settings_hook() {
494
- add_filter( 'wcj_price_labels_settings', array( $this, 'add_settings' ) );
495
- }
496
-
497
  /*
498
  * add_settings.
499
  *
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
+ * @version 2.7.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
28
  parent::__construct();
29
 
30
  // Custom Price Labels - fields array
31
+ $this->custom_tab_group_name = 'wcj_price_labels'; // for compatibility with Custom Price Label Pro plugin should use 'simple_is_custom_pricing_label'
32
  $this->custom_tab_sections = array( '_instead', '_before', '_between', '_after', );
33
  $this->custom_tab_sections_titles = array(
34
+ '_instead' => __( 'Instead of the price', 'woocommerce-jetpack' ), // for compatibility with Custom Price Label Pro plugin should use ''
35
  '_before' => __( 'Before the price', 'woocommerce-jetpack' ),
36
  '_between' => __( 'Between regular and sale prices', 'woocommerce-jetpack' ),
37
  '_after' => __( 'After the price', 'woocommerce-jetpack' ),
38
  );
39
  $this->custom_tab_section_variations = array( '_text', '_enabled', '_home', '_products', '_single', '_page', '_cart', /*'_simple',*/ '_variable', '_variation', /*'_grouped',*/ );
40
  $this->custom_tab_section_variations_titles = array(
41
+ '_text' => '', // 'The label',
42
+ '_enabled' => __( 'Enable', 'woocommerce-jetpack' ), // for compatibility with Custom Price Label Pro plugin should use ''
43
  '_home' => __( 'Hide on home page', 'woocommerce-jetpack' ),
44
  '_products' => __( 'Hide on products page', 'woocommerce-jetpack' ),
45
  '_single' => __( 'Hide on single', 'woocommerce-jetpack' ),
106
  * save_custom_price_labels.
107
  */
108
  function save_custom_price_labels( $post_id, $post ) {
109
+ if ( ! isset( $_POST['woojetpack_price_labels_save_post'] ) ) {
 
 
 
110
  return;
111
+ }
112
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
 
113
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
 
 
114
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
 
 
 
115
  if ( $custom_tab_section_variation == '_text' ) {
116
+ if ( isset( $_POST[ $option_name ] ) ) {
117
+ update_post_meta( $post_id, '_' . $option_name, $_POST[ $option_name ] );
118
+ }
119
+ } else {
120
+ if ( isset( $_POST[ $option_name ] ) ) {
121
+ update_post_meta( $post_id, '_' . $option_name, $_POST[ $option_name ] );
122
+ } else {
123
+ update_post_meta( $post_id, '_' . $option_name, 'off' );
124
+ }
125
  }
126
  }
127
  }
149
  * @version 2.4.8
150
  */
151
  function create_price_label_meta_box() {
 
152
  $current_post_id = get_the_ID();
153
  echo '<table style="width:100%;">';
 
154
  echo '<tr>';
155
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
156
  echo '<td style="width:25%;"><h4>' . $this->custom_tab_sections_titles[ $custom_tab_section ] . '</h4></td>';
157
  }
158
  echo '</tr>';
 
 
159
  echo '<tr>';
160
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
 
 
 
 
 
 
 
 
 
 
 
 
161
  echo '<td style="width:25%;">';
162
+ echo '<ul>';
 
 
 
 
 
 
163
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
 
 
164
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
 
165
  if ( $custom_tab_section_variation == '_text' ) {
166
+ if ( $custom_tab_section != '_instead' ) {
167
+ $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'readonly_string' );
168
+ } else {
169
+ $disabled_if_no_plus = '';
170
+ }
 
 
171
  $label_text = get_post_meta( $current_post_id, '_' . $option_name, true );
172
  $label_text = str_replace ( '"', '&quot;', $label_text );
 
 
173
  echo '<li>' . $this->custom_tab_section_variations_titles[ $custom_tab_section_variation ] . '<textarea style="width:95%;min-width:100px;height:100px;" ' . $disabled_if_no_plus . ' name="' . $option_name . '">' . $label_text . '</textarea></li>';
174
+ } else {
175
+ if ( '_home' === $custom_tab_section_variation ) {
 
 
 
176
  echo '<li><h5>Hide by page type</h5></li>';
177
+ }
178
+ if ( '_variable' === $custom_tab_section_variation ) {
179
  echo '<li><h5>Variable products</h5></li>';
180
+ }
181
+ if ( '_instead' != $custom_tab_section ) {
182
+ $disabled_if_no_plus = apply_filters( 'booster_get_message', '', 'disabled_string' );
183
+ } else {
184
+ $disabled_if_no_plus = '';
185
+ }
 
186
  echo '<li><input class="checkbox" type="checkbox" ' . $disabled_if_no_plus . ' name="' . $option_name . '" id="' . $option_name . '" ' .
187
  checked( get_post_meta( $current_post_id, '_' . $option_name, true ), 'on', false ) . ' /> ' . $this->custom_tab_section_variations_titles[ $custom_tab_section_variation ] . '</li>';
188
  }
189
  }
190
+ echo '</ul>';
 
 
191
  echo '</td>';
 
192
  }
193
  echo '</tr>';
194
  echo '<tr>';
206
 
207
  /*
208
  * customize_price
209
+ *
210
+ * @todo recheck if `str_replace( 'From: ', '', $price );` is necessary? Also this works only for English WP installs.
211
  */
212
  function customize_price( $price, $custom_tab_section, $custom_label ) {
 
213
  switch ( $custom_tab_section ) {
 
214
  case '_instead':
215
  $price = $custom_label;
216
  break;
 
217
  case '_before':
218
  $price = apply_filters( 'booster_get_option', $price, $custom_label . $price );
219
  break;
 
220
  case '_between':
221
  $price = apply_filters( 'booster_get_option', $price, str_replace( '</del> <ins>', '</del>' . $custom_label . '<ins>', $price ) );
222
  break;
 
223
  case '_after':
224
  $price = apply_filters( 'booster_get_option', $price, $price . $custom_label );
225
  break;
226
  }
227
+ return str_replace( 'From: ', '', $price );
 
228
  }
229
 
230
  /*
231
  * custom_price - front end.
232
  *
233
+ * @version 2.7.1
234
+ * @todo rewrite this with less filters (e.g. `woocommerce_get_price_html` only) - at least for `! WCJ_IS_WC_VERSION_BELOW_3`
235
  */
236
  function custom_price( $price, $product ) {
237
 
238
+ if ( ! wcj_is_frontend() ) {
239
+ return $price;
240
+ }
241
  $current_filter_name = current_filter();
 
242
  if ( 'woocommerce_cart_item_price' === $current_filter_name ) {
243
  $product = $product['data'];
244
  }
245
+ $_product_id = wcj_get_product_id_or_variation_parent_id( $product );
 
246
  $_product_type = ( WCJ_IS_WC_VERSION_BELOW_3 ? $product->product_type : $product->get_type() );
 
247
  if ( WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_get_price_html' === $current_filter_name && ! in_array( $_product_type, apply_filters( 'wcj_price_labels_woocommerce_get_price_html_allowed_post_types', array( 'booking' ), $_product_type ) ) ) {
248
  return $price;
249
  }
 
250
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_variable_price_html' === $current_filter_name ) {
251
  return $price;
252
  }
253
+ if ( ! WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_get_price_html' === $current_filter_name && $product->is_type( 'variation' ) ) {
254
+ $current_filter_name = 'woocommerce_variation_price_html';
255
+ }
256
+ if ( ! WCJ_IS_WC_VERSION_BELOW_3 && 'woocommerce_get_price_html' === $current_filter_name && $product->is_type( 'variable' ) ) {
257
+ $current_filter_name = 'woocommerce_variable_price_html';
258
+ }
259
  if ( 'subscription' === $_product_type && 'woocommerce_subscriptions_product_price_string' !== $current_filter_name ) {
260
  return $price;
261
  }
 
262
  if ( 'variable-subscription' === $_product_type && 'woocommerce_variable_subscription_price_html' !== $current_filter_name ) {
263
  return $price;
264
  }
 
265
  if ( 'subscription_variation' === $_product_type && 'woocommerce_subscriptions_product_price_string' !== $current_filter_name ) {
266
  return $price;
267
  }
269
  $current_filter_name = 'woocommerce_variation_subscription_price_html';
270
  }
271
 
272
+ // Global
273
  $do_apply_global = true;
274
  $products_incl = get_option( 'wcj_global_price_labels_products_incl', array() );
275
+ if ( ! empty( $products_incl ) ) {
276
+ $do_apply_global = ( in_array( $_product_id, $products_incl ) ) ? true : false;
277
+ }
278
  $products_excl = get_option( 'wcj_global_price_labels_products_excl', array() );
279
+ if ( ! empty( $products_excl ) ) {
280
+ $do_apply_global = ( in_array( $_product_id, $products_excl ) ) ? false : true;
281
+ }
282
  $product_categories = get_the_terms( $_product_id, 'product_cat' );
283
  $product_categories_incl = get_option( 'wcj_global_price_labels_product_cats_incl', array() );
284
  if ( ! empty( $product_categories_incl ) ) {
332
  $price = $price . $text_to_add_after;
333
  }
334
  }
 
335
  // Global price labels - Between regular and sale prices
336
  $text_to_add_between_regular_and_sale = get_option( 'wcj_global_price_labels_between_regular_and_sale_text' );
337
+ if ( '' != $text_to_add_between_regular_and_sale ) {
338
  $price = apply_filters( 'booster_get_option', $price, str_replace( '</del> <ins>', '</del>' . $text_to_add_between_regular_and_sale . '<ins>', $price ) );
339
+ }
340
  // Global price labels - Remove text from price
341
  $text_to_remove = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_remove_text' ) );
342
+ if ( '' != $text_to_remove ) {
343
  $price = str_replace( $text_to_remove, '', $price );
344
+ }
345
  // Global price labels - Replace in price
346
  $text_to_replace = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_replace_text' ) );
347
  $text_to_replace_with = apply_filters( 'booster_get_option', '', get_option( 'wcj_global_price_labels_replace_with_text' ) );
348
+ if ( '' != $text_to_replace && '' != $text_to_replace_with ) {
349
  $price = str_replace( $text_to_replace, $text_to_replace_with, $price );
350
+ }
351
  // Global price labels - Instead of the price
352
  if ( '' != ( $text_instead = get_option( 'wcj_global_price_labels_instead_text', '' ) ) ) {
353
  $price = $text_instead;
356
 
357
  // Per product
358
  if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
 
359
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
 
360
  $labels_array = array();
 
361
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
 
 
362
  $option_name = $this->custom_tab_group_name . $custom_tab_section . $custom_tab_section_variation;
363
  $labels_array[ 'variation' . $custom_tab_section_variation ] = get_post_meta( $_product_id, '_' . $option_name, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  }
 
365
  if ( 'on' === $labels_array[ 'variation_enabled' ] ) {
 
366
  if (
367
  ( ( 'off' === $labels_array['variation_home'] ) && ( is_front_page() ) ) ||
368
  ( ( 'off' === $labels_array['variation_products'] ) && ( is_archive() ) ) ||
369
  ( ( 'off' === $labels_array['variation_single'] ) && ( is_single() ) ) ||
370
+ ( ( 'off' === $labels_array['variation_page'] ) && ( is_page() && ! is_front_page() ) )
371
+ ) {
372
+ if ( 'woocommerce_cart_item_price' === $current_filter_name && 'on' === $labels_array['variation_cart'] ) {
373
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  }
375
+ $variable_filters_array = array(
376
+ 'woocommerce_variable_empty_price_html',
377
+ 'woocommerce_variable_free_price_html',
378
+ 'woocommerce_variable_free_sale_price_html',
379
+ 'woocommerce_variable_price_html',
380
+ 'woocommerce_variable_sale_price_html',
381
+ 'woocommerce_variable_subscription_price_html',
382
+ );
383
+ $variation_filters_array = array(
384
+ 'woocommerce_variation_empty_price_html',
385
+ 'woocommerce_variation_free_price_html',
386
+ 'woocommerce_variation_price_html',
387
+ 'woocommerce_variation_sale_price_html',
388
+ 'woocommerce_variation_subscription_price_html', // pseudo filter!
389
+ );
390
+ if (
391
+ ( in_array( $current_filter_name, $variable_filters_array ) && ( 'off' === $labels_array['variation_variable'] ) ) ||
392
+ ( in_array( $current_filter_name, $variation_filters_array ) && ( 'off' === $labels_array['variation_variation'] ) ) ||
393
+ ( ! in_array( $current_filter_name, $variable_filters_array ) && ! in_array( $current_filter_name, $variation_filters_array ) )
394
+ ) {
395
+ $price = $this->customize_price( $price, $custom_tab_section, $labels_array['variation_text'] );
396
+ }
397
+ }
398
  }
 
 
399
  }
400
  }
401
 
402
+ // For debug
403
  // return do_shortcode( $price . $current_filter_name . ( WCJ_IS_WC_VERSION_BELOW_3 ? $product->product_type : $product->get_type() ) . $labels_array['variation_variable'] . $labels_array['variation_variation'] );
404
+
405
  global $wcj_product_id_for_shortcode;
406
  $wcj_product_id_for_shortcode = wcj_get_product_id( $product );
407
  $result = do_shortcode( $price );
409
  return $result;
410
  }
411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  /*
413
  * add_settings.
414
  *
includes/functions/wcj-functions.php CHANGED
@@ -721,12 +721,13 @@ if ( ! function_exists( 'validate_VAT' ) ) {
721
  }
722
  }
723
 
724
- /**
725
- * wcj_plugin_url.
726
- *
727
- * @version 2.3.0
728
- */
729
  if ( ! function_exists( 'wcj_plugin_url' ) ) {
 
 
 
 
 
 
730
  function wcj_plugin_url() {
731
  return untrailingslashit( plugin_dir_url( realpath( dirname( __FILE__ ) . '/..' ) ) );
732
  //return untrailingslashit( realpath( dirname( __FILE__ ) . '/..' ) );
721
  }
722
  }
723
 
 
 
 
 
 
724
  if ( ! function_exists( 'wcj_plugin_url' ) ) {
725
+ /**
726
+ * wcj_plugin_url.
727
+ *
728
+ * @version 2.3.0
729
+ * @todo remove this function
730
+ */
731
  function wcj_plugin_url() {
732
  return untrailingslashit( plugin_dir_url( realpath( dirname( __FILE__ ) . '/..' ) ) );
733
  //return untrailingslashit( realpath( dirname( __FILE__ ) . '/..' ) );
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.7
6
- Stable tag: 2.7.0
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -105,10 +105,10 @@ Booster for WooCommerce is a WordPress plugin that supercharges your site with a
105
 
106
  * *Admin Tools* - Booster for WooCommerce debug and log tools.
107
  * *Booster WPML* - Booster for WooCommerce basic WPML support.
108
- * *Custom CSS* - Another custom CSS, if you need one.
109
  * *Emails* - Add custom emails. Add another email recipient(s) to all WooCommerce emails.
110
  * *Export* - WooCommerce export tools.
111
- * *General* - Separate custom CSS for front and back end. Shortcodes in WordPress text widgets. Custom roles tool.
112
  * *Old Slugs* - Remove old WooCommerce products slugs.
113
  * *Reports* - WooCommerce stock, sales, customers etc. reports.
114
 
@@ -140,10 +140,26 @@ You can see the differences between versions in this [table](http://booster.io/b
140
 
141
  == Screenshots ==
142
 
143
- 1. Plugin admin area.
 
 
 
 
 
 
 
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
 
 
 
 
147
  = 2.7.0 - 12/04/2017 =
148
  * Dev - WooCommerce v3.x.x compatibility - `wcj_get_order_item_meta_info()` - `get_meta_data()` instead of `has_meta()`.
149
  * Dev - WooCommerce v3.x.x compatibility - Shortcodes - Orders - `[wcj_order_items_table]` - `wcj_get_order_currency()`. `get_short_description()`. `wcj_get_order_item_meta_info()`.
3
  Tags: woocommerce,booster for woocommerce,woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 4.7
6
+ Stable tag: 2.7.1
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
105
 
106
  * *Admin Tools* - Booster for WooCommerce debug and log tools.
107
  * *Booster WPML* - Booster for WooCommerce basic WPML support.
108
+ * *Custom CSS* - Separate custom CSS for front and back end.
109
  * *Emails* - Add custom emails. Add another email recipient(s) to all WooCommerce emails.
110
  * *Export* - WooCommerce export tools.
111
+ * *General* - Custom roles tool. Shortcodes in WordPress text widgets.
112
  * *Old Slugs* - Remove old WooCommerce products slugs.
113
  * *Reports* - WooCommerce stock, sales, customers etc. reports.
114
 
140
 
141
  == Screenshots ==
142
 
143
+ 1. Booster for WooCommerce - Prices & Currencies.
144
+ 2. Booster for WooCommerce - Button & Price Labels.
145
+ 3. Booster for WooCommerce - Products.
146
+ 4. Booster for WooCommerce - Cart & Checkout.
147
+ 5. Booster for WooCommerce - Payment Gateways.
148
+ 6. Booster for WooCommerce - Shipping & Orders.
149
+ 7. Booster for WooCommerce - PDF Invoicing & Packing Slips.
150
+ 8. Booster for WooCommerce - Emails & Misc.
151
 
152
  == Changelog ==
153
 
154
+ = 2.7.1 - 13/04/2017 =
155
+ * Fix - WooCommerce v3.x.x compatibility - BUTTON & PRICE LABELS - Custom Price Labels - Per Product - "Variable products" visibility options fixed.
156
+ * Fix - BUTTON & PRICE LABELS - Custom Price Labels - Per Product - "Hide on home page" visibility option fixed.
157
+ * Dev - Code refactoring - `add_settings_hook()` - BUTTON & PRICE LABELS - Custom Price Labels.
158
+ * Tweak - EMAILS & MISC. - Custom CSS - Description updated.
159
+ * Tweak - EMAILS & MISC. - General - Description updated.
160
+ * Tweak - readme.txt - Screenshots updated.
161
+ * Tweak - Author URI changed.
162
+
163
  = 2.7.0 - 12/04/2017 =
164
  * Dev - WooCommerce v3.x.x compatibility - `wcj_get_order_item_meta_info()` - `get_meta_data()` instead of `has_meta()`.
165
  * Dev - WooCommerce v3.x.x compatibility - Shortcodes - Orders - `[wcj_order_items_table]` - `wcj_get_order_currency()`. `get_short_description()`. `wcj_get_order_item_meta_info()`.
woocommerce-jetpack.php CHANGED
@@ -3,9 +3,9 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: http://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 2.7.0
7
  Author: Algoritmika Ltd
8
- Author URI: http://www.algoritmika.com
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2017 Algoritmika Ltd.
@@ -42,7 +42,7 @@ final class WC_Jetpack {
42
  * @var string
43
  * @since 2.4.7
44
  */
45
- public $version = '2.7.0';
46
 
47
  /**
48
  * @var WC_Jetpack The single instance of the class
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: http://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 2.7.1
7
  Author: Algoritmika Ltd
8
+ Author URI: http://booster.io
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2017 Algoritmika Ltd.
42
  * @var string
43
  * @since 2.4.7
44
  */
45
+ public $version = '2.7.1';
46
 
47
  /**
48
  * @var WC_Jetpack The single instance of the class