CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.32

Version Description

(2021-02-16) = * Added: Auto exclude url addition for caching plugins.

Download this release

Release Info

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

Code changes from version 4.3.31 to 4.3.32

Files changed (4) hide show
  1. README.txt +5 -2
  2. includes/helper.php +336 -0
  3. includes/hooks.php +13 -0
  4. woo-feed.php +2 -2
README.txt CHANGED
@@ -1,11 +1,11 @@
1
- === CTX Feed - Generate WooCommerce Product Feed ===
2
  Contributors: wahid0003, webappick, mhamudul_hk, shuvo586, nayanchamp7
3
  Donate link: https://webappick.com
4
  Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Catalog, Bing Shopping, Instagram Shop, Skroutz Data Feed, xml feed, csv feed, txt feed, woocommerce product feed
5
  Requires at least: 3.6
6
  Tested Up To: 5.6.1
7
  Requires PHP: 5.6
8
- Stable tag: 4.3.31
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -498,6 +498,9 @@ Using pro version:
498
 
499
  == Changelog ==
500
 
 
 
 
501
  = 4.3.31 (2021-02-14) =
502
  * Added: Woo Feed to new name CTX Feed.
503
  * Added: Status page new look with all product counter.
1
+ === CTX Feed - WooCommerce Product Feed Generator ===
2
  Contributors: wahid0003, webappick, mhamudul_hk, shuvo586, nayanchamp7
3
  Donate link: https://webappick.com
4
  Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Catalog, Bing Shopping, Instagram Shop, Skroutz Data Feed, xml feed, csv feed, txt feed, woocommerce product feed
5
  Requires at least: 3.6
6
  Tested Up To: 5.6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 4.3.32
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
498
 
499
  == Changelog ==
500
 
501
+ = 4.3.32 (2021-02-16) =
502
+ * Added: Auto exclude url addition for caching plugins.
503
+
504
  = 4.3.31 (2021-02-14) =
505
  * Added: Woo Feed to new name CTX Feed.
506
  * Added: Status page new look with all product counter.
includes/helper.php CHANGED
@@ -3886,5 +3886,341 @@ if ( ! function_exists( 'woo_feed_positioning_attribute_value' ) ) {
3886
  }
3887
  }
3888
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3889
 
3890
  // End of file helper.php.
3886
  }
3887
  }
3888
 
3889
+ if ( ! function_exists('woo_feed_get_feed_file_list') ) {
3890
+ function woo_feed_get_feed_file_list(){
3891
+ global $wpdb;
3892
+ $feed_data = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name like %s", 'wf_feed_%' ),ARRAY_A); // phpcs:ignore
3893
+ $feed_urls = [];
3894
+ if ( ! empty($feed_data) and is_array($feed_data) ) {
3895
+ foreach ( $feed_data as $key => $data ) {
3896
+ $feed_info = maybe_unserialize(get_option($data['option_name']));
3897
+ $feed_urls[] = $feed_info['url'];
3898
+ }
3899
+ }
3900
+
3901
+ return $feed_urls;
3902
+ }
3903
+ }
3904
+
3905
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_rocket_cache') ) {
3906
+ /**
3907
+ * Exclude Feed file URL form WP Rocket caching
3908
+ *
3909
+ * @param $files
3910
+ *
3911
+ * @return array
3912
+ */
3913
+ function woo_feed_exclude_feed_from_wp_rocket_cache( $files ) {
3914
+ return array_merge(
3915
+ $files,
3916
+ [
3917
+ '/wp-content/uploads/woo-feed/(.*)',
3918
+ ]
3919
+ );
3920
+ }
3921
+ }
3922
+
3923
+ if ( ! function_exists('woo_feed_exclude_feed_from_litespeed_cache') ) {
3924
+ /**
3925
+ * Exclude Feed file URL form LiteSpeed caching
3926
+ *
3927
+ * @return array|false
3928
+ */
3929
+ function woo_feed_exclude_feed_from_litespeed_cache() {
3930
+ if ( ! class_exists( 'LiteSpeed\Core' ) || ! defined( 'LSCWP_DIR' ) ) {
3931
+ return false;
3932
+ }
3933
+
3934
+ $litespeed_ex_paths = maybe_unserialize(get_option('litespeed.conf.cdn-exc'));
3935
+ if ( $litespeed_ex_paths && is_array($litespeed_ex_paths) && ! in_array('/wp-content/uploads/woo-feed', $litespeed_ex_paths) ) {
3936
+ $litespeed_ex_paths = array_merge(
3937
+ $litespeed_ex_paths,
3938
+ [ '/wp-content/uploads/woo-feed' ]
3939
+ );
3940
+ update_option('litespeed.conf.cdn-exc', $litespeed_ex_paths);
3941
+ }
3942
+ return false;
3943
+ }
3944
+ }
3945
+
3946
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_fastest_cache') ) {
3947
+ /**
3948
+ * Exclude Feed file URL form WP Fastest caching
3949
+ *
3950
+ * @return array|false
3951
+ */
3952
+ function woo_feed_exclude_feed_from_wp_fastest_cache() {
3953
+
3954
+ if ( ! class_exists( 'WpFastestCache' ) ) {
3955
+ return false;
3956
+ }
3957
+
3958
+ $wp_fastest_cache_ex_paths = json_decode(get_option('WpFastestCacheExclude'));
3959
+ if ( $wp_fastest_cache_ex_paths && is_array($wp_fastest_cache_ex_paths) ) {
3960
+
3961
+ $feed_path_exist = false;
3962
+ foreach ( $wp_fastest_cache_ex_paths as $key => $path ) {
3963
+ if ( 'woo-feed' === $path->content ) {
3964
+ $feed_path_exist = true;
3965
+ break;
3966
+ }
3967
+ }
3968
+
3969
+ if ( ! $feed_path_exist ) {
3970
+ $new_rule = new stdClass();
3971
+ $new_rule->prefix = "contain";
3972
+ $new_rule->content = 'woo-feed';
3973
+ $new_rule->type = "page";
3974
+
3975
+ $wp_fastest_cache_ex_paths = array_merge(
3976
+ $wp_fastest_cache_ex_paths,
3977
+ [ $new_rule ]
3978
+ );
3979
+
3980
+ update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
3981
+ }
3982
+ }elseif ( empty($wp_fastest_cache_ex_paths) ) {
3983
+ $wp_fastest_cache_ex_paths = [];
3984
+ $new_rule = new stdClass();
3985
+ $new_rule->prefix = "contain";
3986
+ $new_rule->content = 'woo-feed';
3987
+ $new_rule->type = "page";
3988
+
3989
+ $wp_fastest_cache_ex_paths = array_merge(
3990
+ $wp_fastest_cache_ex_paths,
3991
+ [ $new_rule ]
3992
+ );
3993
+
3994
+ update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
3995
+ }
3996
+ return false;
3997
+ }
3998
+ }
3999
+
4000
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_super_cache') ) {
4001
+ /**
4002
+ * Exclude Feed file URL form WP Super caching
4003
+ *
4004
+ * @return array|false
4005
+ */
4006
+ function woo_feed_exclude_feed_from_wp_super_cache() {
4007
+
4008
+ if ( ! function_exists( 'wpsc_init' ) ) {
4009
+ return false;
4010
+ }
4011
+
4012
+ $wp_super_ex_paths = get_option('ossdl_off_exclude');
4013
+ if ( $wp_super_ex_paths && strpos( $wp_super_ex_paths, 'woo-feed') === false ) {
4014
+ $wp_super_ex_paths = explode(',' , $wp_super_ex_paths);
4015
+ $wp_super_ex_paths = array_merge($wp_super_ex_paths, [ 'woo-feed' ]);
4016
+ update_option('ossdl_off_exclude', implode(',',$wp_super_ex_paths));
4017
+ }
4018
+
4019
+ return false;
4020
+ }
4021
+ }
4022
+
4023
+ if ( ! function_exists('woo_feed_exclude_feed_from_breeze_cache') ) {
4024
+ /**
4025
+ * Exclude Feed file URL form BREEZE caching
4026
+ *
4027
+ * @return array|false
4028
+ */
4029
+ function woo_feed_exclude_feed_from_breeze_cache() {
4030
+
4031
+ if ( ! class_exists( 'Breeze_Admin' ) ) {
4032
+ return false;
4033
+ }
4034
+
4035
+ $breeze_settings = maybe_unserialize(get_option('breeze_cdn_integration'));
4036
+ if ( is_array($breeze_settings) ) {
4037
+ $woo_feed_files = [ '.xml', '.csv', '.tsv', '.txt', '.xls' ];
4038
+ $woo_feed_files = array_unique(array_merge($woo_feed_files,$breeze_settings['cdn-exclude-content']));
4039
+ $breeze_settings['cdn-exclude-content'] = $woo_feed_files;
4040
+ update_option('breeze_cdn_integration', $breeze_settings);
4041
+ }
4042
+ return false;
4043
+ }
4044
+ }
4045
+
4046
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_optimize_cache') ) {
4047
+ /**
4048
+ * Exclude Feed file URL form WP Optimize caching
4049
+ *
4050
+ * @return array|false
4051
+ */
4052
+ function woo_feed_exclude_feed_from_wp_optimize_cache() {
4053
+
4054
+ if ( ! class_exists( 'WP_Optimize' ) ) {
4055
+ return false;
4056
+ }
4057
+
4058
+ $wp_optimize_ex_paths = maybe_unserialize(get_option('wpo_cache_config'));
4059
+ if ( isset( $wp_optimize_ex_paths['enable_page_caching'] ) && $wp_optimize_ex_paths['enable_page_caching'] ) { // If page Caching enabled
4060
+ if ( is_array( $wp_optimize_ex_paths ) && ! in_array('/wp-content/uploads/woo-feed', $wp_optimize_ex_paths['cache_exception_urls']) ) {
4061
+ $woo_feed_ex_path['cache_exception_urls'] = [ '/wp-content/uploads/woo-feed' ];
4062
+ $wp_optimize_ex_paths = array_merge_recursive(
4063
+ $wp_optimize_ex_paths,
4064
+ $woo_feed_ex_path
4065
+ );
4066
+ update_option('wpo_cache_config', $wp_optimize_ex_paths);
4067
+ }
4068
+ }
4069
+
4070
+ return false;
4071
+ }
4072
+ }
4073
+
4074
+ if ( ! function_exists('woo_feed_exclude_feed_from_cache_enabler_cache') ) {
4075
+ /**
4076
+ * Exclude Feed file URL form Cache Enabler caching
4077
+ *
4078
+ * @return array|false
4079
+ */
4080
+ function woo_feed_exclude_feed_from_cache_enabler_cache() {
4081
+
4082
+ if ( ! class_exists( 'Cache_Enabler' ) ) {
4083
+ return false;
4084
+ }
4085
+
4086
+ $cache_enabler_ex_paths = maybe_unserialize(get_option('cache_enabler'));
4087
+ if ( isset( $cache_enabler_ex_paths['excluded_page_paths']) && empty($cache_enabler_ex_paths['excluded_page_paths']) ) {
4088
+ $cache_enabler_ex_paths['excluded_page_paths'] = '/wp-content/uploads/woo-feed/';
4089
+ update_option('cache_enabler', $cache_enabler_ex_paths);
4090
+ }
4091
+
4092
+ return false;
4093
+ }
4094
+ }
4095
+
4096
+ if ( ! function_exists('woo_feed_exclude_feed_from_swift_performance_cache') ) {
4097
+ /**
4098
+ * Exclude Feed file URL form Swift Performance caching
4099
+ *
4100
+ * @return array|false
4101
+ */
4102
+ function woo_feed_exclude_feed_from_swift_performance_cache() {
4103
+
4104
+ if ( ! class_exists( 'Swift_Performance_Lite' ) ) {
4105
+ return false;
4106
+ }
4107
+
4108
+ $swift_perform_ex_paths = maybe_unserialize(get_option('swift_performance_options'));
4109
+
4110
+ if ( $swift_perform_ex_paths && isset( $swift_perform_ex_paths['exclude-strings']) ) {
4111
+ $exclude_strings = $swift_perform_ex_paths['exclude-strings'];
4112
+ if ( is_array( $exclude_strings ) && ! in_array('/wp-content/uploads/woo-feed', $exclude_strings) ) {
4113
+ $woo_feed_ex_path['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4114
+ $swift_perform_ex_paths = array_merge_recursive(
4115
+ $swift_perform_ex_paths,
4116
+ $woo_feed_ex_path
4117
+ );
4118
+ } else {
4119
+ $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4120
+ }
4121
+ update_option('swift_performance_options', $swift_perform_ex_paths);
4122
+ }elseif ( empty($swift_perform_ex_paths) ) {
4123
+ $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4124
+ update_option('swift_performance_options', $swift_perform_ex_paths);
4125
+ }
4126
+
4127
+ return false;
4128
+ }
4129
+ }
4130
+
4131
+ if ( ! function_exists('woo_feed_exclude_feed_from_speed_booster_cache') ) {
4132
+ /**
4133
+ * Exclude Feed file URL form Speed Booster Pack caching
4134
+ *
4135
+ * @return array|false
4136
+ */
4137
+ function woo_feed_exclude_feed_from_speed_booster_cache() {
4138
+
4139
+ if ( ! class_exists( 'Speed_Booster_Pack' ) ) {
4140
+ return false;
4141
+ }
4142
+
4143
+ $feed_files = [];
4144
+ $speed_booster_settings = maybe_unserialize(get_option('sbp_options'));
4145
+ if ( isset( $speed_booster_settings['caching_exclude_urls']) ) {
4146
+ $feed_files = woo_feed_get_feed_file_list();
4147
+ $caching_exclude_urls = $speed_booster_settings['caching_exclude_urls'];
4148
+ if ( ! empty( $caching_exclude_urls ) ) {
4149
+ if ( ! empty( $feed_files ) ) {
4150
+ foreach ( $feed_files as $key => $file ) {
4151
+ $file = str_replace( array( 'http://', 'https://' ),'',$file );
4152
+ if ( ! in_array( $file,explode("\n",$caching_exclude_urls) ) ) {
4153
+ $caching_exclude_urls .= "\n".$file;
4154
+ }
4155
+ }
4156
+ }
4157
+ } else {
4158
+ $caching_exclude_urls = str_replace( array( 'http://', 'https://' ),'', implode("\n",$feed_files) );
4159
+ }
4160
+ $speed_booster_settings['caching_exclude_urls'] = $caching_exclude_urls;
4161
+ update_option('sbp_options', $speed_booster_settings);
4162
+ }
4163
+ //TODO CDN extension exclude
4164
+ return false;
4165
+ }
4166
+ }
4167
+
4168
+ if ( ! function_exists('woo_feed_exclude_feed_from_comet_cache') ) {
4169
+ /**
4170
+ * Exclude Feed file URL form Comet Cache caching
4171
+ *
4172
+ * @return array|false
4173
+ */
4174
+ function woo_feed_exclude_feed_from_comet_cache() {
4175
+ //error_log( print_r( get_plugins(), true ) );
4176
+ if ( ! is_plugin_active('comet-cache/comet-cache.php') ) {
4177
+ return false;
4178
+ }
4179
+
4180
+ $comet_cache_settings = maybe_unserialize(get_option('comet_cache_options'));
4181
+
4182
+ if ( $comet_cache_settings && isset( $comet_cache_settings['exclude_uris']) ) {
4183
+ $exclude_uris = $comet_cache_settings['exclude_uris'];
4184
+ if ( strpos( $exclude_uris, '/wp-content/uploads/woo-feed') === false ) {
4185
+ $exclude_uris .= "\n/wp-content/uploads/woo-feed";
4186
+ $comet_cache_settings['exclude_uris'] = $exclude_uris;
4187
+ update_option('comet_cache_options', $comet_cache_settings);
4188
+ }
4189
+ }
4190
+
4191
+ return false;
4192
+ }
4193
+ }
4194
+
4195
+ if ( ! function_exists('woo_feed_exclude_feed_from_hyper_cache') ) {
4196
+ /**
4197
+ * Exclude Feed file URL form Swift Performance caching
4198
+ *
4199
+ * @return array|false
4200
+ */
4201
+ function woo_feed_exclude_feed_from_hyper_cache() {
4202
+
4203
+ if ( ! class_exists( 'HyperCache' ) ) {
4204
+ return false;
4205
+ }
4206
+
4207
+ $hyper_cache_settings = maybe_unserialize(get_option('hyper-cache'));
4208
+ if ( $hyper_cache_settings && isset( $hyper_cache_settings['reject_uris']) ) {
4209
+ $exclude_strings = $hyper_cache_settings['reject_uris'];
4210
+ if ( is_array( $exclude_strings ) && ! in_array('/wp-content/uploads/woo-feed', $exclude_strings) ) {
4211
+ $woo_feed_ex_path['reject_uris'] = [ '/wp-content/uploads/woo-feed' ];
4212
+ $woo_feed_ex_path['reject_uris_enabled'] = 1;
4213
+ $hyper_cache_settings = array_merge_recursive(
4214
+ $hyper_cache_settings,
4215
+ $woo_feed_ex_path
4216
+ );
4217
+ }
4218
+ update_option('hyper-cache', $hyper_cache_settings);
4219
+ }
4220
+
4221
+ return false;
4222
+ }
4223
+ }
4224
+
4225
 
4226
  // End of file helper.php.
includes/hooks.php CHANGED
@@ -34,4 +34,17 @@ add_filter( 'woo_feed_get_availability_attribute', 'woo_feed_get_availability_at
34
  // Product Loop End.
35
  add_action( 'woo_feed_after_product_loop', 'woo_feed_remove_hooks_before_product_loop', 10, 2 );
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  // End of file hooks.php.
34
  // Product Loop End.
35
  add_action( 'woo_feed_after_product_loop', 'woo_feed_remove_hooks_before_product_loop', 10, 2 );
36
 
37
+ // Exclude Feed files from caching.
38
+ add_filter( 'rocket_cdn_reject_files', 'woo_feed_exclude_feed_from_wp_rocket_cache', 10, 3 );//WP Rocket Cache
39
+ add_action( 'litespeed_init', 'woo_feed_exclude_feed_from_litespeed_cache', 10, 0);//LiteSpeed Cache
40
+ add_action("admin_init", 'woo_feed_exclude_feed_from_wp_fastest_cache', 10, 0);//WP Fastest Cache
41
+ add_action("admin_init", 'woo_feed_exclude_feed_from_wp_super_cache', 10, 0);//WP Super Cache
42
+ add_action("admin_init", 'woo_feed_exclude_feed_from_breeze_cache', 10, 0);//BREEZE Cache
43
+ add_action("admin_init", 'woo_feed_exclude_feed_from_wp_optimize_cache', 10, 0);//WP Optimize Cache
44
+ add_action("admin_init", 'woo_feed_exclude_feed_from_cache_enabler_cache', 10, 0);//Cache Enabler Cache
45
+ add_action("admin_init", 'woo_feed_exclude_feed_from_swift_performance_cache', 10, 0);//Cache Enabler Cache
46
+ add_action("admin_init", 'woo_feed_exclude_feed_from_speed_booster_cache', 10, 0);//Cache Enabler Cache
47
+ add_action("admin_init", 'woo_feed_exclude_feed_from_comet_cache', 10, 0);//Cache Enabler Cache
48
+ add_action("admin_init", 'woo_feed_exclude_feed_from_hyper_cache', 10, 0);//Cache Enabler Cache
49
+
50
  // End of file hooks.php.
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.3.31
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -38,7 +38,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
38
  * @var string
39
  * @since 3.1.6
40
  */
41
- define( 'WOO_FEED_FREE_VERSION', '4.3.31' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
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.3.32
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
38
  * @var string
39
  * @since 3.1.6
40
  */
41
+ define( 'WOO_FEED_FREE_VERSION', '4.3.32' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {