CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.5.1

Version Description

(2022-08-24) = * autoload file not found issue fixed.

Download this release

Release Info

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

Code changes from version 4.5.0 to 4.5.1

Files changed (2) hide show
  1. README.txt +4 -1
  2. woo-feed.php +155 -155
README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: WooCommerce Product Feed, WooCommerce, Google Shopping, Google Merchant, F
5
  Requires at least: 4.4
6
  Tested Up To: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 4.5.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -590,6 +590,9 @@ Using pro version:
590
 
591
  == Changelog ==
592
 
 
 
 
593
  = 4.5.0 (2022-08-24) =
594
  * Product query feature improved.
595
 
5
  Requires at least: 4.4
6
  Tested Up To: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 4.5.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
590
 
591
  == Changelog ==
592
 
593
+ = 4.5.1 (2022-08-24) =
594
+ * autoload file not found issue fixed.
595
+
596
  = 4.5.0 (2022-08-24) =
597
  * Product query feature improved.
598
 
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
- * Version: 4.5.0
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -34,13 +34,13 @@ if ( ! defined( 'ABSPATH' ) ) {
34
 
35
 
36
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
37
- /**
38
- * Plugin Base File
39
- *
40
- * @since 3.1.41
41
- * @var string
42
- */
43
- define( 'WOO_FEED_FREE_FILE', __FILE__ );
44
  }
45
 
46
  require_once __DIR__ . '/includes/classes/class-woo-feed-constants.php';
@@ -53,21 +53,21 @@ Woo_Feed_Constants::defined_constants();
53
  *
54
  * */
55
  require_once __DIR__ . DIRECTORY_SEPARATOR
56
- . 'libs' . DIRECTORY_SEPARATOR
57
- . 'autoload.php';
58
 
59
  /**
60
  * Load V5 Module
61
  */
62
- require_once WOO_FEED_FREE_PATH . 'v5/autoload.php';
63
 
64
  // Attributes executable file [Manages newly added attributes]
65
  // @TODO Refactor all the attributes to a single file.
66
  require_once __DIR__ . DIRECTORY_SEPARATOR
67
- . 'libs' . DIRECTORY_SEPARATOR
68
- . 'WebAppick' . DIRECTORY_SEPARATOR
69
- . 'Attributes' . DIRECTORY_SEPARATOR
70
- . 'Attributes.php';
71
 
72
  /**
73
  * Load Uses Tracker
@@ -122,10 +122,10 @@ if ( ! function_exists( 'run_woo_feed' ) ) {
122
  add_action( 'plugins_loaded', array( $plugin, 'run' ), PHP_INT_MAX );
123
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
124
  //add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
125
- WooFeedWebAppickAPI::getInstance();
126
-
127
- }
128
-
129
  run_woo_feed();
130
  }
131
 
@@ -156,15 +156,15 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
156
  wp_send_json_error( esc_html__( 'Invalid Request.', 'woo-feed' ) );
157
  die();
158
  }
159
-
160
  $feedName = woo_feed_extract_feed_option_name( sanitize_text_field( wp_unslash( $_REQUEST['feed'] ) ) );
161
  $feedInfo = get_option( 'wf_config' . $feedName, false );
162
-
163
  if ( ! $feedInfo ) {
164
  $getFeedConfig = maybe_unserialize( get_option( 'wf_feed_' . $feedName ) );
165
  $feedInfo = $getFeedConfig['feedrules'];
166
  }
167
-
168
  $feedInfo['productIds'] = isset( $_REQUEST['products'] ) ? array_map( 'absint', $_REQUEST['products'] ) : array();
169
  $offset = isset( $_REQUEST['loop'] ) ? absint( $_REQUEST['loop'] ) : 0;
170
  if ( woo_feed_is_debugging_enabled() ) {
@@ -180,17 +180,17 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
180
  woo_feed_log_feed_process( $feedInfo['filename'], $m );
181
  }
182
  }
183
-
184
  if ( 0 === $offset ) {
185
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
186
  }
187
-
188
  if ( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
189
- $feed_data = true;
190
- } else {
191
- $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
192
- }
193
-
194
  if ( $feed_data ) {
195
  woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
196
  wp_send_json_success(
@@ -231,15 +231,15 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
231
  wp_send_json_error( esc_html__( 'Invalid Feed.', 'woo-feed' ) );
232
  die();
233
  }
234
-
235
  $feedName = woo_feed_extract_feed_option_name( sanitize_text_field( wp_unslash( $_REQUEST['feed'] ) ) );
236
  $info = get_option( 'wf_config' . $feedName, false );
237
-
238
  if ( ! $info ) {
239
  $getFeedConfig = maybe_unserialize( get_option( 'wf_feed_' . $feedName ) );
240
  $info = $getFeedConfig['feedrules'];
241
  }
242
-
243
  $feedService = $info['provider'];
244
  $type = $info['feedType'];
245
  woo_feed_log_feed_process( $info['filename'], sprintf( 'Preparing Final Feed (%s) File...', $type ) );
@@ -256,26 +256,26 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
256
  if ( ! $feedFooter ) {
257
  woo_feed_log_feed_process( $info['filename'], 'Unable to Get Footer Chunk' );
258
  }
259
-
260
  // make file xml string
261
  if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
262
- $reviewObj = new Woo_Feed_Review($info);
263
- $feedBody = $reviewObj->make_review_xml_feed();
264
- $string = $feedBody;
265
-
266
  } elseif ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
267
- $csvHead[0] = $feedHeader;
268
- if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
269
- $string = array_merge( $csvHead, $feedBody );
270
- } else {
271
- $string = array();
272
- }
273
- } elseif ( 'json' === $type ) {
274
- $string = $feedBody;
275
- } else {
276
- $string = $feedHeader . $feedBody . $feedFooter;
277
- }
278
-
279
  $upload_dir = wp_get_upload_dir();
280
  $path = $upload_dir['basedir'] . '/woo-feed/' . $feedService . '/' . $type;
281
  $saveFile = false;
@@ -318,7 +318,7 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
318
  wp_send_json_error( $data );
319
  wp_die();
320
  }
321
-
322
  $feed_URL = woo_feed_get_file_url( $feedName, $feedService, $type );
323
  // Save Info into database.
324
  $feedInfo = array(
@@ -332,21 +332,21 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
332
  } else {
333
  $feedInfo['status'] = 1;
334
  }
335
-
336
  woo_feed_unlink_tempFiles( $info, $feedName );
337
-
338
  woo_feed_log_feed_process( $info['filename'], 'Updating Feed Information.' );
339
-
340
  update_option( 'wf_feed_' . $feedName, serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
341
-
342
  if ( $saveFile ) {
343
  // FTP File Upload Info
344
  $ftpEnabled = sanitize_text_field( $info['ftpenabled'] );
345
-
346
  if ( $ftpEnabled ) {
347
  woo_feed_handle_file_transfer( $file, $feedName . '.' . $type, $info );
348
  }
349
-
350
  $cat = woo_feed_check_google_category( $feedInfo );
351
  $data = array(
352
  'info' => $feedInfo,
@@ -380,7 +380,7 @@ if ( ! function_exists( 'woo_feed_generate_batch_data' ) ) {
380
  function woo_feed_generate_batch_data( $info, $feedSlug ) {
381
  // parse rules.
382
  $info = woo_feed_parse_feed_rules( isset( $info['feedrules'] ) ? $info['feedrules'] : $info );
383
-
384
  try {
385
  do_action( 'before_woo_feed_generate_batch_data', $info );
386
  $status = false;
@@ -433,7 +433,7 @@ if ( ! function_exists( 'woo_feed_generate_new_feed' ) ) {
433
  * Generate Feed
434
  */
435
  function woo_feed_generate_new_feed() {
436
-
437
  if ( isset( $_POST['provider'], $_POST['_wpnonce'], $_POST['filename'], $_POST['feedType'] ) ) {
438
  // Verify Nonce.
439
  if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'woo_feed_form_nonce' ) ) {
@@ -443,9 +443,9 @@ if ( ! function_exists( 'woo_feed_generate_new_feed' ) ) {
443
  if ( ! woo_feed_check_valid_extension( sanitize_text_field( wp_unslash( $_POST['feedType'] ) ) ) ) {
444
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
445
  }
446
-
447
  $fileName = woo_feed_save_feed_config_data( $_POST );
448
-
449
  wp_safe_redirect(
450
  add_query_arg(
451
  array(
@@ -458,7 +458,7 @@ if ( ! function_exists( 'woo_feed_generate_new_feed' ) ) {
458
  );
459
  wp_die();
460
  }
461
-
462
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-admin-display.php';
463
  }
464
  }
@@ -467,23 +467,23 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
467
  * Manage Feeds
468
  */
469
  function woo_feed_manage_feed() {
470
-
471
  $provider = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['provider'], "text");
472
  $feed_id = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_id'], "text");
473
  $feed_option_name = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_option_name'], "text");
474
  $filename = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['filename'], "file_name");
475
  $feedType = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feedType'], "text");
476
-
477
  $getaction = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['action'], "text");
478
  $getfeed = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['feed'], "text");
479
-
480
  // @TODO use admin_post_ action for form handling.
481
  // Manage action for category mapping.
482
  if ( 'edit-feed' === $getaction ) {
483
  if ( ! defined( 'WOO_FEED_EDIT_CONFIG' ) ) {
484
  define( 'WOO_FEED_EDIT_CONFIG', true );
485
  }
486
-
487
  if ( count( $_POST ) && $provider && $feed_id && $feed_option_name && $filename && $feedType ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
488
  $nonce = isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
489
  if ( ! wp_verify_nonce( $nonce, 'wf_edit_feed' ) ) {
@@ -493,11 +493,11 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
493
  if ( ! woo_feed_check_valid_extension( wp_unslash( $_POST['feedType'] ) ) ) {
494
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
495
  }
496
-
497
  // check if name is changed... save as new, rename feed isn't implemented ... it can be...
498
  // delete old feed save data as new feed.
499
  $feed_option_name = wp_unslash( $feed_option_name ) ;
500
-
501
  // if ( $_POST['filename'] !== $_POST['feed_option_name'] ) {
502
  // $feed_option_name = ( isset( $_POST['filename'] ) && ! empty( $_POST['filename'] ) ) ? sanitize_text_field( $_POST['filename'] ) : null;
503
  // Delete old feed info & file
@@ -623,23 +623,23 @@ if ( ! function_exists( 'feed_merchant_view' ) ) {
623
  }
624
  // Get facebook Categories.
625
  if ( ! function_exists( 'woo_feed_get_facebook_categories' ) ) {
626
- add_action( 'wp_ajax_get_facebook_categories', 'woo_feed_get_facebook_categories' );
627
- /**
628
- * Ajax Response for Facebook Category Dropdown Data
629
- *
630
- * @return void
631
- */
632
- function woo_feed_get_facebook_categories() {
633
- check_ajax_referer( 'wpf_feed_nonce' );
634
- if ( ! current_user_can( 'manage_woocommerce' ) ) {
635
- woo_feed_log_debug_message( 'User doesnt have enough permission.' );
636
- wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
637
- wp_die();
638
- }
639
- $wooFeedDropDown = new Woo_Feed_Dropdown();
640
- wp_send_json_success( $wooFeedDropDown->facebookTaxonomyArray() );
641
- die();
642
- }
643
  }
644
  // Get Google Categories.
645
  if ( ! function_exists( 'woo_feed_get_google_categories' ) ) {
@@ -702,12 +702,12 @@ if ( ! function_exists( 'woo_feed_update_feed_status' ) ) {
702
  wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
703
  wp_die();
704
  }
705
-
706
  $feedName = isset( $_POST['feedName'] ) ? sanitize_text_field( wp_unslash( $_POST['feedName'] ) ) : '';
707
  if ( ! empty( $feedName ) ) {
708
  $feedInfo = maybe_unserialize( get_option( $feedName ) );
709
  $feedInfo['status'] = isset( $_POST['status'] ) && 1 === (int) $_POST['status'] ? 1 : 0;
710
-
711
  $feed_slug = str_replace( 'wf_feed_', 'wf_config', $feedName );
712
  if ( 1 === $feedInfo['status'] ) {
713
  if ( ! wp_next_scheduled( 'woo_feed_update_single_feed', array( $feed_slug ) ) ) {
@@ -716,7 +716,7 @@ if ( ! function_exists( 'woo_feed_update_feed_status' ) ) {
716
  } else {
717
  wp_clear_scheduled_hook( 'woo_feed_update_single_feed', array( $feed_slug ) );
718
  }
719
-
720
  update_option( $feedName, serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
721
  wp_send_json_success( array( 'status' => true ) );
722
  } else {
@@ -748,7 +748,7 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
748
  function woo_feed_config_feed() {
749
  if ( isset( $_POST['wa_woo_feed_config'], $_POST['_wpnonce'] ) ) {
750
  check_admin_referer( 'woo-feed-config' );
751
-
752
  $data = array(
753
  'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
754
  'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
@@ -760,20 +760,20 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
760
  'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
761
  'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] )) : '',
762
  'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] )) : '',
763
- 'disable_remarketing' => isset( $_POST['disable_remarketing'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_remarketing'] )) : '',
764
- 'remarketing_id' => isset( $_POST['remarketing_id'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_id'] )) : '',
765
- 'remarketing_label' => isset( $_POST['remarketing_label'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_label'] )) : '',
766
- 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
767
  'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
768
  'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
769
  'enable_ftp_upload' => isset( $_POST['enable_ftp_upload'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_ftp_upload'] ) ) : '',
770
  );
771
-
772
  woo_feed_save_options( $data );
773
-
774
  // $currencyAPI = isset( $_POST['currency_api_code'] ) ? sanitize_text_field( $_POST['currency_api_code'] ) : '';
775
  // update_option( 'woo_feed_currency_api_code', $currencyAPI, false );
776
-
777
  if ( isset( $_POST['opt_in'] ) && 'on' === $_POST['opt_in'] ) {
778
  WooFeedWebAppickAPI::getInstance()->trackerOptIn();
779
  } else {
@@ -786,11 +786,11 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
786
  if ( isset( $_POST['purge_feed_cache'] ) ) {
787
  woo_feed_flush_cache_data();
788
  }
789
-
790
  wp_safe_redirect( admin_url( 'admin.php?page=webappick-feed-settings&settings_updated=1' ) );
791
  die();
792
  }
793
-
794
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-settings.php';
795
  }
796
  }
@@ -806,64 +806,64 @@ if ( ! function_exists( 'woo_feed_flash_cache_action' ) ) {
806
  }
807
 
808
  if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
809
- class webappick_suggest_plugin {
810
-
811
- static function init() {
812
- if ( is_admin() ) {
813
- if ( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
814
- add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
815
- }
816
- }
817
- } // init
818
- // add our plugins to recommended list
819
- static function plugins_api_result( $res, $action, $args ) {
820
- remove_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 1 );
821
- $res = self::add_plugin_favs( 'webappick-pdf-invoice-for-woocommerce', $res );
822
-
823
- return $res;
824
- } // plugins_api_result
825
- // helper function for adding plugins to fav list
826
- static function featured_plugins_tab( $args ) {
827
- add_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3 );
828
- return $args;
829
- } // featured_plugins_tab
830
- // add single plugin to list of favs
831
- static function add_plugin_favs( $plugin_slug, $res ) {
832
- if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
833
- foreach ( $res->plugins as $plugin ) {
834
- if ( is_object( $plugin ) && ! empty( $plugin->slug ) && $plugin->slug === $plugin_slug ) {
835
- return $res;
836
- }
837
- } // foreach
838
- }
839
- $plugin_info = get_transient( 'wf-plugin-info-' . $plugin_slug );
840
- if ( $plugin_info ) {
841
- array_unshift( $res->plugins, $plugin_info );
842
- } else {
843
- $plugin_info = plugins_api(
844
- 'plugin_information',
845
- array(
846
- 'slug' => $plugin_slug,
847
- 'is_ssl' => is_ssl(),
848
- 'fields' => array(
849
- 'banners' => true,
850
- 'reviews' => true,
851
- 'downloaded' => true,
852
- 'active_installs' => true,
853
- 'icons' => true,
854
- 'short_description' => true,
855
- ),
856
- )
857
- );
858
- if ( ! is_wp_error( $plugin_info ) ) {
859
- $res->plugins[] = $plugin_info;
860
- set_transient( 'wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7 );
861
- }
862
- }
863
- return $res;
864
- } // add_plugin_favs
865
- }
866
- add_action( 'init', array( 'webappick_suggest_plugin', 'init' ) );
867
  }
868
  // Suggest other plugins of webappick.
869
 
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
+ * Version: 4.5.1
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
34
 
35
 
36
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
37
+ /**
38
+ * Plugin Base File
39
+ *
40
+ * @since 3.1.41
41
+ * @var string
42
+ */
43
+ define( 'WOO_FEED_FREE_FILE', __FILE__ );
44
  }
45
 
46
  require_once __DIR__ . '/includes/classes/class-woo-feed-constants.php';
53
  *
54
  * */
55
  require_once __DIR__ . DIRECTORY_SEPARATOR
56
+ . 'libs' . DIRECTORY_SEPARATOR
57
+ . 'autoload.php';
58
 
59
  /**
60
  * Load V5 Module
61
  */
62
+ require_once WOO_FEED_FREE_PATH . 'V5/autoload.php';
63
 
64
  // Attributes executable file [Manages newly added attributes]
65
  // @TODO Refactor all the attributes to a single file.
66
  require_once __DIR__ . DIRECTORY_SEPARATOR
67
+ . 'libs' . DIRECTORY_SEPARATOR
68
+ . 'WebAppick' . DIRECTORY_SEPARATOR
69
+ . 'Attributes' . DIRECTORY_SEPARATOR
70
+ . 'Attributes.php';
71
 
72
  /**
73
  * Load Uses Tracker
122
  add_action( 'plugins_loaded', array( $plugin, 'run' ), PHP_INT_MAX );
123
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
124
  //add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
125
+ WooFeedWebAppickAPI::getInstance();
126
+
127
+ }
128
+
129
  run_woo_feed();
130
  }
131
 
156
  wp_send_json_error( esc_html__( 'Invalid Request.', 'woo-feed' ) );
157
  die();
158
  }
159
+
160
  $feedName = woo_feed_extract_feed_option_name( sanitize_text_field( wp_unslash( $_REQUEST['feed'] ) ) );
161
  $feedInfo = get_option( 'wf_config' . $feedName, false );
162
+
163
  if ( ! $feedInfo ) {
164
  $getFeedConfig = maybe_unserialize( get_option( 'wf_feed_' . $feedName ) );
165
  $feedInfo = $getFeedConfig['feedrules'];
166
  }
167
+
168
  $feedInfo['productIds'] = isset( $_REQUEST['products'] ) ? array_map( 'absint', $_REQUEST['products'] ) : array();
169
  $offset = isset( $_REQUEST['loop'] ) ? absint( $_REQUEST['loop'] ) : 0;
170
  if ( woo_feed_is_debugging_enabled() ) {
180
  woo_feed_log_feed_process( $feedInfo['filename'], $m );
181
  }
182
  }
183
+
184
  if ( 0 === $offset ) {
185
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
186
  }
187
+
188
  if ( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
189
+ $feed_data = true;
190
+ } else {
191
+ $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
192
+ }
193
+
194
  if ( $feed_data ) {
195
  woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
196
  wp_send_json_success(
231
  wp_send_json_error( esc_html__( 'Invalid Feed.', 'woo-feed' ) );
232
  die();
233
  }
234
+
235
  $feedName = woo_feed_extract_feed_option_name( sanitize_text_field( wp_unslash( $_REQUEST['feed'] ) ) );
236
  $info = get_option( 'wf_config' . $feedName, false );
237
+
238
  if ( ! $info ) {
239
  $getFeedConfig = maybe_unserialize( get_option( 'wf_feed_' . $feedName ) );
240
  $info = $getFeedConfig['feedrules'];
241
  }
242
+
243
  $feedService = $info['provider'];
244
  $type = $info['feedType'];
245
  woo_feed_log_feed_process( $info['filename'], sprintf( 'Preparing Final Feed (%s) File...', $type ) );
256
  if ( ! $feedFooter ) {
257
  woo_feed_log_feed_process( $info['filename'], 'Unable to Get Footer Chunk' );
258
  }
259
+
260
  // make file xml string
261
  if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
262
+ $reviewObj = new Woo_Feed_Review($info);
263
+ $feedBody = $reviewObj->make_review_xml_feed();
264
+ $string = $feedBody;
265
+
266
  } elseif ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
267
+ $csvHead[0] = $feedHeader;
268
+ if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
269
+ $string = array_merge( $csvHead, $feedBody );
270
+ } else {
271
+ $string = array();
272
+ }
273
+ } elseif ( 'json' === $type ) {
274
+ $string = $feedBody;
275
+ } else {
276
+ $string = $feedHeader . $feedBody . $feedFooter;
277
+ }
278
+
279
  $upload_dir = wp_get_upload_dir();
280
  $path = $upload_dir['basedir'] . '/woo-feed/' . $feedService . '/' . $type;
281
  $saveFile = false;
318
  wp_send_json_error( $data );
319
  wp_die();
320
  }
321
+
322
  $feed_URL = woo_feed_get_file_url( $feedName, $feedService, $type );
323
  // Save Info into database.
324
  $feedInfo = array(
332
  } else {
333
  $feedInfo['status'] = 1;
334
  }
335
+
336
  woo_feed_unlink_tempFiles( $info, $feedName );
337
+
338
  woo_feed_log_feed_process( $info['filename'], 'Updating Feed Information.' );
339
+
340
  update_option( 'wf_feed_' . $feedName, serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
341
+
342
  if ( $saveFile ) {
343
  // FTP File Upload Info
344
  $ftpEnabled = sanitize_text_field( $info['ftpenabled'] );
345
+
346
  if ( $ftpEnabled ) {
347
  woo_feed_handle_file_transfer( $file, $feedName . '.' . $type, $info );
348
  }
349
+
350
  $cat = woo_feed_check_google_category( $feedInfo );
351
  $data = array(
352
  'info' => $feedInfo,
380
  function woo_feed_generate_batch_data( $info, $feedSlug ) {
381
  // parse rules.
382
  $info = woo_feed_parse_feed_rules( isset( $info['feedrules'] ) ? $info['feedrules'] : $info );
383
+
384
  try {
385
  do_action( 'before_woo_feed_generate_batch_data', $info );
386
  $status = false;
433
  * Generate Feed
434
  */
435
  function woo_feed_generate_new_feed() {
436
+
437
  if ( isset( $_POST['provider'], $_POST['_wpnonce'], $_POST['filename'], $_POST['feedType'] ) ) {
438
  // Verify Nonce.
439
  if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'woo_feed_form_nonce' ) ) {
443
  if ( ! woo_feed_check_valid_extension( sanitize_text_field( wp_unslash( $_POST['feedType'] ) ) ) ) {
444
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
445
  }
446
+
447
  $fileName = woo_feed_save_feed_config_data( $_POST );
448
+
449
  wp_safe_redirect(
450
  add_query_arg(
451
  array(
458
  );
459
  wp_die();
460
  }
461
+
462
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-admin-display.php';
463
  }
464
  }
467
  * Manage Feeds
468
  */
469
  function woo_feed_manage_feed() {
470
+
471
  $provider = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['provider'], "text");
472
  $feed_id = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_id'], "text");
473
  $feed_option_name = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_option_name'], "text");
474
  $filename = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['filename'], "file_name");
475
  $feedType = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feedType'], "text");
476
+
477
  $getaction = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['action'], "text");
478
  $getfeed = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['feed'], "text");
479
+
480
  // @TODO use admin_post_ action for form handling.
481
  // Manage action for category mapping.
482
  if ( 'edit-feed' === $getaction ) {
483
  if ( ! defined( 'WOO_FEED_EDIT_CONFIG' ) ) {
484
  define( 'WOO_FEED_EDIT_CONFIG', true );
485
  }
486
+
487
  if ( count( $_POST ) && $provider && $feed_id && $feed_option_name && $filename && $feedType ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
488
  $nonce = isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
489
  if ( ! wp_verify_nonce( $nonce, 'wf_edit_feed' ) ) {
493
  if ( ! woo_feed_check_valid_extension( wp_unslash( $_POST['feedType'] ) ) ) {
494
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
495
  }
496
+
497
  // check if name is changed... save as new, rename feed isn't implemented ... it can be...
498
  // delete old feed save data as new feed.
499
  $feed_option_name = wp_unslash( $feed_option_name ) ;
500
+
501
  // if ( $_POST['filename'] !== $_POST['feed_option_name'] ) {
502
  // $feed_option_name = ( isset( $_POST['filename'] ) && ! empty( $_POST['filename'] ) ) ? sanitize_text_field( $_POST['filename'] ) : null;
503
  // Delete old feed info & file
623
  }
624
  // Get facebook Categories.
625
  if ( ! function_exists( 'woo_feed_get_facebook_categories' ) ) {
626
+ add_action( 'wp_ajax_get_facebook_categories', 'woo_feed_get_facebook_categories' );
627
+ /**
628
+ * Ajax Response for Facebook Category Dropdown Data
629
+ *
630
+ * @return void
631
+ */
632
+ function woo_feed_get_facebook_categories() {
633
+ check_ajax_referer( 'wpf_feed_nonce' );
634
+ if ( ! current_user_can( 'manage_woocommerce' ) ) {
635
+ woo_feed_log_debug_message( 'User doesnt have enough permission.' );
636
+ wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
637
+ wp_die();
638
+ }
639
+ $wooFeedDropDown = new Woo_Feed_Dropdown();
640
+ wp_send_json_success( $wooFeedDropDown->facebookTaxonomyArray() );
641
+ die();
642
+ }
643
  }
644
  // Get Google Categories.
645
  if ( ! function_exists( 'woo_feed_get_google_categories' ) ) {
702
  wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
703
  wp_die();
704
  }
705
+
706
  $feedName = isset( $_POST['feedName'] ) ? sanitize_text_field( wp_unslash( $_POST['feedName'] ) ) : '';
707
  if ( ! empty( $feedName ) ) {
708
  $feedInfo = maybe_unserialize( get_option( $feedName ) );
709
  $feedInfo['status'] = isset( $_POST['status'] ) && 1 === (int) $_POST['status'] ? 1 : 0;
710
+
711
  $feed_slug = str_replace( 'wf_feed_', 'wf_config', $feedName );
712
  if ( 1 === $feedInfo['status'] ) {
713
  if ( ! wp_next_scheduled( 'woo_feed_update_single_feed', array( $feed_slug ) ) ) {
716
  } else {
717
  wp_clear_scheduled_hook( 'woo_feed_update_single_feed', array( $feed_slug ) );
718
  }
719
+
720
  update_option( $feedName, serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
721
  wp_send_json_success( array( 'status' => true ) );
722
  } else {
748
  function woo_feed_config_feed() {
749
  if ( isset( $_POST['wa_woo_feed_config'], $_POST['_wpnonce'] ) ) {
750
  check_admin_referer( 'woo-feed-config' );
751
+
752
  $data = array(
753
  'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
754
  'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
760
  'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
761
  'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] )) : '',
762
  'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] )) : '',
763
+ 'disable_remarketing' => isset( $_POST['disable_remarketing'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_remarketing'] )) : '',
764
+ 'remarketing_id' => isset( $_POST['remarketing_id'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_id'] )) : '',
765
+ 'remarketing_label' => isset( $_POST['remarketing_label'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_label'] )) : '',
766
+ 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
767
  'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
768
  'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
769
  'enable_ftp_upload' => isset( $_POST['enable_ftp_upload'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_ftp_upload'] ) ) : '',
770
  );
771
+
772
  woo_feed_save_options( $data );
773
+
774
  // $currencyAPI = isset( $_POST['currency_api_code'] ) ? sanitize_text_field( $_POST['currency_api_code'] ) : '';
775
  // update_option( 'woo_feed_currency_api_code', $currencyAPI, false );
776
+
777
  if ( isset( $_POST['opt_in'] ) && 'on' === $_POST['opt_in'] ) {
778
  WooFeedWebAppickAPI::getInstance()->trackerOptIn();
779
  } else {
786
  if ( isset( $_POST['purge_feed_cache'] ) ) {
787
  woo_feed_flush_cache_data();
788
  }
789
+
790
  wp_safe_redirect( admin_url( 'admin.php?page=webappick-feed-settings&settings_updated=1' ) );
791
  die();
792
  }
793
+
794
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-settings.php';
795
  }
796
  }
806
  }
807
 
808
  if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
809
+ class webappick_suggest_plugin {
810
+
811
+ static function init() {
812
+ if ( is_admin() ) {
813
+ if ( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
814
+ add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
815
+ }
816
+ }
817
+ } // init
818
+ // add our plugins to recommended list
819
+ static function plugins_api_result( $res, $action, $args ) {
820
+ remove_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 1 );
821
+ $res = self::add_plugin_favs( 'webappick-pdf-invoice-for-woocommerce', $res );
822
+
823
+ return $res;
824
+ } // plugins_api_result
825
+ // helper function for adding plugins to fav list
826
+ static function featured_plugins_tab( $args ) {
827
+ add_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3 );
828
+ return $args;
829
+ } // featured_plugins_tab
830
+ // add single plugin to list of favs
831
+ static function add_plugin_favs( $plugin_slug, $res ) {
832
+ if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
833
+ foreach ( $res->plugins as $plugin ) {
834
+ if ( is_object( $plugin ) && ! empty( $plugin->slug ) && $plugin->slug === $plugin_slug ) {
835
+ return $res;
836
+ }
837
+ } // foreach
838
+ }
839
+ $plugin_info = get_transient( 'wf-plugin-info-' . $plugin_slug );
840
+ if ( $plugin_info ) {
841
+ array_unshift( $res->plugins, $plugin_info );
842
+ } else {
843
+ $plugin_info = plugins_api(
844
+ 'plugin_information',
845
+ array(
846
+ 'slug' => $plugin_slug,
847
+ 'is_ssl' => is_ssl(),
848
+ 'fields' => array(
849
+ 'banners' => true,
850
+ 'reviews' => true,
851
+ 'downloaded' => true,
852
+ 'active_installs' => true,
853
+ 'icons' => true,
854
+ 'short_description' => true,
855
+ ),
856
+ )
857
+ );
858
+ if ( ! is_wp_error( $plugin_info ) ) {
859
+ $res->plugins[] = $plugin_info;
860
+ set_transient( 'wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7 );
861
+ }
862
+ }
863
+ return $res;
864
+ } // add_plugin_favs
865
+ }
866
+ add_action( 'init', array( 'webappick_suggest_plugin', 'init' ) );
867
  }
868
  // Suggest other plugins of webappick.
869