CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.5.9

Version Description

(2022-11-08) = * Fixed: PHP Warning: Uninitialized string offset.

Download this release

Release Info

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

Code changes from version 4.5.8 to 4.5.9

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.1
7
  Requires PHP: 5.6
8
- Stable tag: 4.5.8
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.8 (2022-11-07) =
594
  * Fixed: Undefined array key “page” Warning fixed.
595
 
5
  Requires at least: 4.4
6
  Tested Up To: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 4.5.9
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.9 (2022-11-08) =
594
+ * Fixed: PHP Warning: Uninitialized string offset.
595
+
596
  = 4.5.8 (2022-11-07) =
597
  * Fixed: Undefined array key “page” Warning fixed.
598
 
includes/classes/class-woo-feed-constants.php CHANGED
@@ -23,7 +23,7 @@ if( ! class_exists("Woo_Feed_Constants") ) {
23
  * @var string
24
  * @since 3.1.6
25
  */
26
- define( 'WOO_FEED_FREE_VERSION', '4.5.8' );
27
  }
28
 
29
  if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
23
  * @var string
24
  * @since 3.1.6
25
  */
26
+ define( 'WOO_FEED_FREE_VERSION', '4.5.9' );
27
  }
28
 
29
  if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
includes/helper.php CHANGED
@@ -5250,9 +5250,6 @@ if ( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5250
  'bing'
5251
  ] ) ) {
5252
  if ( strlen( $title ) > 150 ) {
5253
- for ( $I = 149; $title[ $I ] != ' '; $I -- ) {
5254
- ;
5255
- }
5256
  $title = substr( $title, 0, $I );
5257
  }
5258
  }
5250
  'bing'
5251
  ] ) ) {
5252
  if ( strlen( $title ) > 150 ) {
 
 
 
5253
  $title = substr( $title, 0, $I );
5254
  }
5255
  }
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.8
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -36,13 +36,13 @@ if ( ! defined( 'ABSPATH' ) ) {
36
 
37
 
38
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
39
- /**
40
- * Plugin Base File
41
- *
42
- * @since 3.1.41
43
- * @var string
44
- */
45
- define( 'WOO_FEED_FREE_FILE', __FILE__ );
46
  }
47
 
48
  if ( ! defined( 'WOO_FEED_FREE_ADMIN_URL' ) ) {
@@ -65,8 +65,8 @@ Woo_Feed_Constants::defined_constants();
65
  *
66
  * */
67
  require_once __DIR__ . DIRECTORY_SEPARATOR
68
- . 'libs' . DIRECTORY_SEPARATOR
69
- . 'autoload.php';
70
 
71
  /**
72
  * Load V5 Module
@@ -76,10 +76,10 @@ require_once WOO_FEED_FREE_PATH . 'V5/autoload.php';
76
  // Attributes executable file [Manages newly added attributes]
77
  // @TODO Refactor all the attributes to a single file.
78
  require_once __DIR__ . DIRECTORY_SEPARATOR
79
- . 'libs' . DIRECTORY_SEPARATOR
80
- . 'WebAppick' . DIRECTORY_SEPARATOR
81
- . 'Attributes' . DIRECTORY_SEPARATOR
82
- . 'Attributes.php';
83
 
84
  /**
85
  * Load Uses Tracker
@@ -135,9 +135,9 @@ if ( ! function_exists( 'run_woo_feed' ) ) {
135
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
136
  //add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
137
 
138
- WooFeedWebAppickAPI::getInstance();
139
 
140
- }
141
 
142
  run_woo_feed();
143
  }
@@ -198,11 +198,11 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
198
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
199
  }
200
 
201
- if ( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
202
- $feed_data = true;
203
- } else {
204
- $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
205
- }
206
 
207
  if ( $feed_data ) {
208
  woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
@@ -230,8 +230,8 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
230
  /**
231
  * Ajax Response for Save Feed File
232
  *
233
- * @throws Exception
234
  * @return void
 
235
  */
236
  function woo_feed_save_feed_file() {
237
  check_ajax_referer( 'wpf_feed_nonce' );
@@ -272,22 +272,22 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
272
 
273
  // make file xml string
274
  if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
275
- $reviewObj = new Woo_Feed_Review($info);
276
- $feedBody = $reviewObj->make_review_xml_feed();
277
- $string = $feedBody;
278
 
279
  } elseif ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
280
- $csvHead[0] = $feedHeader;
281
- if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
282
- $string = array_merge( $csvHead, $feedBody );
283
- } else {
284
- $string = array();
285
- }
286
- } elseif ( 'json' === $type ) {
287
- $string = $feedBody;
288
- } else {
289
- $string = $feedHeader . $feedBody . $feedFooter;
290
- }
291
 
292
  $upload_dir = wp_get_upload_dir();
293
  $path = $upload_dir['basedir'] . '/woo-feed/' . $feedService . '/' . $type;
@@ -385,7 +385,7 @@ if ( ! function_exists( 'woo_feed_generate_batch_data' ) ) {
385
  /**
386
  * Generate Feed Data
387
  *
388
- * @param array $info Feed info.
389
  * @param string $feedSlug feed option slug.
390
  *
391
  * @return bool
@@ -430,11 +430,13 @@ if ( ! function_exists( 'woo_feed_generate_batch_data' ) ) {
430
  }
431
  }
432
  do_action( 'after_woo_feed_generate_batch_data', $info );
 
433
  return $status;
434
  } catch ( Exception $e ) {
435
  $message = 'Error Generating Product Data.' . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
436
  woo_feed_log( $info['filename'], $message, 'critical', $e, true );
437
  woo_feed_log_fatal_error( $message, $e );
 
438
  return false;
439
  }
440
  }
@@ -481,14 +483,14 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
481
  */
482
  function woo_feed_manage_feed() {
483
 
484
- $provider = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['provider'], "text");
485
- $feed_id = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_id'], "text");
486
- $feed_option_name = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feed_option_name'], "text");
487
- $filename = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['filename'], "file_name");
488
- $feedType = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['feedType'], "text");
489
 
490
- $getaction = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['action'], "text");
491
- $getfeed = apply_filters('CTXFEED_filter_securing_input', "GET", @$_GET['feed'], "text");
492
 
493
  // @TODO use admin_post_ action for form handling.
494
  // Manage action for category mapping.
@@ -497,19 +499,19 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
497
  define( 'WOO_FEED_EDIT_CONFIG', true );
498
  }
499
 
500
- if ( count( $_POST ) && $provider && $feed_id && $feed_option_name && $filename && $feedType ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
501
  $nonce = isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
502
  if ( ! wp_verify_nonce( $nonce, 'wf_edit_feed' ) ) {
503
  wp_die( esc_html__( 'Failed security check', 'woo-feed' ), 403 );
504
  }
505
  // Check feed type (file ext)
506
- if ( ! woo_feed_check_valid_extension( wp_unslash( $_POST['feedType'] ) ) ) {
507
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
508
  }
509
 
510
  // check if name is changed... save as new, rename feed isn't implemented ... it can be...
511
  // delete old feed save data as new feed.
512
- $feed_option_name = wp_unslash( $feed_option_name ) ;
513
 
514
  // if ( $_POST['filename'] !== $_POST['feed_option_name'] ) {
515
  // $feed_option_name = ( isset( $_POST['filename'] ) && ! empty( $_POST['filename'] ) ) ? sanitize_text_field( $_POST['filename'] ) : null;
@@ -545,7 +547,7 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
545
  }
546
  if ( $getfeed ) {
547
  global $wpdb, $feedRules, $feedName, $feedId, $provider;
548
- $feedName = wp_unslash( $getfeed ) ;
549
  $feedInfo = maybe_unserialize( get_option( $feedName ) );
550
  if ( false !== $feedInfo ) {
551
  $query = $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT 1", $feedName );
@@ -566,12 +568,12 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
566
  }
567
  } else {
568
  // Update Interval.
569
- $wf_schedule = apply_filters('CTXFEED_filter_securing_input', "POST", @$_POST['wf_schedule'], "text");
570
  if ( $wf_schedule ) {
571
  if ( isset( $_POST['wf_schedule_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wf_schedule_nonce'] ) ), 'wf_schedule' ) ) {
572
  $interval = absint( $wf_schedule );
573
  if ( $interval >= woo_feed_get_minimum_interval_option() ) {
574
- if ( update_option( 'wf_schedule', wp_unslash( $wf_schedule ) , false ) ) {
575
  wp_clear_scheduled_hook( 'woo_feed_update' );
576
  add_filter( 'cron_schedules', 'Woo_Feed_installer::cron_schedules' ); // phpcs:ignore
577
  // wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update' );
@@ -636,23 +638,23 @@ if ( ! function_exists( 'feed_merchant_view' ) ) {
636
  }
637
  // Get facebook Categories.
638
  if ( ! function_exists( 'woo_feed_get_facebook_categories' ) ) {
639
- add_action( 'wp_ajax_get_facebook_categories', 'woo_feed_get_facebook_categories' );
640
- /**
641
- * Ajax Response for Facebook Category Dropdown Data
642
- *
643
- * @return void
644
- */
645
- function woo_feed_get_facebook_categories() {
646
- check_ajax_referer( 'wpf_feed_nonce' );
647
- if ( ! current_user_can( 'manage_woocommerce' ) ) {
648
- woo_feed_log_debug_message( 'User doesnt have enough permission.' );
649
- wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
650
- wp_die();
651
- }
652
- $wooFeedDropDown = new Woo_Feed_Dropdown();
653
- wp_send_json_success( $wooFeedDropDown->facebookTaxonomyArray() );
654
- die();
655
- }
656
  }
657
  // Get Google Categories.
658
  if ( ! function_exists( 'woo_feed_get_google_categories' ) ) {
@@ -771,12 +773,12 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
771
  'overridden_structured_data' => isset( $_POST['overridden_structured_data'] ) ? sanitize_text_field( wp_unslash( $_POST['overridden_structured_data'] ) ) : '',
772
  'disable_mpn' => isset( $_POST['disable_mpn'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_mpn'] ) ) : '',
773
  'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
774
- 'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] )) : '',
775
- 'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] )) : '',
776
- 'disable_remarketing' => isset( $_POST['disable_remarketing'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_remarketing'] )) : '',
777
- 'remarketing_id' => isset( $_POST['remarketing_id'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_id'] )) : '',
778
- 'remarketing_label' => isset( $_POST['remarketing_label'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_label'] )) : '',
779
- 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
780
  'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
781
  'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
782
  'enable_ftp_upload' => isset( $_POST['enable_ftp_upload'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_ftp_upload'] ) ) : '',
@@ -819,64 +821,70 @@ if ( ! function_exists( 'woo_feed_flash_cache_action' ) ) {
819
  }
820
 
821
  if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
822
- class webappick_suggest_plugin {
823
-
824
- static function init() {
825
- if ( is_admin() ) {
826
- if ( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
827
- add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
828
- }
829
- }
830
- } // init
831
- // add our plugins to recommended list
832
- static function plugins_api_result( $res, $action, $args ) {
833
- remove_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 1 );
834
- $res = self::add_plugin_favs( 'webappick-pdf-invoice-for-woocommerce', $res );
835
-
836
- return $res;
837
- } // plugins_api_result
838
- // helper function for adding plugins to fav list
839
- static function featured_plugins_tab( $args ) {
840
- add_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3 );
841
- return $args;
842
- } // featured_plugins_tab
843
- // add single plugin to list of favs
844
- static function add_plugin_favs( $plugin_slug, $res ) {
845
- if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
846
- foreach ( $res->plugins as $plugin ) {
847
- if ( is_object( $plugin ) && ! empty( $plugin->slug ) && $plugin->slug === $plugin_slug ) {
848
- return $res;
849
- }
850
- } // foreach
851
- }
852
- $plugin_info = get_transient( 'wf-plugin-info-' . $plugin_slug );
853
- if ( $plugin_info ) {
854
- array_unshift( $res->plugins, $plugin_info );
855
- } else {
856
- $plugin_info = plugins_api(
857
- 'plugin_information',
858
- array(
859
- 'slug' => $plugin_slug,
860
- 'is_ssl' => is_ssl(),
861
- 'fields' => array(
862
- 'banners' => true,
863
- 'reviews' => true,
864
- 'downloaded' => true,
865
- 'active_installs' => true,
866
- 'icons' => true,
867
- 'short_description' => true,
868
- ),
869
- )
870
- );
871
- if ( ! is_wp_error( $plugin_info ) ) {
872
- $res->plugins[] = $plugin_info;
873
- set_transient( 'wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7 );
874
- }
875
- }
876
- return $res;
877
- } // add_plugin_favs
878
- }
879
- add_action( 'init', array( 'webappick_suggest_plugin', 'init' ) );
 
 
 
 
 
 
880
  }
881
  // Suggest other plugins of webappick.
882
 
@@ -896,11 +904,13 @@ if ( ! function_exists( 'woo_feed_deactivate' ) ) {
896
  * rest api init
897
  * @return void
898
  */
899
- //if( ! function_exists( 'init_rest_api' ) ) {
900
  // function init_rest_api() {
901
  // RestController::instance();
902
  // }
 
 
903
  //}
904
 
905
- //add_action('init', 'init_rest_api' );
906
  // End of file woo-feed.php
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.9
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
36
 
37
 
38
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
39
+ /**
40
+ * Plugin Base File
41
+ *
42
+ * @since 3.1.41
43
+ * @var string
44
+ */
45
+ define( 'WOO_FEED_FREE_FILE', __FILE__ );
46
  }
47
 
48
  if ( ! defined( 'WOO_FEED_FREE_ADMIN_URL' ) ) {
65
  *
66
  * */
67
  require_once __DIR__ . DIRECTORY_SEPARATOR
68
+ . 'libs' . DIRECTORY_SEPARATOR
69
+ . 'autoload.php';
70
 
71
  /**
72
  * Load V5 Module
76
  // Attributes executable file [Manages newly added attributes]
77
  // @TODO Refactor all the attributes to a single file.
78
  require_once __DIR__ . DIRECTORY_SEPARATOR
79
+ . 'libs' . DIRECTORY_SEPARATOR
80
+ . 'WebAppick' . DIRECTORY_SEPARATOR
81
+ . 'Attributes' . DIRECTORY_SEPARATOR
82
+ . 'Attributes.php';
83
 
84
  /**
85
  * Load Uses Tracker
135
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
136
  //add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
137
 
138
+ WooFeedWebAppickAPI::getInstance();
139
 
140
+ }
141
 
142
  run_woo_feed();
143
  }
198
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
199
  }
200
 
201
+ if ( isset( $feedInfo['provider'] ) && 'googlereview' === $feedInfo['provider'] ) {
202
+ $feed_data = true;
203
+ } else {
204
+ $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
205
+ }
206
 
207
  if ( $feed_data ) {
208
  woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
230
  /**
231
  * Ajax Response for Save Feed File
232
  *
 
233
  * @return void
234
+ * @throws Exception
235
  */
236
  function woo_feed_save_feed_file() {
237
  check_ajax_referer( 'wpf_feed_nonce' );
272
 
273
  // make file xml string
274
  if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
275
+ $reviewObj = new Woo_Feed_Review( $info );
276
+ $feedBody = $reviewObj->make_review_xml_feed();
277
+ $string = $feedBody;
278
 
279
  } elseif ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
280
+ $csvHead[0] = $feedHeader;
281
+ if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
282
+ $string = array_merge( $csvHead, $feedBody );
283
+ } else {
284
+ $string = array();
285
+ }
286
+ } elseif ( 'json' === $type ) {
287
+ $string = $feedBody;
288
+ } else {
289
+ $string = $feedHeader . $feedBody . $feedFooter;
290
+ }
291
 
292
  $upload_dir = wp_get_upload_dir();
293
  $path = $upload_dir['basedir'] . '/woo-feed/' . $feedService . '/' . $type;
385
  /**
386
  * Generate Feed Data
387
  *
388
+ * @param array $info Feed info.
389
  * @param string $feedSlug feed option slug.
390
  *
391
  * @return bool
430
  }
431
  }
432
  do_action( 'after_woo_feed_generate_batch_data', $info );
433
+
434
  return $status;
435
  } catch ( Exception $e ) {
436
  $message = 'Error Generating Product Data.' . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
437
  woo_feed_log( $info['filename'], $message, 'critical', $e, true );
438
  woo_feed_log_fatal_error( $message, $e );
439
+
440
  return false;
441
  }
442
  }
483
  */
484
  function woo_feed_manage_feed() {
485
 
486
+ $provider = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['provider'], "text" );
487
+ $feed_id = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['feed_id'], "text" );
488
+ $feed_option_name = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['feed_option_name'], "text" );
489
+ $filename = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['filename'], "file_name" );
490
+ $feedType = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['feedType'], "text" );
491
 
492
+ $getaction = apply_filters( 'CTXFEED_filter_securing_input', "GET", @$_GET['action'], "text" );
493
+ $getfeed = apply_filters( 'CTXFEED_filter_securing_input', "GET", @$_GET['feed'], "text" );
494
 
495
  // @TODO use admin_post_ action for form handling.
496
  // Manage action for category mapping.
499
  define( 'WOO_FEED_EDIT_CONFIG', true );
500
  }
501
 
502
+ if ( count( $_POST ) && $provider && $feed_id && $feed_option_name && $filename && $feedType ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
503
  $nonce = isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
504
  if ( ! wp_verify_nonce( $nonce, 'wf_edit_feed' ) ) {
505
  wp_die( esc_html__( 'Failed security check', 'woo-feed' ), 403 );
506
  }
507
  // Check feed type (file ext)
508
+ if ( ! woo_feed_check_valid_extension( wp_unslash( $_POST['feedType'] ) ) ) {
509
  wp_die( esc_html__( 'Invalid Feed Type!', 'woo-feed' ), 400 );
510
  }
511
 
512
  // check if name is changed... save as new, rename feed isn't implemented ... it can be...
513
  // delete old feed save data as new feed.
514
+ $feed_option_name = wp_unslash( $feed_option_name );
515
 
516
  // if ( $_POST['filename'] !== $_POST['feed_option_name'] ) {
517
  // $feed_option_name = ( isset( $_POST['filename'] ) && ! empty( $_POST['filename'] ) ) ? sanitize_text_field( $_POST['filename'] ) : null;
547
  }
548
  if ( $getfeed ) {
549
  global $wpdb, $feedRules, $feedName, $feedId, $provider;
550
+ $feedName = wp_unslash( $getfeed );
551
  $feedInfo = maybe_unserialize( get_option( $feedName ) );
552
  if ( false !== $feedInfo ) {
553
  $query = $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT 1", $feedName );
568
  }
569
  } else {
570
  // Update Interval.
571
+ $wf_schedule = apply_filters( 'CTXFEED_filter_securing_input', "POST", @$_POST['wf_schedule'], "text" );
572
  if ( $wf_schedule ) {
573
  if ( isset( $_POST['wf_schedule_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wf_schedule_nonce'] ) ), 'wf_schedule' ) ) {
574
  $interval = absint( $wf_schedule );
575
  if ( $interval >= woo_feed_get_minimum_interval_option() ) {
576
+ if ( update_option( 'wf_schedule', wp_unslash( $wf_schedule ), false ) ) {
577
  wp_clear_scheduled_hook( 'woo_feed_update' );
578
  add_filter( 'cron_schedules', 'Woo_Feed_installer::cron_schedules' ); // phpcs:ignore
579
  // wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update' );
638
  }
639
  // Get facebook Categories.
640
  if ( ! function_exists( 'woo_feed_get_facebook_categories' ) ) {
641
+ add_action( 'wp_ajax_get_facebook_categories', 'woo_feed_get_facebook_categories' );
642
+ /**
643
+ * Ajax Response for Facebook Category Dropdown Data
644
+ *
645
+ * @return void
646
+ */
647
+ function woo_feed_get_facebook_categories() {
648
+ check_ajax_referer( 'wpf_feed_nonce' );
649
+ if ( ! current_user_can( 'manage_woocommerce' ) ) {
650
+ woo_feed_log_debug_message( 'User doesnt have enough permission.' );
651
+ wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
652
+ wp_die();
653
+ }
654
+ $wooFeedDropDown = new Woo_Feed_Dropdown();
655
+ wp_send_json_success( $wooFeedDropDown->facebookTaxonomyArray() );
656
+ die();
657
+ }
658
  }
659
  // Get Google Categories.
660
  if ( ! function_exists( 'woo_feed_get_google_categories' ) ) {
773
  'overridden_structured_data' => isset( $_POST['overridden_structured_data'] ) ? sanitize_text_field( wp_unslash( $_POST['overridden_structured_data'] ) ) : '',
774
  'disable_mpn' => isset( $_POST['disable_mpn'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_mpn'] ) ) : '',
775
  'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
776
+ 'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] ) ) : '',
777
+ 'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] ) ) : '',
778
+ 'disable_remarketing' => isset( $_POST['disable_remarketing'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_remarketing'] ) ) : '',
779
+ 'remarketing_id' => isset( $_POST['remarketing_id'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_id'] ) ) : '',
780
+ 'remarketing_label' => isset( $_POST['remarketing_label'] ) ? sanitize_text_field( wp_unslash( $_POST['remarketing_label'] ) ) : '',
781
+ 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
782
  'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
783
  'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
784
  'enable_ftp_upload' => isset( $_POST['enable_ftp_upload'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_ftp_upload'] ) ) : '',
821
  }
822
 
823
  if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
824
+ class webappick_suggest_plugin {
825
+
826
+ static function init() {
827
+ if ( is_admin() ) {
828
+ if ( ! is_plugin_active( 'xt-woo-variation-swatches/xt-woo-variation-swatches.php' ) ) {
829
+ add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
830
+ }
831
+ }
832
+ } // init
833
+
834
+ // add our plugins to recommended list
835
+ static function plugins_api_result( $res, $action, $args ) {
836
+ remove_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 1 );
837
+ $res = self::add_plugin_favs( 'webappick-pdf-invoice-for-woocommerce', $res );
838
+
839
+ return $res;
840
+ } // plugins_api_result
841
+
842
+ // helper function for adding plugins to fav list
843
+ static function featured_plugins_tab( $args ) {
844
+ add_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3 );
845
+
846
+ return $args;
847
+ } // featured_plugins_tab
848
+
849
+ // add single plugin to list of favs
850
+ static function add_plugin_favs( $plugin_slug, $res ) {
851
+ if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
852
+ foreach ( $res->plugins as $plugin ) {
853
+ if ( is_object( $plugin ) && ! empty( $plugin->slug ) && $plugin->slug === $plugin_slug ) {
854
+ return $res;
855
+ }
856
+ } // foreach
857
+ }
858
+ $plugin_info = get_transient( 'wf-plugin-info-' . $plugin_slug );
859
+ if ( $plugin_info ) {
860
+ array_unshift( $res->plugins, $plugin_info );
861
+ } else {
862
+ $plugin_info = plugins_api(
863
+ 'plugin_information',
864
+ array(
865
+ 'slug' => $plugin_slug,
866
+ 'is_ssl' => is_ssl(),
867
+ 'fields' => array(
868
+ 'banners' => true,
869
+ 'reviews' => true,
870
+ 'downloaded' => true,
871
+ 'active_installs' => true,
872
+ 'icons' => true,
873
+ 'short_description' => true,
874
+ ),
875
+ )
876
+ );
877
+ if ( ! is_wp_error( $plugin_info ) ) {
878
+ $res->plugins[] = $plugin_info;
879
+ set_transient( 'wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7 );
880
+ }
881
+ }
882
+
883
+ return $res;
884
+ } // add_plugin_favs
885
+ }
886
+
887
+ add_action( 'init', array( 'webappick_suggest_plugin', 'init' ) );
888
  }
889
  // Suggest other plugins of webappick.
890
 
904
  * rest api init
905
  * @return void
906
  */
907
+ //if ( !function_exists( 'init_rest_api' ) ) {
908
  // function init_rest_api() {
909
  // RestController::instance();
910
  // }
911
+ //
912
+ // add_action( 'init', 'init_rest_api' );
913
  //}
914
 
915
+
916
  // End of file woo-feed.php