WooCommerce Wishlist Plugin - Version 1.9.16

Version Description

Release Date - 7 March 2019

  • Fixed an issue in case of NULL in a product price field
  • Updated Share settings in the install wizard
Download this release

Release Info

Developer templateinvaders
Plugin Icon 128x128 WooCommerce Wishlist Plugin
Version 1.9.16
Comparing to
See all releases

Code changes from version 1.9.15 to 1.9.16

assets/css/admin-form.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/css/admin-setup.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/css/admin.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/css/public.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/css/theme.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/js/admin.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
assets/js/public.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! WooCommerce Wishlist Plugin - version 1.9.15
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
1
+ /*! WooCommerce Wishlist Plugin - version 1.9.16
2
  * https://wordpress.org/plugins/ti-woocommerce-wishlist/
3
  * Copyright (c) 2019;
4
  * Licensed GPLv2+ */
includes/activator.class.php CHANGED
@@ -324,11 +324,11 @@ class TInvWL_Activator {
324
  /**
325
  * Created tables from array
326
  *
327
- * @global wpdb $wpdb
328
- *
329
  * @param array $tables Array tables.
330
  *
331
  * @return boolean
 
 
332
  */
333
  public static function create( $tables ) {
334
  global $wpdb;
@@ -350,11 +350,11 @@ class TInvWL_Activator {
350
  /**
351
  * Upgrade tables from array
352
  *
353
- * @global wpdb $wpdb
354
- *
355
  * @param array $tables Array tables.
356
  *
357
  * @return boolean
 
 
358
  */
359
  public static function upgrade( $tables ) {
360
 
@@ -372,11 +372,11 @@ class TInvWL_Activator {
372
  /**
373
  * Get columns for exist table.
374
  *
375
- * @global wpdb $wpdb
376
- *
377
  * @param string $name Table name.
378
  *
379
  * @return array
 
 
380
  */
381
  public static function upgrade_get_columns( $name ) {
382
  global $wpdb;
@@ -393,12 +393,12 @@ class TInvWL_Activator {
393
  /**
394
  * Apply upgrade action
395
  *
396
- * @global wpdb $wpdb
397
- *
398
  * @param string $name Name Table.
399
  * @param array $table Structured array table.
400
  *
401
  * @return boolean
 
 
402
  */
403
  public static function upgrade_action( $name, $table ) {
404
 
@@ -445,9 +445,10 @@ class TInvWL_Activator {
445
  * Apply upgrade action
446
  * Truncate table
447
  *
 
 
448
  * @global wpdb $wpdb
449
  *
450
- * @param string $name Table name.
451
  */
452
  public static function upgrade_action_truncate( $name ) {
453
  global $wpdb;
@@ -458,9 +459,10 @@ class TInvWL_Activator {
458
  * Apply upgrade action
459
  * Drop table
460
  *
 
 
461
  * @global wpdb $wpdb
462
  *
463
- * @param string $name Table name.
464
  */
465
  public static function upgrade_action_drop( $name ) {
466
  global $wpdb;
@@ -472,13 +474,13 @@ class TInvWL_Activator {
472
  * Apply upgrade action
473
  * Rename table
474
  *
475
- * @global wpdb $wpdb
476
- *
477
  * @param string $name Table name.
478
  * @param array $table Not used.
479
  * @param array $upgrade Upgrade fields.
480
  *
481
  * @return boolean
 
 
482
  */
483
  public static function upgrade_action_rename_table( $name, $table, $upgrade ) {
484
  global $wpdb;
@@ -498,10 +500,11 @@ class TInvWL_Activator {
498
  * Apply upgrade action
499
  * Update fields table
500
  *
501
- * @global wpdb $wpdb
502
- *
503
  * @param string $name Table name.
504
  * @param array $table Table array.
 
 
 
505
  */
506
  public static function upgrade_action_update_fields( $name, $table ) {
507
  global $wpdb;
@@ -537,13 +540,13 @@ class TInvWL_Activator {
537
  * Apply upgrade action
538
  * Update field table
539
  *
540
- * @global wpdb $wpdb
541
- *
542
  * @param string $name Table name.
543
  * @param array $table Table array.
544
  * @param array $upgrade Upgrade fields.
545
  *
546
  * @return boolean
 
 
547
  */
548
  public static function upgrade_action_update_field( $name, $table, $upgrade ) {
549
  global $wpdb;
@@ -587,13 +590,13 @@ class TInvWL_Activator {
587
  * Apply upgrade action
588
  * Rename field.
589
  *
590
- * @global wpdb $wpdb
591
- *
592
  * @param string $name Table name.
593
  * @param array $table Table array.
594
  * @param array $upgrade Upgrade fields.
595
  *
596
  * @return boolean
 
 
597
  */
598
  public static function upgrade_action_rename_field( $name, $table, $upgrade ) {
599
  global $wpdb;
@@ -627,13 +630,13 @@ class TInvWL_Activator {
627
  * Apply upgrade action
628
  * Use sql.
629
  *
630
- * @global wpdb $wpdb
631
- *
632
  * @param string $name Table name.
633
  * @param array $table Not used.
634
  * @param array $upgrade Upgrade fields.
635
  *
636
  * @return boolean
 
 
637
  */
638
  public static function upgrade_action_sql( $name, $table, $upgrade ) {
639
  global $wpdb;
@@ -648,11 +651,11 @@ class TInvWL_Activator {
648
  /**
649
  * Destroy tables from array
650
  *
651
- * @global wpdb $wpdb
652
- *
653
  * @param type $tables Array tables.
654
  *
655
  * @return boolean
 
 
656
  */
657
  public static function destroy( $tables ) {
658
  global $wpdb;
@@ -688,7 +691,7 @@ class TInvWL_Activator {
688
  'first++' => array( 'BIGINT', null, false, null, true ),
689
  'int_0' => array( 'BIGINT', null, false, 0 ),
690
  'int_1' => array( 'BIGINT', null, false, 1 ),
691
- 'text' => array( 'TEXT' ),
692
  'longtext' => array( 'LONGTEXT' ),
693
  'date' => array( 'DATETIME', null, false, '0000-00-00 00:00:00' ),
694
  'bool' => array( 'TINYINT', 1, false, 1 ),
@@ -698,8 +701,8 @@ class TInvWL_Activator {
698
  /**
699
  * Database
700
  *
701
- * @since 1.0.0
702
  * @return array
 
703
  */
704
  private static function database_1_0_0() {
705
  $t = array(
@@ -740,8 +743,8 @@ class TInvWL_Activator {
740
  /**
741
  * Database
742
  *
743
- * @since 1.5.0
744
  * @return array
 
745
  */
746
  private static function database_1_5_0() {
747
  return array(
@@ -770,8 +773,8 @@ class TInvWL_Activator {
770
  /**
771
  * Database
772
  *
773
- * @since 1.8.13
774
  * @return array
 
775
  */
776
  private static function database_1_8_13() {
777
  $t = array(
@@ -820,6 +823,37 @@ class TInvWL_Activator {
820
  );
821
  }
822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
823
  /**
824
  * Set localisation
825
  */
324
  /**
325
  * Created tables from array
326
  *
 
 
327
  * @param array $tables Array tables.
328
  *
329
  * @return boolean
330
+ * @global wpdb $wpdb
331
+ *
332
  */
333
  public static function create( $tables ) {
334
  global $wpdb;
350
  /**
351
  * Upgrade tables from array
352
  *
 
 
353
  * @param array $tables Array tables.
354
  *
355
  * @return boolean
356
+ * @global wpdb $wpdb
357
+ *
358
  */
359
  public static function upgrade( $tables ) {
360
 
372
  /**
373
  * Get columns for exist table.
374
  *
 
 
375
  * @param string $name Table name.
376
  *
377
  * @return array
378
+ * @global wpdb $wpdb
379
+ *
380
  */
381
  public static function upgrade_get_columns( $name ) {
382
  global $wpdb;
393
  /**
394
  * Apply upgrade action
395
  *
 
 
396
  * @param string $name Name Table.
397
  * @param array $table Structured array table.
398
  *
399
  * @return boolean
400
+ * @global wpdb $wpdb
401
+ *
402
  */
403
  public static function upgrade_action( $name, $table ) {
404
 
445
  * Apply upgrade action
446
  * Truncate table
447
  *
448
+ * @param string $name Table name.
449
+ *
450
  * @global wpdb $wpdb
451
  *
 
452
  */
453
  public static function upgrade_action_truncate( $name ) {
454
  global $wpdb;
459
  * Apply upgrade action
460
  * Drop table
461
  *
462
+ * @param string $name Table name.
463
+ *
464
  * @global wpdb $wpdb
465
  *
 
466
  */
467
  public static function upgrade_action_drop( $name ) {
468
  global $wpdb;
474
  * Apply upgrade action
475
  * Rename table
476
  *
 
 
477
  * @param string $name Table name.
478
  * @param array $table Not used.
479
  * @param array $upgrade Upgrade fields.
480
  *
481
  * @return boolean
482
+ * @global wpdb $wpdb
483
+ *
484
  */
485
  public static function upgrade_action_rename_table( $name, $table, $upgrade ) {
486
  global $wpdb;
500
  * Apply upgrade action
501
  * Update fields table
502
  *
 
 
503
  * @param string $name Table name.
504
  * @param array $table Table array.
505
+ *
506
+ * @global wpdb $wpdb
507
+ *
508
  */
509
  public static function upgrade_action_update_fields( $name, $table ) {
510
  global $wpdb;
540
  * Apply upgrade action
541
  * Update field table
542
  *
 
 
543
  * @param string $name Table name.
544
  * @param array $table Table array.
545
  * @param array $upgrade Upgrade fields.
546
  *
547
  * @return boolean
548
+ * @global wpdb $wpdb
549
+ *
550
  */
551
  public static function upgrade_action_update_field( $name, $table, $upgrade ) {
552
  global $wpdb;
590
  * Apply upgrade action
591
  * Rename field.
592
  *
 
 
593
  * @param string $name Table name.
594
  * @param array $table Table array.
595
  * @param array $upgrade Upgrade fields.
596
  *
597
  * @return boolean
598
+ * @global wpdb $wpdb
599
+ *
600
  */
601
  public static function upgrade_action_rename_field( $name, $table, $upgrade ) {
602
  global $wpdb;
630
  * Apply upgrade action
631
  * Use sql.
632
  *
 
 
633
  * @param string $name Table name.
634
  * @param array $table Not used.
635
  * @param array $upgrade Upgrade fields.
636
  *
637
  * @return boolean
638
+ * @global wpdb $wpdb
639
+ *
640
  */
641
  public static function upgrade_action_sql( $name, $table, $upgrade ) {
642
  global $wpdb;
651
  /**
652
  * Destroy tables from array
653
  *
 
 
654
  * @param type $tables Array tables.
655
  *
656
  * @return boolean
657
+ * @global wpdb $wpdb
658
+ *
659
  */
660
  public static function destroy( $tables ) {
661
  global $wpdb;
691
  'first++' => array( 'BIGINT', null, false, null, true ),
692
  'int_0' => array( 'BIGINT', null, false, 0 ),
693
  'int_1' => array( 'BIGINT', null, false, 1 ),
694
+ 'text' => array( 'TEXT', null, true, null ),
695
  'longtext' => array( 'LONGTEXT' ),
696
  'date' => array( 'DATETIME', null, false, '0000-00-00 00:00:00' ),
697
  'bool' => array( 'TINYINT', 1, false, 1 ),
701
  /**
702
  * Database
703
  *
 
704
  * @return array
705
+ * @since 1.0.0
706
  */
707
  private static function database_1_0_0() {
708
  $t = array(
743
  /**
744
  * Database
745
  *
 
746
  * @return array
747
+ * @since 1.5.0
748
  */
749
  private static function database_1_5_0() {
750
  return array(
773
  /**
774
  * Database
775
  *
 
776
  * @return array
777
+ * @since 1.8.13
778
  */
779
  private static function database_1_8_13() {
780
  $t = array(
823
  );
824
  }
825
 
826
+ /**
827
+ * Database
828
+ *
829
+ * @return array
830
+ * @since 1.9.16
831
+ */
832
+ private static function database_1_9_16() {
833
+
834
+ return array(
835
+ 'items' => array(
836
+ 'field' => array(
837
+ 'ID' => 'first++',
838
+ 'wishlist_id' => 'int_0',
839
+ 'product_id' => 'int_0',
840
+ 'variation_id' => 'int_0',
841
+ 'formdata' => 'text',
842
+ 'author' => 'int_0',
843
+ 'date' => 'date',
844
+ 'quantity' => 'int_1',
845
+ 'price' => array( 'VARCHAR', 255, false, 0 ),
846
+ 'in_stock' => 'bool',
847
+ ),
848
+ 'upgrade' => array(
849
+ array(
850
+ 'action' => 'update_fields',
851
+ ),
852
+ ),
853
+ ),
854
+ );
855
+ }
856
+
857
  /**
858
  * Set localisation
859
  */
includes/product.helper.php CHANGED
@@ -44,10 +44,11 @@ class TInvWL_Product {
44
  /**
45
  * Constructor
46
  *
47
- * @global wpdb $wpdb
48
- *
49
  * @param array $wishlist Object wishlist.
50
  * @param string $plugin_name Plugin name.
 
 
 
51
  */
52
  function __construct( $wishlist = array(), $plugin_name = TINVWL_PREFIX ) {
53
  global $wpdb;
@@ -129,23 +130,25 @@ class TInvWL_Product {
129
  /**
130
  * Add product
131
  *
132
- * @global wpdb $wpdb
133
- *
134
  * @param array $data Object product.
135
  * @param array $meta Object meta form data.
136
  *
137
  * @return boolean
 
 
138
  */
139
  function add( $data = array(), $meta = array() ) {
 
140
  $default = array(
 
 
 
 
141
  'author' => $this->user,
142
  'date' => current_time( 'Y-m-d H:i:s' ),
143
- 'in_stock' => false,
144
- 'price' => 0,
145
- 'product_id' => 0,
146
  'quantity' => 1,
147
- 'variation_id' => 0,
148
- 'wishlist_id' => $this->wishlist_id(),
149
  );
150
  $data = filter_var_array( $data, apply_filters( 'tinvwl_wishlist_product_add_field', array(
151
  'author' => FILTER_VALIDATE_INT,
@@ -172,12 +175,10 @@ class TInvWL_Product {
172
  $data['quantity'] = 1;
173
  }
174
 
175
- $data = apply_filters( 'tinvwl_wishlist_product_add', $data );
176
- $data['product_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
177
- $data['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
178
- $data['in_stock'] = $product_data->is_in_stock();
179
- $data['price'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price() );
180
- $data['formdata'] = $this->prepare_save_meta( $meta, $data['product_id'], $data['variation_id'] );
181
 
182
  global $wpdb;
183
  if ( $wpdb->insert( $this->table, $data ) ) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
@@ -259,11 +260,11 @@ class TInvWL_Product {
259
  /**
260
  * Get products
261
  *
262
- * @global wpdb $wpdb
263
- *
264
  * @param array $data Request.
265
  *
266
  * @return array
 
 
267
  */
268
  function get( $data = array() ) {
269
  global $wpdb;
@@ -421,12 +422,12 @@ class TInvWL_Product {
421
  /**
422
  * Update product
423
  *
424
- * @global wpdb $wpdb
425
- *
426
  * @param array $data Object product.
427
  * @param array $meta Object meta form data.
428
  *
429
  * @return boolean
 
 
430
  */
431
  function update( $data = array(), $meta = array() ) {
432
  if ( empty( $meta ) && array_key_exists( 'meta', $data ) && ! empty( $data['meta'] ) ) {
@@ -461,11 +462,9 @@ class TInvWL_Product {
461
  $data['quantity'] = 1;
462
  }
463
 
464
- $data = apply_filters( 'tinvwl_wishlist_product_update', $data );
465
- $data['product_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
466
- $data['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
467
- $data['in_stock'] = $product_data->is_in_stock();
468
- $data['price'] = version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price();
469
 
470
  global $wpdb;
471
 
@@ -480,14 +479,14 @@ class TInvWL_Product {
480
  /**
481
  * Remove product from wishlist
482
  *
483
- * @global wpdb $wpdb
484
- *
485
  * @param integer $wishlist_id If exist wishlist object, you can put 0.
486
  * @param integer $product_id Product id.
487
  * @param integer $variation_id Product variation id.
488
  * @param array $meta Object meta form data.
489
  *
490
  * @return boolean
 
 
491
  */
492
  function remove_product_from_wl( $wishlist_id = 0, $product_id = 0, $variation_id = 0, $meta = array() ) {
493
  global $wpdb;
@@ -521,11 +520,11 @@ class TInvWL_Product {
521
  /**
522
  * Remove product
523
  *
524
- * @global wpdb $wpdb
525
- *
526
  * @param integer $product_id Product id.
527
  *
528
  * @return boolean
 
 
529
  */
530
  function remove_product( $product_id = 0 ) {
531
  if ( empty( $product_id ) ) {
@@ -544,11 +543,11 @@ class TInvWL_Product {
544
  /**
545
  * Remove product by ID
546
  *
547
- * @global wpdb $wpdb
548
- *
549
  * @param array $data Product data.
550
  *
551
  * @return boolean
 
 
552
  */
553
  function remove( $data ) {
554
  if ( ! isset( $data['ID'] ) || empty( $data['ID'] ) ) {
44
  /**
45
  * Constructor
46
  *
 
 
47
  * @param array $wishlist Object wishlist.
48
  * @param string $plugin_name Plugin name.
49
+ *
50
+ * @global wpdb $wpdb
51
+ *
52
  */
53
  function __construct( $wishlist = array(), $plugin_name = TINVWL_PREFIX ) {
54
  global $wpdb;
130
  /**
131
  * Add product
132
  *
 
 
133
  * @param array $data Object product.
134
  * @param array $meta Object meta form data.
135
  *
136
  * @return boolean
137
+ * @global wpdb $wpdb
138
+ *
139
  */
140
  function add( $data = array(), $meta = array() ) {
141
+
142
  $default = array(
143
+ 'wishlist_id' => $this->wishlist_id(),
144
+ 'product_id' => 0,
145
+ 'variation_id' => 0,
146
+ 'formdata' => '',
147
  'author' => $this->user,
148
  'date' => current_time( 'Y-m-d H:i:s' ),
 
 
 
149
  'quantity' => 1,
150
+ 'price' => 0,
151
+ 'in_stock' => 1,
152
  );
153
  $data = filter_var_array( $data, apply_filters( 'tinvwl_wishlist_product_add_field', array(
154
  'author' => FILTER_VALIDATE_INT,
175
  $data['quantity'] = 1;
176
  }
177
 
178
+ $data = apply_filters( 'tinvwl_wishlist_product_add', $data );
179
+ $data['in_stock'] = $product_data->is_in_stock();
180
+ $data['price'] = filter_var( ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price() ), FILTER_VALIDATE_FLOAT );
181
+ $data['formdata'] = $this->prepare_save_meta( $meta, $data['product_id'], $data['variation_id'] );
 
 
182
 
183
  global $wpdb;
184
  if ( $wpdb->insert( $this->table, $data ) ) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
260
  /**
261
  * Get products
262
  *
 
 
263
  * @param array $data Request.
264
  *
265
  * @return array
266
+ * @global wpdb $wpdb
267
+ *
268
  */
269
  function get( $data = array() ) {
270
  global $wpdb;
422
  /**
423
  * Update product
424
  *
 
 
425
  * @param array $data Object product.
426
  * @param array $meta Object meta form data.
427
  *
428
  * @return boolean
429
+ * @global wpdb $wpdb
430
+ *
431
  */
432
  function update( $data = array(), $meta = array() ) {
433
  if ( empty( $meta ) && array_key_exists( 'meta', $data ) && ! empty( $data['meta'] ) ) {
462
  $data['quantity'] = 1;
463
  }
464
 
465
+ $data = apply_filters( 'tinvwl_wishlist_product_update', $data );
466
+ $data['in_stock'] = $product_data->is_in_stock();
467
+ $data['price'] = filter_var( ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price() ), FILTER_VALIDATE_FLOAT );
 
 
468
 
469
  global $wpdb;
470
 
479
  /**
480
  * Remove product from wishlist
481
  *
 
 
482
  * @param integer $wishlist_id If exist wishlist object, you can put 0.
483
  * @param integer $product_id Product id.
484
  * @param integer $variation_id Product variation id.
485
  * @param array $meta Object meta form data.
486
  *
487
  * @return boolean
488
+ * @global wpdb $wpdb
489
+ *
490
  */
491
  function remove_product_from_wl( $wishlist_id = 0, $product_id = 0, $variation_id = 0, $meta = array() ) {
492
  global $wpdb;
520
  /**
521
  * Remove product
522
  *
 
 
523
  * @param integer $product_id Product id.
524
  *
525
  * @return boolean
526
+ * @global wpdb $wpdb
527
+ *
528
  */
529
  function remove_product( $product_id = 0 ) {
530
  if ( empty( $product_id ) ) {
543
  /**
544
  * Remove product by ID
545
  *
 
 
546
  * @param array $data Product data.
547
  *
548
  * @return boolean
549
+ * @global wpdb $wpdb
550
+ *
551
  */
552
  function remove( $data ) {
553
  if ( ! isset( $data['ID'] ) || empty( $data['ID'] ) ) {
includes/wizard.class.php CHANGED
@@ -1,526 +1,532 @@
1
- <?php
2
- /**
3
- * Wizard installation plugin helper
4
- *
5
- * @since 1.0.0
6
- * @package TInvWishlist
7
- */
8
-
9
- // If this file is called directly, abort.
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- die;
12
- }
13
-
14
- /**
15
- * Wizard installation plugin helper
16
- */
17
- class TInvWL_Wizard {
18
-
19
- /**
20
- * Plugin name
21
- *
22
- * @var string
23
- */
24
- public $_name;
25
-
26
- /**
27
- * Plugin version
28
- *
29
- * @var string
30
- */
31
- public $_version;
32
-
33
- /**
34
- * Constructor
35
- *
36
- * @param string $plugin_name Plugin name.
37
- * @param string $version Plugin version.
38
- */
39
- function __construct( $plugin_name, $version ) {
40
- $this->_name = $plugin_name;
41
- $this->_version = $version;
42
- if ( apply_filters( $this->_name . '_enable_wizard', true ) ) {
43
- $this->define_hooks();
44
- }
45
- update_option( $this->_name . '_wizard', true );
46
- }
47
-
48
- /**
49
- * Define hooks
50
- */
51
- function define_hooks() {
52
- add_action( 'admin_menu', array( $this, 'action_menu' ) );
53
- add_action( 'admin_init', array( $this, 'wizard' ) );
54
- }
55
-
56
- /**
57
- * Create admin page for wizard
58
- */
59
- function action_menu() {
60
- add_dashboard_page( '', '', 'manage_options', 'tinvwl-wizard', '' );
61
- }
62
-
63
- /**
64
- * Apply render wizard steps and save previous step
65
- *
66
- * @return void
67
- */
68
- function wizard() {
69
- $page = filter_input( INPUT_GET, 'page' );
70
- if ( 'tinvwl-wizard' !== $page ) {
71
- return;
72
- }
73
-
74
- $this->page = filter_input( INPUT_GET, 'step', FILTER_VALIDATE_INT, array(
75
- 'default' => 0,
76
- 'min_range' => 0,
77
- ) );
78
- if ( empty( $this->page ) ) {
79
- $this->page = 'intro';
80
- }
81
- if ( ! method_exists( $this, __FUNCTION__ . '_' . $this->page ) ) {
82
- $this->page = 'finish';
83
- }
84
- if ( method_exists( $this, __FUNCTION__ . '_' . $this->page ) ) {
85
- $this->method = __FUNCTION__ . '_' . $this->page;
86
- }
87
-
88
- // Run save form.
89
- $referer = wp_get_referer();
90
- if ( $referer ) {
91
- $url_attr = wp_parse_url( $referer );
92
- if ( array_key_exists( 'query', (array) $url_attr ) ) {
93
- parse_str( $url_attr['query'], $url_attr );
94
- } else {
95
- $url_attr['step'] = 0;
96
- }
97
- $url_attr = filter_var_array( $url_attr, array(
98
- 'step' => array(
99
- 'filter' => FILTER_VALIDATE_INT,
100
- 'default' => 0,
101
- 'min_range' => 0,
102
- ),
103
- ) );
104
- if ( empty( $url_attr['step'] ) ) {
105
- $url_attr['step'] = 'intro';
106
- }
107
- $method = __FUNCTION__ . '_' . $url_attr['step'] . '_save';
108
- if ( ! method_exists( $this, $method ) ) {
109
- $method = __FUNCTION__ . '_finish_save';
110
- }
111
- if ( method_exists( $this, $method ) ) {
112
- $nonce = filter_input( 0, '_wpnonce' );
113
- if ( $nonce && wp_verify_nonce( $nonce, sprintf( '%s-setup-%s', $this->_name, $url_attr['step'] ) ) ) {
114
- $this->$method();
115
- }
116
- }
117
- }
118
-
119
- ob_start();
120
- $this->load_header();
121
- $this->load_content();
122
- $this->load_footer();
123
- exit;
124
- }
125
-
126
- /**
127
- * Create index next page
128
- *
129
- * @return string
130
- */
131
- private function next_page() {
132
- $index = $this->page;
133
- if ( 'finish' === $index ) {
134
- return '';
135
- } elseif ( 'intro' === $index ) {
136
- $index = 0;
137
- }
138
- $index ++;
139
-
140
- return 'index.php?' . http_build_query( array(
141
- 'page' => 'tinvwl-wizard',
142
- 'step' => $index,
143
- ) );
144
- }
145
-
146
- /**
147
- * Output header wizard page
148
- */
149
- function load_header() {
150
- $this->enqueue_styles();
151
- $this->enqueue_scripts();
152
- $content = $title = '';
153
- $method = $this->method . '_title';
154
- if ( method_exists( $this, $method ) ) {
155
- $title = $this->$method();
156
- }
157
- $method = $this->method . '_header';
158
- if ( method_exists( $this, $method ) ) {
159
- ob_start();
160
- $this->$method();
161
- $content = ob_get_clean();
162
- }
163
-
164
- TInvWL_View::view( 'header', array(
165
- 'title' => $title,
166
- 'content' => $content,
167
- 'page' => $this->page,
168
- 'list_steps' => $this->get_list_steps(),
169
- ), 'wizard' );
170
- }
171
-
172
- /**
173
- * Load style
174
- */
175
- function enqueue_styles() {
176
- wp_enqueue_style( 'gfonts', ( is_ssl() ? 'https' : 'http' ) . '://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800', '', null, 'all' );
177
- wp_enqueue_style( $this->_name, TINVWL_URL . 'assets/css/admin.css', array(), $this->_version, 'all' );
178
- wp_enqueue_style( $this->_name . '-form', TINVWL_URL . 'assets/css/admin-form.css', array(), $this->_version, 'all' );
179
- wp_enqueue_style( $this->_name . '-setup', TINVWL_URL . 'assets/css/admin-setup.css', array(
180
- 'dashicons',
181
- 'install'
182
- ), $this->_version, 'all' );
183
- }
184
-
185
- /**
186
- * Load javascript
187
- */
188
- function enqueue_scripts() {
189
- wp_enqueue_script( $this->_name, TINVWL_URL . 'assets/js/admin.js', array( 'jquery' ), $this->_version, 'all' );
190
- }
191
-
192
- /**
193
- * Output content wizard page
194
- */
195
- function load_content() {
196
- ?>
197
- <div class="<?php echo esc_attr( sprintf( '%s-content', $this->_name ) ); ?>">
198
- <form method="POST" action="<?php echo esc_url( admin_url( $this->next_page() ) ) ?>">
199
- <?php
200
- $method = $this->method;
201
- if ( method_exists( $this, $method ) ) {
202
- $this->$method();
203
- }
204
- wp_nonce_field( sprintf( '%s-setup-%s', $this->_name, $this->page ) );
205
- ?>
206
- </form>
207
- </div>
208
- <?php
209
- }
210
-
211
- /**
212
- * Get titles steps
213
- *
214
- * @return array
215
- */
216
- function get_list_steps() {
217
- $lists = get_class_methods( $this );
218
- foreach ( $lists as $key => $value ) {
219
- if ( ! preg_match( '/^wizard_[^_]+_title$/i', $value ) ) {
220
- unset( $lists[ $key ] );
221
- }
222
- }
223
- sort( $lists );
224
-
225
- $steps = array();
226
- foreach ( $lists as $method ) {
227
- $key = preg_replace( '/(^wizard_|_title$)/i', '', $method );
228
- if ( 'intro' == $key ) { // WPCS: loose comparison ok.
229
- $key = 0;
230
- } elseif ( 'finish' == $key ) { // WPCS: loose comparison ok.
231
- $key = count( $lists ) - 1;
232
- }
233
- $steps[ $key ] = $this->$method();
234
- }
235
- ksort( $steps );
236
-
237
- return $steps;
238
- }
239
-
240
- /**
241
- * Output footer wizard page
242
- */
243
- function load_footer() {
244
- $content = '';
245
- $method = $this->method . '_footer';
246
- if ( method_exists( $this, $method ) ) {
247
- ob_start();
248
- $this->$method();
249
- $content = ob_get_clean();
250
- }
251
-
252
- TInvWL_View::view( 'footer', array(
253
- 'content' => $content,
254
- 'page' => $this->page,
255
- ), 'wizard' );
256
- }
257
-
258
- /**
259
- * Title intro
260
- *
261
- * @return string
262
- */
263
- function wizard_intro_title() {
264
- return __( 'Introduction', 'ti-woocommerce-wishlist' );
265
- }
266
-
267
- /**
268
- * Content intro
269
- */
270
- function wizard_intro() {
271
- TInvWL_View::view( 'intro', array(), 'wizard' );
272
- }
273
-
274
- /**
275
- * Title step 1
276
- *
277
- * @return string
278
- */
279
- function wizard_1_title() {
280
- return __( 'Page Setup', 'ti-woocommerce-wishlist' );
281
- }
282
-
283
- /**
284
- * Content step 1
285
- */
286
- function wizard_1() {
287
- $title_pages = array(
288
- 'wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
289
- );
290
- $lists = get_pages( array( 'number' => 999999 ) ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.get_pages
291
- $page_list = array(
292
- '' => __( 'Create Automatically', 'ti-woocommerce-wishlist' ),
293
- - 100 => __( 'Create new Page', 'ti-woocommerce-wishlist' ),
294
- );
295
- $page_name = array();
296
- foreach ( $lists as $list ) {
297
- $page_list[ $list->ID ] = $list->post_title;
298
- $page_name[ $list->post_name ] = $list->ID;
299
- }
300
- $data = array(
301
- 'general_default_title_value' => apply_filters( 'tinvwl-general-default_title', tinv_get_option( 'general', 'default_title' ) ),
302
- );
303
- foreach ( $title_pages as $key => $text ) {
304
- $_data['options'] = $page_list;
305
- $_data['new_value'] = $text;
306
- $_data['value'] = tinv_get_option( 'page', $key ) ? tinv_get_option( 'page', $key ) : '';
307
- $_data['error'] = array_key_exists( ( 'wishlist' === $key ? $key : 'wishlist-' . $key ), $page_name );
308
-
309
- $data['page_pages'][ $key ] = $_data;
310
- }
311
- TInvWL_View::view( 'step-page', $data, 'wizard' );
312
- }
313
-
314
- /**
315
- * Save content step 1
316
- */
317
- function wizard_1_save() {
318
- $title_pages = array(
319
- 'wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
320
- );
321
- $shortcode_pages = array(
322
- 'wishlist' => '[ti_wishlistsview]',
323
- );
324
- $data = array(
325
- 'general_default_title' => FILTER_SANITIZE_STRING,
326
- );
327
- foreach ( $title_pages as $key => $text ) {
328
- $data[ 'page_' . $key ] = FILTER_VALIDATE_INT;
329
- $data[ 'page_' . $key . '_new' ] = FILTER_SANITIZE_STRING;
330
- $data[ 'page_' . $key . '_auto' ] = FILTER_VALIDATE_BOOLEAN;
331
- }
332
- $data = filter_input_array( INPUT_POST, $data );
333
- if ( ! empty( $data['general_default_title'] ) ) {
334
- tinv_update_option( 'general', 'default_title', $data['general_default_title'] );
335
- }
336
-
337
- $required = array( 'wishlist' );
338
- $required_notsets = array();
339
- foreach ( $title_pages as $key => $title ) {
340
- $shortcode = $shortcode_pages[ $key ];
341
- $auto = $data[ sprintf( 'page_%s_auto', $key ) ];
342
- $title_new = $data[ sprintf( 'page_%s_new', $key ) ];
343
- $page = $data[ sprintf( 'page_%s', $key ) ];
344
-
345
- $the_page_id = 0;
346
- if ( ( empty( $page ) && $auto ) || ( is_integer( $page ) && - 100 === $page ) ) {
347
- if ( - 100 === $page ) {
348
- $title = empty( $title_new ) ? $title : $title_new;
349
- }
350
- $title = apply_filters( 'tinvwl_create_new_page_post_title', $title, $key );
351
-
352
- $_page = array(
353
- 'post_title' => $title,
354
- 'post_content' => $shortcode,
355
- 'post_status' => '',
356
- 'post_name' => 'wishlist' === $key ? $key : 'wishlist-' . $key,
357
- 'post_type' => 'page',
358
- 'comment_status' => 'closed',
359
- 'ping_status' => 'closed',
360
- 'post_category' => array( 1 ),
361
- );
362
- if ( - 100 === $page ) {
363
- unset( $_page['post_name'] );
364
- }
365
- $the_page_id = wp_insert_post( $_page );
366
- } elseif ( is_integer( $page ) && 0 < $page ) {
367
- $the_page_id = $page;
368
- }
369
-
370
- if ( 0 < $the_page_id ) {
371
- $the_page = get_post( $the_page_id );
372
- $the_page->post_content = $shortcode;
373
- $the_page->post_status = 'publish';
374
- $the_page_id = wp_update_post( $the_page );
375
- tinv_update_option( 'page', $key, $the_page_id );
376
- } else {
377
- tinv_update_option( 'page', $key, '' );
378
- if ( in_array( $key, $required ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
379
- $required_notsets[] = $key;
380
- }
381
- }
382
- } // End foreach().
383
- if ( ! empty( $required_notsets ) ) {
384
- wp_safe_redirect( wp_get_referer() );
385
- exit;
386
- } else {
387
- TInvWL_Public_TInvWL::update_rewrite_rules();
388
- }
389
- }
390
-
391
- /**
392
- * Title step 2
393
- *
394
- * @return string
395
- */
396
- function wizard_2_title() {
397
- return __( 'Button', 'ti-woocommerce-wishlist' );
398
- }
399
-
400
- /**
401
- * Content step 2
402
- */
403
- function wizard_2() {
404
-
405
- $data = array(
406
- 'add_to_wishlist_position_value' => tinv_get_option( 'add_to_wishlist', 'position' ),
407
- 'add_to_wishlist_position_options' => array(
408
- 'after' => __( 'After "Add to Cart" button', 'ti-woocommerce-wishlist' ),
409
- 'before' => __( 'Before "Add to Cart" button', 'ti-woocommerce-wishlist' ),
410
- 'shortcode' => __( 'Custom position with code', 'ti-woocommerce-wishlist' ),
411
- ),
412
- 'add_to_wishlist_text_value' => tinv_get_option( 'add_to_wishlist', 'text' ),
413
- 'add_to_wishlist_catalog_show_in_loop_value' => tinv_get_option( 'add_to_wishlist_catalog', 'show_in_loop' ),
414
- 'add_to_wishlist_catalog_text_value' => tinv_get_option( 'add_to_wishlist_catalog', 'text' ),
415
- );
416
- TInvWL_View::view( 'step-button', $data, 'wizard' );
417
- }
418
-
419
- /**
420
- * Save content step 2
421
- */
422
- function wizard_2_save() {
423
- $data = filter_input_array( INPUT_POST, array(
424
- 'add_to_wishlist_position' => FILTER_SANITIZE_STRING,
425
- 'add_to_wishlist_text' => FILTER_SANITIZE_STRING,
426
- 'add_to_wishlist_catalog_show_in_loop' => FILTER_VALIDATE_BOOLEAN,
427
- 'add_to_wishlist_catalog_text' => FILTER_SANITIZE_STRING,
428
- ) );
429
- tinv_update_option( 'add_to_wishlist', 'position', $data['add_to_wishlist_position'] );
430
- tinv_update_option( 'add_to_wishlist', 'text', $data['add_to_wishlist_text'] );
431
- tinv_update_option( 'add_to_wishlist_catalog', 'show_in_loop', (bool) $data['add_to_wishlist_catalog_show_in_loop'] );
432
- tinv_update_option( 'add_to_wishlist_catalog', 'text', $data['add_to_wishlist_catalog_text'] );
433
- }
434
-
435
- /**
436
- * Title step 3
437
- *
438
- * @return string
439
- */
440
- function wizard_3_title() {
441
- return __( 'Processing', 'ti-woocommerce-wishlist' );
442
- }
443
-
444
- /**
445
- * Content step 3
446
- */
447
- function wizard_3() {
448
- $data = array(
449
- 'processing_autoremove_value' => tinv_get_option( 'processing', 'autoremove' ) ? 'auto' : 'manual',
450
- 'processing_autoremove_options' => array(
451
- 'auto' => __( 'Automatically', 'ti-woocommerce-wishlist' ),
452
- 'manual' => __( 'Manual', 'ti-woocommerce-wishlist' ),
453
- ),
454
- );
455
- TInvWL_View::view( 'step-processing', $data, 'wizard' );
456
- }
457
-
458
- /**
459
- * Save content step 3
460
- */
461
- function wizard_3_save() {
462
- $data = filter_input_array( INPUT_POST, array(
463
- 'processing_autoremove' => FILTER_SANITIZE_STRING,
464
- ) );
465
- $autoremove = 'auto' === $data['processing_autoremove'];
466
- tinv_update_option( 'processing', 'autoremove', $autoremove );
467
- tinv_update_option( 'processing', 'autoremove_status', 'tinvwl-addcart' );
468
- }
469
-
470
- /**
471
- * Title step 4
472
- *
473
- * @return string
474
- */
475
- function wizard_4_title() {
476
- return __( 'Share', 'ti-woocommerce-wishlist' );
477
- }
478
-
479
- /**
480
- * Content step 4
481
- */
482
- function wizard_4() {
483
- $data = array(
484
- 'social_facebook_value' => tinv_get_option( 'social', 'facebook' ),
485
- 'social_twitter_value' => tinv_get_option( 'social', 'twitter' ),
486
- 'social_pinterest_value' => tinv_get_option( 'social', 'pinterest' ),
487
- 'social_google_value' => tinv_get_option( 'social', 'google' ),
488
- 'social_email_value' => tinv_get_option( 'social', 'email' ),
489
- );
490
- TInvWL_View::view( 'step-social', $data, 'wizard' );
491
- }
492
-
493
- /**
494
- * Save content step 4
495
- */
496
- function wizard_4_save() {
497
- $data = filter_input_array( INPUT_POST, array(
498
- 'social_facebook' => FILTER_VALIDATE_BOOLEAN,
499
- 'social_twitter' => FILTER_VALIDATE_BOOLEAN,
500
- 'social_pinterest' => FILTER_VALIDATE_BOOLEAN,
501
- 'social_google' => FILTER_VALIDATE_BOOLEAN,
502
- 'social_email' => FILTER_VALIDATE_BOOLEAN,
503
- ) );
504
- tinv_update_option( 'social', 'facebook', (bool) $data['social_facebook'] );
505
- tinv_update_option( 'social', 'twitter', (bool) $data['social_twitter'] );
506
- tinv_update_option( 'social', 'pinterest', (bool) $data['social_pinterest'] );
507
- tinv_update_option( 'social', 'google', (bool) $data['social_google'] );
508
- tinv_update_option( 'social', 'email', (bool) $data['social_email'] );
509
- }
510
-
511
- /**
512
- * Title finish
513
- *
514
- * @return string
515
- */
516
- function wizard_finish_title() {
517
- return __( 'Ready!', 'ti-woocommerce-wishlist' );
518
- }
519
-
520
- /**
521
- * Content finish
522
- */
523
- function wizard_finish() {
524
- TInvWL_View::view( 'finish', array(), 'wizard' );
525
- }
526
- }
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Wizard installation plugin helper
4
+ *
5
+ * @since 1.0.0
6
+ * @package TInvWishlist
7
+ */
8
+
9
+ // If this file is called directly, abort.
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ die;
12
+ }
13
+
14
+ /**
15
+ * Wizard installation plugin helper
16
+ */
17
+ class TInvWL_Wizard {
18
+
19
+ /**
20
+ * Plugin name
21
+ *
22
+ * @var string
23
+ */
24
+ public $_name;
25
+
26
+ /**
27
+ * Plugin version
28
+ *
29
+ * @var string
30
+ */
31
+ public $_version;
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @param string $plugin_name Plugin name.
37
+ * @param string $version Plugin version.
38
+ */
39
+ function __construct( $plugin_name, $version ) {
40
+ $this->_name = $plugin_name;
41
+ $this->_version = $version;
42
+ if ( apply_filters( $this->_name . '_enable_wizard', true ) ) {
43
+ $this->define_hooks();
44
+ }
45
+ update_option( $this->_name . '_wizard', true );
46
+ }
47
+
48
+ /**
49
+ * Define hooks
50
+ */
51
+ function define_hooks() {
52
+ add_action( 'admin_menu', array( $this, 'action_menu' ) );
53
+ add_action( 'admin_init', array( $this, 'wizard' ) );
54
+ }
55
+
56
+ /**
57
+ * Create admin page for wizard
58
+ */
59
+ function action_menu() {
60
+ add_dashboard_page( '', '', 'manage_options', 'tinvwl-wizard', '' );
61
+ }
62
+
63
+ /**
64
+ * Apply render wizard steps and save previous step
65
+ *
66
+ * @return void
67
+ */
68
+ function wizard() {
69
+ $page = filter_input( INPUT_GET, 'page' );
70
+ if ( 'tinvwl-wizard' !== $page ) {
71
+ return;
72
+ }
73
+
74
+ $this->page = filter_input( INPUT_GET, 'step', FILTER_VALIDATE_INT, array(
75
+ 'default' => 0,
76
+ 'min_range' => 0,
77
+ ) );
78
+ if ( empty( $this->page ) ) {
79
+ $this->page = 'intro';
80
+ }
81
+ if ( ! method_exists( $this, __FUNCTION__ . '_' . $this->page ) ) {
82
+ $this->page = 'finish';
83
+ }
84
+ if ( method_exists( $this, __FUNCTION__ . '_' . $this->page ) ) {
85
+ $this->method = __FUNCTION__ . '_' . $this->page;
86
+ }
87
+
88
+ // Run save form.
89
+ $referer = wp_get_referer();
90
+ if ( $referer ) {
91
+ $url_attr = wp_parse_url( $referer );
92
+ if ( array_key_exists( 'query', (array) $url_attr ) ) {
93
+ parse_str( $url_attr['query'], $url_attr );
94
+ } else {
95
+ $url_attr['step'] = 0;
96
+ }
97
+ $url_attr = filter_var_array( $url_attr, array(
98
+ 'step' => array(
99
+ 'filter' => FILTER_VALIDATE_INT,
100
+ 'default' => 0,
101
+ 'min_range' => 0,
102
+ ),
103
+ ) );
104
+ if ( empty( $url_attr['step'] ) ) {
105
+ $url_attr['step'] = 'intro';
106
+ }
107
+ $method = __FUNCTION__ . '_' . $url_attr['step'] . '_save';
108
+ if ( ! method_exists( $this, $method ) ) {
109
+ $method = __FUNCTION__ . '_finish_save';
110
+ }
111
+ if ( method_exists( $this, $method ) ) {
112
+ $nonce = filter_input( 0, '_wpnonce' );
113
+ if ( $nonce && wp_verify_nonce( $nonce, sprintf( '%s-setup-%s', $this->_name, $url_attr['step'] ) ) ) {
114
+ $this->$method();
115
+ }
116
+ }
117
+ }
118
+
119
+ ob_start();
120
+ $this->load_header();
121
+ $this->load_content();
122
+ $this->load_footer();
123
+ exit;
124
+ }
125
+
126
+ /**
127
+ * Create index next page
128
+ *
129
+ * @return string
130
+ */
131
+ private function next_page() {
132
+ $index = $this->page;
133
+ if ( 'finish' === $index ) {
134
+ return '';
135
+ } elseif ( 'intro' === $index ) {
136
+ $index = 0;
137
+ }
138
+ $index ++;
139
+
140
+ return 'index.php?' . http_build_query( array(
141
+ 'page' => 'tinvwl-wizard',
142
+ 'step' => $index,
143
+ ) );
144
+ }
145
+
146
+ /**
147
+ * Output header wizard page
148
+ */
149
+ function load_header() {
150
+ $this->enqueue_styles();
151
+ $this->enqueue_scripts();
152
+ $content = $title = '';
153
+ $method = $this->method . '_title';
154
+ if ( method_exists( $this, $method ) ) {
155
+ $title = $this->$method();
156
+ }
157
+ $method = $this->method . '_header';
158
+ if ( method_exists( $this, $method ) ) {
159
+ ob_start();
160
+ $this->$method();
161
+ $content = ob_get_clean();
162
+ }
163
+
164
+ TInvWL_View::view( 'header', array(
165
+ 'title' => $title,
166
+ 'content' => $content,
167
+ 'page' => $this->page,
168
+ 'list_steps' => $this->get_list_steps(),
169
+ ), 'wizard' );
170
+ }
171
+
172
+ /**
173
+ * Load style
174
+ */
175
+ function enqueue_styles() {
176
+ wp_enqueue_style( 'gfonts', ( is_ssl() ? 'https' : 'http' ) . '://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800', '', null, 'all' );
177
+ wp_enqueue_style( $this->_name, TINVWL_URL . 'assets/css/admin.css', array(), $this->_version, 'all' );
178
+ wp_enqueue_style( $this->_name . '-form', TINVWL_URL . 'assets/css/admin-form.css', array(), $this->_version, 'all' );
179
+ wp_enqueue_style( $this->_name . '-setup', TINVWL_URL . 'assets/css/admin-setup.css', array(
180
+ 'dashicons',
181
+ 'install'
182
+ ), $this->_version, 'all' );
183
+ }
184
+
185
+ /**
186
+ * Load javascript
187
+ */
188
+ function enqueue_scripts() {
189
+ wp_enqueue_script( $this->_name, TINVWL_URL . 'assets/js/admin.js', array( 'jquery' ), $this->_version, 'all' );
190
+ }
191
+
192
+ /**
193
+ * Output content wizard page
194
+ */
195
+ function load_content() {
196
+ ?>
197
+ <div class="<?php echo esc_attr( sprintf( '%s-content', $this->_name ) ); ?>">
198
+ <form method="POST" action="<?php echo esc_url( admin_url( $this->next_page() ) ) ?>">
199
+ <?php
200
+ $method = $this->method;
201
+ if ( method_exists( $this, $method ) ) {
202
+ $this->$method();
203
+ }
204
+ wp_nonce_field( sprintf( '%s-setup-%s', $this->_name, $this->page ) );
205
+ ?>
206
+ </form>
207
+ </div>
208
+ <?php
209
+ }
210
+
211
+ /**
212
+ * Get titles steps
213
+ *
214
+ * @return array
215
+ */
216
+ function get_list_steps() {
217
+ $lists = get_class_methods( $this );
218
+ foreach ( $lists as $key => $value ) {
219
+ if ( ! preg_match( '/^wizard_[^_]+_title$/i', $value ) ) {
220
+ unset( $lists[ $key ] );
221
+ }
222
+ }
223
+ sort( $lists );
224
+
225
+ $steps = array();
226
+ foreach ( $lists as $method ) {
227
+ $key = preg_replace( '/(^wizard_|_title$)/i', '', $method );
228
+ if ( 'intro' == $key ) { // WPCS: loose comparison ok.
229
+ $key = 0;
230
+ } elseif ( 'finish' == $key ) { // WPCS: loose comparison ok.
231
+ $key = count( $lists ) - 1;
232
+ }
233
+ $steps[ $key ] = $this->$method();
234
+ }
235
+ ksort( $steps );
236
+
237
+ return $steps;
238
+ }
239
+
240
+ /**
241
+ * Output footer wizard page
242
+ */
243
+ function load_footer() {
244
+ $content = '';
245
+ $method = $this->method . '_footer';
246
+ if ( method_exists( $this, $method ) ) {
247
+ ob_start();
248
+ $this->$method();
249
+ $content = ob_get_clean();
250
+ }
251
+
252
+ TInvWL_View::view( 'footer', array(
253
+ 'content' => $content,
254
+ 'page' => $this->page,
255
+ ), 'wizard' );
256
+ }
257
+
258
+ /**
259
+ * Title intro
260
+ *
261
+ * @return string
262
+ */
263
+ function wizard_intro_title() {
264
+ return __( 'Introduction', 'ti-woocommerce-wishlist' );
265
+ }
266
+
267
+ /**
268
+ * Content intro
269
+ */
270
+ function wizard_intro() {
271
+ TInvWL_View::view( 'intro', array(), 'wizard' );
272
+ }
273
+
274
+ /**
275
+ * Title step 1
276
+ *
277
+ * @return string
278
+ */
279
+ function wizard_1_title() {
280
+ return __( 'Page Setup', 'ti-woocommerce-wishlist' );
281
+ }
282
+
283
+ /**
284
+ * Content step 1
285
+ */
286
+ function wizard_1() {
287
+ $title_pages = array(
288
+ 'wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
289
+ );
290
+ $lists = get_pages( array( 'number' => 999999 ) ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.get_pages
291
+ $page_list = array(
292
+ '' => __( 'Create Automatically', 'ti-woocommerce-wishlist' ),
293
+ - 100 => __( 'Create new Page', 'ti-woocommerce-wishlist' ),
294
+ );
295
+ $page_name = array();
296
+ foreach ( $lists as $list ) {
297
+ $page_list[ $list->ID ] = $list->post_title;
298
+ $page_name[ $list->post_name ] = $list->ID;
299
+ }
300
+ $data = array(
301
+ 'general_default_title_value' => apply_filters( 'tinvwl-general-default_title', tinv_get_option( 'general', 'default_title' ) ),
302
+ );
303
+ foreach ( $title_pages as $key => $text ) {
304
+ $_data['options'] = $page_list;
305
+ $_data['new_value'] = $text;
306
+ $_data['value'] = tinv_get_option( 'page', $key ) ? tinv_get_option( 'page', $key ) : '';
307
+ $_data['error'] = array_key_exists( ( 'wishlist' === $key ? $key : 'wishlist-' . $key ), $page_name );
308
+
309
+ $data['page_pages'][ $key ] = $_data;
310
+ }
311
+ TInvWL_View::view( 'step-page', $data, 'wizard' );
312
+ }
313
+
314
+ /**
315
+ * Save content step 1
316
+ */
317
+ function wizard_1_save() {
318
+ $title_pages = array(
319
+ 'wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
320
+ );
321
+ $shortcode_pages = array(
322
+ 'wishlist' => '[ti_wishlistsview]',
323
+ );
324
+ $data = array(
325
+ 'general_default_title' => FILTER_SANITIZE_STRING,
326
+ );
327
+ foreach ( $title_pages as $key => $text ) {
328
+ $data[ 'page_' . $key ] = FILTER_VALIDATE_INT;
329
+ $data[ 'page_' . $key . '_new' ] = FILTER_SANITIZE_STRING;
330
+ $data[ 'page_' . $key . '_auto' ] = FILTER_VALIDATE_BOOLEAN;
331
+ }
332
+ $data = filter_input_array( INPUT_POST, $data );
333
+ if ( ! empty( $data['general_default_title'] ) ) {
334
+ tinv_update_option( 'general', 'default_title', $data['general_default_title'] );
335
+ }
336
+
337
+ $required = array( 'wishlist' );
338
+ $required_notsets = array();
339
+ foreach ( $title_pages as $key => $title ) {
340
+ $shortcode = $shortcode_pages[ $key ];
341
+ $auto = $data[ sprintf( 'page_%s_auto', $key ) ];
342
+ $title_new = $data[ sprintf( 'page_%s_new', $key ) ];
343
+ $page = $data[ sprintf( 'page_%s', $key ) ];
344
+
345
+ $the_page_id = 0;
346
+ if ( ( empty( $page ) && $auto ) || ( is_integer( $page ) && - 100 === $page ) ) {
347
+ if ( - 100 === $page ) {
348
+ $title = empty( $title_new ) ? $title : $title_new;
349
+ }
350
+ $title = apply_filters( 'tinvwl_create_new_page_post_title', $title, $key );
351
+
352
+ $_page = array(
353
+ 'post_title' => $title,
354
+ 'post_content' => $shortcode,
355
+ 'post_status' => '',
356
+ 'post_name' => 'wishlist' === $key ? $key : 'wishlist-' . $key,
357
+ 'post_type' => 'page',
358
+ 'comment_status' => 'closed',
359
+ 'ping_status' => 'closed',
360
+ 'post_category' => array( 1 ),
361
+ );
362
+ if ( - 100 === $page ) {
363
+ unset( $_page['post_name'] );
364
+ }
365
+ $the_page_id = wp_insert_post( $_page );
366
+ } elseif ( is_integer( $page ) && 0 < $page ) {
367
+ $the_page_id = $page;
368
+ }
369
+
370
+ if ( 0 < $the_page_id ) {
371
+ $the_page = get_post( $the_page_id );
372
+ $the_page->post_content = $shortcode;
373
+ $the_page->post_status = 'publish';
374
+ $the_page_id = wp_update_post( $the_page );
375
+ tinv_update_option( 'page', $key, $the_page_id );
376
+ } else {
377
+ tinv_update_option( 'page', $key, '' );
378
+ if ( in_array( $key, $required ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
379
+ $required_notsets[] = $key;
380
+ }
381
+ }
382
+ } // End foreach().
383
+ if ( ! empty( $required_notsets ) ) {
384
+ wp_safe_redirect( wp_get_referer() );
385
+ exit;
386
+ } else {
387
+ TInvWL_Public_TInvWL::update_rewrite_rules();
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Title step 2
393
+ *
394
+ * @return string
395
+ */
396
+ function wizard_2_title() {
397
+ return __( 'Button', 'ti-woocommerce-wishlist' );
398
+ }
399
+
400
+ /**
401
+ * Content step 2
402
+ */
403
+ function wizard_2() {
404
+
405
+ $data = array(
406
+ 'add_to_wishlist_position_value' => tinv_get_option( 'add_to_wishlist', 'position' ),
407
+ 'add_to_wishlist_position_options' => array(
408
+ 'after' => __( 'After "Add to Cart" button', 'ti-woocommerce-wishlist' ),
409
+ 'before' => __( 'Before "Add to Cart" button', 'ti-woocommerce-wishlist' ),
410
+ 'shortcode' => __( 'Custom position with code', 'ti-woocommerce-wishlist' ),
411
+ ),
412
+ 'add_to_wishlist_text_value' => tinv_get_option( 'add_to_wishlist', 'text' ),
413
+ 'add_to_wishlist_catalog_show_in_loop_value' => tinv_get_option( 'add_to_wishlist_catalog', 'show_in_loop' ),
414
+ 'add_to_wishlist_catalog_text_value' => tinv_get_option( 'add_to_wishlist_catalog', 'text' ),
415
+ );
416
+ TInvWL_View::view( 'step-button', $data, 'wizard' );
417
+ }
418
+
419
+ /**
420
+ * Save content step 2
421
+ */
422
+ function wizard_2_save() {
423
+ $data = filter_input_array( INPUT_POST, array(
424
+ 'add_to_wishlist_position' => FILTER_SANITIZE_STRING,
425
+ 'add_to_wishlist_text' => FILTER_SANITIZE_STRING,
426
+ 'add_to_wishlist_catalog_show_in_loop' => FILTER_VALIDATE_BOOLEAN,
427
+ 'add_to_wishlist_catalog_text' => FILTER_SANITIZE_STRING,
428
+ ) );
429
+ tinv_update_option( 'add_to_wishlist', 'position', $data['add_to_wishlist_position'] );
430
+ tinv_update_option( 'add_to_wishlist', 'text', $data['add_to_wishlist_text'] );
431
+ tinv_update_option( 'add_to_wishlist_catalog', 'show_in_loop', (bool) $data['add_to_wishlist_catalog_show_in_loop'] );
432
+ tinv_update_option( 'add_to_wishlist_catalog', 'text', $data['add_to_wishlist_catalog_text'] );
433
+ }
434
+
435
+ /**
436
+ * Title step 3
437
+ *
438
+ * @return string
439
+ */
440
+ function wizard_3_title() {
441
+ return __( 'Processing', 'ti-woocommerce-wishlist' );
442
+ }
443
+
444
+ /**
445
+ * Content step 3
446
+ */
447
+ function wizard_3() {
448
+ $data = array(
449
+ 'processing_autoremove_value' => tinv_get_option( 'processing', 'autoremove' ) ? 'auto' : 'manual',
450
+ 'processing_autoremove_options' => array(
451
+ 'auto' => __( 'Automatically', 'ti-woocommerce-wishlist' ),
452
+ 'manual' => __( 'Manual', 'ti-woocommerce-wishlist' ),
453
+ ),
454
+ );
455
+ TInvWL_View::view( 'step-processing', $data, 'wizard' );
456
+ }
457
+
458
+ /**
459
+ * Save content step 3
460
+ */
461
+ function wizard_3_save() {
462
+ $data = filter_input_array( INPUT_POST, array(
463
+ 'processing_autoremove' => FILTER_SANITIZE_STRING,
464
+ ) );
465
+ $autoremove = 'auto' === $data['processing_autoremove'];
466
+ tinv_update_option( 'processing', 'autoremove', $autoremove );
467
+ tinv_update_option( 'processing', 'autoremove_status', 'tinvwl-addcart' );
468
+ }
469
+
470
+ /**
471
+ * Title step 4
472
+ *
473
+ * @return string
474
+ */
475
+ function wizard_4_title() {
476
+ return __( 'Share', 'ti-woocommerce-wishlist' );
477
+ }
478
+
479
+ /**
480
+ * Content step 4
481
+ */
482
+ function wizard_4() {
483
+ $data = array(
484
+ 'social_facebook_value' => tinv_get_option( 'social', 'facebook' ),
485
+ 'social_twitter_value' => tinv_get_option( 'social', 'twitter' ),
486
+ 'social_pinterest_value' => tinv_get_option( 'social', 'pinterest' ),
487
+ 'social_google_value' => tinv_get_option( 'social', 'google' ),
488
+ 'social_whatsapp_value' => tinv_get_option( 'social', 'whatsapp' ),
489
+ 'social_clipboard_value' => tinv_get_option( 'social', 'clipboard' ),
490
+ 'social_email_value' => tinv_get_option( 'social', 'email' ),
491
+ );
492
+ TInvWL_View::view( 'step-social', $data, 'wizard' );
493
+ }
494
+
495
+ /**
496
+ * Save content step 4
497
+ */
498
+ function wizard_4_save() {
499
+ $data = filter_input_array( INPUT_POST, array(
500
+ 'social_facebook' => FILTER_VALIDATE_BOOLEAN,
501
+ 'social_twitter' => FILTER_VALIDATE_BOOLEAN,
502
+ 'social_pinterest' => FILTER_VALIDATE_BOOLEAN,
503
+ 'social_google' => FILTER_VALIDATE_BOOLEAN,
504
+ 'social_whatsapp' => FILTER_VALIDATE_BOOLEAN,
505
+ 'social_clipboard' => FILTER_VALIDATE_BOOLEAN,
506
+ 'social_email' => FILTER_VALIDATE_BOOLEAN,
507
+ ) );
508
+ tinv_update_option( 'social', 'facebook', (bool) $data['social_facebook'] );
509
+ tinv_update_option( 'social', 'twitter', (bool) $data['social_twitter'] );
510
+ tinv_update_option( 'social', 'pinterest', (bool) $data['social_pinterest'] );
511
+ tinv_update_option( 'social', 'google', (bool) $data['social_google'] );
512
+ tinv_update_option( 'social', 'whatsapp', (bool) $data['social_whatsapp'] );
513
+ tinv_update_option( 'social', 'clipboard', (bool) $data['social_clipboard'] );
514
+ tinv_update_option( 'social', 'email', (bool) $data['social_email'] );
515
+ }
516
+
517
+ /**
518
+ * Title finish
519
+ *
520
+ * @return string
521
+ */
522
+ function wizard_finish_title() {
523
+ return __( 'Ready!', 'ti-woocommerce-wishlist' );
524
+ }
525
+
526
+ /**
527
+ * Content finish
528
+ */
529
+ function wizard_finish() {
530
+ TInvWL_View::view( 'finish', array(), 'wizard' );
531
+ }
532
+ }
languages/ti-woocommerce-wishlist.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Wishlist Plugin 1.9.15\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
8
- "POT-Creation-Date: 2019-03-05 08:18:59+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -442,7 +442,7 @@ msgstr ""
442
  msgid "Show \"Google+\" Button"
443
  msgstr ""
444
 
445
- #: admin/settings/general.class.php:630
446
  msgid "Show \"WhatsApp\" Button"
447
  msgstr ""
448
 
@@ -450,7 +450,7 @@ msgstr ""
450
  msgid "Show \"Copy to clipboard\" Button"
451
  msgstr ""
452
 
453
- #: admin/settings/general.class.php:642 views/wizard/step-social.php:62
454
  msgid "Show \"Share by Email\" Button"
455
  msgstr ""
456
 
@@ -963,7 +963,7 @@ msgstr ""
963
  msgid "Share"
964
  msgstr ""
965
 
966
- #: includes/wizard.class.php:517
967
  msgid "Ready!"
968
  msgstr ""
969
 
@@ -1336,12 +1336,12 @@ msgid "\"Add to Wishlist\" Text in Product listing"
1336
  msgstr ""
1337
 
1338
  #: views/wizard/step-button.php:76 views/wizard/step-page.php:53
1339
- #: views/wizard/step-processing.php:35 views/wizard/step-social.php:75
1340
  msgid "Skip this step"
1341
  msgstr ""
1342
 
1343
  #: views/wizard/step-button.php:77 views/wizard/step-page.php:54
1344
- #: views/wizard/step-processing.php:36 views/wizard/step-social.php:76
1345
  msgid "continue"
1346
  msgstr ""
1347
 
@@ -1385,6 +1385,10 @@ msgid ""
1385
  "page."
1386
  msgstr ""
1387
 
 
 
 
 
1388
  #. Plugin Name of the plugin/theme
1389
  msgid "WooCommerce Wishlist Plugin"
1390
  msgstr ""
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Wishlist Plugin 1.9.16\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
8
+ "POT-Creation-Date: 2019-03-07 17:44:08+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
442
  msgid "Show \"Google+\" Button"
443
  msgstr ""
444
 
445
+ #: admin/settings/general.class.php:630 views/wizard/step-social.php:62
446
  msgid "Show \"WhatsApp\" Button"
447
  msgstr ""
448
 
450
  msgid "Show \"Copy to clipboard\" Button"
451
  msgstr ""
452
 
453
+ #: admin/settings/general.class.php:642 views/wizard/step-social.php:80
454
  msgid "Show \"Share by Email\" Button"
455
  msgstr ""
456
 
963
  msgid "Share"
964
  msgstr ""
965
 
966
+ #: includes/wizard.class.php:523
967
  msgid "Ready!"
968
  msgstr ""
969
 
1336
  msgstr ""
1337
 
1338
  #: views/wizard/step-button.php:76 views/wizard/step-page.php:53
1339
+ #: views/wizard/step-processing.php:35 views/wizard/step-social.php:93
1340
  msgid "Skip this step"
1341
  msgstr ""
1342
 
1343
  #: views/wizard/step-button.php:77 views/wizard/step-page.php:54
1344
+ #: views/wizard/step-processing.php:36 views/wizard/step-social.php:94
1345
  msgid "continue"
1346
  msgstr ""
1347
 
1385
  "page."
1386
  msgstr ""
1387
 
1388
+ #: views/wizard/step-social.php:71
1389
+ msgid "Show \"Clipboard\" Button"
1390
+ msgstr ""
1391
+
1392
  #. Plugin Name of the plugin/theme
1393
  msgid "WooCommerce Wishlist Plugin"
1394
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpr
4
  Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
- Stable tag: 1.9.15
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -140,6 +140,12 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
140
 
141
 
142
  == Changelog ==
 
 
 
 
 
 
143
  = 1.9.15 =
144
  *Release Date - 5 March 2019*
145
 
4
  Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
+ Stable tag: 1.9.16
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
140
 
141
 
142
  == Changelog ==
143
+ = 1.9.16 =
144
+ *Release Date - 7 March 2019*
145
+
146
+ * Fixed an issue in case of NULL in a product price field
147
+ * Updated Share settings in the install wizard
148
+
149
  = 1.9.15 =
150
  *Release Date - 5 March 2019*
151
 
ti-woocommerce-wishlist.php CHANGED
@@ -1,253 +1,253 @@
1
- <?php
2
- /**
3
- * WooCommerce Wishlist Plugin.
4
- * Plugin Name: WooCommerce Wishlist Plugin
5
- * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
- * Description: Wishlist functionality for your WooCommerce store.
7
- * Version: 1.9.15
8
- * Requires at least: 4.5
9
- * Tested up to: 5.1
10
- * WC requires at least: 2.6
11
- * WC tested up to: 3.5
12
- * Author: TemplateInvaders
13
- * Author URI: https://templateinvaders.com/
14
- * License: GPL-2.0+
15
- * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
16
- * Text Domain: ti-woocommerce-wishlist
17
- * Domain Path: /languages
18
- *
19
- * @package TInvWishlist
20
- */
21
-
22
- // If this file is called directly, abort.
23
- if ( ! defined( 'ABSPATH' ) ) {
24
- die;
25
- }
26
-
27
- // Define default path.
28
- if ( ! defined( 'TINVWL_URL' ) ) {
29
- define( 'TINVWL_URL', plugins_url( '/', __FILE__ ) );
30
- }
31
- if ( ! defined( 'TINVWL_PATH' ) ) {
32
- define( 'TINVWL_PATH', plugin_dir_path( __FILE__ ) );
33
- }
34
-
35
- if ( ! defined( 'TINVWL_PREFIX' ) ) {
36
- define( 'TINVWL_PREFIX', 'tinvwl' );
37
- }
38
-
39
- if ( ! defined( 'TINVWL_DOMAIN' ) ) {
40
- define( 'TINVWL_DOMAIN', 'ti-woocommerce-wishlist' );
41
- }
42
-
43
- if ( ! defined( 'TINVWL_FVERSION' ) ) {
44
- define( 'TINVWL_FVERSION', '1.9.15' );
45
- }
46
-
47
- if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
48
- define( 'TINVWL_LOAD_FREE', plugin_basename( __FILE__ ) );
49
- }
50
-
51
- if ( ! function_exists( 'tinv_array_merge' ) ) {
52
-
53
- /**
54
- * Function to merge arrays with replacement options
55
- *
56
- * @param array $array1 Array.
57
- * @param array $_ Array.
58
- *
59
- * @return array
60
- */
61
- function tinv_array_merge( $array1, $_ = null ) {
62
- if ( ! is_array( $array1 ) ) {
63
- return $array1;
64
- }
65
- $args = func_get_args();
66
- array_shift( $args );
67
- foreach ( $args as $array2 ) {
68
- if ( is_array( $array2 ) ) {
69
- foreach ( $array2 as $key => $value ) {
70
- $array1[ $key ] = $value;
71
- }
72
- }
73
- }
74
-
75
- return $array1;
76
- }
77
- }
78
-
79
-
80
- if ( ! function_exists( 'tinv_get_option_defaults' ) ) {
81
-
82
- /**
83
- * Extract default options from settings class
84
- *
85
- * @param string $category Name category settings.
86
- *
87
- * @return array
88
- */
89
- function tinv_get_option_defaults( $category ) {
90
- $dir = TINVWL_PATH . 'admin/settings/';
91
- if ( ! file_exists( $dir ) || ! is_dir( $dir ) ) {
92
- return array();
93
- }
94
- $files = scandir( $dir );
95
- foreach ( $files as $key => $value ) {
96
- if ( preg_match( '/\.class\.php$/i', $value ) ) {
97
- $files[ $key ] = preg_replace( '/\.class\.php$/i', '', $value );
98
- } else {
99
- unset( $files[ $key ] );
100
- }
101
- }
102
- $defaults = array();
103
- foreach ( $files as $file ) {
104
- $class = 'TInvWL_Admin_Settings_' . ucfirst( $file );
105
- $class = new $class( '', '' );
106
- $class_methods = get_class_methods( $class );
107
- foreach ( $class_methods as $method ) {
108
- if ( preg_match( '/_data$/i', $method ) ) {
109
- $settings = $class->get_defaults( $class->$method() );
110
- $defaults = tinv_array_merge( $defaults, $settings );
111
- }
112
- }
113
- }
114
- if ( 'all' === $category ) {
115
- return $defaults;
116
- }
117
- if ( array_key_exists( $category, $defaults ) ) {
118
- return $defaults[ $category ];
119
- }
120
-
121
- return array();
122
- }
123
- } // End if().
124
-
125
- if ( ! function_exists( 'activation_tinv_wishlist' ) ) {
126
-
127
- /**
128
- * Activation plugin
129
- */
130
- function activation_tinv_wishlist() {
131
- if ( dependency_tinv_wishlist( false ) ) {
132
- TInvWL_Activator::activate();
133
- flush_rewrite_rules();
134
- }
135
- }
136
- }
137
-
138
- if ( ! function_exists( 'deactivation_tinv_wishlist' ) ) {
139
-
140
- /**
141
- * Deactivation plugin
142
- */
143
- function deactivation_tinv_wishlist() {
144
- flush_rewrite_rules();
145
- }
146
- }
147
-
148
- if ( ! function_exists( 'uninstall_tinv_wishlist' ) ) {
149
-
150
- /**
151
- * Uninstall plugin
152
- */
153
- function uninstall_tinv_wishlist() {
154
- if ( ! defined( 'TINVWL_LOAD_PREMIUM' ) ) {
155
- TInvWL_Activator::uninstall();
156
- flush_rewrite_rules();
157
- wp_clear_scheduled_hook( 'tinvwl_remove_without_author_wishlist' );
158
- }
159
- }
160
- }
161
-
162
- if ( function_exists( 'spl_autoload_register' ) && ! function_exists( 'autoload_tinv_wishlist' ) ) {
163
-
164
- /**
165
- * Autoloader class. If no function spl_autoload_register, then all the files will be required
166
- *
167
- * @param string $_class Required class name.
168
- *
169
- * @return boolean
170
- */
171
- function autoload_tinv_wishlist( $_class ) {
172
- $preffix = 'TInvWL';
173
- $ext = '.php';
174
- $class = explode( '_', $_class );
175
- $object = array_shift( $class );
176
- if ( $preffix !== $object ) {
177
- return false;
178
- }
179
- if ( empty( $class ) ) {
180
- $class = array( $preffix );
181
- }
182
- $basicclass = $class;
183
- array_unshift( $class, 'includes' );
184
- $classs = array(
185
- TINVWL_PATH . strtolower( implode( DIRECTORY_SEPARATOR, $basicclass ) ),
186
- TINVWL_PATH . strtolower( implode( DIRECTORY_SEPARATOR, $class ) ),
187
- );
188
- foreach ( $classs as $class ) {
189
- foreach ( array( '.class', '.helper' ) as $suffix ) {
190
- $filename = $class . $suffix . $ext;
191
- if ( file_exists( $filename ) ) {
192
- require_once $filename;
193
-
194
- return true;
195
- }
196
- }
197
- }
198
-
199
- return false;
200
- }
201
-
202
- spl_autoload_register( 'autoload_tinv_wishlist' );
203
- } // End if().
204
-
205
- if ( ! function_exists( 'dependency_tinv_wishlist' ) ) {
206
-
207
- /**
208
- * Dependency plugin
209
- *
210
- * @param boolean $run For run hooks dependency or return error message.
211
- *
212
- * @return boolean
213
- */
214
- function dependency_tinv_wishlist( $run = true ) {
215
- $ext = new TInvWL_PluginExtend( null, __FILE__, TINVWL_PREFIX );
216
- $ext->set_dependency( 'woocommerce/woocommerce.php', 'WooCommerce' )->need();
217
- if ( $run ) {
218
- $ext->run();
219
- }
220
-
221
- return $ext->status_dependency();
222
- }
223
- }
224
-
225
- if ( ! function_exists( 'run_tinv_wishlist' ) ) {
226
-
227
- /**
228
- * Run plugin
229
- */
230
- function run_tinv_wishlist() {
231
- require_once TINVWL_PATH . 'tinv-wishlists-function.php';
232
- require_once TINVWL_PATH . 'tinv-wishlists-function-integration.php';
233
-
234
- if ( ! function_exists( 'is_plugin_active' ) ) {
235
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
236
- }
237
- if ( defined( 'TINVWL_LOAD_PREMIUM' ) && defined( 'TINVWL_LOAD_FREE' ) ) {
238
- $redirect = tinv_wishlist_status( plugin_basename( __FILE__ ) );
239
- if ( $redirect ) {
240
- header( 'Location: ' . $redirect );
241
- exit;
242
- }
243
- } elseif ( dependency_tinv_wishlist() ) {
244
- $plugin = new TInvWL();
245
- $plugin->run();
246
- }
247
- }
248
- }
249
-
250
- register_activation_hook( __FILE__, 'activation_tinv_wishlist' );
251
- register_deactivation_hook( __FILE__, 'deactivation_tinv_wishlist' );
252
- register_uninstall_hook( __FILE__, 'uninstall_tinv_wishlist' );
253
- add_action( 'plugins_loaded', 'run_tinv_wishlist', 20 );
1
+ <?php
2
+ /**
3
+ * WooCommerce Wishlist Plugin.
4
+ * Plugin Name: WooCommerce Wishlist Plugin
5
+ * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
+ * Description: Wishlist functionality for your WooCommerce store.
7
+ * Version: 1.9.16
8
+ * Requires at least: 4.5
9
+ * Tested up to: 5.1
10
+ * WC requires at least: 2.6
11
+ * WC tested up to: 3.5
12
+ * Author: TemplateInvaders
13
+ * Author URI: https://templateinvaders.com/
14
+ * License: GPL-2.0+
15
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
16
+ * Text Domain: ti-woocommerce-wishlist
17
+ * Domain Path: /languages
18
+ *
19
+ * @package TInvWishlist
20
+ */
21
+
22
+ // If this file is called directly, abort.
23
+ if ( ! defined( 'ABSPATH' ) ) {
24
+ die;
25
+ }
26
+
27
+ // Define default path.
28
+ if ( ! defined( 'TINVWL_URL' ) ) {
29
+ define( 'TINVWL_URL', plugins_url( '/', __FILE__ ) );
30
+ }
31
+ if ( ! defined( 'TINVWL_PATH' ) ) {
32
+ define( 'TINVWL_PATH', plugin_dir_path( __FILE__ ) );
33
+ }
34
+
35
+ if ( ! defined( 'TINVWL_PREFIX' ) ) {
36
+ define( 'TINVWL_PREFIX', 'tinvwl' );
37
+ }
38
+
39
+ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
40
+ define( 'TINVWL_DOMAIN', 'ti-woocommerce-wishlist' );
41
+ }
42
+
43
+ if ( ! defined( 'TINVWL_FVERSION' ) ) {
44
+ define( 'TINVWL_FVERSION', '1.9.16' );
45
+ }
46
+
47
+ if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
48
+ define( 'TINVWL_LOAD_FREE', plugin_basename( __FILE__ ) );
49
+ }
50
+
51
+ if ( ! function_exists( 'tinv_array_merge' ) ) {
52
+
53
+ /**
54
+ * Function to merge arrays with replacement options
55
+ *
56
+ * @param array $array1 Array.
57
+ * @param array $_ Array.
58
+ *
59
+ * @return array
60
+ */
61
+ function tinv_array_merge( $array1, $_ = null ) {
62
+ if ( ! is_array( $array1 ) ) {
63
+ return $array1;
64
+ }
65
+ $args = func_get_args();
66
+ array_shift( $args );
67
+ foreach ( $args as $array2 ) {
68
+ if ( is_array( $array2 ) ) {
69
+ foreach ( $array2 as $key => $value ) {
70
+ $array1[ $key ] = $value;
71
+ }
72
+ }
73
+ }
74
+
75
+ return $array1;
76
+ }
77
+ }
78
+
79
+
80
+ if ( ! function_exists( 'tinv_get_option_defaults' ) ) {
81
+
82
+ /**
83
+ * Extract default options from settings class
84
+ *
85
+ * @param string $category Name category settings.
86
+ *
87
+ * @return array
88
+ */
89
+ function tinv_get_option_defaults( $category ) {
90
+ $dir = TINVWL_PATH . 'admin/settings/';
91
+ if ( ! file_exists( $dir ) || ! is_dir( $dir ) ) {
92
+ return array();
93
+ }
94
+ $files = scandir( $dir );
95
+ foreach ( $files as $key => $value ) {
96
+ if ( preg_match( '/\.class\.php$/i', $value ) ) {
97
+ $files[ $key ] = preg_replace( '/\.class\.php$/i', '', $value );
98
+ } else {
99
+ unset( $files[ $key ] );
100
+ }
101
+ }
102
+ $defaults = array();
103
+ foreach ( $files as $file ) {
104
+ $class = 'TInvWL_Admin_Settings_' . ucfirst( $file );
105
+ $class = new $class( '', '' );
106
+ $class_methods = get_class_methods( $class );
107
+ foreach ( $class_methods as $method ) {
108
+ if ( preg_match( '/_data$/i', $method ) ) {
109
+ $settings = $class->get_defaults( $class->$method() );
110
+ $defaults = tinv_array_merge( $defaults, $settings );
111
+ }
112
+ }
113
+ }
114
+ if ( 'all' === $category ) {
115
+ return $defaults;
116
+ }
117
+ if ( array_key_exists( $category, $defaults ) ) {
118
+ return $defaults[ $category ];
119
+ }
120
+
121
+ return array();
122
+ }
123
+ } // End if().
124
+
125
+ if ( ! function_exists( 'activation_tinv_wishlist' ) ) {
126
+
127
+ /**
128
+ * Activation plugin
129
+ */
130
+ function activation_tinv_wishlist() {
131
+ if ( dependency_tinv_wishlist( false ) ) {
132
+ TInvWL_Activator::activate();
133
+ flush_rewrite_rules();
134
+ }
135
+ }
136
+ }
137
+
138
+ if ( ! function_exists( 'deactivation_tinv_wishlist' ) ) {
139
+
140
+ /**
141
+ * Deactivation plugin
142
+ */
143
+ function deactivation_tinv_wishlist() {
144
+ flush_rewrite_rules();
145
+ }
146
+ }
147
+
148
+ if ( ! function_exists( 'uninstall_tinv_wishlist' ) ) {
149
+
150
+ /**
151
+ * Uninstall plugin
152
+ */
153
+ function uninstall_tinv_wishlist() {
154
+ if ( ! defined( 'TINVWL_LOAD_PREMIUM' ) ) {
155
+ TInvWL_Activator::uninstall();
156
+ flush_rewrite_rules();
157
+ wp_clear_scheduled_hook( 'tinvwl_remove_without_author_wishlist' );
158
+ }
159
+ }
160
+ }
161
+
162
+ if ( function_exists( 'spl_autoload_register' ) && ! function_exists( 'autoload_tinv_wishlist' ) ) {
163
+
164
+ /**
165
+ * Autoloader class. If no function spl_autoload_register, then all the files will be required
166
+ *
167
+ * @param string $_class Required class name.
168
+ *
169
+ * @return boolean
170
+ */
171
+ function autoload_tinv_wishlist( $_class ) {
172
+ $preffix = 'TInvWL';
173
+ $ext = '.php';
174
+ $class = explode( '_', $_class );
175
+ $object = array_shift( $class );
176
+ if ( $preffix !== $object ) {
177
+ return false;
178
+ }
179
+ if ( empty( $class ) ) {
180
+ $class = array( $preffix );
181
+ }
182
+ $basicclass = $class;
183
+ array_unshift( $class, 'includes' );
184
+ $classs = array(
185
+ TINVWL_PATH . strtolower( implode( DIRECTORY_SEPARATOR, $basicclass ) ),
186
+ TINVWL_PATH . strtolower( implode( DIRECTORY_SEPARATOR, $class ) ),
187
+ );
188
+ foreach ( $classs as $class ) {
189
+ foreach ( array( '.class', '.helper' ) as $suffix ) {
190
+ $filename = $class . $suffix . $ext;
191
+ if ( file_exists( $filename ) ) {
192
+ require_once $filename;
193
+
194
+ return true;
195
+ }
196
+ }
197
+ }
198
+
199
+ return false;
200
+ }
201
+
202
+ spl_autoload_register( 'autoload_tinv_wishlist' );
203
+ } // End if().
204
+
205
+ if ( ! function_exists( 'dependency_tinv_wishlist' ) ) {
206
+
207
+ /**
208
+ * Dependency plugin
209
+ *
210
+ * @param boolean $run For run hooks dependency or return error message.
211
+ *
212
+ * @return boolean
213
+ */
214
+ function dependency_tinv_wishlist( $run = true ) {
215
+ $ext = new TInvWL_PluginExtend( null, __FILE__, TINVWL_PREFIX );
216
+ $ext->set_dependency( 'woocommerce/woocommerce.php', 'WooCommerce' )->need();
217
+ if ( $run ) {
218
+ $ext->run();
219
+ }
220
+
221
+ return $ext->status_dependency();
222
+ }
223
+ }
224
+
225
+ if ( ! function_exists( 'run_tinv_wishlist' ) ) {
226
+
227
+ /**
228
+ * Run plugin
229
+ */
230
+ function run_tinv_wishlist() {
231
+ require_once TINVWL_PATH . 'tinv-wishlists-function.php';
232
+ require_once TINVWL_PATH . 'tinv-wishlists-function-integration.php';
233
+
234
+ if ( ! function_exists( 'is_plugin_active' ) ) {
235
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
236
+ }
237
+ if ( defined( 'TINVWL_LOAD_PREMIUM' ) && defined( 'TINVWL_LOAD_FREE' ) ) {
238
+ $redirect = tinv_wishlist_status( plugin_basename( __FILE__ ) );
239
+ if ( $redirect ) {
240
+ header( 'Location: ' . $redirect );
241
+ exit;
242
+ }
243
+ } elseif ( dependency_tinv_wishlist() ) {
244
+ $plugin = new TInvWL();
245
+ $plugin->run();
246
+ }
247
+ }
248
+ }
249
+
250
+ register_activation_hook( __FILE__, 'activation_tinv_wishlist' );
251
+ register_deactivation_hook( __FILE__, 'deactivation_tinv_wishlist' );
252
+ register_uninstall_hook( __FILE__, 'uninstall_tinv_wishlist' );
253
+ add_action( 'plugins_loaded', 'run_tinv_wishlist', 20 );
views/wizard/step-social.php CHANGED
@@ -57,6 +57,24 @@ if ( ! defined( 'ABSPATH' ) ) {
57
  </div>
58
  </div>
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  <div class="form-horizontal">
61
  <div class="form-group">
62
  <?php echo TInvWL_Form::_label( 'social_email', __( 'Show "Share by Email" Button', 'ti-woocommerce-wishlist' ), array( 'class' => 'col-md-6 control-label' ) ); // WPCS: xss ok. ?>
57
  </div>
58
  </div>
59
 
60
+ <div class="form-horizontal">
61
+ <div class="form-group">
62
+ <?php echo TInvWL_Form::_label( 'social_whatsapp', __( 'Show "WhatsApp" Button', 'ti-woocommerce-wishlist' ), array( 'class' => 'col-md-6 control-label' ) ); // WPCS: xss ok. ?>
63
+ <div class="col-md-6">
64
+ <?php echo TInvWL_Form::_checkboxonoff( 'social_whatsapp', $social_whatsapp_value ); // WPCS: xss ok. ?>
65
+ </div>
66
+ </div>
67
+ </div>
68
+
69
+ <div class="form-horizontal">
70
+ <div class="form-group">
71
+ <?php echo TInvWL_Form::_label( 'social_clipboard', __( 'Show "Clipboard" Button', 'ti-woocommerce-wishlist' ), array( 'class' => 'col-md-6 control-label' ) ); // WPCS: xss ok. ?>
72
+ <div class="col-md-6">
73
+ <?php echo TInvWL_Form::_checkboxonoff( 'social_clipboard', $social_clipboard_value ); // WPCS: xss ok. ?>
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
  <div class="form-horizontal">
79
  <div class="form-group">
80
  <?php echo TInvWL_Form::_label( 'social_email', __( 'Show "Share by Email" Button', 'ti-woocommerce-wishlist' ), array( 'class' => 'col-md-6 control-label' ) ); // WPCS: xss ok. ?>