CTX Feed – WooCommerce Product Feed Manager Plugin - Version 3.1.42

Version Description

(2019-10-27) = * Fix deactivation script

Download this release

Release Info

Developer wahid0003
Plugin Icon 128x128 CTX Feed – WooCommerce Product Feed Manager Plugin
Version 3.1.42
Comparing to
See all releases

Code changes from version 3.1.41 to 3.1.42

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://webappick.com
4
  Tags:woocommerce,google product feed,facebook product feed,woocommerce product feed,woocommerce,
5
  Requires at least: 3.6
6
  Tested Up To: 5.3
7
- Stable tag: 3.1.41
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -304,6 +304,9 @@ Using pro version:
304
 
305
  == Changelog ==
306
 
 
 
 
307
  = 3.1.41 (2019-10-24) =
308
  * Dependency & compatibility check upon activation
309
  * Tested with latest WordPress & WooCommerce Release
4
  Tags:woocommerce,google product feed,facebook product feed,woocommerce product feed,woocommerce,
5
  Requires at least: 3.6
6
  Tested Up To: 5.3
7
+ Stable tag: 3.1.42
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
304
 
305
  == Changelog ==
306
 
307
+ = 3.1.42 (2019-10-27) =
308
+ * Fix deactivation script
309
+
310
  = 3.1.41 (2019-10-24) =
311
  * Dependency & compatibility check upon activation
312
  * Tested with latest WordPress & WooCommerce Release
includes/classes/class-woo-feed-tracker.php CHANGED
@@ -23,12 +23,12 @@ final class WooFeedTracker {
23
  *
24
  */
25
  public function __construct() {
26
- if ( ! class_exists( 'WebAppick\Client' ) ) {
27
  /** @noinspection PhpIncludeInspection */
28
- require_once WOO_FEED_LIBS_PATH . 'WebAppick/Client.php';
29
  }
30
 
31
- $client = new WebAppick\Client( '4e68acba-cbdc-476b-b4bf-eab176ac6a16', 'WooCommerce Product Feed', WOO_FEED_FREE_FILE );
32
 
33
  $this->insights = $client->insights();
34
  // Hide tracker notice until tracking server gets ready...
23
  *
24
  */
25
  public function __construct() {
26
+ if ( ! class_exists( 'WebAppick\AppServices\Client' ) ) {
27
  /** @noinspection PhpIncludeInspection */
28
+ require_once WOO_FEED_LIBS_PATH . 'WebAppick/AppServices/Client.php';
29
  }
30
 
31
+ $client = new WebAppick\AppServices\Client( '4e68acba-cbdc-476b-b4bf-eab176ac6a16', 'WooCommerce Product Feed', WOO_FEED_FREE_FILE );
32
 
33
  $this->insights = $client->insights();
34
  // Hide tracker notice until tracking server gets ready...
libs/WebAppick/{Client.php → AppServices/Client.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace WebAppick;
3
  use WP_Error;
4
 
5
  /**
1
  <?php
2
+ namespace WebAppick\AppServices;
3
  use WP_Error;
4
 
5
  /**
libs/WebAppick/{Insights.php → AppServices/Insights.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace WebAppick;
3
  use WP_Theme;
4
  use WP_User;
5
 
@@ -34,7 +34,7 @@ class Insights {
34
  protected $extra_data = array();
35
 
36
  /**
37
- * WebAppick\Client
38
  *
39
  * @var Client
40
  */
@@ -48,12 +48,11 @@ class Insights {
48
  * @param string $file
49
  */
50
  public function __construct( $client, $name = null, $file = null ) {
51
-
52
  if ( is_string( $client ) && ! empty( $name ) && ! empty( $file ) ) {
53
  $client = new Client( $client, $name, $file );
54
  }
55
 
56
- if ( is_object( $client ) && is_a( $client, 'WebAppick\Client' ) ) {
57
  $this->client = $client;
58
  }
59
  }
@@ -380,7 +379,6 @@ class Insights {
380
  public function optIn() {
381
  update_option( $this->client->slug . '_allow_tracking', 'yes' );
382
  update_option( $this->client->slug . '_tracking_notice', 'hide' );
383
-
384
  $this->__clear_schedule_event();
385
  $this->__schedule_event();
386
  $this->send_tracking_data();
@@ -530,12 +528,10 @@ class Insights {
530
  */
531
  public function deactivation_cleanup() {
532
  $this->__clear_schedule_event();
533
-
534
  if ( 'theme' == $this->client->type ) {
535
  delete_option( $this->client->slug . '_tracking_last_send' );
536
  delete_option( $this->client->slug . '_allow_tracking' );
537
  }
538
-
539
  delete_option( $this->client->slug . '_tracking_notice' );
540
  }
541
 
@@ -621,36 +617,29 @@ class Insights {
621
 
622
  $current_user = wp_get_current_user();
623
  global $wpdb;
624
- /**
625
- * @TODO remove old data variable after server upgrade
626
- $data = array(
627
- 'hash' => $this->client->hash,
628
- 'reason_id' => sanitize_text_field( $_POST['reason_id'] ),
629
- 'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
630
- 'site' => $this->__get_site_name(),
631
- 'url' => esc_url( home_url() ),
632
- 'admin_email' => get_option( 'admin_email' ),
633
- 'user_email' => $current_user->user_email,
634
- 'first_name' => $current_user->first_name,
635
- 'last_name' => $current_user->last_name,
636
- 'server' => $this->__get_server_info(),
637
- 'wp' => $this->__get_wp_info(),
638
- 'ip_address' => $this->__get_user_ip_address(),
639
- 'version' => $this->client->project_version,
640
- );*/
641
  $data = array(
642
- 'reason_id' => sanitize_text_field( $_POST['reason_id'] ), // WPCS: CSRF ok, Input var ok.
643
- 'plugin' => "Woo Feed Free",
644
- 'url' => home_url(),
645
- 'user_email' => $current_user->data->user_email,
646
- 'user_name' => $current_user->data->display_name,
647
  'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
648
- 'software' => $_SERVER['SERVER_SOFTWARE'],
649
- 'php_version' => phpversion(),
650
- 'mysql_version' => $wpdb->db_version(),
651
- 'wp_version' => get_bloginfo( 'version' ),
652
- 'locale' => get_locale(),
653
- 'multisite' => is_multisite() ? 'Yes' : 'No'
 
 
 
 
 
 
 
 
 
 
 
 
654
  );
655
  // Add extra data
656
  if ( $extra = $this->get_extra_data() ) {
@@ -667,30 +656,23 @@ class Insights {
667
  */
668
  public function deactivate_scripts() {
669
  global $pagenow;
670
-
671
- if ( 'plugins.php' != $pagenow ) {
672
- return;
673
- }
674
-
675
  $reasons = $this->__get_uninstall_reasons();
676
  ?>
677
-
678
  <div class="wapk-dr-modal" id="<?php echo $this->client->slug; ?>-wapk-dr-modal">
679
  <div class="wapk-dr-modal-wrap">
680
  <div class="wapk-dr-modal-header">
681
  <h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'domain' ); ?></h3>
682
  </div>
683
-
684
  <div class="wapk-dr-modal-body">
685
  <ul class="reasons">
686
- <?php foreach ($reasons as $reason) { ?>
687
- <li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
688
- <label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
689
- </li>
690
- <?php } ?>
691
  </ul>
692
  </div>
693
-
694
  <div class="wapk-dr-modal-footer">
695
  <a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', 'domain' ); ?></a>
696
  <button class="button-secondary"><?php _e( 'Submit & Deactivate', 'domain' ); ?></button>
@@ -698,57 +680,16 @@ class Insights {
698
  </div>
699
  </div>
700
  </div>
701
-
702
- <!--suppress CssUnusedSymbol -->
703
  <style type="text/css">
704
- .wapk-dr-modal {
705
- position: fixed;
706
- z-index: 99999;
707
- top: 0;
708
- right: 0;
709
- bottom: 0;
710
- left: 0;
711
- background: rgba(0,0,0,0.5);
712
- display: none;
713
- }
714
-
715
- .wapk-dr-modal.modal-active {
716
- display: block;
717
- }
718
-
719
- .wapk-dr-modal-wrap {
720
- width: 475px;
721
- position: relative;
722
- margin: 10% auto;
723
- background: #fff;
724
- }
725
-
726
- .wapk-dr-modal-header {
727
- border-bottom: 1px solid #eee;
728
- padding: 8px 20px;
729
- }
730
-
731
- .wapk-dr-modal-header h3 {
732
- line-height: 150%;
733
- margin: 0;
734
- }
735
-
736
- .wapk-dr-modal-body {
737
- padding: 5px 20px 20px 20px;
738
- }
739
-
740
- .wapk-dr-modal-body .reason-input {
741
- margin-top: 5px;
742
- margin-left: 20px;
743
- }
744
- .wapk-dr-modal-footer {
745
- border-top: 1px solid #eee;
746
- padding: 12px 20px;
747
- text-align: right;
748
- }
749
  </style>
750
-
751
- <!--suppress JSUnresolvedVariable, ES6ConvertVarToLetConst -->
752
  <script type="text/javascript">
753
  (function($) {
754
  $(function() {
@@ -770,9 +711,9 @@ class Insights {
770
  buttonElem.addClass("disabled");
771
  buttonElem.text('Processing...');
772
  },
773
- always: function() {
774
  window.location.href = redirectTo;
775
- } // not only on complete...!
776
  } );
777
  }
778
  var modal = $( '#<?php echo $this->client->slug; ?>-wapk-dr-modal' ), deactivateLink = '';
@@ -825,7 +766,6 @@ class Insights {
825
  // Make sure this is WebAppick theme
826
  if( $old_theme->get_template() == $this->client->slug ) {
827
  $current_user = wp_get_current_user();
828
- /** @noinspection PhpUndefinedFieldInspection */
829
  $data = array(
830
  'hash' => $this->client->hash,
831
  'reason_id' => 'none',
1
  <?php
2
+ namespace WebAppick\AppServices;
3
  use WP_Theme;
4
  use WP_User;
5
 
34
  protected $extra_data = array();
35
 
36
  /**
37
+ * WebAppick\AppServices\Client
38
  *
39
  * @var Client
40
  */
48
  * @param string $file
49
  */
50
  public function __construct( $client, $name = null, $file = null ) {
 
51
  if ( is_string( $client ) && ! empty( $name ) && ! empty( $file ) ) {
52
  $client = new Client( $client, $name, $file );
53
  }
54
 
55
+ if ( is_object( $client ) && is_a( $client, 'WebAppick\AppServices\Client' ) ) {
56
  $this->client = $client;
57
  }
58
  }
379
  public function optIn() {
380
  update_option( $this->client->slug . '_allow_tracking', 'yes' );
381
  update_option( $this->client->slug . '_tracking_notice', 'hide' );
 
382
  $this->__clear_schedule_event();
383
  $this->__schedule_event();
384
  $this->send_tracking_data();
528
  */
529
  public function deactivation_cleanup() {
530
  $this->__clear_schedule_event();
 
531
  if ( 'theme' == $this->client->type ) {
532
  delete_option( $this->client->slug . '_tracking_last_send' );
533
  delete_option( $this->client->slug . '_allow_tracking' );
534
  }
 
535
  delete_option( $this->client->slug . '_tracking_notice' );
536
  }
537
 
617
 
618
  $current_user = wp_get_current_user();
619
  global $wpdb;
620
+ // @TODO remove deprecated data after server update
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  $data = array(
622
+ 'hash' => $this->client->hash,
623
+ 'reason_id' => sanitize_text_field( $_REQUEST['reason_id'] ), // WPCS: CSRF ok, Input var ok.
 
 
 
624
  'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
625
+ 'plugin' => $this->client->name, // deprecated
626
+ 'site' => $this->__get_site_name(),
627
+ 'url' => esc_url( home_url() ),
628
+ 'admin_email' => get_option( 'admin_email' ),
629
+ 'user_email' => $current_user->user_email,
630
+ 'user_name' => $current_user->display_name, // deprecated
631
+ 'first_name' => ( ! empty( $current_user->first_name ) ) ? $current_user->first_name : $current_user->display_name,
632
+ 'last_name' => $current_user->last_name,
633
+ 'server' => $this->__get_server_info(),
634
+ 'software' => $_SERVER['SERVER_SOFTWARE'], // deprecated, using $data['server'] for wp info
635
+ 'php_version' => phpversion(), // deprecated, using $data['server'] for wp info
636
+ 'mysql_version' => $wpdb->db_version(), // deprecated, using $data['server'] for wp info
637
+ 'wp' => $this->__get_wp_info(),
638
+ 'wp_version' => get_bloginfo( 'version' ), // deprecated, using $data['wp'] for wp info
639
+ 'locale' => get_locale(), // deprecated, using $data['wp'] for wp info
640
+ 'multisite' => is_multisite() ? 'Yes' : 'No', // deprecated, using $data['wp'] for wp info
641
+ 'ip_address' => $this->__get_user_ip_address(),
642
+ 'version' => $this->client->project_version,
643
  );
644
  // Add extra data
645
  if ( $extra = $this->get_extra_data() ) {
656
  */
657
  public function deactivate_scripts() {
658
  global $pagenow;
659
+ if ( 'plugins.php' !== $pagenow ) return;
 
 
 
 
660
  $reasons = $this->__get_uninstall_reasons();
661
  ?>
 
662
  <div class="wapk-dr-modal" id="<?php echo $this->client->slug; ?>-wapk-dr-modal">
663
  <div class="wapk-dr-modal-wrap">
664
  <div class="wapk-dr-modal-header">
665
  <h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'domain' ); ?></h3>
666
  </div>
 
667
  <div class="wapk-dr-modal-body">
668
  <ul class="reasons">
669
+ <?php foreach ($reasons as $reason) { ?>
670
+ <li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
671
+ <label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
672
+ </li>
673
+ <?php } ?>
674
  </ul>
675
  </div>
 
676
  <div class="wapk-dr-modal-footer">
677
  <a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', 'domain' ); ?></a>
678
  <button class="button-secondary"><?php _e( 'Submit & Deactivate', 'domain' ); ?></button>
680
  </div>
681
  </div>
682
  </div>
 
 
683
  <style type="text/css">
684
+ .wapk-dr-modal { position: fixed; z-index: 99999; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.5); display: none; }
685
+ .wapk-dr-modal.modal-active { display: block; }
686
+ .wapk-dr-modal-wrap { width: 475px; position: relative; margin: 10% auto; background: #fff; }
687
+ .wapk-dr-modal-header { border-bottom: 1px solid #eee; padding: 8px 20px; }
688
+ .wapk-dr-modal-header h3 { line-height: 150%; margin: 0; }
689
+ .wapk-dr-modal-body { padding: 5px 20px 20px 20px; }
690
+ .wapk-dr-modal-body .reason-input { margin-top: 5px; margin-left: 20px; }
691
+ .wapk-dr-modal-footer { border-top: 1px solid #eee; padding: 12px 20px; text-align: right; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  </style>
 
 
693
  <script type="text/javascript">
694
  (function($) {
695
  $(function() {
711
  buttonElem.addClass("disabled");
712
  buttonElem.text('Processing...');
713
  },
714
+ complete: function(x,y,z) {
715
  window.location.href = redirectTo;
716
+ }
717
  } );
718
  }
719
  var modal = $( '#<?php echo $this->client->slug; ?>-wapk-dr-modal' ), deactivateLink = '';
766
  // Make sure this is WebAppick theme
767
  if( $old_theme->get_template() == $this->client->slug ) {
768
  $current_user = wp_get_current_user();
 
769
  $data = array(
770
  'hash' => $this->client->hash,
771
  'reason_id' => 'none',
libs/WebAppick/{License.php → AppServices/License.php} RENAMED
@@ -1,16 +1,16 @@
1
  <?php
2
- namespace WebAppick;
3
  /**
4
  * WebAppick License Checker
5
  *
6
- * This class will check, active and deactive license
7
  */
8
  class License {
9
 
10
  /**
11
- * Client
12
  *
13
- * @var object
14
  */
15
  protected $client;
16
 
@@ -56,80 +56,72 @@ class License {
56
  */
57
  public function __construct( Client $client ) {
58
  $this->client = $client;
59
-
60
  $this->option_key = 'WebAppick_' . md5( $this->client->slug ) . '_licenses';
61
  }
62
 
63
  /**
64
  * Check license
65
  * @param string $license_key
66
- * @return boolean
67
  */
68
  public function check( $license_key ) {
69
- $route = 'public/license/' . $this->client->hash . '/check';
70
-
71
- return $this->send_request( $license_key, $route );
72
  }
73
 
74
  /**
75
  * Active a license
76
- *
77
- * @return boolean
78
  */
79
  public function activate( $license_key ) {
80
- $route = 'public/license/' . $this->client->hash . '/activate';
81
-
82
- return $this->send_request( $license_key, $route );
83
  }
84
 
85
  /**
86
  * Deactivate a license
87
- *
88
  * @return array
89
  */
90
  public function deactivate( $license_key ) {
91
- $route = 'public/license/' . $this->client->hash . '/deactivate';
92
- return $this->send_request( $license_key, $route );
93
  }
94
 
95
  /**
96
  * Send common request
97
  *
98
- * @param $license_key
99
- * @param $route
100
  *
101
  * @return array
102
  */
103
  protected function send_request( $license_key, $route ) {
104
- $params = array(
105
  'license_key' => $license_key,
106
  'url' => esc_url( home_url() ),
107
- );
108
  $response = $this->client->send_request( $params, $route, true );
109
-
110
  if ( is_wp_error( $response ) ) {
111
- return array(
112
- 'success' => false,
113
- 'error' => $response->get_error_message()
114
- );
 
115
  }
116
-
117
  $response = json_decode( wp_remote_retrieve_body( $response ), true );
118
-
119
- if ( empty( $response ) || isset( $response['exception'] )) {
120
- return array(
121
- 'success' => false,
122
- 'error' => 'Unknown error occurred, Please try again.'
123
- );
124
  }
125
-
126
  if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) {
127
- $response = array(
128
- 'success' => false,
129
- 'error' => $response['errors']['license_key'][0]
130
- );
 
131
  }
132
-
133
  return $response;
134
  }
135
 
@@ -141,7 +133,7 @@ class License {
141
  * @return void
142
  */
143
  public function add_settings_page( $args = array() ) {
144
- $defaults = array(
145
  'type' => 'menu', // Can be: menu, options, submenu
146
  'page_title' => 'Manage License',
147
  'menu_title' => 'Manage License',
@@ -150,12 +142,9 @@ class License {
150
  'icon_url' => '',
151
  'position' => null,
152
  'parent_slug' => '',
153
- );
154
-
155
  $this->menu_args = wp_parse_args( $args, $defaults );
156
-
157
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
158
-
159
  add_action( $this->client->slug . '_license_check_event', array( $this, 'check_license_status' ) );
160
  }
161
 
@@ -166,7 +155,6 @@ class License {
166
  */
167
  public function admin_menu() {
168
  $add_page = 'add_' . $this->menu_args['type'] . '_page';
169
-
170
  switch ( $this->menu_args['type'] ) {
171
  case 'menu':
172
  $add_page(
@@ -205,34 +193,28 @@ class License {
205
 
206
  /**
207
  * License menu output
 
208
  */
209
  public function menu_output() {
210
-
211
  if ( isset( $_POST['submit'] ) ) {
212
  $this->license_page_form( $_POST );
213
  }
214
-
215
  $license = get_option( $this->option_key, null );
216
  $action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'Deactive' : 'Active';
217
  ?>
218
-
219
- <div class="wrap">
220
  <h1><?php echo $this->menu_args['menu_title']; ?></h1>
221
-
222
  <?php if ( ! empty( $this->error ) ) : ?>
223
  <div class="notice notice-error is-dismissible" style="max-width: 745px;">
224
  <p><?php echo $this->error; ?></p>
225
  </div>
226
  <?php endif; ?>
227
-
228
  <?php if ( ! empty( $this->success ) ) : ?>
229
  <div class="notice notice-success is-dismissible" style="max-width: 745px;">
230
  <p><?php echo $this->success; ?></p>
231
  </div>
232
  <?php endif; ?>
233
-
234
  <br />
235
-
236
  <div class="widget open" style="max-width: 800px; margin: 0;">
237
  <div class="widget-top">
238
  <div class="widget-title"><h3>License Settings</h3></div>
@@ -246,9 +228,7 @@ class License {
246
  <label>License key</label>
247
  </th>
248
  <td>
249
- <input type="text" class="regular-text code" value="<?php echo $license['key']; ?>"
250
- placeholder="Enter your license key" name="license_key"
251
- <?php echo ( 'Deactive' == $action ) ? 'readonly="readonly"' : ''; ?> />
252
  </td>
253
  </tr>
254
  </tbody>
@@ -267,75 +247,67 @@ class License {
267
 
268
  /**
269
  * License form submit
 
 
270
  */
271
  private function license_page_form( $form ) {
272
  if ( $form['_action'] == 'Active' ) {
273
  $response = $this->activate( $form['license_key'] );
274
-
275
  if ( ! empty( $response['success'] ) ) {
276
- $data = array(
277
  'key' => $form['license_key'],
278
  'status' => 'activate',
279
- );
280
  update_option( $this->option_key, $data, false );
281
  $this->success = 'License activated successfully.';
282
  }
283
  } else if ( $form['_action'] == 'Deactive' ) {
284
  $response = $this->deactivate( $form['license_key'] );
285
-
286
  if ( ! empty( $response['success'] ) ) {
287
  $this->success = 'License deactivated successfully.';
288
  }
289
-
290
- $data = array(
291
  'key' => '',
292
  'status' => 'deactivate',
293
- );
294
-
295
  update_option( $this->option_key, $data, false );
296
  }
297
-
298
  if ( isset( $response['error'] ) && ! empty( $response['error'] ) ) {
299
  $this->error = $response['error'];
300
  }
301
-
302
- // var_export( $response );
303
  }
304
 
305
  /**
306
  * Check license status on schedule
 
307
  */
308
  public function check_license_status() {
309
  $license = get_option( $this->option_key, null );
310
-
311
  if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
312
  $response = $this->check( $license['key'] );
313
-
314
  if ( isset( $response['success'] ) && $response['success'] ) {
315
  $license['status'] = 'activate';
316
  } else {
317
  $license['status'] = 'deactivate';
318
  }
319
-
320
  update_option( $this->option_key, $license, false );
321
  }
322
  }
323
 
324
  /**
325
  * Check this is a valid license
 
326
  */
327
  public function is_valid() {
328
  if ( null !== $this->is_valid_license ) {
329
  return $this->is_valid_license;
330
  }
331
-
332
  $license = get_option( $this->option_key, null );
333
  if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
334
  $this->is_valid_license = true;
335
  } else {
336
  $this->is_valid_license = false;
337
  }
338
-
339
  return $this->is_valid_license;
340
  }
341
 
1
  <?php
2
+ namespace WebAppick\AppServices;
3
  /**
4
  * WebAppick License Checker
5
  *
6
+ * This class will check, active and deactivate license
7
  */
8
  class License {
9
 
10
  /**
11
+ * WebAppick\AppServices\Client
12
  *
13
+ * @var Client
14
  */
15
  protected $client;
16
 
56
  */
57
  public function __construct( Client $client ) {
58
  $this->client = $client;
 
59
  $this->option_key = 'WebAppick_' . md5( $this->client->slug ) . '_licenses';
60
  }
61
 
62
  /**
63
  * Check license
64
  * @param string $license_key
65
+ * @return array
66
  */
67
  public function check( $license_key ) {
68
+ return $this->send_request( $license_key, 'public/license/' . $this->client->hash . '/check' );
 
 
69
  }
70
 
71
  /**
72
  * Active a license
73
+ * @param string $license_key
74
+ * @return array
75
  */
76
  public function activate( $license_key ) {
77
+ return $this->send_request( $license_key, 'public/license/' . $this->client->hash . '/activate' );
 
 
78
  }
79
 
80
  /**
81
  * Deactivate a license
82
+ * @param string $license_key
83
  * @return array
84
  */
85
  public function deactivate( $license_key ) {
86
+ return $this->send_request( $license_key, 'public/license/' . $this->client->hash . '/deactivate' );
 
87
  }
88
 
89
  /**
90
  * Send common request
91
  *
92
+ * @param string $license_key
93
+ * @param string $route
94
  *
95
  * @return array
96
  */
97
  protected function send_request( $license_key, $route ) {
98
+ $params = [
99
  'license_key' => $license_key,
100
  'url' => esc_url( home_url() ),
101
+ ];
102
  $response = $this->client->send_request( $params, $route, true );
 
103
  if ( is_wp_error( $response ) ) {
104
+ return [
105
+ 'success' => false,
106
+ 'error_code' => $response->get_error_code(),
107
+ 'error' => $response->get_error_message()
108
+ ];
109
  }
 
110
  $response = json_decode( wp_remote_retrieve_body( $response ), true );
111
+ if ( empty( $response ) || isset( $response['exception'] ) ) {
112
+ return [
113
+ 'success' => false,
114
+ 'error_code' => 'UNKNOWN',
115
+ 'error' => esc_html__( 'Unknown error occurred, Please try again.', 'webappick' ),
116
+ ];
117
  }
 
118
  if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) {
119
+ $response = [
120
+ 'success' => false,
121
+ 'error_code' => isset( $response['errors']['error_code'] ) ? $response['errors']['error_code'] : 'UNKNOWN',
122
+ 'error' => $response['errors']['license_key'][0]
123
+ ];
124
  }
 
125
  return $response;
126
  }
127
 
133
  * @return void
134
  */
135
  public function add_settings_page( $args = array() ) {
136
+ $defaults = [
137
  'type' => 'menu', // Can be: menu, options, submenu
138
  'page_title' => 'Manage License',
139
  'menu_title' => 'Manage License',
142
  'icon_url' => '',
143
  'position' => null,
144
  'parent_slug' => '',
145
+ ];
 
146
  $this->menu_args = wp_parse_args( $args, $defaults );
 
147
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
 
148
  add_action( $this->client->slug . '_license_check_event', array( $this, 'check_license_status' ) );
149
  }
150
 
155
  */
156
  public function admin_menu() {
157
  $add_page = 'add_' . $this->menu_args['type'] . '_page';
 
158
  switch ( $this->menu_args['type'] ) {
159
  case 'menu':
160
  $add_page(
193
 
194
  /**
195
  * License menu output
196
+ * @return void
197
  */
198
  public function menu_output() {
 
199
  if ( isset( $_POST['submit'] ) ) {
200
  $this->license_page_form( $_POST );
201
  }
 
202
  $license = get_option( $this->option_key, null );
203
  $action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'Deactive' : 'Active';
204
  ?>
205
+ <div class="wrap wapk-admin">
 
206
  <h1><?php echo $this->menu_args['menu_title']; ?></h1>
 
207
  <?php if ( ! empty( $this->error ) ) : ?>
208
  <div class="notice notice-error is-dismissible" style="max-width: 745px;">
209
  <p><?php echo $this->error; ?></p>
210
  </div>
211
  <?php endif; ?>
 
212
  <?php if ( ! empty( $this->success ) ) : ?>
213
  <div class="notice notice-success is-dismissible" style="max-width: 745px;">
214
  <p><?php echo $this->success; ?></p>
215
  </div>
216
  <?php endif; ?>
 
217
  <br />
 
218
  <div class="widget open" style="max-width: 800px; margin: 0;">
219
  <div class="widget-top">
220
  <div class="widget-title"><h3>License Settings</h3></div>
228
  <label>License key</label>
229
  </th>
230
  <td>
231
+ <input type="text" class="regular-text code" value="<?php echo $license['key']; ?>" placeholder="Enter your license key" name="license_key"<?php echo ( 'Deactive' == $action ) ? 'readonly="readonly"' : ''; ?> />
 
 
232
  </td>
233
  </tr>
234
  </tbody>
247
 
248
  /**
249
  * License form submit
250
+ * @param array $form
251
+ * @return void
252
  */
253
  private function license_page_form( $form ) {
254
  if ( $form['_action'] == 'Active' ) {
255
  $response = $this->activate( $form['license_key'] );
 
256
  if ( ! empty( $response['success'] ) ) {
257
+ $data = [
258
  'key' => $form['license_key'],
259
  'status' => 'activate',
260
+ ];
261
  update_option( $this->option_key, $data, false );
262
  $this->success = 'License activated successfully.';
263
  }
264
  } else if ( $form['_action'] == 'Deactive' ) {
265
  $response = $this->deactivate( $form['license_key'] );
 
266
  if ( ! empty( $response['success'] ) ) {
267
  $this->success = 'License deactivated successfully.';
268
  }
269
+ $data = [
 
270
  'key' => '',
271
  'status' => 'deactivate',
272
+ ];
 
273
  update_option( $this->option_key, $data, false );
274
  }
 
275
  if ( isset( $response['error'] ) && ! empty( $response['error'] ) ) {
276
  $this->error = $response['error'];
277
  }
 
 
278
  }
279
 
280
  /**
281
  * Check license status on schedule
282
+ * @return void
283
  */
284
  public function check_license_status() {
285
  $license = get_option( $this->option_key, null );
 
286
  if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
287
  $response = $this->check( $license['key'] );
 
288
  if ( isset( $response['success'] ) && $response['success'] ) {
289
  $license['status'] = 'activate';
290
  } else {
291
  $license['status'] = 'deactivate';
292
  }
 
293
  update_option( $this->option_key, $license, false );
294
  }
295
  }
296
 
297
  /**
298
  * Check this is a valid license
299
+ * @return bool
300
  */
301
  public function is_valid() {
302
  if ( null !== $this->is_valid_license ) {
303
  return $this->is_valid_license;
304
  }
 
305
  $license = get_option( $this->option_key, null );
306
  if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
307
  $this->is_valid_license = true;
308
  } else {
309
  $this->is_valid_license = false;
310
  }
 
311
  return $this->is_valid_license;
312
  }
313
 
libs/WebAppick/{Updater.php → AppServices/Updater.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- namespace WebAppick;
3
  /**
4
  * WebAppick Updater
5
  *
@@ -8,22 +8,26 @@ namespace WebAppick;
8
  class Updater {
9
 
10
  /**
11
- * WebAppick\Client
12
  *
13
  * @var Client
14
  */
15
  protected $client;
16
 
 
 
 
 
 
 
17
  /**
18
  * Initialize the class
19
  *
20
  * @param Client
21
  */
22
  public function __construct( Client $client ) {
23
-
24
  $this->client = $client;
25
  $this->cache_key = 'WebAppick_' . md5( $this->client->slug ) . '_version_info';
26
-
27
  // Run hooks.
28
  if ( $this->client->type == 'plugin' ) {
29
  $this->run_plugin_hooks();
@@ -58,37 +62,24 @@ class Updater {
58
  */
59
  public function check_plugin_update( $transient_data ) {
60
  global $pagenow;
61
-
62
- if ( ! is_object( $transient_data ) ) {
63
- $transient_data = new \stdClass;
64
- }
65
-
66
- if ( 'plugins.php' == $pagenow && is_multisite() ) {
67
- return $transient_data;
68
- }
69
-
70
  if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) {
71
  return $transient_data;
72
  }
73
-
74
  $version_info = $this->get_cached_version_info();
75
-
76
  if ( false === $version_info ) {
77
  $version_info = $this->get_project_latest_version();
78
  $this->set_cached_version_info( $version_info );
79
  }
80
-
81
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
82
-
83
  if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
84
  unset( $version_info->sections );
85
  $transient_data->response[ $this->client->basename ] = $version_info;
86
  }
87
-
88
  $transient_data->last_checked = time();
89
  $transient_data->checked[ $this->client->basename ] = $this->client->project_version;
90
  }
91
-
92
  return $transient_data;
93
  }
94
 
@@ -98,27 +89,21 @@ class Updater {
98
  * @return object|bool
99
  */
100
  private function get_cached_version_info() {
101
-
102
  $value = get_transient( $this->cache_key );
103
-
104
  if( ! $value && ! isset( $value->name ) ) {
105
  return false; // Cache is expired
106
  }
107
-
108
  // We need to turn the icons into an array
109
  if ( isset( $value->icons ) ) {
110
  $value->icons = (array) $value->icons;
111
  }
112
-
113
  // We need to turn the banners into an array
114
  if ( isset( $value->banners ) ) {
115
  $value->banners = (array) $value->banners;
116
  }
117
-
118
  if ( isset( $value->sections ) ) {
119
  $value->sections = (array) $value->sections;
120
  }
121
-
122
  return $value;
123
  }
124
 
@@ -128,9 +113,7 @@ class Updater {
128
  * @return void
129
  */
130
  private function set_cached_version_info( $value ) {
131
- if ( ! $value ) {
132
- return;
133
- }
134
  set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS );
135
  }
136
 
@@ -138,44 +121,22 @@ class Updater {
138
  * Get plugin info from WebAppick
139
  */
140
  private function get_project_latest_version() {
141
-
142
  $license_option_key = 'WebAppick_' . md5( $this->client->slug ) . '_manage_license';
143
  $license = get_option( $license_option_key, null );
144
-
145
- $params = array(
146
  'version' => $this->client->project_version,
147
  'name' => $this->client->name,
148
  'slug' => $this->client->slug,
149
  'basename' => $this->client->basename,
150
  'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '',
151
- );
152
-
153
- $route = 'update/' . $this->client->hash . '/check';
154
-
155
- $response = $this->client->send_request( $params, $route, true );
156
-
157
- if ( is_wp_error( $response ) ) {
158
- return false;
159
- }
160
-
161
  $response = json_decode( wp_remote_retrieve_body( $response ) );
162
-
163
- if ( ! isset( $response->slug ) ) {
164
- return false;
165
- }
166
-
167
- if ( isset( $response->icons ) ) {
168
- $response->icons = (array) $response->icons;
169
- }
170
-
171
- if ( isset( $response->banners ) ) {
172
- $response->banners = (array) $response->banners;
173
- }
174
-
175
- if ( isset( $response->sections ) ) {
176
- $response->sections = (array) $response->sections;
177
- }
178
-
179
  return $response;
180
  }
181
 
@@ -189,60 +150,38 @@ class Updater {
189
  * @return object $data
190
  */
191
  public function plugins_api_filter( $data, $action = '', $args = null ) {
192
-
193
- if ( $action != 'plugin_information' ) {
194
- return $data;
195
- }
196
-
197
- if ( ! isset( $args->slug ) || ( $args->slug != $this->client->slug ) ) {
198
- return $data;
199
- }
200
-
201
  $version_info = $this->get_cached_version_info();
202
-
203
  if ( false === $version_info ) {
204
  $version_info = $this->get_project_latest_version();
205
  $this->set_cached_version_info( $version_info );
206
  }
207
-
208
  return $version_info;
209
  }
210
 
211
  /**
212
- * Check theme upate
213
  */
214
  public function check_theme_update( $transient_data ) {
215
  global $pagenow;
216
-
217
- if ( ! is_object( $transient_data ) ) {
218
- $transient_data = new \stdClass;
219
- }
220
-
221
- if ( 'themes.php' == $pagenow && is_multisite() ) {
222
- return $transient_data;
223
- }
224
-
225
  if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) {
226
  return $transient_data;
227
  }
228
-
229
  $version_info = $this->get_cached_version_info();
230
-
231
  if ( false === $version_info ) {
232
  $version_info = $this->get_project_latest_version();
233
  $this->set_cached_version_info( $version_info );
234
  }
235
-
236
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
237
-
238
  if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
239
  $transient_data->response[ $this->client->slug ] = (array) $version_info;
240
  }
241
-
242
  $transient_data->last_checked = time();
243
  $transient_data->checked[ $this->client->slug ] = $this->client->project_version;
244
  }
245
-
246
  return $transient_data;
247
  }
248
 
1
  <?php
2
+ namespace WebAppick\AppServices;
3
  /**
4
  * WebAppick Updater
5
  *
8
  class Updater {
9
 
10
  /**
11
+ * WebAppick\AppServices\Client
12
  *
13
  * @var Client
14
  */
15
  protected $client;
16
 
17
+ /**
18
+ * Cache Key for current App
19
+ * @var string
20
+ */
21
+ private $cache_key;
22
+
23
  /**
24
  * Initialize the class
25
  *
26
  * @param Client
27
  */
28
  public function __construct( Client $client ) {
 
29
  $this->client = $client;
30
  $this->cache_key = 'WebAppick_' . md5( $this->client->slug ) . '_version_info';
 
31
  // Run hooks.
32
  if ( $this->client->type == 'plugin' ) {
33
  $this->run_plugin_hooks();
62
  */
63
  public function check_plugin_update( $transient_data ) {
64
  global $pagenow;
65
+ if ( ! is_object( $transient_data ) ) $transient_data = new \stdClass;
66
+ if ( 'plugins.php' == $pagenow && is_multisite() ) return $transient_data;
 
 
 
 
 
 
 
67
  if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) {
68
  return $transient_data;
69
  }
 
70
  $version_info = $this->get_cached_version_info();
 
71
  if ( false === $version_info ) {
72
  $version_info = $this->get_project_latest_version();
73
  $this->set_cached_version_info( $version_info );
74
  }
 
75
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
 
76
  if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
77
  unset( $version_info->sections );
78
  $transient_data->response[ $this->client->basename ] = $version_info;
79
  }
 
80
  $transient_data->last_checked = time();
81
  $transient_data->checked[ $this->client->basename ] = $this->client->project_version;
82
  }
 
83
  return $transient_data;
84
  }
85
 
89
  * @return object|bool
90
  */
91
  private function get_cached_version_info() {
 
92
  $value = get_transient( $this->cache_key );
 
93
  if( ! $value && ! isset( $value->name ) ) {
94
  return false; // Cache is expired
95
  }
 
96
  // We need to turn the icons into an array
97
  if ( isset( $value->icons ) ) {
98
  $value->icons = (array) $value->icons;
99
  }
 
100
  // We need to turn the banners into an array
101
  if ( isset( $value->banners ) ) {
102
  $value->banners = (array) $value->banners;
103
  }
 
104
  if ( isset( $value->sections ) ) {
105
  $value->sections = (array) $value->sections;
106
  }
 
107
  return $value;
108
  }
109
 
113
  * @return void
114
  */
115
  private function set_cached_version_info( $value ) {
116
+ if ( ! $value ) return;
 
 
117
  set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS );
118
  }
119
 
121
  * Get plugin info from WebAppick
122
  */
123
  private function get_project_latest_version() {
 
124
  $license_option_key = 'WebAppick_' . md5( $this->client->slug ) . '_manage_license';
125
  $license = get_option( $license_option_key, null );
126
+ $params = [
 
127
  'version' => $this->client->project_version,
128
  'name' => $this->client->name,
129
  'slug' => $this->client->slug,
130
  'basename' => $this->client->basename,
131
  'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '',
132
+ ];
133
+ $response = $this->client->send_request( $params, 'update/' . $this->client->hash . '/check', true );
134
+ if ( is_wp_error( $response ) ) return false;
 
 
 
 
 
 
 
135
  $response = json_decode( wp_remote_retrieve_body( $response ) );
136
+ if ( ! isset( $response->slug ) ) return false;
137
+ if ( isset( $response->icons ) ) $response->icons = (array) $response->icons;
138
+ if ( isset( $response->banners ) ) $response->banners = (array) $response->banners;
139
+ if ( isset( $response->sections ) ) $response->sections = (array) $response->sections;
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  return $response;
141
  }
142
 
150
  * @return object $data
151
  */
152
  public function plugins_api_filter( $data, $action = '', $args = null ) {
153
+ if ( $action != 'plugin_information' ) return $data;
154
+ if ( ! isset( $args->slug ) || ( $args->slug != $this->client->slug ) ) return $data;
 
 
 
 
 
 
 
155
  $version_info = $this->get_cached_version_info();
 
156
  if ( false === $version_info ) {
157
  $version_info = $this->get_project_latest_version();
158
  $this->set_cached_version_info( $version_info );
159
  }
 
160
  return $version_info;
161
  }
162
 
163
  /**
164
+ * Check theme update
165
  */
166
  public function check_theme_update( $transient_data ) {
167
  global $pagenow;
168
+ if ( ! is_object( $transient_data ) ) $transient_data = new \stdClass;
169
+ if ( 'themes.php' == $pagenow && is_multisite() ) return $transient_data;
 
 
 
 
 
 
 
170
  if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) {
171
  return $transient_data;
172
  }
 
173
  $version_info = $this->get_cached_version_info();
 
174
  if ( false === $version_info ) {
175
  $version_info = $this->get_project_latest_version();
176
  $this->set_cached_version_info( $version_info );
177
  }
 
178
  if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
 
179
  if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
180
  $transient_data->response[ $this->client->slug ] = (array) $version_info;
181
  }
 
182
  $transient_data->last_checked = time();
183
  $transient_data->checked[ $this->client->slug ] = $this->client->project_version;
184
  }
 
185
  return $transient_data;
186
  }
187
 
libs/WebAppick/AppServices/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
woo-feed.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: WooCommerce Product Feed
16
  * Plugin URI: https://webappick.com/
17
  * Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
18
- * Version: 3.1.41
19
  * Author: WebAppick
20
  * Author URI: https://webappick.com/
21
  * License: GPL v2
@@ -34,7 +34,7 @@ if( ! defined( 'WOO_FEED_VERSION' ) ) {
34
  * Plugin Version
35
  * @var string
36
  */
37
- define( 'WOO_FEED_VERSION', '3.1.41' );
38
  }
39
  if( ! defined( 'WOO_FEED_FREE_FILE') ) {
40
  /**
15
  * Plugin Name: WooCommerce Product Feed
16
  * Plugin URI: https://webappick.com/
17
  * Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
18
+ * Version: 3.1.42
19
  * Author: WebAppick
20
  * Author URI: https://webappick.com/
21
  * License: GPL v2
34
  * Plugin Version
35
  * @var string
36
  */
37
+ define( 'WOO_FEED_VERSION', '3.1.42' );
38
  }
39
  if( ! defined( 'WOO_FEED_FREE_FILE') ) {
40
  /**