CTX Feed – WooCommerce Product Feed Manager Plugin - Version 3.2.10

Version Description

(2020-01-07) = * New Hook added before and after product loop. * Sanitize ajax & optimize request for admin notices. * Admin Notice updated.

Download this release

Release Info

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

Code changes from version 3.2.9 to 3.2.10

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags:woocommerce,google product feed,facebook product feed,woocommerce product f
5
  Requires at least: 3.6
6
  Tested Up To: 5.4-alpha-46743
7
  Requires PHP: 5.6
8
- Stable tag: 3.2.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -305,6 +305,11 @@ Using pro version:
305
 
306
  == Changelog ==
307
 
 
 
 
 
 
308
  = 3.2.9 (2020-01-06) =
309
  * Fix Docs Page Postbox styles
310
  * Update Button UI
5
  Requires at least: 3.6
6
  Tested Up To: 5.4-alpha-46743
7
  Requires PHP: 5.6
8
+ Stable tag: 3.2.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
305
 
306
  == Changelog ==
307
 
308
+ = 3.2.10 (2020-01-07) =
309
+ * New Hook added before and after product loop.
310
+ * Sanitize ajax & optimize request for admin notices.
311
+ * Admin Notice updated.
312
+
313
  = 3.2.9 (2020-01-06) =
314
  * Fix Docs Page Postbox styles
315
  * Update Button UI
admin/css/woo-feed-admin.css CHANGED
@@ -646,6 +646,7 @@ table.wf-info-table th a.tutorial { color: #ee264a; }
646
  table.wf-info-table th a.support { color: #0DD41E; }
647
  table.wf-rate-table a.review-star:after {
648
  content: "\f155\f155\f155\f155\f155" !important;
 
649
  font-family: dashicons;
650
  font-size: 10px;
651
  font-weight: 100;
646
  table.wf-info-table th a.support { color: #0DD41E; }
647
  table.wf-rate-table a.review-star:after {
648
  content: "\f155\f155\f155\f155\f155" !important;
649
+ /*noinspection CssNoGenericFontName*/
650
  font-family: dashicons;
651
  font-size: 10px;
652
  font-weight: 100;
admin/js/woo-feed-admin.js CHANGED
@@ -1,5 +1,5 @@
1
  // noinspection JSUnresolvedVariable,ES6ConvertVarToLetConst,SpellCheckingInspection
2
- ( function ($, window, document, opts) {
3
  "use strict";
4
  /**
5
  * All of the code for your admin-facing JavaScript source
@@ -423,34 +423,21 @@
423
  ssh2Status.hide();
424
  }
425
  });
426
- $(document).on('click', '.woo-feed-review-notice ul li a', function (e) {
427
  e.preventDefault();
428
  // noinspection ES6ConvertVarToLetConst
429
- var notice = $(this).attr('val');
430
- if(notice === "given") {
431
  window.open('https://wordpress.org/support/plugin/webappick-product-feed-for-woocommerce/reviews/?rate=5#new-post','_blank');
432
  }
433
- $( ".woo-feed-review-notice" ).slideUp( 200, "linear");
434
  // noinspection JSUnresolvedVariable
435
- $.ajax({
436
- url: opts.wpf_ajax_url,
437
- type: 'post',
438
- data: { _ajax_nonce: opts.nonce, action: "woo_feed_save_review_notice", notice: notice },
439
- success: function (response) {}
440
- });
441
  });
442
- $(document).on('click', '.woo-feed-wpml-notice .notice-dismiss', function (e) {
443
  e.preventDefault();
444
  // noinspection JSUnresolvedVariable
445
- $.ajax({
446
- url: opts.wpf_ajax_url,
447
- type: 'post',
448
- data: { _ajax_nonce: opts.nonce, action: "woo_feed_save_wpml_notice", },
449
- success: function (response) {
450
- if (response.success) {
451
- $( ".woo-feed-wpml-notice" ).slideUp( 200, "linear");
452
- }
453
- }
454
- });
455
  });
456
- }( jQuery, window, document, wpf_ajax_obj ) );
1
  // noinspection JSUnresolvedVariable,ES6ConvertVarToLetConst,SpellCheckingInspection
2
+ ( function ($, window, document, wpAjax, opts) {
3
  "use strict";
4
  /**
5
  * All of the code for your admin-facing JavaScript source
423
  ssh2Status.hide();
424
  }
425
  });
426
+ $(document).on('click', '.woo-feed-notice ul li a', function (e) {
427
  e.preventDefault();
428
  // noinspection ES6ConvertVarToLetConst
429
+ var self = $(this), notice = self.attr('data-response');
430
+ if( notice === "given" ) {
431
  window.open('https://wordpress.org/support/plugin/webappick-product-feed-for-woocommerce/reviews/?rate=5#new-post','_blank');
432
  }
433
+ self.closest( ".woo-feed-notice" ).slideUp( 200, "linear");
434
  // noinspection JSUnresolvedVariable
435
+ wpAjax.post( 'woo_feed_save_review_notice', { _ajax_nonce: opts.nonce, notice: notice } );
 
 
 
 
 
436
  });
437
+ $(document).on('click', '.woo-feed-notice .notice-dismiss', function (e) {
438
  e.preventDefault();
439
  // noinspection JSUnresolvedVariable
440
+ var which = $(this).parent().data('which');
441
+ which && wpAjax.post( 'woo_feed_hide_notice', { _wpnonce: opts.nonce, which: which, } );
 
 
 
 
 
 
 
 
442
  });
443
+ }( jQuery, window, document, wp.ajax, wpf_ajax_obj ) );
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -132,23 +132,31 @@ class Woo_Feed_Products_v3 {
132
  return array_unique(array_merge($wc,$wp));
133
  }
134
  }
135
-
136
  /**
137
  * Get Product Information according to feed config
138
  *
139
  * @since 3.2.0
140
  *
141
- * @param $ids
142
  *
143
- * @return bool
144
  */
145
- public function get_products( $ids ) {
146
 
147
- if ( empty( $ids ) ) {
148
  return false;
149
  }
150
 
151
- foreach ( $ids as $key => $pid ) {
 
 
 
 
 
 
 
 
152
 
153
  $product = wc_get_product( $pid );
154
 
@@ -316,6 +324,14 @@ class Woo_Feed_Products_v3 {
316
 
317
  $this->pi++;
318
  }
 
 
 
 
 
 
 
 
319
 
320
  return $this->products;
321
  }
132
  return array_unique(array_merge($wc,$wp));
133
  }
134
  }
135
+
136
  /**
137
  * Get Product Information according to feed config
138
  *
139
  * @since 3.2.0
140
  *
141
+ * @param int[] $productIds
142
  *
143
+ * @return []
144
  */
145
+ public function get_products( $productIds ) {
146
 
147
+ if ( empty( $productIds ) ) {
148
  return false;
149
  }
150
 
151
+ /**
152
+ * Fires before looping through request product for getting product data
153
+ * @since 3.2.10
154
+ * @param int[] $productIds
155
+ * @param array $feedConfig
156
+ */
157
+ do_action( 'woo_feed_before_product_loop', $productIds, $this->config );
158
+
159
+ foreach ( $productIds as $key => $pid ) {
160
 
161
  $product = wc_get_product( $pid );
162
 
324
 
325
  $this->pi++;
326
  }
327
+
328
+ /**
329
+ * Fires before looping through request product for getting product data
330
+ * @since 3.2.10
331
+ * @param int[] $productIds
332
+ * @param array $feedConfig
333
+ */
334
+ do_action( 'woo_feed_after_product_loop', $productIds, $this->config );
335
 
336
  return $this->products;
337
  }
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.2.9
19
  * Author: WebAppick
20
  * Author URI: https://webappick.com/
21
  * License: GPL v2
@@ -41,7 +41,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
41
  * Plugin Version
42
  * @var string
43
  */
44
- define( 'WOO_FEED_FREE_VERSION', '3.2.9' );
45
  }
46
  if ( ! defined( 'WOO_FEED_FREE_FILE') ) {
47
  /**
@@ -877,26 +877,33 @@ if ( ! function_exists( 'woo_feed_pro_features_page_remove_admin_notices' ) ) {
877
  }
878
  }
879
  }
 
880
  // Notices
881
  if ( ! function_exists( 'woo_feed_review_notice' ) ) {
882
  function woo_feed_review_notice() {
883
- $options = get_option('woo_feed_review_notice');
884
- $installDate=get_option('woo-feed-free-activation-time');
885
- $installDate=strtotime('-16 days',$installDate);
886
-
887
- $notice = '<div class="woo-feed-review-notice notice notice-info is-dismissible">';
888
- $notice .= '<p><b>:) We have spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating. Your opinion matters a lot to us. It helps us to get better. Thanks for using <i>WooCommerce Product Feed</i>.</b></p>';
889
- $notice .= '<ul>';
890
- $notice .= '<li><a val="later" href="#">Remind me later</a></li>';
891
- $notice .= '<li><a val="never" href="#">I would not</a></li>';
892
- $notice .= '<li><a val="given" href="#" target="_blank">Review Here</a></li>';
893
- $notice .= '</ul>';
894
- $notice .= '</div>';
895
-
896
- if(!$options && time()>= $installDate + (60*60*24*15)){
 
 
 
 
 
 
897
  echo $notice;
898
- } else if(is_array($options)) {
899
- if((!array_key_exists('review_notice',$options)) || ($options['review_notice'] =='later' && time()>=($options['updated_at'] + (60*60*24*30) ))){
900
  echo $notice;
901
  }
902
  }
@@ -908,39 +915,64 @@ if ( ! function_exists( 'woo_feed_save_review_notice' ) ) {
908
  * Show Review request admin notice
909
  */
910
  function woo_feed_save_review_notice() {
911
- $notice = sanitize_text_field($_POST['notice']);
912
- $value['review_notice'] = $notice;
913
- $value['updated_at'] = time();
914
-
915
- update_option('woo_feed_review_notice',$value);
916
- wp_send_json_success($value);
 
 
 
 
 
 
917
  }
918
  add_action('wp_ajax_woo_feed_save_review_notice', 'woo_feed_save_review_notice');
919
  }
920
- if ( ! function_exists( 'woo_feed_wpml_notice' ) ) {
921
  /**
922
  * Show notice if WPML installed
923
  */
924
- function woo_feed_wpml_notice() {
925
- if (class_exists('SitePress') && get_option('woo_feed_wpml_notice') == false) {
926
- $wpml_notice = '<div class="woo-feed-wpml-notice notice notice-success is-dismissible">';
927
- $wpml_notice .= '<p>You are awesome for using <b>WooCommerce Product Feed</b>.
928
- Using the <b><a href="https://webappick.com/plugin/woocommerce-product-feed-pro/" target="_blank">Premium</a></b> version you can make multilingual feed for your WPML languages.</p>';
929
- $wpml_notice .= '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>';
930
- $wpml_notice .= '</div>';
931
- echo $wpml_notice;
932
- }
 
 
 
 
 
 
 
 
 
 
 
 
933
  }
934
- add_action( 'admin_notices', 'woo_feed_wpml_notice' );
935
- }
936
- if ( ! function_exists( 'woo_feed_save_wpml_notice' ) ) {
937
- add_action('wp_ajax_woo_feed_save_wpml_notice', 'woo_feed_save_wpml_notice');
938
- function woo_feed_save_wpml_notice() {
939
- $notice = true;
940
- $value['wpml_notice'] = $notice;
941
- update_option('woo_feed_wpml_notice',$value);
942
-
943
- wp_send_json_success();
 
 
 
 
 
 
 
944
  }
945
  }
946
 
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.2.10
19
  * Author: WebAppick
20
  * Author URI: https://webappick.com/
21
  * License: GPL v2
41
  * Plugin Version
42
  * @var string
43
  */
44
+ define( 'WOO_FEED_FREE_VERSION', '3.2.10' );
45
  }
46
  if ( ! defined( 'WOO_FEED_FREE_FILE') ) {
47
  /**
877
  }
878
  }
879
  }
880
+
881
  // Notices
882
  if ( ! function_exists( 'woo_feed_review_notice' ) ) {
883
  function woo_feed_review_notice() {
884
+ $options = get_option( 'woo_feed_review_notice' );
885
+ $installDate = get_option( 'woo-feed-free-activation-time' );
886
+ $installDate = strtotime( '-16 days', $installDate );
887
+ $pluginName = sprintf( '<i>%s</i>', esc_html__( 'WooCommerce Product Feed', 'woo-feed' ) );
888
+ ob_start();
889
+ ?>
890
+ <div class="woo-feed-notice notice notice-info is-dismissible">
891
+ <p><strong><?php printf(
892
+ esc_html__( ':) We have spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating. Your opinion matters a lot to us. It helps us to get better. Thanks for using %s.', 'woo-feed' ),
893
+ $pluginName
894
+ ); ?></strong></p>
895
+ <ul>
896
+ <li><a data-response="later" href="#"><?php esc_html_e( 'Remind me later', 'woo-feed' ); ?></a></li>
897
+ <li><a data-response="never" href="#"><?php esc_html_e( 'I would not', 'woo-feed' ); ?></a></li>
898
+ <li><a data-response="given" href="#" target="_blank"><?php esc_html_e( 'Review Here', 'woo-feed' ); ?></a></li>
899
+ </ul>
900
+ </div>
901
+ <?php
902
+ $notice = ob_get_clean();
903
+ if ( ! $options && time() >= $installDate + ( DAY_IN_SECONDS * 15 ) ) {
904
  echo $notice;
905
+ } elseif ( is_array( $options ) ) {
906
+ if ( ( ! array_key_exists( 'review_notice', $options ) ) || ( $options['review_notice'] == 'later' && time() >= ( $options['updated_at'] + ( DAY_IN_SECONDS * 30 ) ) ) ) {
907
  echo $notice;
908
  }
909
  }
915
  * Show Review request admin notice
916
  */
917
  function woo_feed_save_review_notice() {
918
+ check_ajax_referer( 'wpf_feed_nonce' );
919
+ if( isset( $_POST['notice'] ) && ! empty( $_POST['notice'] ) && in_array( $_POST['notice'], [ 'later', 'never', 'given' ] ) ) {
920
+ $value = [
921
+ 'review_notice' => sanitize_text_field( $_POST['notice'] ),
922
+ 'updated_at' => time(),
923
+ ];
924
+ update_option( 'woo_feed_review_notice', $value );
925
+ wp_send_json_success( $value );
926
+ wp_die();
927
+ }
928
+ wp_send_json_error( esc_html__( 'Invalid Request.', 'woo-feed' ) );
929
+ wp_die();
930
  }
931
  add_action('wp_ajax_woo_feed_save_review_notice', 'woo_feed_save_review_notice');
932
  }
933
+ if ( ! function_exists( 'woo_feed_admin_notices' ) ) {
934
  /**
935
  * Show notice if WPML installed
936
  */
937
+ function woo_feed_admin_notices() {
938
+ $pluginName = sprintf( '<b>%s</b>', esc_html__( 'WooCommerce Product Feed', 'woo-feed' ) );
939
+ $proLink = sprintf( '<b><a href="http://bit.ly/2KIwvTt" target="_blank">%s</a></b>', esc_html__( 'Premium', 'woo-feed' ) );
940
+ if ( class_exists( 'SitePress' ) && get_option( 'woo_feed_wpml_notice' ) === false ) { ?>
941
+ <div class="woo-feed-notice notice notice-success is-dismissible" data-which="wpml">
942
+ <button type="button" class="notice-dismiss">
943
+ <span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'woo-feed' ); ?></span>
944
+ </button>
945
+ <p><?php printf( esc_html__( 'You are awesome for using %s. Using the %s version you can make multilingual feed for your WPML languages.', 'woo-feed' ), $pluginName, $proLink ); ?></p>
946
+ </div>
947
+ <?php }
948
+ if ( class_exists( 'RP_WCDPD', false ) && get_option( 'woo_feed_rp-wcdpd_notice' ) === false ) {
949
+ $rp_dpd = sprintf( '<b>%s</b>', esc_html__( 'WooCommerce Dynamic Pricing & Discounts', 'rp_wcdpd' ) );
950
+ ?>
951
+ <div class="woo-feed-notice notice notice-success is-dismissible" data-which="rp-wcdpd">
952
+ <button type="button" class="notice-dismiss">
953
+ <span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'woo-feed' ); ?></span>
954
+ </button>
955
+ <p><?php printf( esc_html__( '%s isn\'t fully compatible with %s. Get the %s version for full support.', 'woo-feed' ), $pluginName, $rp_dpd, $proLink ); ?></p>
956
+ </div>
957
+ <?php }
958
  }
959
+ add_action( 'admin_notices', 'woo_feed_admin_notices' );
960
+ }
961
+ if ( ! function_exists( 'woo_feed_hide_notice' ) ) {
962
+ add_action('wp_ajax_woo_feed_hide_notice', 'woo_feed_hide_notice');
963
+ function woo_feed_hide_notice() {
964
+ check_ajax_referer( 'wpf_feed_nonce' );
965
+ if( isset( $_REQUEST['which'] ) && ! empty( $_REQUEST['which'] ) ) {
966
+ $which = sanitize_text_field( $_REQUEST['which'] );
967
+ $notices = [ 'rp-wcdpd', 'wpml' ];
968
+ if( in_array( $which, $notices ) ) {
969
+ update_option( sprintf( 'woo_feed_%s_notice', $which ), '1', false );
970
+ wp_send_json_success( esc_html__( 'Request Successful.', 'woo-feed' ) );
971
+ wp_die();
972
+ }
973
+ }
974
+ wp_send_json_error( esc_html__( 'Invalid Request.', 'woo-feed' ) );
975
+ wp_die();
976
  }
977
  }
978