CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.5.11

Version Description

(2022-11-21) = * Added: Black Friday Notice Banner Added

Download this release

Release Info

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

Code changes from version 4.5.10 to 4.5.11

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.10
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.10 (2022-11-14) =
594
  * Fixed: Skroutz template additional image attribute tag
595
  * Added: Skroutz template multiple additional image attribute tag
5
  Requires at least: 4.4
6
  Tested Up To: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 4.5.11
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.11 (2022-11-21) =
594
+ * Added: Black Friday Notice Banner Added
595
+
596
  = 4.5.10 (2022-11-14) =
597
  * Fixed: Skroutz template additional image attribute tag
598
  * Added: Skroutz template multiple additional image attribute tag
V5/Helper/ProductHelper.php CHANGED
@@ -290,7 +290,6 @@ class ProductHelper {
290
  return apply_filters( 'woo_feed_filter_product_attribute', $getAttribute, $attr, $product, $config );
291
  }
292
 
293
-
294
  /**
295
  * Get ACF Field values
296
  *
@@ -573,7 +572,7 @@ class ProductHelper {
573
  * @return array|float|int|string
574
  * @since 3.2.0
575
  */
576
- private
577
  static function price_format(
578
  $name, $conditionName, $result
579
  ) {
@@ -623,6 +622,21 @@ class ProductHelper {
623
  return $result;
624
  }
625
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  /**
627
  * Get attribute value by type
628
  *
290
  return apply_filters( 'woo_feed_filter_product_attribute', $getAttribute, $attr, $product, $config );
291
  }
292
 
 
293
  /**
294
  * Get ACF Field values
295
  *
572
  * @return array|float|int|string
573
  * @since 3.2.0
574
  */
575
+ public
576
  static function price_format(
577
  $name, $conditionName, $result
578
  ) {
622
  return $result;
623
  }
624
 
625
+ /**
626
+ * Get date is Validate
627
+ *
628
+ * @param date $date Date
629
+ * @param string $format Date Formate
630
+ *
631
+ * @return boolean
632
+ */
633
+
634
+ public static function validateDate($date, $format = 'Y-m-d')
635
+ {
636
+ $d = DateTime::createFromFormat($format, $date);
637
+ return $d && $d->format($format) == $date;
638
+ }
639
+
640
  /**
641
  * Get attribute value by type
642
  *
V5/Output/CategoryMapping.php CHANGED
@@ -2,7 +2,8 @@
2
 
3
  namespace CTXFeed\V5\Output;
4
 
5
-
 
6
  /**
7
  * Class CategoryMapping
8
  *
@@ -15,4 +16,136 @@ namespace CTXFeed\V5\Output;
15
  */
16
  class CategoryMapping {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
2
 
3
  namespace CTXFeed\V5\Output;
4
 
5
+ use CTXFeed\V5\Helper\CommonHelper;
6
+ use CTXFeed\V5\Helper\ProductHelper;
7
  /**
8
  * Class CategoryMapping
9
  *
16
  */
17
  class CategoryMapping {
18
 
19
+
20
+ /**
21
+ * @param $categoryMappingName
22
+ * @param $product_id
23
+ *
24
+ * @return string
25
+ */
26
+ public function getCategoryMappingValue( $categoryMappingName, $product_id ) {
27
+
28
+ $getValue = maybe_unserialize( get_option( $categoryMappingName ) );
29
+ $cat_map_value = '';
30
+ $suggestive_category_list_merchants = array(
31
+ 'google',
32
+ 'facebook',
33
+ 'pinterest',
34
+ 'bing',
35
+ 'bing_local_inventory',
36
+ 'snapchat',
37
+ );
38
+
39
+ if ( ! isset( $getValue['cmapping'] ) && ! isset( $getValue['gcl-cmapping'] ) ) {
40
+ return '';
41
+ }
42
+
43
+ //get product terms
44
+ $categories = get_the_terms( $product_id, 'product_cat' );
45
+
46
+
47
+ //get cmapping value
48
+ if ( isset( $getValue['gcl-cmapping'] ) && in_array( $getValue['mappingprovider'], $suggestive_category_list_merchants, true ) ) {
49
+ $cmapping = is_array( $getValue['gcl-cmapping'] ) ? array_reverse( $getValue['gcl-cmapping'], true ) : $getValue['gcl-cmapping'];
50
+ } else {
51
+ $cmapping = is_array( $getValue['cmapping'] ) ? array_reverse( $getValue['cmapping'], true ) : $getValue['cmapping'];
52
+ }
53
+
54
+ // Fixes empty mapped category issue
55
+ if ( ! empty( $categories ) && is_array( $categories ) && count( $categories ) ) {
56
+ $categories = array_reverse( $categories );
57
+ foreach ( $categories as $category ) {
58
+ if ( isset( $cmapping[ $category->term_id ] ) && ! empty( $cmapping[ $category->term_id ] ) ) {
59
+ $cat_map_value = $cmapping[ $category->term_id ];
60
+ break;
61
+ }
62
+ }
63
+ }
64
+
65
+ return $cat_map_value;
66
+ }
67
+
68
+
69
+ /**
70
+ * Get Category Mapping.
71
+ *
72
+ * @param $category
73
+ *
74
+ * @return false|mixed|null
75
+ */
76
+
77
+ public function getCategoryMapping( $category ) {
78
+ if ( strpos( $category, ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX ) === false ) {
79
+ $category = ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX . $category;
80
+ }
81
+
82
+ return get_option( $category );
83
+ }
84
+
85
+ public function getCategoryMappings() {
86
+
87
+ $category_mappings = CommonHelper::get_options( ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX );
88
+ $data = array();
89
+ if ( ! empty( $category_mappings ) ) {
90
+ foreach ( $category_mappings as $mapping ) {
91
+ $data[ $mapping->option_name ] = get_option( $mapping->option_name );
92
+ }
93
+
94
+ return $data;
95
+ }
96
+
97
+ return false;
98
+ }
99
+
100
+ /**
101
+ * Save Category Mapping.
102
+ *
103
+ * @param array $categoryMappingConfig
104
+ *
105
+ * @return bool
106
+ */
107
+ public function saveCategoryMapping( $categoryMappingConfig ) {
108
+
109
+ $data = array();
110
+
111
+ $data['name'] = '';
112
+ if ( isset( $categoryMappingConfig['mappingname'] ) ) {
113
+ $data['name'] = sanitize_text_field( $categoryMappingConfig['mappingname'] );
114
+ }
115
+
116
+ // Set Option Name.
117
+ if ( isset( $categoryMappingConfig['option'] ) &&
118
+ ! empty( $categoryMappingConfig['option'] ) &&
119
+ false !== strpos( $categoryMappingConfig['option'], ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
120
+ ) {
121
+ $option = sanitize_text_field( $categoryMappingConfig['option'] );
122
+ } else {
123
+ // generate unique one.
124
+ $option = CommonHelper::unique_option_name( ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX . $data['name'] );
125
+ }
126
+
127
+ if ( is_array( $categoryMappingConfig ) ) {
128
+
129
+ $data = serialize( woo_feed_array_sanitize( $categoryMappingConfig ) );
130
+ }
131
+
132
+ return update_option( $option, $data );
133
+
134
+ }
135
+
136
+ /**
137
+ * Delete Category Mapping.
138
+ *
139
+ * @param $category
140
+ *
141
+ * @return bool
142
+ */
143
+ public function deleteCategoryMapping( $category ) {
144
+ if ( strpos( $category, ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX ) === false ) {
145
+ $category = ProductHelper::PRODUCT_CATEGORY_MAPPING_PREFIX . $category;
146
+ }
147
+
148
+ return delete_option( $category );
149
+ }
150
+
151
  }
V5/Output/DynamicAttributes.php CHANGED
@@ -2,6 +2,10 @@
2
 
3
  namespace CTXFeed\V5\Output;
4
 
 
 
 
 
5
 
6
  /**
7
  * Class DynamicAttributes
@@ -15,4 +19,328 @@ namespace CTXFeed\V5\Output;
15
  */
16
  class DynamicAttributes {
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
2
 
3
  namespace CTXFeed\V5\Output;
4
 
5
+ use CTXFeed\V5\Helper\CommonHelper;
6
+ use CTXFeed\V5\Helper\ProductHelper;
7
+ use CTXFeed\V5\Product\AttributeValueByType;
8
+
9
 
10
  /**
11
  * Class DynamicAttributes
19
  */
20
  class DynamicAttributes {
21
 
22
+
23
+ /**
24
+ * @param $attribute
25
+ * @param $merchant_attribute
26
+ * @param WC_Product $product
27
+ * @param Config $config
28
+ *
29
+ * @return string
30
+ */
31
+ public function getDynamicAttributeValue( $attribute, $merchant_attribute, $product, $config ) {
32
+
33
+ //$getAttributeValueByType = new AttributeValueByType( $attribute, $merchant_attribute, $product, $config );
34
+ $getValue = maybe_unserialize( get_option( $attribute ) );
35
+ $wfDAttributeCode = isset( $getValue['wfDAttributeCode'] ) ? $getValue['wfDAttributeCode'] : '';
36
+ $attribute = isset( $getValue['attribute'] ) ? (array) $getValue['attribute'] : array();
37
+ $condition = isset( $getValue['condition'] ) ? (array) $getValue['condition'] : array();
38
+ $compare = isset( $getValue['compare'] ) ? (array) $getValue['compare'] : array();
39
+ $type = isset( $getValue['type'] ) ? (array) $getValue['type'] : array();
40
+
41
+ $logical_condition = isset( $getValue['logical_condition'] ) ? (array) $getValue['logical_condition'] : array();
42
+
43
+ $prefix = isset( $getValue['prefix'] ) ? (array) $getValue['prefix'] : array();
44
+ $suffix = isset( $getValue['suffix'] ) ? (array) $getValue['suffix'] : array();
45
+
46
+ $value_attribute = isset( $getValue['value_attribute'] ) ? (array) $getValue['value_attribute'] : array();
47
+ $value_pattern = isset( $getValue['value_pattern'] ) ? (array) $getValue['value_pattern'] : array();
48
+
49
+ $default_type = isset( $getValue['default_type'] ) ? $getValue['default_type'] : 'attribute';
50
+ $default_value_attribute = isset( $getValue['default_value_attribute'] ) ? $getValue['default_value_attribute'] : '';
51
+ $default_value_pattern = isset( $getValue['default_value_pattern'] ) ? $getValue['default_value_pattern'] : '';
52
+
53
+ $result = '';
54
+ $result_array=array();
55
+
56
+ // Check If Attribute Code exist
57
+ if ( $wfDAttributeCode && count( $attribute ) ) {
58
+ foreach ( $attribute as $key => $name ) {
59
+ if ( ! empty( $name ) ) {
60
+
61
+ if ( !empty( $logical_condition ) || in_array( '&&', $logical_condition ) ) {
62
+ $result = '';
63
+ }
64
+
65
+ $conditionName =(new AttributeValueByType($attribute, $product, $config))->get_value($name);
66
+
67
+ if ( 'weight' === $name ) {
68
+ $unit = ' ' . get_option( 'woocommerce_weight_unit' );
69
+ if ( ! empty( $unit ) ) {
70
+ $conditionName = (float) str_replace( $unit, '', $conditionName );
71
+ }
72
+ }
73
+
74
+ $conditionCompare = $compare[ $key ];
75
+ $conditionOperator = $condition[ $key ];
76
+
77
+ if ( ! empty( $conditionCompare ) ) {
78
+ $conditionCompare = trim( $conditionCompare );
79
+ }
80
+ $conditionValue = '';
81
+ if ( 'pattern' === $type[ $key ] ) {
82
+ $conditionValue = $value_pattern[ $key ];
83
+ } elseif ( 'attribute' === $type[ $key ] ) {
84
+ $conditionValue =(new AttributeValueByType($attribute, $product, $config))->get_value($value_attribute[ $key ]);
85
+ } elseif ( 'remove' === $type[ $key ] ) {
86
+ $conditionValue = '';
87
+ }
88
+
89
+ switch ( $conditionOperator ) {
90
+ case '==':
91
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
92
+ $conditionName=strtotime($conditionName);
93
+ $conditionCompare=strtotime($conditionCompare);
94
+ }
95
+ if ( $conditionName == $conditionCompare ) {
96
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
97
+ if ( '' !== $result ) {
98
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
99
+ }
100
+ }
101
+ break;
102
+ case '!=':
103
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
104
+ $conditionName=strtotime($conditionName);
105
+ $conditionCompare=strtotime($conditionCompare);
106
+ }
107
+ if ( $conditionName != $conditionCompare ) {
108
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
109
+ if ( '' !== $result ) {
110
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
111
+ }
112
+ }
113
+ break;
114
+ case '>=':
115
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
116
+ $conditionName=strtotime($conditionName);
117
+ $conditionCompare=strtotime($conditionCompare);
118
+ }
119
+ if ( $conditionName >= $conditionCompare ) {
120
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
121
+ if ( '' !== $result ) {
122
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
123
+ }
124
+ }
125
+
126
+ break;
127
+ case '<=':
128
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
129
+ $conditionName=strtotime($conditionName);
130
+ $conditionCompare=strtotime($conditionCompare);
131
+ }
132
+ if ( $conditionName <= $conditionCompare ) {
133
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
134
+ if ( '' !== $result ) {
135
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
136
+ }
137
+ }
138
+ break;
139
+ case '>':
140
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
141
+ $conditionName=strtotime($conditionName);
142
+ $conditionCompare=strtotime($conditionCompare);
143
+ }
144
+ if ( $conditionName > $conditionCompare ) {
145
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
146
+ if ( '' !== $result ) {
147
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
148
+ }
149
+ }
150
+ break;
151
+ case '<':
152
+ if(ProductHelper::validateDate( $conditionName ) && ProductHelper::validateDate( $conditionCompare)){
153
+ $conditionName=strtotime($conditionName);
154
+ $conditionCompare=strtotime($conditionCompare);
155
+ }
156
+ if ( $conditionName < $conditionCompare ) {
157
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
158
+ if ( '' !== $result ) {
159
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
160
+ }
161
+ }
162
+ break;
163
+ case 'contains':
164
+ if ( false !== stripos( $conditionName, $conditionCompare ) ) {
165
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
166
+ if ( '' !== $result ) {
167
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
168
+ }
169
+ }
170
+ break;
171
+ case 'nContains':
172
+ if ( stripos( $conditionName, $conditionCompare ) === false ) {
173
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
174
+ if ( '' !== $result ) {
175
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
176
+ }
177
+ }
178
+ break;
179
+ case 'between':
180
+ $compare_items = explode( ',', $conditionCompare );
181
+
182
+ if ( isset( $compare_items[1] ) && is_numeric( $compare_items[0] ) && is_numeric( $compare_items[1] ) ) {
183
+ if ( $conditionName >= $compare_items[0] && $conditionName <= $compare_items[1] ) {
184
+ $result = ProductHelper::price_format( $name, $conditionName, $conditionValue );
185
+ if ( '' !== $result ) {
186
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
187
+ }
188
+ }
189
+ }
190
+ else if ( isset( $compare_items[1] ) && ProductHelper::validateDate( $compare_items[0] ) && ProductHelper::validateDate( $compare_items[1] ) ) {
191
+ if ( $conditionName >= $compare_items[0] && $conditionName <= $compare_items[1] ) {
192
+ $result = $this->price_format( $name, $conditionName, $conditionValue );
193
+ if ( '' != $result ) {
194
+ $result = $prefix[ $key ] . $result . $suffix[ $key ];
195
+ }
196
+ }
197
+ }
198
+ else {
199
+ $result = '';
200
+ }
201
+ break;
202
+ default:
203
+ break;
204
+ }
205
+ }
206
+ $result_array[$key]=array(
207
+ 'conditionName'=>$conditionName,
208
+ 'result'=>$result,
209
+ 'condition'=>$logical_condition[$key],
210
+ 'name'=>$name,
211
+ 'conditionOperator'=>$conditionOperator,
212
+ 'conditionCompare'=>$conditionCompare,
213
+ );
214
+
215
+ }
216
+ }
217
+
218
+ if ( empty( $logical_condition ) || ! in_array( '&&', $logical_condition ) ) {
219
+ $result=$result;
220
+
221
+ }else{
222
+ $new_logical_condition=$logical_condition;
223
+ array_shift($new_logical_condition);
224
+ if ( ! in_array( '||', $new_logical_condition ) ) {
225
+ foreach($result_array as $key=>$value){
226
+ if($value['result']===''){
227
+ $result='';
228
+ break;
229
+ }else{
230
+ $result=$value['result'];
231
+ }
232
+ }
233
+ }else{
234
+ foreach($result_array as $key=>$value){
235
+ if($key==0)
236
+ continue;
237
+ else if($value['condition']=='&&'){
238
+ if($value['result']!=='' && $result_array[$key-1]['result']!==''){
239
+ $result=$value['result'];
240
+ }else{
241
+ $result='';
242
+ }
243
+ }
244
+ else if($value['condition']=='||'){
245
+ if($value['result']!==''){
246
+ $result=$value['result'];
247
+ }
248
+ }
249
+
250
+ }
251
+ }
252
+ }
253
+
254
+ //return $result;
255
+
256
+ if ( '' === $result ) {
257
+ if ( 'pattern' === $default_type ) {
258
+ $result = $default_value_pattern;
259
+ } elseif ( 'attribute' === $default_type ) {
260
+ if ( ! empty( $default_value_attribute ) ) {
261
+ $result = (new AttributeValueByType($attribute, $product, $config))->get_value($default_value_attribute);
262
+ }
263
+ } elseif ( 'remove' === $default_type ) {
264
+ $result = '';
265
+ }
266
+ }
267
+ //return $result;
268
+ return apply_filters( 'woo_feed_after_dynamic_attribute_value', $result, $product, $attribute, $merchant_attribute, $config );
269
+
270
+ }
271
+
272
+ /**
273
+ * Save Dynamic Attribute.
274
+ *
275
+ * @param array $dynamicAttributes
276
+ *
277
+ * @return bool
278
+ */
279
+ public function saveDynamicAttribute( $dynamicAttributes ) {
280
+
281
+ $condition = '';
282
+ $_data = array();
283
+ $wf_attribute_opt_name = '';
284
+
285
+ if ( count( $dynamicAttributes ) && isset( $dynamicAttributes['wfDAttributeCode']) ) {
286
+ $condition = sanitize_text_field( $dynamicAttributes['wfDAttributeCode'] );
287
+ $_data = woo_feed_sanitize_form_fields( $dynamicAttributes );
288
+ $wf_attribute_opt_name = AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX . $condition;
289
+ }
290
+
291
+
292
+ if ( false !== get_option( $wf_attribute_opt_name, false ) ) {
293
+ $option = CommonHelper::unique_option_name( $wf_attribute_opt_name );
294
+ }else{
295
+ $option = $wf_attribute_opt_name;
296
+ }
297
+ //print_r( $_data ); exit;
298
+ return update_option( $option, $_data );
299
+ }
300
+
301
+ /**
302
+ * Get Dynamic Attribute.
303
+ *
304
+ * @param $attribute
305
+ *
306
+ * @return false|mixed|null
307
+ */
308
+ public function getDynamicAttribute( $attribute ) {
309
+ if ( strpos( $attribute, AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX ) === false ) {
310
+ $attribute = AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX . $attribute;
311
+ }
312
+
313
+ return get_option( $attribute );
314
+ }
315
+
316
+ public function getDynamicAttributes() {
317
+
318
+ $dynamic_attributes = CommonHelper::get_options( AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX );
319
+ $data = [];
320
+ if ( ! empty( $dynamic_attributes ) ) {
321
+ foreach ( $dynamic_attributes as $attributes ) {
322
+ $data[ $attributes->option_name ] = get_option( $attributes->option_name );
323
+ }
324
+
325
+ return $data;
326
+ }
327
+
328
+ return false;
329
+ }
330
+
331
+ /**
332
+ * Delete Dynamic Attribute.
333
+ *
334
+ * @param $attribute
335
+ *
336
+ * @return bool
337
+ */
338
+ public function deleteDynamicAttribute( $attribute ) {
339
+ if ( strpos( $attribute, AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX ) === false ) {
340
+ $attribute = AttributeValueByType::PRODUCT_DYNAMIC_ATTRIBUTE_PREFIX . $attribute;
341
+ }
342
+
343
+ return delete_option( $attribute );
344
+ }
345
+
346
  }
V5/Product/AttributeValueByType.php CHANGED
@@ -111,6 +111,7 @@ class AttributeValueByType {
111
  * @return mixed|void
112
  */
113
  public function get_value( $attr = '' ) {
 
114
  if ( ! empty( $attr ) ) {
115
  $this->attribute = $attr;
116
  }
111
  * @return mixed|void
112
  */
113
  public function get_value( $attr = '' ) {
114
+
115
  if ( ! empty( $attr ) ) {
116
  $this->attribute = $attr;
117
  }
admin/images/ctx-feed-black-friday-banner-2021.png DELETED
Binary file
admin/images/ctx-feed-black-friday-banner-2022.png ADDED
Binary file
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.10' );
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.11' );
27
  }
28
 
29
  if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
includes/helper.php CHANGED
@@ -116,7 +116,7 @@ if ( ! function_exists( 'wooFeed_deactivate_plugins' ) ) {
116
  */
117
  function wooFeed_Deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
118
  if ( ! function_exists( 'deactivate_plugins' ) ) {
119
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
120
  }
121
  deactivate_plugins( $plugins, $silent, $network_wide );
122
  }
@@ -244,33 +244,33 @@ if ( ! function_exists( 'woo_feed_black_friday_notice' ) ) {
244
  */
245
  function woo_feed_black_friday_notice() {
246
  $user_id = get_current_user_id();
247
- if ( ! get_user_meta( $user_id, 'woo_feed_black_friday_notice_2021_dismissed' ) ) {
248
  ob_start();
249
  ?>
250
- <script type="text/javascript">
251
- (function ($) {
252
- $(document).on('click', '.woo-feed-ctx-startup-notice button.notice-dismiss', function (e) {
253
- e.preventDefault();
254
- let nonce = $('#woo_feed_to_ctx_feed_nonce').val();
255
-
256
- //woo feed black friday notice cancel callback
257
- wp.ajax.post('woo_feed_save_black_friday_notice_2021_notice', {
258
- _wp_ajax_nonce: nonce,
259
- clicked: true,
260
- }).then(response => {
261
- console.log(response);
262
- }).fail(error => {
263
- console.log(error);
264
- });
265
- });
266
- })(jQuery)
267
- </script>
268
- <a href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=freePlugin&utm_medium=go_premium&utm_campaign=black_friday_2021&utm_term=wooFeed"
269
- class="notice woo-feed-ctx-startup-notice is-dismissible"
270
- style="background: url(<?php echo WOO_FEED_PLUGIN_URL . "admin/images/ctx-feed-black-friday-banner-2021.png"; ?>) no-repeat top center;">
271
- <input type="hidden" id="woo_feed_to_ctx_feed_nonce"
272
- value="<?php echo wp_create_nonce( 'woo-feed-to-ctx-feed-notice' ); ?>">
273
- </a>
274
  <?php
275
  $image = ob_get_contents();
276
  }
@@ -291,30 +291,30 @@ if ( ! function_exists( 'woo_feed_halloween_notice' ) ) {
291
  if ( ! get_user_meta( $user_id, 'woo_feed_halloween_notice_dismissed' ) ) {
292
  ob_start();
293
  ?>
294
- <script type="text/javascript">
295
- (function ($) {
296
- $(document).on('click', '.woo-feed-ctx-halloween-notice button.notice-dismiss', function (e) {
297
- e.preventDefault();
298
- let nonce = $('#woo_feed_to_ctx_feed_halloween_nonce').val();
299
-
300
- //woo feed halloween cancel callback
301
- wp.ajax.post('woo_feed_save_halloween_notice', {
302
- _wp_ajax_nonce: nonce,
303
- clicked: true,
304
- }).then(response => {
305
- console.log(response);
306
- }).fail(error => {
307
- console.log(error);
308
- });
309
- });
310
- })(jQuery)
311
- </script>
312
- <a target="_blank" href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=hw&utm_medium=ctx-plugin-banner&utm_campaign=hw-cm-22"
313
- class="notice woo-feed-ctx-halloween-notice is-dismissible"
314
- style="background: url(<?php echo WOO_FEED_PLUGIN_URL . "admin/images/woo_feed_halloween_notice.png"; ?>) no-repeat top center;">
315
- <input type="hidden" id="woo_feed_to_ctx_feed_halloween_nonce"
316
- value="<?php echo wp_create_nonce( 'woo-feed-to-ctx-feed-halloween-nonce' ); ?>">
317
- </a>
318
  <?php
319
  $image = ob_get_contents();
320
  }
@@ -332,36 +332,36 @@ if ( ! function_exists( 'woo_feed_progress_bar' ) ) {
332
  $progress_bar = '';
333
  ob_start();
334
  ?>
335
- <div id="feed_progress_table" style="display: none;">
336
- <table class="table widefat fixed">
337
- <thead>
338
- <tr>
339
- <th><b><?php esc_html_e( 'Generating Product Feed', 'woo-feed' ); ?></b></th>
340
- </tr>
341
- </thead>
342
- <tbody>
343
- <tr>
344
- <td>
345
- <div class="feed-progress-container">
346
- <div class="feed-progress-bar">
347
- <span class="feed-progress-bar-fill"></span>
348
- </div>
349
- </div>
350
- </td>
351
- </tr>
352
- <tr>
353
- <td>
354
- <div style="float: left;"><b style='color: darkblue;'><i
355
- class='dashicons dashicons-sos wpf_spin'></i></b>&nbsp;&nbsp;&nbsp;
356
- </div>
357
- <div class="feed-progress-status"></div>
358
- <div class="feed-progress-percentage"></div>
359
- </td>
360
- </tr>
361
- </tbody>
362
- </table>
363
- <br>
364
- </div>
365
  <?php
366
  $progress_bar .= ob_get_clean();
367
 
@@ -428,16 +428,16 @@ if ( ! function_exists( 'woo_feed_get_query_type_options' ) ) {
428
  */
429
  function woo_feed_get_query_type_options( $type = '' ) {
430
  if ( 'variation' === $type ) {
431
- return [
432
  'individual' => __( 'Individual', 'woo-feed' ),
433
  'variable' => __( 'Variable Dependable', 'woo-feed' ),
434
- ];
435
  } else {
436
- return [
437
  'wc' => __( 'WC_Product_Query', 'woo-feed' ),
438
  'wp' => __( 'WP_Query', 'woo-feed' ),
439
  'both' => __( 'Both', 'woo-feed' ),
440
- ];
441
  }
442
  }
443
  }
@@ -449,7 +449,7 @@ if ( ! function_exists( 'woo_feed_get_cache_ttl_options' ) ) {
449
  function woo_feed_get_cache_ttl_options() {
450
  return apply_filters(
451
  'woo_feed_cache_ttl_options',
452
- [
453
  0 => esc_html__( 'No Expiration ', 'woo-feed' ),
454
  MONTH_IN_SECONDS => esc_html__( '1 Month', 'woo-feed' ),
455
  WEEK_IN_SECONDS => esc_html__( '1 Week', 'woo-feed' ),
@@ -457,7 +457,7 @@ if ( ! function_exists( 'woo_feed_get_cache_ttl_options' ) ) {
457
  12 * HOUR_IN_SECONDS => esc_html__( '12 Hours', 'woo-feed' ),
458
  6 * HOUR_IN_SECONDS => esc_html__( '6 Hours', 'woo-feed' ),
459
  HOUR_IN_SECONDS => esc_html__( '1 Hours', 'woo-feed' ),
460
- ]
461
  );
462
  }
463
  }
@@ -477,14 +477,18 @@ if ( ! function_exists( 'woo_feed_get_merchant_class' ) ) {
477
  * @return string
478
  */
479
  function woo_feed_get_merchant_class( $provider ) {
480
- if ( in_array( $provider, [
481
- 'google',
482
- 'google_shopping_action',
483
- 'google_local',
484
- 'google_local_inventory',
485
- 'adroll',
486
- 'smartly.io'
487
- ], true ) ) {
 
 
 
 
488
  return 'Woo_Feed_Google';
489
  } elseif ( in_array( $provider, array( 'pinterest', 'pinterest_rss' ) ) ) {
490
  return 'Woo_Feed_Pinterest';
@@ -593,7 +597,7 @@ if ( ! function_exists( 'woo_feed_get_default_brand' ) ) {
593
  if ( false !== $url ) {
594
  $url = wp_parse_url( $url );
595
  if ( array_key_exists( 'host', $url ) ) {
596
- if ( strpos( $url['host'], "." ) !== false ) {
597
  $arr = explode( '.', $url['host'] );
598
  $brand = $arr[ count( $arr ) - 2 ];
599
  $brand = ucfirst( $brand );
@@ -617,8 +621,8 @@ if ( ! function_exists( 'woo_feed_merchant_require_google_category' ) ) {
617
  * @return array|bool
618
  */
619
  function woo_feed_merchant_require_google_category( $merchant = null, $attribute = null ) {
620
- $list = [
621
- 'current_category' => [
622
  'google',
623
  'google_shopping_action',
624
  'google_local',
@@ -630,10 +634,10 @@ if ( ! function_exists( 'woo_feed_merchant_require_google_category' ) ) {
630
  'smartly.io',
631
  'pinterest',
632
  'rakuten.de',
633
- ],
634
- 'fb_product_category' => [ 'facebook' ],
635
- 'google_product_category' => [ 'rakuten.de', 'tiktok', 'snapchat' ],
636
- 'google_category_id' => [
637
  'daisycon',
638
  'daisycon_automotive',
639
  'daisycon_books',
@@ -654,9 +658,9 @@ if ( ! function_exists( 'woo_feed_merchant_require_google_category' ) ) {
654
  'daisycon_holidays_accommodations',
655
  'daisycon_holidays_accommodations_and_transport',
656
  'daisycon_holidays_trips',
657
- 'daisycon_work_jobs'
658
- ],
659
- ];
660
  if ( null !== $merchant && null !== $attribute ) {
661
  return ( isset( $list[ $attribute ] ) && in_array( $merchant, $list[ $attribute ], true ) );
662
  }
@@ -668,7 +672,7 @@ if ( ! function_exists( 'woo_feed_get_item_wrapper_hidden_merchant' ) ) {
668
  function woo_feed_get_item_wrapper_hidden_merchant() {
669
  return apply_filters(
670
  'woo_feed_item_wrapper_hidden_merchant',
671
- [
672
  'google',
673
  'google_shopping_action',
674
  'facebook',
@@ -709,7 +713,7 @@ if ( ! function_exists( 'woo_feed_get_item_wrapper_hidden_merchant' ) ) {
709
  'daisycon_holidays_accommodations_and_transport',
710
  'daisycon_holidays_trips',
711
  'daisycon_work_jobs',
712
- ]
713
  );
714
  }
715
  }
@@ -729,12 +733,12 @@ if ( ! function_exists( 'woo_feed_parse_feed_rules' ) ) {
729
  * @uses wp_parse_args
730
  *
731
  */
732
- function woo_feed_parse_feed_rules( $rules = [], $context = 'view' ) {
733
 
734
  if ( empty( $rules ) ) {
735
- $rules = [];
736
  }
737
- $defaults = [
738
  'provider' => '',
739
  'filename' => '',
740
  'feedType' => '',
@@ -757,48 +761,50 @@ if ( ! function_exists( 'woo_feed_parse_feed_rules' ) ) {
757
  'delimiter' => ',',
758
  'enclosure' => 'double',
759
  'extraHeader' => '',
760
- 'vendors' => [],
761
  // Feed Config
762
- 'mattributes' => [], // merchant attributes
763
- 'prefix' => [], // prefixes
764
- 'type' => [], // value (attribute) types
765
- 'attributes' => [], // product attribute mappings
766
- 'default' => [], // default values (patterns) if value type set to pattern
767
- 'suffix' => [], // suffixes
768
- 'output_type' => [], // output type (output filter)
769
- 'limit' => [], // limit or command
770
  // filters tab
771
  'composite_price' => '',
772
  'shipping_country' => '',
773
  'tax_country' => '',
774
  'product_ids' => '',
775
- 'categories' => [],
776
- 'post_status' => [ 'publish' ],
777
- 'filter_mode' => [],
778
- 'campaign_parameters' => [],
779
-
780
- 'ptitle_show' => '',
781
- 'decimal_separator' => wc_get_price_decimal_separator(),
782
- 'thousand_separator' => wc_get_price_thousand_separator(),
783
- 'decimals' => wc_get_price_decimals(),
784
- ];
785
  $rules = wp_parse_args( $rules, $defaults );
786
- $rules['filter_mode'] = wp_parse_args( $rules['filter_mode'],
787
- [
 
788
  'product_ids' => 'include',
789
  'categories' => 'include',
790
  'post_status' => 'include',
791
- ] );
 
792
 
793
  $rules['campaign_parameters'] = wp_parse_args(
794
  $rules['campaign_parameters'],
795
- [
796
  'utm_source' => '',
797
  'utm_medium' => '',
798
  'utm_campaign' => '',
799
  'utm_term' => '',
800
  'utm_content' => '',
801
- ]
802
  );
803
 
804
  if ( ! empty( $rules['provider'] ) && is_string( $rules['provider'] ) ) {
@@ -866,29 +872,37 @@ if ( ! function_exists( 'woo_feed_register_and_do_woo_feed_meta_boxes' ) ) {
866
  if ( ! function_exists( 'woo_feed_ajax_merchant_info' ) ) {
867
  add_action( 'wp_ajax_woo_feed_get_merchant_info', 'woo_feed_ajax_merchant_info' );
868
  function woo_feed_ajax_merchant_info() {
869
- if ( isset( $_REQUEST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ),
870
- 'wpf_feed_nonce' ) ) {
 
 
871
  $provider = ( isset( $_REQUEST['provider'] ) && ! empty( $_REQUEST['provider'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['provider'] ) ) : '';
872
  $merchantInfo = new Woo_Feed_Merchant( $provider );
873
- $data = [];
874
  $na = esc_html__( 'N/A', 'woo-feed' );
875
  foreach ( $merchantInfo->get_info() as $k => $v ) {
876
  if ( 'link' === $k ) {
877
  /** @noinspection HtmlUnknownTarget */
878
- $data[ $k ] = empty( $v ) ? $na : sprintf( '<a href="%s" target="_blank">%s</a>',
 
879
  esc_url( $v ),
880
- esc_html__( 'Read Article', 'woo-feed' ) );
 
881
  } elseif ( 'video' === $k ) {
882
  /** @noinspection HtmlUnknownTarget */
883
- $data[ $k ] = empty( $v ) ? $na : sprintf( '<a href="%s" target="_blank">%s</a>',
 
884
  esc_url( $v ),
885
- esc_html__( 'Watch Now', 'woo-feed' ) );
 
886
  } elseif ( 'feed_file_type' === $k ) {
887
  if ( ! empty( $v ) ) {
888
- $v = array_map( function ( $type ) {
889
- return strtoupper( $type );
890
- },
891
- (array) $v );
 
 
892
  $data[ $k ] = esc_html( implode( ', ', $v ) );
893
  } else {
894
  $data[ $k ] = $na;
@@ -897,9 +911,11 @@ if ( ! function_exists( 'woo_feed_ajax_merchant_info' ) ) {
897
  $links = '';
898
  foreach ( $v as $label => $link ) {
899
  /** @noinspection HtmlUnknownTarget */
900
- $links .= sprintf( '<li><a href="%s" target="_blank">%s</a></li>',
 
901
  esc_url( $link ),
902
- esc_html( $label ) );
 
903
  }
904
  $data[ $k ] = empty( $links ) ? $na : $links;
905
  }
@@ -929,77 +945,91 @@ if ( ! function_exists( 'woo_feed_merchant_info_metabox' ) ) {
929
  $feed_options = maybe_unserialize( get_option( 'wf_feed_' . $filename ) );
930
  }
931
  ?>
932
- <span class="spinner"></span>
933
- <div class="merchant-infos">
934
  <?php foreach ( $merchantInfo->get_info() as $k => $v ) { ?>
935
- <div class="merchant-info-section <?php echo esc_attr( $k ); ?>">
936
  <?php if ( 'link' === $k ) { ?>
937
- <span class="dashicons dashicons-media-document" style="color: #82878c;"
938
- aria-hidden="true"></span>
939
- <span><?php esc_html_e( 'Feed Specification:', 'woo-feed' ); ?></span>
940
- <strong class="data">
941
  <?php
942
  /** @noinspection HtmlUnknownTarget */
943
- ( empty( $v ) ) ? esc_html_e( 'N/A',
944
- 'woo-feed' ) : printf( '<a href="%s" target="_blank">%s</a>',
 
 
 
945
  esc_url( $v ),
946
- esc_html__( 'Read Article', 'woo-feed' ) );
 
947
  ?>
948
- </strong>
949
  <?php } elseif ( 'video' === $k ) { ?>
950
- <span class="dashicons dashicons-video-alt3" style="color: #82878c;" aria-hidden="true"></span>
951
- <span><?php esc_html_e( 'Video Documentation:', 'woo-feed' ); ?></span>
952
- <strong class="data">
953
  <?php
954
  /** @noinspection HtmlUnknownTarget */
955
- ( empty( $v ) ) ? esc_html_e( 'N/A',
956
- 'woo-feed' ) : printf( '<a href="%s" target="_blank">%s</a>',
 
 
 
957
  esc_url( $v ),
958
- esc_html__( 'Watch now', 'woo-feed' ) );
 
959
  ?>
960
- </strong>
961
  <?php } elseif ( 'feed_file_type' === $k ) { ?>
962
- <span class="dashicons dashicons-media-text" style="color: #82878c;"
963
- aria-hidden="true"></span> <?php esc_html_e( 'Supported File Types:', 'woo-feed' ); ?>
964
- <strong class="data" style="display: block;padding-left: 24px;margin-top: 5px;">
965
  <?php
966
  if ( empty( $v ) ) {
967
  esc_html_e( 'N/A', 'woo-feed' );
968
  } else {
969
- $v = implode( ', ',
970
- array_map( function ( $type ) {
971
- return esc_html( strtoupper( $type ) );
972
- },
973
- (array) $v ) );
 
 
 
 
974
  echo esc_html( $v );
975
  }
976
  ?>
977
- </strong>
978
  <?php
979
  } elseif ( 'doc' === $k ) {
980
  ?>
981
- <span class="dashicons dashicons-editor-help" style="color: #82878c;" aria-hidden="true"></span>
982
- <span><?php esc_html_e( 'Support Docs:', 'woo-feed' ); ?></span>
983
- <ul class="data">
984
  <?php
985
  if ( empty( $v ) ) {
986
  esc_html_e( 'N/A', 'woo-feed' );
987
  } else {
988
  foreach ( $v as $label => $link ) {
989
  /** @noinspection HtmlUnknownTarget */
990
- printf( '<li><a href="%s" target="_blank">%s</a></li>',
 
991
  esc_url( $link ),
992
- esc_html( $label ) );
 
993
  }
994
  }
995
  ?>
996
- </ul>
997
  <?php
998
  }
999
  ?>
1000
- </div>
1001
  <?php } ?>
1002
- <div class="merchant-info-section woo-feed-open-file">
1003
  <?php
1004
  if ( isset( $feed_options['url'] ) && ! empty( $feed_options['url'] ) ) {
1005
  echo sprintf(
@@ -1010,8 +1040,8 @@ if ( ! function_exists( 'woo_feed_merchant_info_metabox' ) ) {
1010
  );
1011
  }
1012
  ?>
1013
- </div>
1014
- </div>
1015
  <?php
1016
  }
1017
  }
@@ -1021,14 +1051,14 @@ if ( ! function_exists( 'woo_feed_get_csv_delimiters' ) ) {
1021
  * @return array
1022
  */
1023
  function woo_feed_get_csv_delimiters() {
1024
- return [
1025
  ',' => 'Comma',
1026
  ':' => 'Colon',
1027
  ' ' => 'Space',
1028
  '|' => 'Pipe',
1029
  ';' => 'Semi Colon',
1030
  "\t" => 'TAB',
1031
- ];
1032
  }
1033
  }
1034
  if ( ! function_exists( 'woo_feed_get_csv_enclosure' ) ) {
@@ -1037,11 +1067,11 @@ if ( ! function_exists( 'woo_feed_get_csv_enclosure' ) ) {
1037
  * @return array
1038
  */
1039
  function woo_feed_get_csv_enclosure() {
1040
- return [
1041
  'double' => '"',
1042
  'single' => '\'',
1043
  ' ' => 'None',
1044
- ];
1045
  }
1046
  }
1047
 
@@ -1092,9 +1122,9 @@ if ( ! function_exists( 'woo_feed_check_google_category' ) ) {
1092
  $list = woo_feed_merchant_require_google_category();
1093
  $cat_keys = array_keys( $list );
1094
  $merchants = call_user_func_array( 'array_merge', array_values( $list ) );
1095
- $checkCategory = isset( $feedInfo['feedrules']['mattributes'] ) ? $feedInfo['feedrules']['mattributes'] : [];
1096
- $checkCategoryType = isset( $feedInfo['feedrules']['type'] ) ? $feedInfo['feedrules']['type'] : [];
1097
- $merchant = isset( $feedInfo['feedrules']['provider'] ) ? $feedInfo['feedrules']['provider'] : [];
1098
  $cat = 'yes';
1099
  foreach ( $list as $attribute => $merchants ) {
1100
  if ( in_array( $merchant, $merchants, true ) && in_array( $attribute, $checkCategory, true ) ) {
@@ -1286,7 +1316,7 @@ if ( ! function_exists( 'woo_feed_save_feed_config_data' ) ) {
1286
  return false;
1287
  }
1288
  // unnecessary form fields to remove
1289
- $removables = [ 'closedpostboxesnonce', '_wpnonce', '_wp_http_referer', 'save_feed_config', 'edit-feed' ];
1290
  foreach ( $removables as $removable ) {
1291
  if ( isset( $data[ $removable ] ) ) {
1292
  unset( $data[ $removable ] );
@@ -1300,7 +1330,8 @@ if ( ! function_exists( 'woo_feed_save_feed_config_data' ) ) {
1300
  $feed_option_name = generate_unique_feed_file_name(
1301
  $data['filename'],
1302
  $data['feedType'],
1303
- $data['provider'] );
 
1304
  } else {
1305
  $feed_option_name = woo_feed_extract_feed_option_name( $feed_option_name );
1306
  }
@@ -1392,7 +1423,7 @@ if ( ! function_exists( 'woo_feed_extract_feed_option_name' ) ) {
1392
  * @return string
1393
  */
1394
  function woo_feed_extract_feed_option_name( $feed_option_name ) {
1395
- return str_replace( [ 'wf_feed_', 'wf_config' ], '', $feed_option_name );
1396
  }
1397
  }
1398
  if ( ! function_exists( 'woo_feed_get_file_path' ) ) {
@@ -1441,12 +1472,16 @@ if ( ! function_exists( 'woo_feed_get_file_url' ) ) {
1441
  $fileName = woo_feed_extract_feed_option_name( $fileName );
1442
  $upload_dir = wp_get_upload_dir();
1443
 
1444
- return esc_url( sprintf( '%s/woo-feed/%s/%s/%s.%s',
1445
- $upload_dir['baseurl'],
1446
- $provider,
1447
- $type,
1448
- $fileName,
1449
- $type ) );
 
 
 
 
1450
  }
1451
  }
1452
  if ( ! function_exists( 'woo_feed_check_feed_file' ) ) {
@@ -1462,12 +1497,16 @@ if ( ! function_exists( 'woo_feed_check_feed_file' ) ) {
1462
  function woo_feed_check_feed_file( $fileName, $provider, $type ) {
1463
  $upload_dir = wp_get_upload_dir();
1464
 
1465
- return file_exists( sprintf( '%s/woo-feed/%s/%s/%s.%s',
1466
- $upload_dir['basedir'],
1467
- $provider,
1468
- $type,
1469
- $fileName,
1470
- $type ) );
 
 
 
 
1471
  }
1472
  }
1473
  if ( ! function_exists( 'woo_feed_get_file_dir' ) ) {
@@ -1566,11 +1605,11 @@ if ( ! function_exists( 'woo_feed_unlink_tempFiles' ) ) {
1566
  if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
1567
  $ext = 'json';
1568
  }
1569
- $files = [
1570
  'headerFile' => $path . '/' . 'wf_store_feed_header_info_' . $fileName . '.' . $ext,
1571
  'bodyFile' => $path . '/' . 'wf_store_feed_body_info_' . $fileName . '.' . $ext,
1572
  'footerFile' => $path . '/' . 'wf_store_feed_footer_info_' . $fileName . '.' . $ext,
1573
- ];
1574
 
1575
  woo_feed_log_feed_process( $config['filename'], sprintf( 'Deleting Temporary Files (%s).', implode( ', ', array_values( $files ) ) ) );
1576
  foreach ( $files as $key => $file ) {
@@ -1622,7 +1661,7 @@ if ( ! function_exists( 'woo_feed_delete_feed' ) ) {
1622
 
1623
  // Delete cron schedule.
1624
  $feed_cron_param = 'wf_config' . $feed_name;
1625
- wp_clear_scheduled_hook( 'woo_feed_update_single_feed', [ $feed_cron_param ] );
1626
 
1627
  return $deleted;
1628
  }
@@ -1719,13 +1758,13 @@ if ( ! function_exists( 'str_replace_trim' ) ) {
1719
  if ( ! function_exists( 'woo_feed_strip_all_tags' ) ) {
1720
 
1721
  /*
1722
- * Extends wp_strip_all_tags to fix WP_Error object passing issue
1723
- *
1724
- * @param string | WP_Error $string
1725
- *
1726
- * @return string
1727
- * @since 4.4.19
1728
- * */
1729
  function woo_feed_strip_all_tags( $string ) {
1730
 
1731
  if ( $string instanceof WP_Error ) {
@@ -1830,13 +1869,13 @@ if ( ! function_exists( 'woo_feed_get_schedule_interval_options' ) ) {
1830
  function woo_feed_get_schedule_interval_options() {
1831
  return apply_filters(
1832
  'woo_feed_schedule_interval_options',
1833
- [
1834
  WEEK_IN_SECONDS => esc_html__( '1 Week', 'woo-feed' ),
1835
  DAY_IN_SECONDS => esc_html__( '24 Hours', 'woo-feed' ),
1836
  12 * HOUR_IN_SECONDS => esc_html__( '12 Hours', 'woo-feed' ),
1837
  6 * HOUR_IN_SECONDS => esc_html__( '6 Hours', 'woo-feed' ),
1838
  HOUR_IN_SECONDS => esc_html__( '1 Hours', 'woo-feed' ),
1839
- ]
1840
  );
1841
  }
1842
  }
@@ -1886,9 +1925,11 @@ if ( ! function_exists( 'woo_feed_get_formatted_url' ) ) {
1886
  */
1887
  function woo_feed_get_formatted_url( $url = '' ) {
1888
  if ( ! empty( $url ) ) {
1889
- if ( substr( trim( $url ), 0, 4 ) === 'http' || substr( trim( $url ),
1890
- 0,
1891
- 3 ) === 'ftp' || substr( trim( $url ), 0, 4 ) === 'sftp' ) {
 
 
1892
  return rtrim( $url, '/' );
1893
  } else {
1894
  $base = get_site_url();
@@ -1996,7 +2037,7 @@ if ( ! function_exists( 'woo_feed_parse_string' ) ) {
1996
  }
1997
  } elseif ( ! empty( $str ) ) {
1998
  list( $name, $value ) = explode( '=', $str, 2 );
1999
- $arr[ $name ] = $value;
2000
  }
2001
 
2002
  // return result array
@@ -2017,11 +2058,11 @@ if ( ! function_exists( 'woo_feed_replace_to_merchant_attribute' ) ) {
2017
  $attributeClass = new Woo_Feed_Default_Attributes();
2018
  $merchantAttributes = '';
2019
  if ( 'google' === $merchant
2020
- || 'google_shopping_action' === $merchant
2021
- || 'google_local' === $merchant
2022
- || 'google_local_inventory' === $merchant
2023
- || 'adroll' == $merchant
2024
- || 'smartly.io' == $merchant ) {
2025
  if ( 'xml' === $feedType ) {
2026
  $g_attributes = $attributeClass->googleXMLAttribute;
2027
  if ( 'google_local' === $merchant ) {
@@ -2068,7 +2109,7 @@ if ( ! function_exists( 'woo_feed_add_cdata' ) ) {
2068
  * @return string
2069
  */
2070
  function woo_feed_add_cdata( $pluginAttribute, $attributeValue, $merchant, $feed_type ) {
2071
- if ( "xml" !== $feed_type ) {
2072
  return "$attributeValue";
2073
  }
2074
 
@@ -2076,7 +2117,7 @@ if ( ! function_exists( 'woo_feed_add_cdata' ) ) {
2076
  return "$attributeValue";
2077
  }
2078
 
2079
- if ( "shipping" === $pluginAttribute || "tax" === $pluginAttribute ) {
2080
  return "$attributeValue";
2081
  }
2082
 
@@ -2109,7 +2150,7 @@ if ( ! function_exists( 'woo_feed_add_cdata' ) ) {
2109
  }
2110
  } else {
2111
  return "<![CDATA[ $attributeValue ]]>";
2112
- // return "$attributeValue";
2113
  }
2114
  } else {
2115
  return "$attributeValue";
@@ -2133,7 +2174,7 @@ if ( ! function_exists( 'woo_feed_get_options' ) ) {
2133
  * @since 3.3.11
2134
  */
2135
  function woo_feed_get_options( $key, $default = false ) {
2136
- $defaults = [
2137
  'per_batch' => 200,
2138
  'product_query_type' => 'wc',
2139
  'variation_query_type' => 'individual',
@@ -2173,7 +2214,7 @@ if ( ! function_exists( 'woo_feed_get_options' ) ) {
2173
  'custom_field_3' => 'disable',
2174
  'custom_field_4' => 'disable',
2175
  ),
2176
- ];
2177
 
2178
  /**
2179
  * Add defaults without chainging the core values.
@@ -2182,13 +2223,13 @@ if ( ! function_exists( 'woo_feed_get_options' ) ) {
2182
  *
2183
  * @since 3.3.11
2184
  */
2185
- $defaults = wp_parse_args( apply_filters( 'woo_feed_settings_extra_defaults', [] ), $defaults );
2186
 
2187
  if ( 'defaults' === $key ) {
2188
  return $defaults;
2189
  }
2190
 
2191
- $settings = wp_parse_args( get_option( 'woo_feed_settings', [] ), $defaults );
2192
 
2193
  if ( 'all' === $key ) {
2194
  return $settings;
@@ -2240,11 +2281,14 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2240
  }
2241
  if ( array_key_exists( 'enable_error_debugging', $args ) ) {
2242
  $data['enable_error_debugging'] = strtolower( $args['enable_error_debugging'] );
2243
- if ( ! in_array( $data['enable_error_debugging'], [ 'on', 'off' ] ) ) {
2244
- $data['enable_error_debugging'] = in_array( $_data['enable_error_debugging'], [
2245
- 'on',
2246
- 'off'
2247
- ] ) ? $_data['enable_error_debugging'] : $defaults['enable_error_debugging'];
 
 
 
2248
  }
2249
  unset( $args['enable_error_debugging'] );
2250
  }
@@ -2255,10 +2299,13 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2255
  if ( array_key_exists( 'overridden_structured_data', $args ) ) {
2256
  $data['overridden_structured_data'] = strtolower( $args['overridden_structured_data'] );
2257
  if ( ! in_array( $data['overridden_structured_data'], array( 'on', 'off' ) ) ) {
2258
- $data['overridden_structured_data'] = in_array( $_data['overridden_structured_data'], array(
2259
- 'on',
2260
- 'off'
2261
- ) ) ? $_data['overridden_structured_data'] : $defaults['overridden_structured_data'];
 
 
 
2262
  }
2263
  unset( $args['overridden_structured_data'] );
2264
  }
@@ -2266,10 +2313,13 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2266
  if ( array_key_exists( 'disable_pixel', $args ) ) {
2267
  $data['disable_pixel'] = strtolower( $args['disable_pixel'] );
2268
  if ( ! in_array( $data['disable_pixel'], array( 'enable', 'disable' ) ) ) {
2269
- $data['disable_pixel'] = in_array( $_data['disable_pixel'], array(
2270
- 'enable',
2271
- 'disable'
2272
- ) ) ? $_data['disable_pixel'] : $defaults['disable_pixel'];
 
 
 
2273
  }
2274
  unset( $args['disable_pixel'] );
2275
  }
@@ -2285,10 +2335,13 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2285
  if ( array_key_exists( 'disable_remarketing', $args ) ) {
2286
  $data['disable_remarketing'] = strtolower( $args['disable_remarketing'] );
2287
  if ( ! in_array( $data['disable_remarketing'], array( 'enable', 'disable' ) ) ) {
2288
- $data['disable_remarketing'] = in_array( $_data['disable_remarketing'], array(
2289
- 'enable',
2290
- 'disable'
2291
- ) ) ? $_data['disable_remarketing'] : $defaults['disable_remarketing'];
 
 
 
2292
  }
2293
  unset( $args['disable_remarketing'] );
2294
  }
@@ -2312,10 +2365,13 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2312
  if ( array_key_exists( 'allow_all_shipping', $args ) ) {
2313
  $data['allow_all_shipping'] = strtolower( $args['allow_all_shipping'] );
2314
  if ( ! in_array( $data['allow_all_shipping'], array( 'yes', 'no' ) ) ) {
2315
- $data['allow_all_shipping'] = in_array( $_data['allow_all_shipping'], array(
2316
- 'yes',
2317
- 'no'
2318
- ) ) ? $_data['allow_all_shipping'] : $defaults['allow_all_shipping'];
 
 
 
2319
  }
2320
  unset( $args['allow_all_shipping'] );
2321
  }
@@ -2323,10 +2379,13 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2323
  if ( array_key_exists( 'only_free_shipping', $args ) ) {
2324
  $data['only_free_shipping'] = strtolower( $args['only_free_shipping'] );
2325
  if ( ! in_array( $data['only_free_shipping'], array( 'yes', 'no' ) ) ) {
2326
- $data['only_free_shipping'] = in_array( $_data['only_free_shipping'], array(
2327
- 'yes',
2328
- 'no'
2329
- ) ) ? $_data['only_free_shipping'] : $defaults['only_free_shipping'];
 
 
 
2330
  }
2331
  unset( $args['only_free_shipping'] );
2332
  }
@@ -2334,22 +2393,27 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2334
  if ( array_key_exists( 'only_local_pickup_shipping', $args ) ) {
2335
  $data['only_local_pickup_shipping'] = strtolower( $args['only_local_pickup_shipping'] );
2336
  if ( ! in_array( $data['only_local_pickup_shipping'], array( 'yes', 'no' ) ) ) {
2337
- $data['only_local_pickup_shipping'] = in_array( $_data['only_local_pickup_shipping'], array(
2338
- 'yes',
2339
- 'no'
2340
- ) ) ? $_data['only_local_pickup_shipping'] : $defaults['only_local_pickup_shipping'];
 
 
 
2341
  }
2342
  unset( $args['only_local_pickup_shipping'] );
2343
  }
2344
 
2345
-
2346
  if ( array_key_exists( 'enable_ftp_upload', $args ) ) {
2347
  $data['enable_ftp_upload'] = strtolower( $args['enable_ftp_upload'] );
2348
  if ( ! in_array( $data['enable_ftp_upload'], array( 'yes', 'no' ) ) ) {
2349
- $data['enable_ftp_upload'] = in_array( $_data['enable_ftp_upload'], array(
2350
- 'yes',
2351
- 'no'
2352
- ) ) ? $_data['enable_ftp_upload'] : $defaults['enable_ftp_upload'];
 
 
 
2353
  }
2354
  unset( $args['enable_ftp_upload'] );
2355
  }
@@ -2443,8 +2507,8 @@ if ( ! function_exists( 'woo_feed_flush_cache_data' ) ) {
2443
  */
2444
  function woo_feed_flush_cache_data() {
2445
  global $wpdb;
2446
- // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%' " ); // phpcs:ignore
2447
- // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%'" ); // phpcs:ignore
2448
  $wpdb->query( "DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')" ); // phpcs:ignore
2449
  }
2450
  }
@@ -2464,12 +2528,12 @@ if ( ! function_exists( 'woo_feed_apply_tax_location_data' ) ) {
2464
  // @TODO use filter. add tab in feed editor so user can set custom settings.
2465
  // @TODO tab should not list all country and cities. it only list available tax settings and user can just select one.
2466
  // @TODO then it will extract the location data from it to use here.
2467
- $wc_tax_location = [
2468
  WC()->countries->get_base_country(),
2469
  WC()->countries->get_base_state(),
2470
  WC()->countries->get_base_postcode(),
2471
  WC()->countries->get_base_city(),
2472
- ];
2473
  /**
2474
  * Filter Tax Location to apply before product loop
2475
  *
@@ -2737,8 +2801,11 @@ if ( ! function_exists( 'woo_feed_custom_fields_status_change_cb' ) ) {
2737
  function woo_feed_custom_fields_status_change_cb() {
2738
  $is_nonce_valid = isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wpf_feed_nonce' );
2739
 
2740
- if ( $is_nonce_valid && isset( $_POST['field'], $_POST['status'],
2741
- $_POST['isTaxonomy'] ) ) {
 
 
 
2742
  $field = sanitize_text_field( wp_unslash( $_POST['field'] ) );
2743
  $is_taxonomy = sanitize_text_field( wp_unslash( $_POST['isTaxonomy'] ) );
2744
  $status = sanitize_text_field( wp_unslash( $_POST['status'] ) );
@@ -2838,7 +2905,7 @@ if ( ! function_exists( 'woo_feed_save_custom_identifier' ) ) {
2838
  $set_meta_val = $new_meta_val;
2839
  }
2840
 
2841
- $product_meta_value = isset( $_POST[ $product_meta_key ] ) ? sanitize_text_field( $_POST[ $product_meta_key ] ) : ( isset( $_POST["woo_feed_identifier_{$key}"] ) ? sanitize_text_field( $_POST["woo_feed_identifier_{$key}"] ) : $set_meta_val );
2842
 
2843
  if ( isset( $product_meta_value ) && ! empty( $product_meta_value ) ) {
2844
  update_post_meta( $product_id, $product_meta_key, $product_meta_value );
@@ -2866,7 +2933,7 @@ if ( ! function_exists( 'woo_feed_add_custom_identifier_for_variation' ) ) {
2866
  */
2867
  function woo_feed_add_custom_identifier_for_variation( $loop, $variation_data, $variation ) {
2868
  $settings = woo_feed_get_options( 'all' );
2869
- if ( isset( $settings['disable_mpn'] ) && "enable" === $settings['disable_mpn'] ) {
2870
  echo '<div class="woo-feed-variation-options">';
2871
  $custom_fields = woo_feed_product_custom_fields();
2872
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter( $custom_fields );
@@ -2927,7 +2994,7 @@ if ( ! function_exists( 'woo_feed_save_custom_identifier_for_variation' ) ) {
2927
 
2928
  if ( ! empty( $custom_identifier ) ) {
2929
  foreach ( $custom_identifier as $key => $value ) {
2930
- $custom_field_value = isset( $_POST["woo_feed_{$key}_var"][ $variation_id ] ) ? sanitize_text_field( $_POST["woo_feed_{$key}_var"][ $variation_id ] ) : ( isset( $_POST["woo_feed_identifier_{$key}_var"][ $variation_id ] ) ? sanitize_text_field( $_POST["woo_feed_identifier_{$key}_var"] ) : '' );
2931
  if ( isset( $custom_field_value ) ) {
2932
  update_post_meta( $variation_id, "woo_feed_{$key}_var", $custom_field_value );
2933
  }
@@ -3017,7 +3084,7 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3017
  * @return void
3018
  */
3019
  function woo_feed_render_categories( $parent = 0, $par = '', $value = '' ) {
3020
- $categoryArgs = [
3021
  'taxonomy' => 'product_cat',
3022
  'parent' => $parent,
3023
  'orderby' => 'term_group',
@@ -3026,7 +3093,7 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3026
  'hierarchical' => 1,
3027
  'title_li' => '',
3028
  'hide_empty' => 0,
3029
- ];
3030
  $categories = get_categories( $categoryArgs );
3031
  if ( ! empty( $categories ) ) {
3032
  if ( ! empty( $par ) ) {
@@ -3035,25 +3102,25 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3035
  foreach ( $categories as $cat ) {
3036
  $class = $parent ? "treegrid-parent-{$parent} category-mapping" : 'treegrid-parent category-mapping';
3037
  ?>
3038
- <tr class="treegrid-1 ">
3039
- <th>
3040
- <label for="cat_mapping_<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $par . $cat->name ); ?></label>
3041
- </th>
3042
- <td colspan="3">
3043
- <!--suppress HtmlUnknownAttribute -->
3044
  <?php
3045
  $newOrGoogleFacebook = ! empty( $value )
3046
- && in_array(
3047
- $value['mappingprovider'],
3048
- array(
3049
- 'google',
3050
- 'facebook',
3051
- 'pinterest',
3052
- 'bing',
3053
- 'bing_local_inventory',
3054
- 'snapchat'
3055
- )
3056
- );
3057
 
3058
  $previous_mapping_value = is_array( $value ) && isset( $value['cmapping'][ $cat->term_id ] ) ? esc_attr( $value['cmapping'][ $cat->term_id ] ) : '';
3059
  $previous_listing_mapping_value = is_array( $value ) && isset( $value['gcl-cmapping'][ $cat->term_id ] ) && ! empty( $value['gcl-cmapping'][ $cat->term_id ] )
@@ -3061,29 +3128,29 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3061
  : $previous_mapping_value;
3062
 
3063
  ?>
3064
- <input <?php echo ( ! $newOrGoogleFacebook ) ? '' : 'style=" display: none;" '; ?>
3065
- id="cat_mapping_<?php echo esc_attr( $cat->term_id ); ?>"
3066
- class="<?php echo esc_attr( $class ); ?> woo-feed-mapping-input"
3067
- autocomplete="off"
3068
- type="text"
3069
- name="cmapping[<?php echo esc_attr( $cat->term_id ); ?>]"
3070
- placeholder="<?php echo esc_attr( $par . $cat->name ); ?>"
3071
- data-cat_id="<?php echo esc_attr( $cat->term_id ); ?>"
3072
- value="<?php echo $previous_mapping_value; ?>"
3073
- >
3074
- <span
3075
  <?php echo ( $newOrGoogleFacebook ) ? '' : 'style=" display: none;" '; ?>class="wf_default wf_attributes">
3076
- <select name="gcl-cmapping[<?php echo $cat->term_id ?>]"
3077
- class="selectize selectize-google-category woo-feed-mapping-select"
3078
- data-selected="<?php echo $previous_mapping_value; ?>"
3079
- data-placeholder="<?php esc_attr_e( 'Select A Category', 'woo-feed' ); ?>">
3080
  <option value="<?php echo esc_attr( $previous_listing_mapping_value ); ?>" selected>
3081
- <?php echo esc_attr( $previous_listing_mapping_value ); ?>
3082
- </option>
3083
  </select>
3084
 
3085
  </span>
3086
- </td>
3087
  <?php
3088
  if ( ! empty( get_term_children( $cat->term_id, 'product_cat' ) ) ) {
3089
  $woo_map_term_id = 'parent-' . $cat->term_id;
@@ -3092,7 +3159,7 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3092
  }
3093
  $termchildren = ! empty( get_term_children( $cat->term_id, 'product_cat' ) ) || $cat->parent;
3094
  ?>
3095
- <td class="<?php echo $termchildren ? 'group-' . $woo_map_term_id : ''; ?>">
3096
  <?php
3097
  $childrencat = ! empty( get_term_children( $cat->term_id, 'product_cat' ) );
3098
  if ( $childrencat ) {
@@ -3100,8 +3167,8 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
3100
  echo '<span class="dashicons dashicons-arrow-down-alt" title=" ' . $title . '" id="cat-map-' . $cat->term_id . '"></span>';
3101
  }
3102
  ?>
3103
- </td>
3104
- </tr>
3105
  <?php
3106
  // call and render the child category if any.
3107
  woo_feed_render_categories( $cat->term_id, $par . $cat->name, $value );
@@ -3119,15 +3186,16 @@ if ( ! function_exists( 'woo_feed_clear_cache_button' ) ) {
3119
  */
3120
  function woo_feed_clear_cache_button() {
3121
  ?>
3122
- <div class="wf_clean_cache_wrapper">
3123
- <img class="woo-feed-cache-loader"
3124
- src="data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%0D%0A%3C%21--%20Generator%3A%20Adobe%20Illustrator%2019.0.0%2C%20SVG%20Export%20Plug-In%20.%20SVG%20Version%3A%206.00%20Build%200%29%20%20--%3E%0D%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Capa_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0D%0A%09%20viewBox%3D%220%200%20458.186%20458.186%22%20style%3D%22enable-background%3Anew%200%200%20458.186%20458.186%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0D%0A%3Cg%3E%0D%0A%09%3Cg%3E%0D%0A%09%09%3Cpath%20d%3D%22M445.651%2C201.95c-1.485-9.308-10.235-15.649-19.543-14.164c-9.308%2C1.485-15.649%2C10.235-14.164%2C19.543%0D%0A%09%09%09c0.016%2C0.102%2C0.033%2C0.203%2C0.051%2C0.304c17.38%2C102.311-51.47%2C199.339-153.781%2C216.719c-102.311%2C17.38-199.339-51.47-216.719-153.781%0D%0A%09%09%09S92.966%2C71.232%2C195.276%2C53.852c62.919-10.688%2C126.962%2C11.29%2C170.059%2C58.361l-75.605%2C25.19%0D%0A%09%09%09c-8.944%2C2.976-13.781%2C12.638-10.806%2C21.582c0.001%2C0.002%2C0.002%2C0.005%2C0.003%2C0.007c2.976%2C8.944%2C12.638%2C13.781%2C21.582%2C10.806%0D%0A%09%09%09c0.003-0.001%2C0.005-0.002%2C0.007-0.002l102.4-34.133c6.972-2.322%2C11.675-8.847%2C11.674-16.196v-102.4%0D%0A%09%09%09C414.59%2C7.641%2C406.949%2C0%2C397.523%2C0s-17.067%2C7.641-17.067%2C17.067v62.344C292.564-4.185%2C153.545-0.702%2C69.949%2C87.19%0D%0A%09%09%09s-80.114%2C226.911%2C7.779%2C310.508s226.911%2C80.114%2C310.508-7.779C435.905%2C339.799%2C457.179%2C270.152%2C445.651%2C201.95z%22%2F%3E%0D%0A%09%3C%2Fg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3C%2Fsvg%3E%0D%0A"
3125
- alt="loader">
3126
- <input type="hidden" class="woo-feed-clean-cache-nonce"
3127
  value="<?php echo wp_create_nonce( 'clean_cache_nonce' ); //phpcs:ignore
3128
- ?>">
3129
- <button type="button"><?php esc_html_e( 'Clear Cache', 'woo-feed' ); ?></button>
3130
- </div>
 
3131
  <?php
3132
  }
3133
  }
@@ -3144,14 +3212,13 @@ if ( ! function_exists( 'woo_feed_clear_cache_data' ) ) {
3144
  if ( isset( $_REQUEST['_ajax_clean_nonce'] ) ) {
3145
 
3146
  if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_ajax_clean_nonce'] ) ), 'clean_cache_nonce' ) ) {
3147
- $data = [];
3148
 
3149
  global $wpdb;
3150
  //TODO add wpdb prepare statement
3151
  $wpdb->query( "DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')" ); // phpcs:ignore
3152
 
3153
-
3154
- $data = [ 'success' => true ];
3155
 
3156
  wp_send_json_success( $data );
3157
  }
@@ -3265,7 +3332,6 @@ if ( ! function_exists( 'woo_feed_get_products_ids_of_reviews' ) ) {
3265
  $reviews = get_comments( $args );
3266
  $review_products_ids = wp_list_pluck( $reviews, 'comment_post_ID' );
3267
 
3268
-
3269
  return ! empty( $review_products_ids ) && is_array( $review_products_ids ) ? array_unique( $review_products_ids ) : array();
3270
 
3271
  }
@@ -3279,18 +3345,20 @@ if ( ! function_exists( 'woo_feed_get_approved_reviews_data' ) ) {
3279
  * @since 4.3.0
3280
  */
3281
  function woo_feed_get_approved_reviews_data() {
3282
- $approved_reviews = [];
3283
  $product_ids = woo_feed_get_products_ids_of_reviews();
3284
 
3285
  if ( ! empty( $product_ids ) && is_array( $product_ids ) ) {
3286
 
3287
  foreach ( $product_ids as $product_id ) {
3288
- $reviews = get_comments( array(
3289
- 'post_id' => $product_id,
3290
- 'comment_type' => 'review',
3291
- 'comment_approved' => 1,
3292
- 'parent' => 0,
3293
- ) );
 
 
3294
 
3295
  $product_name = get_the_title( $product_id );
3296
  $product_link = get_the_permalink( $product_id );
@@ -3327,7 +3395,7 @@ if ( ! function_exists( 'woo_feed_get_approved_reviews_data' ) ) {
3327
  }
3328
  }
3329
 
3330
- if ( ! function_exists( 'woo_feed_save_black_friday_notice_2021_notice' ) ) {
3331
  /**
3332
  * Update user meta to work ctx startup notice once.
3333
  *
@@ -3336,11 +3404,11 @@ if ( ! function_exists( 'woo_feed_save_black_friday_notice_2021_notice' ) ) {
3336
  * @since 4.3.31
3337
  * @author Nazrul Islam Nayan
3338
  */
3339
- function woo_feed_save_black_friday_notice_2021_notice() {
3340
  if ( isset( $_REQUEST['_wp_ajax_nonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wp_ajax_nonce'] ), 'woo-feed-to-ctx-feed-notice' ) ) { //phpcs:ignore
3341
  $user_id = get_current_user_id();
3342
  if ( isset( $_REQUEST['clicked'] ) ) {
3343
- $updated_user_meta = add_user_meta( $user_id, 'woo_feed_black_friday_notice_2021_dismissed', 'true', true );
3344
 
3345
  if ( $updated_user_meta ) {
3346
  wp_send_json_success( esc_html__( 'User meta updated successfully.', 'woo-feed' ) );
@@ -3354,7 +3422,7 @@ if ( ! function_exists( 'woo_feed_save_black_friday_notice_2021_notice' ) ) {
3354
  wp_die();
3355
  }
3356
  }
3357
- add_action( 'wp_ajax_woo_feed_save_black_friday_notice_2021_notice', 'woo_feed_save_black_friday_notice_2021_notice' );
3358
 
3359
 
3360
  if ( ! function_exists( 'woo_feed_save_halloween_notice' ) ) {
@@ -3535,7 +3603,7 @@ if ( ! function_exists( 'woo_feed_filter_woocommerce_structured_data_product' )
3535
  $overridden_structured_data = $settings['overridden_structured_data'];
3536
 
3537
 
3538
- if ( "on" === $overridden_structured_data ) {
3539
 
3540
  /**
3541
  * Removed woocommerce default schema structure
@@ -3557,14 +3625,14 @@ if ( ! function_exists( 'woo_feed_filter_woocommerce_structured_data_product' )
3557
  $disable_brand = $settings['disable_brand'];
3558
 
3559
  $description = apply_filters( 'woo_feed_schema_description', wp_strip_all_tags( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ), $product );
3560
- $markup["description"] = $description;
3561
 
3562
  if ( 'enable' === $disable_brand ) {
3563
  $brand_term = wp_get_post_terms( $product->get_id(), 'woo-feed-brand', array( 'fields' => 'names' ) );
3564
 
3565
  if ( ! is_wp_error( $brand_term ) ) {
3566
  if ( isset( $brand_term[0] ) ) {
3567
- $markup['brand']["name"] = $brand_term[0];
3568
  }
3569
  }
3570
  }
@@ -3574,9 +3642,9 @@ if ( ! function_exists( 'woo_feed_filter_woocommerce_structured_data_product' )
3574
  $currency = get_woocommerce_currency();
3575
 
3576
  //filter schema price & currency
3577
- $price = apply_filters( 'woo_feed_schema_product_price', $price, $markup, $product );
3578
- $currency = apply_filters( 'woo_feed_schema_product_currency', $currency, $markup, $product );
3579
- $markup['offers'][0]['price'] = $price;
3580
  $markup['offers'][0]['priceSpecification']['price'] = $price;
3581
  $markup['offers'][0]['priceSpecification']['priceCurrency'] = $currency;
3582
  $markup['offers'][0]['priceCurrency'] = $currency;
@@ -3587,7 +3655,7 @@ if ( ! function_exists( 'woo_feed_filter_woocommerce_structured_data_product' )
3587
  $markup['mpn'] = $mpn;
3588
  }
3589
 
3590
- $markup = apply_filters( "woo_feed_after_wc_product_structured_data", $markup, $product );
3591
 
3592
  return $markup;
3593
  }
@@ -3665,7 +3733,7 @@ if ( ! function_exists( 'woo_feed_filter_dropdown_attributes' ) ) {
3665
  if ( in_array( 'pinterest', $merchants ) ) {
3666
  if ( isset( $default_attr['ads_redirect'] ) ) {
3667
  if ( array_key_exists( 'ads_redirect', $default_attr ) ) {
3668
- $keys = array_keys( $default_attr );
3669
  $keys[ array_search( 'ads_redirect', $keys ) ] = 'ads_link';
3670
  $filtered_attributes = array_combine( $keys, $default_attr );
3671
  $filtered_attributes['ads_link'] = 'Ads Link[ads_link]';
@@ -3989,7 +4057,7 @@ if ( ! function_exists( 'woo_feed_get_feed_file_list' ) ) {
3989
  function woo_feed_get_feed_file_list() {
3990
  global $wpdb;
3991
  $feed_data = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name like %s", 'wf_feed_%' ), ARRAY_A ); // phpcs:ignore
3992
- $feed_urls = [];
3993
  if ( ! empty( $feed_data ) and is_array( $feed_data ) ) {
3994
  foreach ( $feed_data as $key => $data ) {
3995
  $feed_info = maybe_unserialize( get_option( $data['option_name'] ) );
@@ -4012,9 +4080,9 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_wp_rocket_cache' ) ) {
4012
  function woo_feed_exclude_feed_from_wp_rocket_cache( $files ) {
4013
  return array_merge(
4014
  $files,
4015
- [
4016
  '/wp-content/uploads/woo-feed/(.*)',
4017
- ]
4018
  );
4019
  }
4020
  }
@@ -4034,7 +4102,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_litespeed_cache' ) ) {
4034
  if ( $litespeed_ex_paths && is_array( $litespeed_ex_paths ) && ! in_array( '/wp-content/uploads/woo-feed', $litespeed_ex_paths ) ) {
4035
  $litespeed_ex_paths = array_merge(
4036
  $litespeed_ex_paths,
4037
- [ '/wp-content/uploads/woo-feed' ]
4038
  );
4039
  update_option( 'litespeed.conf.cdn-exc', $litespeed_ex_paths );
4040
  }
@@ -4068,27 +4136,27 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_wp_fastest_cache' ) ) {
4068
 
4069
  if ( ! $feed_path_exist ) {
4070
  $new_rule = new stdClass();
4071
- $new_rule->prefix = "contain";
4072
  $new_rule->content = 'woo-feed';
4073
- $new_rule->type = "page";
4074
 
4075
  $wp_fastest_cache_ex_paths = array_merge(
4076
  $wp_fastest_cache_ex_paths,
4077
- [ $new_rule ]
4078
  );
4079
 
4080
  update_option( 'WpFastestCacheExclude', wp_json_encode( $wp_fastest_cache_ex_paths ) );
4081
  }
4082
  } elseif ( empty( $wp_fastest_cache_ex_paths ) ) {
4083
- $wp_fastest_cache_ex_paths = [];
4084
  $new_rule = new stdClass();
4085
- $new_rule->prefix = "contain";
4086
  $new_rule->content = 'woo-feed';
4087
- $new_rule->type = "page";
4088
 
4089
  $wp_fastest_cache_ex_paths = array_merge(
4090
  $wp_fastest_cache_ex_paths,
4091
- [ $new_rule ]
4092
  );
4093
 
4094
  update_option( 'WpFastestCacheExclude', wp_json_encode( $wp_fastest_cache_ex_paths ) );
@@ -4113,7 +4181,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_wp_super_cache' ) ) {
4113
  $wp_super_ex_paths = get_option( 'ossdl_off_exclude' );
4114
  if ( $wp_super_ex_paths && strpos( $wp_super_ex_paths, 'woo-feed' ) === false ) {
4115
  $wp_super_ex_paths = explode( ',', $wp_super_ex_paths );
4116
- $wp_super_ex_paths = array_merge( $wp_super_ex_paths, [ 'woo-feed' ] );
4117
  update_option( 'ossdl_off_exclude', implode( ',', $wp_super_ex_paths ) );
4118
  }
4119
 
@@ -4135,7 +4203,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_breeze_cache' ) ) {
4135
 
4136
  $breeze_settings = maybe_unserialize( get_option( 'breeze_cdn_integration' ) );
4137
  if ( is_array( $breeze_settings ) ) {
4138
- $woo_feed_files = [ '.xml', '.csv', '.tsv', '.txt', '.xls' ];
4139
  $woo_feed_files = array_unique( array_merge( $woo_feed_files, $breeze_settings['cdn-exclude-content'] ) );
4140
  $breeze_settings['cdn-exclude-content'] = $woo_feed_files;
4141
  update_option( 'breeze_cdn_integration', $breeze_settings );
@@ -4160,7 +4228,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_wp_optimize_cache' ) ) {
4160
  $wp_optimize_ex_paths = maybe_unserialize( get_option( 'wpo_cache_config' ) );
4161
  if ( isset( $wp_optimize_ex_paths['enable_page_caching'] ) && $wp_optimize_ex_paths['enable_page_caching'] ) { // If page Caching enabled
4162
  if ( is_array( $wp_optimize_ex_paths ) && ! in_array( '/wp-content/uploads/woo-feed', $wp_optimize_ex_paths['cache_exception_urls'] ) ) {
4163
- $woo_feed_ex_path['cache_exception_urls'] = [ '/wp-content/uploads/woo-feed' ];
4164
  $wp_optimize_ex_paths = array_merge_recursive(
4165
  $wp_optimize_ex_paths,
4166
  $woo_feed_ex_path
@@ -4212,17 +4280,17 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_swift_performance_cache' ) )
4212
  if ( $swift_perform_ex_paths && isset( $swift_perform_ex_paths['exclude-strings'] ) ) {
4213
  $exclude_strings = $swift_perform_ex_paths['exclude-strings'];
4214
  if ( is_array( $exclude_strings ) && ! in_array( '/wp-content/uploads/woo-feed', $exclude_strings ) ) {
4215
- $woo_feed_ex_path['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4216
  $swift_perform_ex_paths = array_merge_recursive(
4217
  $swift_perform_ex_paths,
4218
  $woo_feed_ex_path
4219
  );
4220
  } else {
4221
- $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4222
  }
4223
  update_option( 'swift_performance_options', $swift_perform_ex_paths );
4224
  } elseif ( empty( $swift_perform_ex_paths ) ) {
4225
- $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4226
  update_option( 'swift_performance_options', $swift_perform_ex_paths );
4227
  }
4228
 
@@ -4242,7 +4310,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_speed_booster_cache' ) ) {
4242
  return false;
4243
  }
4244
 
4245
- $feed_files = [];
4246
  $speed_booster_settings = maybe_unserialize( get_option( 'sbp_options' ) );
4247
  if ( isset( $speed_booster_settings['caching_exclude_urls'] ) ) {
4248
  $feed_files = woo_feed_get_feed_file_list();
@@ -4284,7 +4352,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_comet_cache' ) ) {
4284
  if ( $comet_cache_settings && isset( $comet_cache_settings['exclude_uris'] ) ) {
4285
  $exclude_uris = $comet_cache_settings['exclude_uris'];
4286
  if ( strpos( $exclude_uris, '/wp-content/uploads/woo-feed' ) === false ) {
4287
- $exclude_uris .= "\n/wp-content/uploads/woo-feed";
4288
  $comet_cache_settings['exclude_uris'] = $exclude_uris;
4289
  update_option( 'comet_cache_options', $comet_cache_settings );
4290
  }
@@ -4310,7 +4378,7 @@ if ( ! function_exists( 'woo_feed_exclude_feed_from_hyper_cache' ) ) {
4310
  if ( $hyper_cache_settings && isset( $hyper_cache_settings['reject_uris'] ) ) {
4311
  $exclude_strings = $hyper_cache_settings['reject_uris'];
4312
  if ( is_array( $exclude_strings ) && ! in_array( '/wp-content/uploads/woo-feed', $exclude_strings ) ) {
4313
- $woo_feed_ex_path['reject_uris'] = [ '/wp-content/uploads/woo-feed' ];
4314
  $woo_feed_ex_path['reject_uris_enabled'] = 1;
4315
  $hyper_cache_settings = array_merge_recursive(
4316
  $hyper_cache_settings,
@@ -4394,7 +4462,6 @@ if ( ! function_exists( 'woo_feed_get_dynamic_discounted_product_price' ) ) {
4394
  $base_price = $price;
4395
  $discount_plugin_activate = false;
4396
 
4397
-
4398
  /**
4399
  * PLUGIN: Discount Rules for WooCommerce
4400
  * URL: https://wordpress.org/plugins/woo-discount-rules/
@@ -4447,12 +4514,12 @@ if ( ! function_exists( 'woo_feed_get_dynamic_discounted_product_price' ) ) {
4447
  *
4448
  * Don't apply discount manually.
4449
  */
4450
- // if (is_plugin_active('aco-woo-dynamic-pricing/start.php')) {
4451
- // $discount_plugin_activate = true;
4452
- // if (class_exists('AWDP_Discount')) {
4453
- // $price = AWDP_Discount::instance()->calculate_discount($product->get_price(), $product);
4454
- // }
4455
- // }
4456
 
4457
  /**
4458
  * PLUGIN: Conditional Discounts for WooCommerce
@@ -4460,29 +4527,29 @@ if ( ! function_exists( 'woo_feed_get_dynamic_discounted_product_price' ) ) {
4460
  *
4461
  * NOTE:* Automatically apply discount to $product->get_sale_price() method.
4462
  */
4463
- // if (is_plugin_active('woo-advanced-discounts/wad.php')) {
4464
- // $discount_plugin_activate = true;
4465
- // $discount_amount = 0;
4466
- // global $wad_discounts;
4467
- // if (isset($wad_discounts["product"])) {
4468
- // foreach ($wad_discounts["product"] as $discount_id => $discount_obj) {
4469
- // if ($discount_obj->is_applicable($product->get_id())) {
4470
- // $wad_obj = new WAD_Discount($discount_id);
4471
- // if (isset($wad_obj->settings)) {
4472
- // $settings = $wad_obj->settings;
4473
- // $discount_type = $wad_obj->settings['action'];
4474
- // if (false !== strpos($discount_type, 'fixed')) {
4475
- // $discount_amount = (float) $wad_obj->get_discount_amount($price);
4476
- // } elseif (false !== strpos($discount_type, 'percentage')) {
4477
- // $percentage = $settings['percentage-or-fixed-amount'];
4478
- // $discount_amount = ($product->get_price() * ($percentage / 100));
4479
- // }
4480
- // }
4481
- // }
4482
- // }
4483
- // $price = (float) $product->get_price() - (float) $discount_amount;
4484
- // }
4485
- // }
4486
 
4487
  /**
4488
  * PLUGIN: Pricing Deals for WooCommerce
@@ -4535,7 +4602,6 @@ if ( ! function_exists( 'woo_feed_get_dynamic_discounted_product_price' ) ) {
4535
  * No need to add the compatibility.
4536
  */
4537
 
4538
-
4539
  // Get Price with tax
4540
  if ( $discount_plugin_activate && $tax ) {
4541
  $price = woo_feed_get_price_with_tax( $price, $product );
@@ -4963,13 +5029,17 @@ if ( ! function_exists( 'woo_feed_modify_google_color_attribute_value' ) ) {
4963
  function woo_feed_modify_google_color_attribute_value( $attribute_value, $product, $feed_config, $merchant_attribute ) {
4964
  // Replace Google Color attribute value according to requirements
4965
  if ( ( 'g:color' === $merchant_attribute || 'color' === $merchant_attribute )
4966
- && in_array( $feed_config['provider'], [
4967
- 'google',
4968
- 'facebook',
4969
- 'pinterest',
4970
- 'bing',
4971
- 'snapchat',
4972
- ], true ) ) {
 
 
 
 
4973
  return str_replace( ', ', '/', $attribute_value );
4974
  }
4975
 
@@ -4989,13 +5059,16 @@ if ( ! function_exists( 'woo_feed_modify_weight_attribute_value' ) ) {
4989
  */
4990
  function woo_feed_modify_weight_attribute_value( $attribute_value, $product, $feed_config ) {
4991
  if ( isset( $feed_config['attributes'] )
4992
- && in_array( $feed_config['provider'], [
4993
- 'google',
4994
- 'facebook',
4995
- 'pinterest',
4996
- 'bing',
4997
- 'snapchat',
4998
- ] ) ) {
 
 
 
4999
  $attributes = $feed_config['attributes'];
5000
  $key = array_search( 'weight', $attributes, true );
5001
  if ( isset( $feed_config['suffix'] ) && ! empty( $key ) && array_key_exists( $key, $feed_config['suffix'] ) ) {
@@ -5041,10 +5114,10 @@ if ( ! function_exists( 'woo_feed_availability_attribute_value_modify' ) ) {
5041
  function woo_feed_availability_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5042
  if ( 'bestprice' === $feed_config['provider'] ) {
5043
  if ( 'in stock' === $attribute_value ) {
5044
- return "Y";
5045
  }
5046
 
5047
- return "N";
5048
  }
5049
 
5050
  if ( 'skroutz' === $feed_config['provider'] ) {
@@ -5060,10 +5133,10 @@ if ( ! function_exists( 'woo_feed_availability_attribute_value_modify' ) ) {
5060
 
5061
  if ( 'pricerunner' === $feed_config['provider'] ) {
5062
  if ( 'in stock' === $attribute_value ) {
5063
- return "Yes";
5064
  }
5065
 
5066
- return "No";
5067
  }
5068
 
5069
  if ( 'google' === $feed_config['provider'] || 'pinterest' === $feed_config['provider'] ) {
@@ -5072,10 +5145,10 @@ if ( ! function_exists( 'woo_feed_availability_attribute_value_modify' ) ) {
5072
  }
5073
 
5074
  if ( 'google' === $feed_config['provider'] ) {
5075
- if ( ! in_array( $attribute_value, [ 'in_stock', 'out_of_stock', 'on_backorder' ] ) ) {
5076
  return 'in_stock';
5077
  }
5078
- } elseif ( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5079
  return 'in stock';
5080
  }
5081
  }
@@ -5083,7 +5156,7 @@ if ( ! function_exists( 'woo_feed_availability_attribute_value_modify' ) ) {
5083
  if ( 'facebook' === $feed_config['provider'] ) {
5084
  if ( 'on backorder' === $attribute_value ) {
5085
  return 'available for order';
5086
- } elseif ( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5087
  return 'in stock';
5088
  }
5089
  }
@@ -5105,10 +5178,10 @@ if ( ! function_exists( 'woo_feed_spartoo_attribute_value_modify' ) ) {
5105
  function woo_feed_spartoo_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5106
  if ( 'spartoo.fi' === $feed_config['provider'] ) {
5107
  if ( 'variation' === $attribute_value ) {
5108
- return "child";
5109
  }
5110
 
5111
- return "parent";
5112
  }
5113
 
5114
  return $attribute_value;
@@ -5199,7 +5272,7 @@ if ( ! function_exists( 'woo_feed_is_google_group_merchant' ) ) {
5199
  * @author Nazrul Islam Nayan
5200
  */
5201
  function woo_feed_is_google_group_merchant( $provider ) {
5202
- return in_array( $provider, [ 'google', 'facebook', 'pinterest', 'bing' ] );
5203
  }
5204
  }
5205
 
@@ -5243,14 +5316,18 @@ if ( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5243
  return '';
5244
  }
5245
 
5246
- if ( isset( $config['provider'] ) && in_array( $config['provider'], [
 
 
5247
  'google',
5248
  'facebook',
5249
  'pinterest',
5250
- 'bing'
5251
- ] ) ) {
 
5252
  if ( strlen( $title ) > 150 ) {
5253
- $title = substr( $title, 0, $I );
 
5254
  }
5255
  }
5256
 
@@ -5287,9 +5364,9 @@ if ( ! function_exists( 'woo_feed_get_js_dequeue_handles_list' ) ) {
5287
  * @since 4.4.43
5288
  */
5289
  function woo_feed_get_js_dequeue_handles_list() {
5290
- $js_files_handles = [ 'common_aramex', 'jquery_chained', 'validate_aramex' ]; //aramex shipping plugin handles
5291
 
5292
- return apply_filters( "woo_feed_filter_js_dequeue_handles", $js_files_handles );
5293
  }
5294
  }
5295
 
@@ -5302,7 +5379,7 @@ if ( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5302
  * @since 4.4.44
5303
  */
5304
  function woo_feed_get_plugin_pages_slugs() {
5305
- $woo_feed_plugin_pages = [
5306
  'webappick-manage-feeds',
5307
  'webappick-new-feed',
5308
  'webappick-wp-options',
@@ -5312,7 +5389,7 @@ if ( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5312
  'webappick-wp-status',
5313
  'webappick-feed-category-mapping',
5314
  'webappick-wp-options',
5315
- ];
5316
 
5317
  return apply_filters( 'woo_feed_plugin_pages_slugs', $woo_feed_plugin_pages );
5318
  }
@@ -5322,7 +5399,7 @@ if ( ! function_exists( 'woo_feed_make_feed_big_data' ) ) {
5322
  function woo_feed_make_feed_big_data( $data, $ids, $config ) {
5323
 
5324
  //setup feed shipping data @TODO: need to make a class when another data setup will be added
5325
- if ( isset( $config['attributes'] ) && in_array( "shipping", $config["attributes"] ) ) {
5326
  if ( class_exists( 'WC_Shipping_Zones' ) ) {
5327
  $data['shipping_zones'] = WC_Shipping_Zones::get_zones();
5328
  }
@@ -5355,14 +5432,14 @@ if ( ! function_exists( 'woo_feed_after_wc_product_structured_data' ) ) {
5355
  $attribute_names = array_keys( $attributes );
5356
 
5357
  if ( isset( $attribute_names ) && is_array( $attribute_names ) ) {
5358
- $meta_query_items = [];
5359
  $meta_query_items['relation'] = 'AND';
5360
 
5361
  foreach ( $attribute_names as $attr_name ) {
5362
  $attribute_name = 'attribute_' . $attr_name;
5363
 
5364
  if ( isset( $params[ $attribute_name ] ) ) {
5365
- $new_query_item = [];
5366
  $new_query_item['key'] = $attribute_name;
5367
  $new_query_item['value'] = $params[ $attribute_name ];
5368
  $new_query_item['compare'] = 'LIKE';
@@ -5388,18 +5465,15 @@ if ( ! function_exists( 'woo_feed_after_wc_product_structured_data' ) ) {
5388
  if ( $variation_product instanceof WC_Product_Variation ) {
5389
  $variation_price = $variation_product->get_price();
5390
 
5391
- $markup['offers'][0]['@type'] = "Offer";
5392
  $markup['offers'][0]['price'] = $variation_price;
5393
  $markup['offers'][0]['priceSpecification']['price'] = $variation_price;
5394
  $markup['offers'][0]['priceSpecification']['priceCurrency'] = $currency;
5395
  $markup['offers'][0]['priceCurrency'] = $currency;
5396
  }
5397
-
5398
  }
5399
-
5400
  }
5401
  }
5402
-
5403
  }
5404
 
5405
  return $markup;
@@ -5447,9 +5521,9 @@ if ( ! function_exists( 'woo_feed_filter_shipping_info_callback' ) ) {
5447
  $exist_shipping_keys = array_keys( $cart_shippings );
5448
 
5449
  if ( isset( $cart_shippings ) && is_array( $cart_shippings ) ) {
5450
- $adv_shipping = [];
5451
  foreach ( $cart_shippings as $key => $cart_shipping ) {
5452
- $new_adv_shipping = [];
5453
 
5454
  if ( in_array( $key, $ids ) ) {
5455
  $new_adv_shipping['country'] = $config['feed_country'];
@@ -5472,23 +5546,18 @@ if ( ! function_exists( 'woo_feed_filter_shipping_info_callback' ) ) {
5472
 
5473
  array_push( $adv_shipping, $new_adv_shipping );
5474
  }
5475
-
5476
  }
5477
  }
5478
-
5479
  }
5480
 
5481
  // Make sure to empty the cart again
5482
  $woocommerce->cart->empty_cart();
5483
 
5484
-
5485
  if ( ! empty( $adv_shipping ) ) {
5486
  $shipping_info = array_merge( $shipping_info, $adv_shipping );
5487
  }
5488
-
5489
  }
5490
 
5491
-
5492
  return $shipping_info;
5493
 
5494
  }
@@ -5505,7 +5574,7 @@ if ( ! function_exists( 'woo_feed_get_acf_field_list' ) ) {
5505
  * @return Array
5506
  */
5507
  function woo_feed_get_acf_field_list() {
5508
- $options = [];
5509
  if ( class_exists( 'ACF' ) ) {
5510
  $acf_fields = woo_feed_get_cached_data( 'acf_field_list' );
5511
  if ( false === $acf_fields ) {
@@ -5513,16 +5582,18 @@ if ( ! function_exists( 'woo_feed_get_acf_field_list' ) ) {
5513
  foreach ( $field_groups as $group ) {
5514
  // DO NOT USE here: $fields = acf_get_fields($group['key']);
5515
  // because it causes repeater field bugs and returns "trashed" fields
5516
- $fields = get_posts( array(
5517
- 'posts_per_page' => - 1,
5518
- 'post_type' => 'acf-field',
5519
- 'orderby' => 'menu_order',
5520
- 'order' => 'ASC',
5521
- 'suppress_filters' => true, // DO NOT allow WPML to modify the query
5522
- 'post_parent' => $group['ID'],
5523
- 'post_status' => 'any',
5524
- 'update_post_meta_cache' => false,
5525
- ) );
 
 
5526
  foreach ( $fields as $field ) {
5527
  $options[ 'acf_fields_' . $field->post_name ] = $field->post_title;
5528
  }
116
  */
117
  function wooFeed_Deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
118
  if ( ! function_exists( 'deactivate_plugins' ) ) {
119
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
120
  }
121
  deactivate_plugins( $plugins, $silent, $network_wide );
122
  }
244
  */
245
  function woo_feed_black_friday_notice() {
246
  $user_id = get_current_user_id();
247
+ if ( ! get_user_meta( $user_id, 'woo_feed_black_friday_notice_2022_dismissed' ) ) {
248
  ob_start();
249
  ?>
250
+ <script type="text/javascript">
251
+ (function ($) {
252
+ $(document).on('click', '.woo-feed-ctx-startup-notice button.notice-dismiss', function (e) {
253
+ e.preventDefault();
254
+ let nonce = $('#woo_feed_to_ctx_feed_nonce').val();
255
+
256
+ //woo feed black friday notice cancel callback
257
+ wp.ajax.post('woo_feed_save_black_friday_notice_2022_notice', {
258
+ _wp_ajax_nonce: nonce,
259
+ clicked: true,
260
+ }).then(response => {
261
+ console.log(response);
262
+ }).fail(error => {
263
+ console.log(error);
264
+ });
265
+ });
266
+ })(jQuery)
267
+ </script>
268
+ <a target="_blank" href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=plugin&utm_medium=banner&utm_campaign=bfcm-banner-22"
269
+ class="notice woo-feed-ctx-startup-notice is-dismissible"
270
+ style="background: url(<?php echo WOO_FEED_PLUGIN_URL . 'admin/images/ctx-feed-black-friday-banner-2022.png'; ?>) no-repeat top center;">
271
+ <input type="hidden" id="woo_feed_to_ctx_feed_nonce"
272
+ value="<?php echo wp_create_nonce( 'woo-feed-to-ctx-feed-notice' ); ?>">
273
+ </a>
274
  <?php
275
  $image = ob_get_contents();
276
  }
291
  if ( ! get_user_meta( $user_id, 'woo_feed_halloween_notice_dismissed' ) ) {
292
  ob_start();
293
  ?>
294
+ <script type="text/javascript">
295
+ (function ($) {
296
+ $(document).on('click', '.woo-feed-ctx-halloween-notice button.notice-dismiss', function (e) {
297
+ e.preventDefault();
298
+ let nonce = $('#woo_feed_to_ctx_feed_halloween_nonce').val();
299
+
300
+ //woo feed halloween cancel callback
301
+ wp.ajax.post('woo_feed_save_halloween_notice', {
302
+ _wp_ajax_nonce: nonce,
303
+ clicked: true,
304
+ }).then(response => {
305
+ console.log(response);
306
+ }).fail(error => {
307
+ console.log(error);
308
+ });
309
+ });
310
+ })(jQuery)
311
+ </script>
312
+ <a target="_blank" href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=hw&utm_medium=ctx-plugin-banner&utm_campaign=hw-cm-22"
313
+ class="notice woo-feed-ctx-halloween-notice is-dismissible"
314
+ style="background: url(<?php echo WOO_FEED_PLUGIN_URL . 'admin/images/woo_feed_halloween_notice.png'; ?>) no-repeat top center;">
315
+ <input type="hidden" id="woo_feed_to_ctx_feed_halloween_nonce"
316
+ value="<?php echo wp_create_nonce( 'woo-feed-to-ctx-feed-halloween-nonce' ); ?>">
317
+ </a>
318
  <?php
319
  $image = ob_get_contents();
320
  }
332
  $progress_bar = '';
333
  ob_start();
334
  ?>
335
+ <div id="feed_progress_table" style="display: none;">
336
+ <table class="table widefat fixed">
337
+ <thead>
338
+ <tr>
339
+ <th><b><?php esc_html_e( 'Generating Product Feed', 'woo-feed' ); ?></b></th>
340
+ </tr>
341
+ </thead>
342
+ <tbody>
343
+ <tr>
344
+ <td>
345
+ <div class="feed-progress-container">
346
+ <div class="feed-progress-bar">
347
+ <span class="feed-progress-bar-fill"></span>
348
+ </div>
349
+ </div>
350
+ </td>
351
+ </tr>
352
+ <tr>
353
+ <td>
354
+ <div style="float: left;"><b style='color: darkblue;'><i
355
+ class='dashicons dashicons-sos wpf_spin'></i></b>&nbsp;&nbsp;&nbsp;
356
+ </div>
357
+ <div class="feed-progress-status"></div>
358
+ <div class="feed-progress-percentage"></div>
359
+ </td>
360
+ </tr>
361
+ </tbody>
362
+ </table>
363
+ <br>
364
+ </div>
365
  <?php
366
  $progress_bar .= ob_get_clean();
367
 
428
  */
429
  function woo_feed_get_query_type_options( $type = '' ) {
430
  if ( 'variation' === $type ) {
431
+ return array(
432
  'individual' => __( 'Individual', 'woo-feed' ),
433
  'variable' => __( 'Variable Dependable', 'woo-feed' ),
434
+ );
435
  } else {
436
+ return array(
437
  'wc' => __( 'WC_Product_Query', 'woo-feed' ),
438
  'wp' => __( 'WP_Query', 'woo-feed' ),
439
  'both' => __( 'Both', 'woo-feed' ),
440
+ );
441
  }
442
  }
443
  }
449
  function woo_feed_get_cache_ttl_options() {
450
  return apply_filters(
451
  'woo_feed_cache_ttl_options',
452
+ array(
453
  0 => esc_html__( 'No Expiration ', 'woo-feed' ),
454
  MONTH_IN_SECONDS => esc_html__( '1 Month', 'woo-feed' ),
455
  WEEK_IN_SECONDS => esc_html__( '1 Week', 'woo-feed' ),
457
  12 * HOUR_IN_SECONDS => esc_html__( '12 Hours', 'woo-feed' ),
458
  6 * HOUR_IN_SECONDS => esc_html__( '6 Hours', 'woo-feed' ),
459
  HOUR_IN_SECONDS => esc_html__( '1 Hours', 'woo-feed' ),
460
+ )
461
  );
462
  }
463
  }
477
  * @return string
478
  */
479
  function woo_feed_get_merchant_class( $provider ) {
480
+ if ( in_array(
481
+ $provider,
482
+ array(
483
+ 'google',
484
+ 'google_shopping_action',
485
+ 'google_local',
486
+ 'google_local_inventory',
487
+ 'adroll',
488
+ 'smartly.io',
489
+ ),
490
+ true
491
+ ) ) {
492
  return 'Woo_Feed_Google';
493
  } elseif ( in_array( $provider, array( 'pinterest', 'pinterest_rss' ) ) ) {
494
  return 'Woo_Feed_Pinterest';
597
  if ( false !== $url ) {
598
  $url = wp_parse_url( $url );
599
  if ( array_key_exists( 'host', $url ) ) {
600
+ if ( strpos( $url['host'], '.' ) !== false ) {
601
  $arr = explode( '.', $url['host'] );
602
  $brand = $arr[ count( $arr ) - 2 ];
603
  $brand = ucfirst( $brand );
621
  * @return array|bool
622
  */
623
  function woo_feed_merchant_require_google_category( $merchant = null, $attribute = null ) {
624
+ $list = array(
625
+ 'current_category' => array(
626
  'google',
627
  'google_shopping_action',
628
  'google_local',
634
  'smartly.io',
635
  'pinterest',
636
  'rakuten.de',
637
+ ),
638
+ 'fb_product_category' => array( 'facebook' ),
639
+ 'google_product_category' => array( 'rakuten.de', 'tiktok', 'snapchat' ),
640
+ 'google_category_id' => array(
641
  'daisycon',
642
  'daisycon_automotive',
643
  'daisycon_books',
658
  'daisycon_holidays_accommodations',
659
  'daisycon_holidays_accommodations_and_transport',
660
  'daisycon_holidays_trips',
661
+ 'daisycon_work_jobs',
662
+ ),
663
+ );
664
  if ( null !== $merchant && null !== $attribute ) {
665
  return ( isset( $list[ $attribute ] ) && in_array( $merchant, $list[ $attribute ], true ) );
666
  }
672
  function woo_feed_get_item_wrapper_hidden_merchant() {
673
  return apply_filters(
674
  'woo_feed_item_wrapper_hidden_merchant',
675
+ array(
676
  'google',
677
  'google_shopping_action',
678
  'facebook',
713
  'daisycon_holidays_accommodations_and_transport',
714
  'daisycon_holidays_trips',
715
  'daisycon_work_jobs',
716
+ )
717
  );
718
  }
719
  }
733
  * @uses wp_parse_args
734
  *
735
  */
736
+ function woo_feed_parse_feed_rules( $rules = array(), $context = 'view' ) {
737
 
738
  if ( empty( $rules ) ) {
739
+ $rules = array();
740
  }
741
+ $defaults = array(
742
  'provider' => '',
743
  'filename' => '',
744
  'feedType' => '',
761
  'delimiter' => ',',
762
  'enclosure' => 'double',
763
  'extraHeader' => '',
764
+ 'vendors' => array(),
765
  // Feed Config
766
+ 'mattributes' => array(), // merchant attributes
767
+ 'prefix' => array(), // prefixes
768
+ 'type' => array(), // value (attribute) types
769
+ 'attributes' => array(), // product attribute mappings
770
+ 'default' => array(), // default values (patterns) if value type set to pattern
771
+ 'suffix' => array(), // suffixes
772
+ 'output_type' => array(), // output type (output filter)
773
+ 'limit' => array(), // limit or command
774
  // filters tab
775
  'composite_price' => '',
776
  'shipping_country' => '',
777
  'tax_country' => '',
778
  'product_ids' => '',
779
+ 'categories' => array(),
780
+ 'post_status' => array( 'publish' ),
781
+ 'filter_mode' => array(),
782
+ 'campaign_parameters' => array(),
783
+
784
+ 'ptitle_show' => '',
785
+ 'decimal_separator' => wc_get_price_decimal_separator(),
786
+ 'thousand_separator' => wc_get_price_thousand_separator(),
787
+ 'decimals' => wc_get_price_decimals(),
788
+ );
789
  $rules = wp_parse_args( $rules, $defaults );
790
+ $rules['filter_mode'] = wp_parse_args(
791
+ $rules['filter_mode'],
792
+ array(
793
  'product_ids' => 'include',
794
  'categories' => 'include',
795
  'post_status' => 'include',
796
+ )
797
+ );
798
 
799
  $rules['campaign_parameters'] = wp_parse_args(
800
  $rules['campaign_parameters'],
801
+ array(
802
  'utm_source' => '',
803
  'utm_medium' => '',
804
  'utm_campaign' => '',
805
  'utm_term' => '',
806
  'utm_content' => '',
807
+ )
808
  );
809
 
810
  if ( ! empty( $rules['provider'] ) && is_string( $rules['provider'] ) ) {
872
  if ( ! function_exists( 'woo_feed_ajax_merchant_info' ) ) {
873
  add_action( 'wp_ajax_woo_feed_get_merchant_info', 'woo_feed_ajax_merchant_info' );
874
  function woo_feed_ajax_merchant_info() {
875
+ if ( isset( $_REQUEST['nonce'] ) && wp_verify_nonce(
876
+ sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ),
877
+ 'wpf_feed_nonce'
878
+ ) ) {
879
  $provider = ( isset( $_REQUEST['provider'] ) && ! empty( $_REQUEST['provider'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['provider'] ) ) : '';
880
  $merchantInfo = new Woo_Feed_Merchant( $provider );
881
+ $data = array();
882
  $na = esc_html__( 'N/A', 'woo-feed' );
883
  foreach ( $merchantInfo->get_info() as $k => $v ) {
884
  if ( 'link' === $k ) {
885
  /** @noinspection HtmlUnknownTarget */
886
+ $data[ $k ] = empty( $v ) ? $na : sprintf(
887
+ '<a href="%s" target="_blank">%s</a>',
888
  esc_url( $v ),
889
+ esc_html__( 'Read Article', 'woo-feed' )
890
+ );
891
  } elseif ( 'video' === $k ) {
892
  /** @noinspection HtmlUnknownTarget */
893
+ $data[ $k ] = empty( $v ) ? $na : sprintf(
894
+ '<a href="%s" target="_blank">%s</a>',
895
  esc_url( $v ),
896
+ esc_html__( 'Watch Now', 'woo-feed' )
897
+ );
898
  } elseif ( 'feed_file_type' === $k ) {
899
  if ( ! empty( $v ) ) {
900
+ $v = array_map(
901
+ function ( $type ) {
902
+ return strtoupper( $type );
903
+ },
904
+ (array) $v
905
+ );
906
  $data[ $k ] = esc_html( implode( ', ', $v ) );
907
  } else {
908
  $data[ $k ] = $na;
911
  $links = '';
912
  foreach ( $v as $label => $link ) {
913
  /** @noinspection HtmlUnknownTarget */
914
+ $links .= sprintf(
915
+ '<li><a href="%s" target="_blank">%s</a></li>',
916
  esc_url( $link ),
917
+ esc_html( $label )
918
+ );
919
  }
920
  $data[ $k ] = empty( $links ) ? $na : $links;
921
  }
945
  $feed_options = maybe_unserialize( get_option( 'wf_feed_' . $filename ) );
946
  }
947
  ?>
948
+ <span class="spinner"></span>
949
+ <div class="merchant-infos">
950
  <?php foreach ( $merchantInfo->get_info() as $k => $v ) { ?>
951
+ <div class="merchant-info-section <?php echo esc_attr( $k ); ?>">
952
  <?php if ( 'link' === $k ) { ?>
953
+ <span class="dashicons dashicons-media-document" style="color: #82878c;"
954
+ aria-hidden="true"></span>
955
+ <span><?php esc_html_e( 'Feed Specification:', 'woo-feed' ); ?></span>
956
+ <strong class="data">
957
  <?php
958
  /** @noinspection HtmlUnknownTarget */
959
+ ( empty( $v ) ) ? esc_html_e(
960
+ 'N/A',
961
+ 'woo-feed'
962
+ ) : printf(
963
+ '<a href="%s" target="_blank">%s</a>',
964
  esc_url( $v ),
965
+ esc_html__( 'Read Article', 'woo-feed' )
966
+ );
967
  ?>
968
+ </strong>
969
  <?php } elseif ( 'video' === $k ) { ?>
970
+ <span class="dashicons dashicons-video-alt3" style="color: #82878c;" aria-hidden="true"></span>
971
+ <span><?php esc_html_e( 'Video Documentation:', 'woo-feed' ); ?></span>
972
+ <strong class="data">
973
  <?php
974
  /** @noinspection HtmlUnknownTarget */
975
+ ( empty( $v ) ) ? esc_html_e(
976
+ 'N/A',
977
+ 'woo-feed'
978
+ ) : printf(
979
+ '<a href="%s" target="_blank">%s</a>',
980
  esc_url( $v ),
981
+ esc_html__( 'Watch now', 'woo-feed' )
982
+ );
983
  ?>
984
+ </strong>
985
  <?php } elseif ( 'feed_file_type' === $k ) { ?>
986
+ <span class="dashicons dashicons-media-text" style="color: #82878c;"
987
+ aria-hidden="true"></span> <?php esc_html_e( 'Supported File Types:', 'woo-feed' ); ?>
988
+ <strong class="data" style="display: block;padding-left: 24px;margin-top: 5px;">
989
  <?php
990
  if ( empty( $v ) ) {
991
  esc_html_e( 'N/A', 'woo-feed' );
992
  } else {
993
+ $v = implode(
994
+ ', ',
995
+ array_map(
996
+ function ( $type ) {
997
+ return esc_html( strtoupper( $type ) );
998
+ },
999
+ (array) $v
1000
+ )
1001
+ );
1002
  echo esc_html( $v );
1003
  }
1004
  ?>
1005
+ </strong>
1006
  <?php
1007
  } elseif ( 'doc' === $k ) {
1008
  ?>
1009
+ <span class="dashicons dashicons-editor-help" style="color: #82878c;" aria-hidden="true"></span>
1010
+ <span><?php esc_html_e( 'Support Docs:', 'woo-feed' ); ?></span>
1011
+ <ul class="data">
1012
  <?php
1013
  if ( empty( $v ) ) {
1014
  esc_html_e( 'N/A', 'woo-feed' );
1015
  } else {
1016
  foreach ( $v as $label => $link ) {
1017
  /** @noinspection HtmlUnknownTarget */
1018
+ printf(
1019
+ '<li><a href="%s" target="_blank">%s</a></li>',
1020
  esc_url( $link ),
1021
+ esc_html( $label )
1022
+ );
1023
  }
1024
  }
1025
  ?>
1026
+ </ul>
1027
  <?php
1028
  }
1029
  ?>
1030
+ </div>
1031
  <?php } ?>
1032
+ <div class="merchant-info-section woo-feed-open-file">
1033
  <?php
1034
  if ( isset( $feed_options['url'] ) && ! empty( $feed_options['url'] ) ) {
1035
  echo sprintf(
1040
  );
1041
  }
1042
  ?>
1043
+ </div>
1044
+ </div>
1045
  <?php
1046
  }
1047
  }
1051
  * @return array
1052
  */
1053
  function woo_feed_get_csv_delimiters() {
1054
+ return array(
1055
  ',' => 'Comma',
1056
  ':' => 'Colon',
1057
  ' ' => 'Space',
1058
  '|' => 'Pipe',
1059
  ';' => 'Semi Colon',
1060
  "\t" => 'TAB',
1061
+ );
1062
  }
1063
  }
1064
  if ( ! function_exists( 'woo_feed_get_csv_enclosure' ) ) {
1067
  * @return array
1068
  */
1069
  function woo_feed_get_csv_enclosure() {
1070
+ return array(
1071
  'double' => '"',
1072
  'single' => '\'',
1073
  ' ' => 'None',
1074
+ );
1075
  }
1076
  }
1077
 
1122
  $list = woo_feed_merchant_require_google_category();
1123
  $cat_keys = array_keys( $list );
1124
  $merchants = call_user_func_array( 'array_merge', array_values( $list ) );
1125
+ $checkCategory = isset( $feedInfo['feedrules']['mattributes'] ) ? $feedInfo['feedrules']['mattributes'] : array();
1126
+ $checkCategoryType = isset( $feedInfo['feedrules']['type'] ) ? $feedInfo['feedrules']['type'] : array();
1127
+ $merchant = isset( $feedInfo['feedrules']['provider'] ) ? $feedInfo['feedrules']['provider'] : array();
1128
  $cat = 'yes';
1129
  foreach ( $list as $attribute => $merchants ) {
1130
  if ( in_array( $merchant, $merchants, true ) && in_array( $attribute, $checkCategory, true ) ) {
1316
  return false;
1317
  }
1318
  // unnecessary form fields to remove
1319
+ $removables = array( 'closedpostboxesnonce', '_wpnonce', '_wp_http_referer', 'save_feed_config', 'edit-feed' );
1320
  foreach ( $removables as $removable ) {
1321
  if ( isset( $data[ $removable ] ) ) {
1322
  unset( $data[ $removable ] );
1330
  $feed_option_name = generate_unique_feed_file_name(
1331
  $data['filename'],
1332
  $data['feedType'],
1333
+ $data['provider']
1334
+ );
1335
  } else {
1336
  $feed_option_name = woo_feed_extract_feed_option_name( $feed_option_name );
1337
  }
1423
  * @return string
1424
  */
1425
  function woo_feed_extract_feed_option_name( $feed_option_name ) {
1426
+ return str_replace( array( 'wf_feed_', 'wf_config' ), '', $feed_option_name );
1427
  }
1428
  }
1429
  if ( ! function_exists( 'woo_feed_get_file_path' ) ) {
1472
  $fileName = woo_feed_extract_feed_option_name( $fileName );
1473
  $upload_dir = wp_get_upload_dir();
1474
 
1475
+ return esc_url(
1476
+ sprintf(
1477
+ '%s/woo-feed/%s/%s/%s.%s',
1478
+ $upload_dir['baseurl'],
1479
+ $provider,
1480
+ $type,
1481
+ $fileName,
1482
+ $type
1483
+ )
1484
+ );
1485
  }
1486
  }
1487
  if ( ! function_exists( 'woo_feed_check_feed_file' ) ) {
1497
  function woo_feed_check_feed_file( $fileName, $provider, $type ) {
1498
  $upload_dir = wp_get_upload_dir();
1499
 
1500
+ return file_exists(
1501
+ sprintf(
1502
+ '%s/woo-feed/%s/%s/%s.%s',
1503
+ $upload_dir['basedir'],
1504
+ $provider,
1505
+ $type,
1506
+ $fileName,
1507
+ $type
1508
+ )
1509
+ );
1510
  }
1511
  }
1512
  if ( ! function_exists( 'woo_feed_get_file_dir' ) ) {
1605
  if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
1606
  $ext = 'json';
1607
  }
1608
+ $files = array(
1609
  'headerFile' => $path . '/' . 'wf_store_feed_header_info_' . $fileName . '.' . $ext,
1610
  'bodyFile' => $path . '/' . 'wf_store_feed_body_info_' . $fileName . '.' . $ext,
1611
  'footerFile' => $path . '/' . 'wf_store_feed_footer_info_' . $fileName . '.' . $ext,
1612
+ );
1613
 
1614
  woo_feed_log_feed_process( $config['filename'], sprintf( 'Deleting Temporary Files (%s).', implode( ', ', array_values( $files ) ) ) );
1615
  foreach ( $files as $key => $file ) {
1661
 
1662
  // Delete cron schedule.
1663
  $feed_cron_param = 'wf_config' . $feed_name;
1664
+ wp_clear_scheduled_hook( 'woo_feed_update_single_feed', array( $feed_cron_param ) );
1665
 
1666
  return $deleted;
1667
  }
1758
  if ( ! function_exists( 'woo_feed_strip_all_tags' ) ) {
1759
 
1760
  /*
1761
+ * Extends wp_strip_all_tags to fix WP_Error object passing issue
1762
+ *
1763
+ * @param string | WP_Error $string
1764
+ *
1765
+ * @return string
1766
+ * @since 4.4.19
1767
+ * */
1768
  function woo_feed_strip_all_tags( $string ) {
1769
 
1770
  if ( $string instanceof WP_Error ) {
1869
  function woo_feed_get_schedule_interval_options() {
1870
  return apply_filters(
1871
  'woo_feed_schedule_interval_options',
1872
+ array(
1873
  WEEK_IN_SECONDS => esc_html__( '1 Week', 'woo-feed' ),
1874
  DAY_IN_SECONDS => esc_html__( '24 Hours', 'woo-feed' ),
1875
  12 * HOUR_IN_SECONDS => esc_html__( '12 Hours', 'woo-feed' ),
1876
  6 * HOUR_IN_SECONDS => esc_html__( '6 Hours', 'woo-feed' ),
1877
  HOUR_IN_SECONDS => esc_html__( '1 Hours', 'woo-feed' ),
1878
+ )
1879
  );
1880
  }
1881
  }
1925
  */
1926
  function woo_feed_get_formatted_url( $url = '' ) {
1927
  if ( ! empty( $url ) ) {
1928
+ if ( substr( trim( $url ), 0, 4 ) === 'http' || substr(
1929
+ trim( $url ),
1930
+ 0,
1931
+ 3
1932
+ ) === 'ftp' || substr( trim( $url ), 0, 4 ) === 'sftp' ) {
1933
  return rtrim( $url, '/' );
1934
  } else {
1935
  $base = get_site_url();
2037
  }
2038
  } elseif ( ! empty( $str ) ) {
2039
  list( $name, $value ) = explode( '=', $str, 2 );
2040
+ $arr[ $name ] = $value;
2041
  }
2042
 
2043
  // return result array
2058
  $attributeClass = new Woo_Feed_Default_Attributes();
2059
  $merchantAttributes = '';
2060
  if ( 'google' === $merchant
2061
+ || 'google_shopping_action' === $merchant
2062
+ || 'google_local' === $merchant
2063
+ || 'google_local_inventory' === $merchant
2064
+ || 'adroll' == $merchant
2065
+ || 'smartly.io' == $merchant ) {
2066
  if ( 'xml' === $feedType ) {
2067
  $g_attributes = $attributeClass->googleXMLAttribute;
2068
  if ( 'google_local' === $merchant ) {
2109
  * @return string
2110
  */
2111
  function woo_feed_add_cdata( $pluginAttribute, $attributeValue, $merchant, $feed_type ) {
2112
+ if ( 'xml' !== $feed_type ) {
2113
  return "$attributeValue";
2114
  }
2115
 
2117
  return "$attributeValue";
2118
  }
2119
 
2120
+ if ( 'shipping' === $pluginAttribute || 'tax' === $pluginAttribute ) {
2121
  return "$attributeValue";
2122
  }
2123
 
2150
  }
2151
  } else {
2152
  return "<![CDATA[ $attributeValue ]]>";
2153
+ // return "$attributeValue";
2154
  }
2155
  } else {
2156
  return "$attributeValue";
2174
  * @since 3.3.11
2175
  */
2176
  function woo_feed_get_options( $key, $default = false ) {
2177
+ $defaults = array(
2178
  'per_batch' => 200,
2179
  'product_query_type' => 'wc',
2180
  'variation_query_type' => 'individual',
2214
  'custom_field_3' => 'disable',
2215
  'custom_field_4' => 'disable',
2216
  ),
2217
+ );
2218
 
2219
  /**
2220
  * Add defaults without chainging the core values.
2223
  *
2224
  * @since 3.3.11
2225
  */
2226
+ $defaults = wp_parse_args( apply_filters( 'woo_feed_settings_extra_defaults', array() ), $defaults );
2227
 
2228
  if ( 'defaults' === $key ) {
2229
  return $defaults;
2230
  }
2231
 
2232
+ $settings = wp_parse_args( get_option( 'woo_feed_settings', array() ), $defaults );
2233
 
2234
  if ( 'all' === $key ) {
2235
  return $settings;
2281
  }
2282
  if ( array_key_exists( 'enable_error_debugging', $args ) ) {
2283
  $data['enable_error_debugging'] = strtolower( $args['enable_error_debugging'] );
2284
+ if ( ! in_array( $data['enable_error_debugging'], array( 'on', 'off' ) ) ) {
2285
+ $data['enable_error_debugging'] = in_array(
2286
+ $_data['enable_error_debugging'],
2287
+ array(
2288
+ 'on',
2289
+ 'off',
2290
+ )
2291
+ ) ? $_data['enable_error_debugging'] : $defaults['enable_error_debugging'];
2292
  }
2293
  unset( $args['enable_error_debugging'] );
2294
  }
2299
  if ( array_key_exists( 'overridden_structured_data', $args ) ) {
2300
  $data['overridden_structured_data'] = strtolower( $args['overridden_structured_data'] );
2301
  if ( ! in_array( $data['overridden_structured_data'], array( 'on', 'off' ) ) ) {
2302
+ $data['overridden_structured_data'] = in_array(
2303
+ $_data['overridden_structured_data'],
2304
+ array(
2305
+ 'on',
2306
+ 'off',
2307
+ )
2308
+ ) ? $_data['overridden_structured_data'] : $defaults['overridden_structured_data'];
2309
  }
2310
  unset( $args['overridden_structured_data'] );
2311
  }
2313
  if ( array_key_exists( 'disable_pixel', $args ) ) {
2314
  $data['disable_pixel'] = strtolower( $args['disable_pixel'] );
2315
  if ( ! in_array( $data['disable_pixel'], array( 'enable', 'disable' ) ) ) {
2316
+ $data['disable_pixel'] = in_array(
2317
+ $_data['disable_pixel'],
2318
+ array(
2319
+ 'enable',
2320
+ 'disable',
2321
+ )
2322
+ ) ? $_data['disable_pixel'] : $defaults['disable_pixel'];
2323
  }
2324
  unset( $args['disable_pixel'] );
2325
  }
2335
  if ( array_key_exists( 'disable_remarketing', $args ) ) {
2336
  $data['disable_remarketing'] = strtolower( $args['disable_remarketing'] );
2337
  if ( ! in_array( $data['disable_remarketing'], array( 'enable', 'disable' ) ) ) {
2338
+ $data['disable_remarketing'] = in_array(
2339
+ $_data['disable_remarketing'],
2340
+ array(
2341
+ 'enable',
2342
+ 'disable',
2343
+ )
2344
+ ) ? $_data['disable_remarketing'] : $defaults['disable_remarketing'];
2345
  }
2346
  unset( $args['disable_remarketing'] );
2347
  }
2365
  if ( array_key_exists( 'allow_all_shipping', $args ) ) {
2366
  $data['allow_all_shipping'] = strtolower( $args['allow_all_shipping'] );
2367
  if ( ! in_array( $data['allow_all_shipping'], array( 'yes', 'no' ) ) ) {
2368
+ $data['allow_all_shipping'] = in_array(
2369
+ $_data['allow_all_shipping'],
2370
+ array(
2371
+ 'yes',
2372
+ 'no',
2373
+ )
2374
+ ) ? $_data['allow_all_shipping'] : $defaults['allow_all_shipping'];
2375
  }
2376
  unset( $args['allow_all_shipping'] );
2377
  }
2379
  if ( array_key_exists( 'only_free_shipping', $args ) ) {
2380
  $data['only_free_shipping'] = strtolower( $args['only_free_shipping'] );
2381
  if ( ! in_array( $data['only_free_shipping'], array( 'yes', 'no' ) ) ) {
2382
+ $data['only_free_shipping'] = in_array(
2383
+ $_data['only_free_shipping'],
2384
+ array(
2385
+ 'yes',
2386
+ 'no',
2387
+ )
2388
+ ) ? $_data['only_free_shipping'] : $defaults['only_free_shipping'];
2389
  }
2390
  unset( $args['only_free_shipping'] );
2391
  }
2393
  if ( array_key_exists( 'only_local_pickup_shipping', $args ) ) {
2394
  $data['only_local_pickup_shipping'] = strtolower( $args['only_local_pickup_shipping'] );
2395
  if ( ! in_array( $data['only_local_pickup_shipping'], array( 'yes', 'no' ) ) ) {
2396
+ $data['only_local_pickup_shipping'] = in_array(
2397
+ $_data['only_local_pickup_shipping'],
2398
+ array(
2399
+ 'yes',
2400
+ 'no',
2401
+ )
2402
+ ) ? $_data['only_local_pickup_shipping'] : $defaults['only_local_pickup_shipping'];
2403
  }
2404
  unset( $args['only_local_pickup_shipping'] );
2405
  }
2406
 
 
2407
  if ( array_key_exists( 'enable_ftp_upload', $args ) ) {
2408
  $data['enable_ftp_upload'] = strtolower( $args['enable_ftp_upload'] );
2409
  if ( ! in_array( $data['enable_ftp_upload'], array( 'yes', 'no' ) ) ) {
2410
+ $data['enable_ftp_upload'] = in_array(
2411
+ $_data['enable_ftp_upload'],
2412
+ array(
2413
+ 'yes',
2414
+ 'no',
2415
+ )
2416
+ ) ? $_data['enable_ftp_upload'] : $defaults['enable_ftp_upload'];
2417
  }
2418
  unset( $args['enable_ftp_upload'] );
2419
  }
2507
  */
2508
  function woo_feed_flush_cache_data() {
2509
  global $wpdb;
2510
+ // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%' " ); // phpcs:ignore
2511
+ // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%'" ); // phpcs:ignore
2512
  $wpdb->query( "DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')" ); // phpcs:ignore
2513
  }
2514
  }
2528
  // @TODO use filter. add tab in feed editor so user can set custom settings.
2529
  // @TODO tab should not list all country and cities. it only list available tax settings and user can just select one.
2530
  // @TODO then it will extract the location data from it to use here.
2531
+ $wc_tax_location = array(
2532
  WC()->countries->get_base_country(),
2533
  WC()->countries->get_base_state(),
2534
  WC()->countries->get_base_postcode(),
2535
  WC()->countries->get_base_city(),
2536
+ );
2537
  /**
2538
  * Filter Tax Location to apply before product loop
2539
  *
2801
  function woo_feed_custom_fields_status_change_cb() {
2802
  $is_nonce_valid = isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wpf_feed_nonce' );
2803
 
2804
+ if ( $is_nonce_valid && isset(
2805
+ $_POST['field'],
2806
+ $_POST['status'],
2807
+ $_POST['isTaxonomy']
2808
+ ) ) {
2809
  $field = sanitize_text_field( wp_unslash( $_POST['field'] ) );
2810
  $is_taxonomy = sanitize_text_field( wp_unslash( $_POST['isTaxonomy'] ) );
2811
  $status = sanitize_text_field( wp_unslash( $_POST['status'] ) );
2905
  $set_meta_val = $new_meta_val;
2906
  }
2907
 
2908
+ $product_meta_value = isset( $_POST[ $product_meta_key ] ) ? sanitize_text_field( $_POST[ $product_meta_key ] ) : ( isset( $_POST[ "woo_feed_identifier_{$key}" ] ) ? sanitize_text_field( $_POST[ "woo_feed_identifier_{$key}" ] ) : $set_meta_val );
2909
 
2910
  if ( isset( $product_meta_value ) && ! empty( $product_meta_value ) ) {
2911
  update_post_meta( $product_id, $product_meta_key, $product_meta_value );
2933
  */
2934
  function woo_feed_add_custom_identifier_for_variation( $loop, $variation_data, $variation ) {
2935
  $settings = woo_feed_get_options( 'all' );
2936
+ if ( isset( $settings['disable_mpn'] ) && 'enable' === $settings['disable_mpn'] ) {
2937
  echo '<div class="woo-feed-variation-options">';
2938
  $custom_fields = woo_feed_product_custom_fields();
2939
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter( $custom_fields );
2994
 
2995
  if ( ! empty( $custom_identifier ) ) {
2996
  foreach ( $custom_identifier as $key => $value ) {
2997
+ $custom_field_value = isset( $_POST[ "woo_feed_{$key}_var" ][ $variation_id ] ) ? sanitize_text_field( $_POST[ "woo_feed_{$key}_var" ][ $variation_id ] ) : ( isset( $_POST[ "woo_feed_identifier_{$key}_var" ][ $variation_id ] ) ? sanitize_text_field( $_POST[ "woo_feed_identifier_{$key}_var" ] ) : '' );
2998
  if ( isset( $custom_field_value ) ) {
2999
  update_post_meta( $variation_id, "woo_feed_{$key}_var", $custom_field_value );
3000
  }
3084
  * @return void
3085
  */
3086
  function woo_feed_render_categories( $parent = 0, $par = '', $value = '' ) {
3087
+ $categoryArgs = array(
3088
  'taxonomy' => 'product_cat',
3089
  'parent' => $parent,
3090
  'orderby' => 'term_group',
3093
  'hierarchical' => 1,
3094
  'title_li' => '',
3095
  'hide_empty' => 0,
3096
+ );
3097
  $categories = get_categories( $categoryArgs );
3098
  if ( ! empty( $categories ) ) {
3099
  if ( ! empty( $par ) ) {
3102
  foreach ( $categories as $cat ) {
3103
  $class = $parent ? "treegrid-parent-{$parent} category-mapping" : 'treegrid-parent category-mapping';
3104
  ?>
3105
+ <tr class="treegrid-1 ">
3106
+ <th>
3107
+ <label for="cat_mapping_<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $par . $cat->name ); ?></label>
3108
+ </th>
3109
+ <td colspan="3">
3110
+ <!--suppress HtmlUnknownAttribute -->
3111
  <?php
3112
  $newOrGoogleFacebook = ! empty( $value )
3113
+ && in_array(
3114
+ $value['mappingprovider'],
3115
+ array(
3116
+ 'google',
3117
+ 'facebook',
3118
+ 'pinterest',
3119
+ 'bing',
3120
+ 'bing_local_inventory',
3121
+ 'snapchat',
3122
+ )
3123
+ );
3124
 
3125
  $previous_mapping_value = is_array( $value ) && isset( $value['cmapping'][ $cat->term_id ] ) ? esc_attr( $value['cmapping'][ $cat->term_id ] ) : '';
3126
  $previous_listing_mapping_value = is_array( $value ) && isset( $value['gcl-cmapping'][ $cat->term_id ] ) && ! empty( $value['gcl-cmapping'][ $cat->term_id ] )
3128
  : $previous_mapping_value;
3129
 
3130
  ?>
3131
+ <input <?php echo ( ! $newOrGoogleFacebook ) ? '' : 'style=" display: none;" '; ?>
3132
+ id="cat_mapping_<?php echo esc_attr( $cat->term_id ); ?>"
3133
+ class="<?php echo esc_attr( $class ); ?> woo-feed-mapping-input"
3134
+ autocomplete="off"
3135
+ type="text"
3136
+ name="cmapping[<?php echo esc_attr( $cat->term_id ); ?>]"
3137
+ placeholder="<?php echo esc_attr( $par . $cat->name ); ?>"
3138
+ data-cat_id="<?php echo esc_attr( $cat->term_id ); ?>"
3139
+ value="<?php echo $previous_mapping_value; ?>"
3140
+ >
3141
+ <span
3142
  <?php echo ( $newOrGoogleFacebook ) ? '' : 'style=" display: none;" '; ?>class="wf_default wf_attributes">
3143
+ <select name="gcl-cmapping[<?php echo $cat->term_id; ?>]"
3144
+ class="selectize selectize-google-category woo-feed-mapping-select"
3145
+ data-selected="<?php echo $previous_mapping_value; ?>"
3146
+ data-placeholder="<?php esc_attr_e( 'Select A Category', 'woo-feed' ); ?>">
3147
  <option value="<?php echo esc_attr( $previous_listing_mapping_value ); ?>" selected>
3148
+ <?php echo esc_attr( $previous_listing_mapping_value ); ?>
3149
+ </option>
3150
  </select>
3151
 
3152
  </span>
3153
+ </td>
3154
  <?php
3155
  if ( ! empty( get_term_children( $cat->term_id, 'product_cat' ) ) ) {
3156
  $woo_map_term_id = 'parent-' . $cat->term_id;
3159
  }
3160
  $termchildren = ! empty( get_term_children( $cat->term_id, 'product_cat' ) ) || $cat->parent;
3161
  ?>
3162
+ <td class="<?php echo $termchildren ? 'group-' . $woo_map_term_id : ''; ?>">
3163
  <?php
3164
  $childrencat = ! empty( get_term_children( $cat->term_id, 'product_cat' ) );
3165
  if ( $childrencat ) {
3167
  echo '<span class="dashicons dashicons-arrow-down-alt" title=" ' . $title . '" id="cat-map-' . $cat->term_id . '"></span>';
3168
  }
3169
  ?>
3170
+ </td>
3171
+ </tr>
3172
  <?php
3173
  // call and render the child category if any.
3174
  woo_feed_render_categories( $cat->term_id, $par . $cat->name, $value );
3186
  */
3187
  function woo_feed_clear_cache_button() {
3188
  ?>
3189
+ <div class="wf_clean_cache_wrapper">
3190
+ <img class="woo-feed-cache-loader"
3191
+ src="data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%0D%0A%3C%21--%20Generator%3A%20Adobe%20Illustrator%2019.0.0%2C%20SVG%20Export%20Plug-In%20.%20SVG%20Version%3A%206.00%20Build%200%29%20%20--%3E%0D%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Capa_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0D%0A%09%20viewBox%3D%220%200%20458.186%20458.186%22%20style%3D%22enable-background%3Anew%200%200%20458.186%20458.186%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0D%0A%3Cg%3E%0D%0A%09%3Cg%3E%0D%0A%09%09%3Cpath%20d%3D%22M445.651%2C201.95c-1.485-9.308-10.235-15.649-19.543-14.164c-9.308%2C1.485-15.649%2C10.235-14.164%2C19.543%0D%0A%09%09%09c0.016%2C0.102%2C0.033%2C0.203%2C0.051%2C0.304c17.38%2C102.311-51.47%2C199.339-153.781%2C216.719c-102.311%2C17.38-199.339-51.47-216.719-153.781%0D%0A%09%09%09S92.966%2C71.232%2C195.276%2C53.852c62.919-10.688%2C126.962%2C11.29%2C170.059%2C58.361l-75.605%2C25.19%0D%0A%09%09%09c-8.944%2C2.976-13.781%2C12.638-10.806%2C21.582c0.001%2C0.002%2C0.002%2C0.005%2C0.003%2C0.007c2.976%2C8.944%2C12.638%2C13.781%2C21.582%2C10.806%0D%0A%09%09%09c0.003-0.001%2C0.005-0.002%2C0.007-0.002l102.4-34.133c6.972-2.322%2C11.675-8.847%2C11.674-16.196v-102.4%0D%0A%09%09%09C414.59%2C7.641%2C406.949%2C0%2C397.523%2C0s-17.067%2C7.641-17.067%2C17.067v62.344C292.564-4.185%2C153.545-0.702%2C69.949%2C87.19%0D%0A%09%09%09s-80.114%2C226.911%2C7.779%2C310.508s226.911%2C80.114%2C310.508-7.779C435.905%2C339.799%2C457.179%2C270.152%2C445.651%2C201.95z%22%2F%3E%0D%0A%09%3C%2Fg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%3E%0D%0A%3C%2Fg%3E%0D%0A%3C%2Fsvg%3E%0D%0A"
3192
+ alt="loader">
3193
+ <input type="hidden" class="woo-feed-clean-cache-nonce"
3194
  value="<?php echo wp_create_nonce( 'clean_cache_nonce' ); //phpcs:ignore
3195
+ ?>
3196
+ ">
3197
+ <button type="button"><?php esc_html_e( 'Clear Cache', 'woo-feed' ); ?></button>
3198
+ </div>
3199
  <?php
3200
  }
3201
  }
3212
  if ( isset( $_REQUEST['_ajax_clean_nonce'] ) ) {
3213
 
3214
  if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_ajax_clean_nonce'] ) ), 'clean_cache_nonce' ) ) {
3215
+ $data = array();
3216
 
3217
  global $wpdb;
3218
  //TODO add wpdb prepare statement
3219
  $wpdb->query( "DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')" ); // phpcs:ignore
3220
 
3221
+ $data = array( 'success' => true );
 
3222
 
3223
  wp_send_json_success( $data );
3224
  }
3332
  $reviews = get_comments( $args );
3333
  $review_products_ids = wp_list_pluck( $reviews, 'comment_post_ID' );
3334
 
 
3335
  return ! empty( $review_products_ids ) && is_array( $review_products_ids ) ? array_unique( $review_products_ids ) : array();
3336
 
3337
  }
3345
  * @since 4.3.0
3346
  */
3347
  function woo_feed_get_approved_reviews_data() {
3348
+ $approved_reviews = array();
3349
  $product_ids = woo_feed_get_products_ids_of_reviews();
3350
 
3351
  if ( ! empty( $product_ids ) && is_array( $product_ids ) ) {
3352
 
3353
  foreach ( $product_ids as $product_id ) {
3354
+ $reviews = get_comments(
3355
+ array(
3356
+ 'post_id' => $product_id,
3357
+ 'comment_type' => 'review',
3358
+ 'comment_approved' => 1,
3359
+ 'parent' => 0,
3360
+ )
3361
+ );
3362
 
3363
  $product_name = get_the_title( $product_id );
3364
  $product_link = get_the_permalink( $product_id );
3395
  }
3396
  }
3397
 
3398
+ if ( ! function_exists( 'woo_feed_save_black_friday_notice_2022_notice' ) ) {
3399
  /**
3400
  * Update user meta to work ctx startup notice once.
3401
  *
3404
  * @since 4.3.31
3405
  * @author Nazrul Islam Nayan
3406
  */
3407
+ function woo_feed_save_black_friday_notice_2022_notice() {
3408
  if ( isset( $_REQUEST['_wp_ajax_nonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wp_ajax_nonce'] ), 'woo-feed-to-ctx-feed-notice' ) ) { //phpcs:ignore
3409
  $user_id = get_current_user_id();
3410
  if ( isset( $_REQUEST['clicked'] ) ) {
3411
+ $updated_user_meta = add_user_meta( $user_id, 'woo_feed_black_friday_notice_2022_dismissed', 'true', true );
3412
 
3413
  if ( $updated_user_meta ) {
3414
  wp_send_json_success( esc_html__( 'User meta updated successfully.', 'woo-feed' ) );
3422
  wp_die();
3423
  }
3424
  }
3425
+ add_action( 'wp_ajax_woo_feed_save_black_friday_notice_2022_notice', 'woo_feed_save_black_friday_notice_2022_notice' );
3426
 
3427
 
3428
  if ( ! function_exists( 'woo_feed_save_halloween_notice' ) ) {
3603
  $overridden_structured_data = $settings['overridden_structured_data'];
3604
 
3605
 
3606
+ if ( 'on' === $overridden_structured_data ) {
3607
 
3608
  /**
3609
  * Removed woocommerce default schema structure
3625
  $disable_brand = $settings['disable_brand'];
3626
 
3627
  $description = apply_filters( 'woo_feed_schema_description', wp_strip_all_tags( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ), $product );
3628
+ $markup['description'] = $description;
3629
 
3630
  if ( 'enable' === $disable_brand ) {
3631
  $brand_term = wp_get_post_terms( $product->get_id(), 'woo-feed-brand', array( 'fields' => 'names' ) );
3632
 
3633
  if ( ! is_wp_error( $brand_term ) ) {
3634
  if ( isset( $brand_term[0] ) ) {
3635
+ $markup['brand']['name'] = $brand_term[0];
3636
  }
3637
  }
3638
  }
3642
  $currency = get_woocommerce_currency();
3643
 
3644
  //filter schema price & currency
3645
+ $price = apply_filters( 'woo_feed_schema_product_price', $price, $markup, $product );
3646
+ $currency = apply_filters( 'woo_feed_schema_product_currency', $currency, $markup, $product );
3647
+ $markup['offers'][0]['price'] = $price;
3648
  $markup['offers'][0]['priceSpecification']['price'] = $price;
3649
  $markup['offers'][0]['priceSpecification']['priceCurrency'] = $currency;
3650
  $markup['offers'][0]['priceCurrency'] = $currency;
3655
  $markup['mpn'] = $mpn;
3656
  }
3657
 
3658
+ $markup = apply_filters( 'woo_feed_after_wc_product_structured_data', $markup, $product );
3659
 
3660
  return $markup;
3661
  }
3733
  if ( in_array( 'pinterest', $merchants ) ) {
3734
  if ( isset( $default_attr['ads_redirect'] ) ) {
3735
  if ( array_key_exists( 'ads_redirect', $default_attr ) ) {
3736
+ $keys = array_keys( $default_attr );
3737
  $keys[ array_search( 'ads_redirect', $keys ) ] = 'ads_link';
3738
  $filtered_attributes = array_combine( $keys, $default_attr );
3739
  $filtered_attributes['ads_link'] = 'Ads Link[ads_link]';
4057
  function woo_feed_get_feed_file_list() {
4058
  global $wpdb;
4059
  $feed_data = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name like %s", 'wf_feed_%' ), ARRAY_A ); // phpcs:ignore
4060
+ $feed_urls = array();
4061
  if ( ! empty( $feed_data ) and is_array( $feed_data ) ) {
4062
  foreach ( $feed_data as $key => $data ) {
4063
  $feed_info = maybe_unserialize( get_option( $data['option_name'] ) );
4080
  function woo_feed_exclude_feed_from_wp_rocket_cache( $files ) {
4081
  return array_merge(
4082
  $files,
4083
+ array(
4084
  '/wp-content/uploads/woo-feed/(.*)',
4085
+ )
4086
  );
4087
  }
4088
  }
4102
  if ( $litespeed_ex_paths && is_array( $litespeed_ex_paths ) && ! in_array( '/wp-content/uploads/woo-feed', $litespeed_ex_paths ) ) {
4103
  $litespeed_ex_paths = array_merge(
4104
  $litespeed_ex_paths,
4105
+ array( '/wp-content/uploads/woo-feed' )
4106
  );
4107
  update_option( 'litespeed.conf.cdn-exc', $litespeed_ex_paths );
4108
  }
4136
 
4137
  if ( ! $feed_path_exist ) {
4138
  $new_rule = new stdClass();
4139
+ $new_rule->prefix = 'contain';
4140
  $new_rule->content = 'woo-feed';
4141
+ $new_rule->type = 'page';
4142
 
4143
  $wp_fastest_cache_ex_paths = array_merge(
4144
  $wp_fastest_cache_ex_paths,
4145
+ array( $new_rule )
4146
  );
4147
 
4148
  update_option( 'WpFastestCacheExclude', wp_json_encode( $wp_fastest_cache_ex_paths ) );
4149
  }
4150
  } elseif ( empty( $wp_fastest_cache_ex_paths ) ) {
4151
+ $wp_fastest_cache_ex_paths = array();
4152
  $new_rule = new stdClass();
4153
+ $new_rule->prefix = 'contain';
4154
  $new_rule->content = 'woo-feed';
4155
+ $new_rule->type = 'page';
4156
 
4157
  $wp_fastest_cache_ex_paths = array_merge(
4158
  $wp_fastest_cache_ex_paths,
4159
+ array( $new_rule )
4160
  );
4161
 
4162
  update_option( 'WpFastestCacheExclude', wp_json_encode( $wp_fastest_cache_ex_paths ) );
4181
  $wp_super_ex_paths = get_option( 'ossdl_off_exclude' );
4182
  if ( $wp_super_ex_paths && strpos( $wp_super_ex_paths, 'woo-feed' ) === false ) {
4183
  $wp_super_ex_paths = explode( ',', $wp_super_ex_paths );
4184
+ $wp_super_ex_paths = array_merge( $wp_super_ex_paths, array( 'woo-feed' ) );
4185
  update_option( 'ossdl_off_exclude', implode( ',', $wp_super_ex_paths ) );
4186
  }
4187
 
4203
 
4204
  $breeze_settings = maybe_unserialize( get_option( 'breeze_cdn_integration' ) );
4205
  if ( is_array( $breeze_settings ) ) {
4206
+ $woo_feed_files = array( '.xml', '.csv', '.tsv', '.txt', '.xls' );
4207
  $woo_feed_files = array_unique( array_merge( $woo_feed_files, $breeze_settings['cdn-exclude-content'] ) );
4208
  $breeze_settings['cdn-exclude-content'] = $woo_feed_files;
4209
  update_option( 'breeze_cdn_integration', $breeze_settings );
4228
  $wp_optimize_ex_paths = maybe_unserialize( get_option( 'wpo_cache_config' ) );
4229
  if ( isset( $wp_optimize_ex_paths['enable_page_caching'] ) && $wp_optimize_ex_paths['enable_page_caching'] ) { // If page Caching enabled
4230
  if ( is_array( $wp_optimize_ex_paths ) && ! in_array( '/wp-content/uploads/woo-feed', $wp_optimize_ex_paths['cache_exception_urls'] ) ) {
4231
+ $woo_feed_ex_path['cache_exception_urls'] = array( '/wp-content/uploads/woo-feed' );
4232
  $wp_optimize_ex_paths = array_merge_recursive(
4233
  $wp_optimize_ex_paths,
4234
  $woo_feed_ex_path
4280
  if ( $swift_perform_ex_paths && isset( $swift_perform_ex_paths['exclude-strings'] ) ) {
4281
  $exclude_strings = $swift_perform_ex_paths['exclude-strings'];
4282
  if ( is_array( $exclude_strings ) && ! in_array( '/wp-content/uploads/woo-feed', $exclude_strings ) ) {
4283
+ $woo_feed_ex_path['exclude-strings'] = array( '/wp-content/uploads/woo-feed' );
4284
  $swift_perform_ex_paths = array_merge_recursive(
4285
  $swift_perform_ex_paths,
4286
  $woo_feed_ex_path
4287
  );
4288
  } else {
4289
+ $swift_perform_ex_paths['exclude-strings'] = array( '/wp-content/uploads/woo-feed' );
4290
  }
4291
  update_option( 'swift_performance_options', $swift_perform_ex_paths );
4292
  } elseif ( empty( $swift_perform_ex_paths ) ) {
4293
+ $swift_perform_ex_paths['exclude-strings'] = array( '/wp-content/uploads/woo-feed' );
4294
  update_option( 'swift_performance_options', $swift_perform_ex_paths );
4295
  }
4296
 
4310
  return false;
4311
  }
4312
 
4313
+ $feed_files = array();
4314
  $speed_booster_settings = maybe_unserialize( get_option( 'sbp_options' ) );
4315
  if ( isset( $speed_booster_settings['caching_exclude_urls'] ) ) {
4316
  $feed_files = woo_feed_get_feed_file_list();
4352
  if ( $comet_cache_settings && isset( $comet_cache_settings['exclude_uris'] ) ) {
4353
  $exclude_uris = $comet_cache_settings['exclude_uris'];
4354
  if ( strpos( $exclude_uris, '/wp-content/uploads/woo-feed' ) === false ) {
4355
+ $exclude_uris .= "\n/wp-content/uploads/woo-feed";
4356
  $comet_cache_settings['exclude_uris'] = $exclude_uris;
4357
  update_option( 'comet_cache_options', $comet_cache_settings );
4358
  }
4378
  if ( $hyper_cache_settings && isset( $hyper_cache_settings['reject_uris'] ) ) {
4379
  $exclude_strings = $hyper_cache_settings['reject_uris'];
4380
  if ( is_array( $exclude_strings ) && ! in_array( '/wp-content/uploads/woo-feed', $exclude_strings ) ) {
4381
+ $woo_feed_ex_path['reject_uris'] = array( '/wp-content/uploads/woo-feed' );
4382
  $woo_feed_ex_path['reject_uris_enabled'] = 1;
4383
  $hyper_cache_settings = array_merge_recursive(
4384
  $hyper_cache_settings,
4462
  $base_price = $price;
4463
  $discount_plugin_activate = false;
4464
 
 
4465
  /**
4466
  * PLUGIN: Discount Rules for WooCommerce
4467
  * URL: https://wordpress.org/plugins/woo-discount-rules/
4514
  *
4515
  * Don't apply discount manually.
4516
  */
4517
+ // if (is_plugin_active('aco-woo-dynamic-pricing/start.php')) {
4518
+ // $discount_plugin_activate = true;
4519
+ // if (class_exists('AWDP_Discount')) {
4520
+ // $price = AWDP_Discount::instance()->calculate_discount($product->get_price(), $product);
4521
+ // }
4522
+ // }
4523
 
4524
  /**
4525
  * PLUGIN: Conditional Discounts for WooCommerce
4527
  *
4528
  * NOTE:* Automatically apply discount to $product->get_sale_price() method.
4529
  */
4530
+ // if (is_plugin_active('woo-advanced-discounts/wad.php')) {
4531
+ // $discount_plugin_activate = true;
4532
+ // $discount_amount = 0;
4533
+ // global $wad_discounts;
4534
+ // if (isset($wad_discounts["product"])) {
4535
+ // foreach ($wad_discounts["product"] as $discount_id => $discount_obj) {
4536
+ // if ($discount_obj->is_applicable($product->get_id())) {
4537
+ // $wad_obj = new WAD_Discount($discount_id);
4538
+ // if (isset($wad_obj->settings)) {
4539
+ // $settings = $wad_obj->settings;
4540
+ // $discount_type = $wad_obj->settings['action'];
4541
+ // if (false !== strpos($discount_type, 'fixed')) {
4542
+ // $discount_amount = (float) $wad_obj->get_discount_amount($price);
4543
+ // } elseif (false !== strpos($discount_type, 'percentage')) {
4544
+ // $percentage = $settings['percentage-or-fixed-amount'];
4545
+ // $discount_amount = ($product->get_price() * ($percentage / 100));
4546
+ // }
4547
+ // }
4548
+ // }
4549
+ // }
4550
+ // $price = (float) $product->get_price() - (float) $discount_amount;
4551
+ // }
4552
+ // }
4553
 
4554
  /**
4555
  * PLUGIN: Pricing Deals for WooCommerce
4602
  * No need to add the compatibility.
4603
  */
4604
 
 
4605
  // Get Price with tax
4606
  if ( $discount_plugin_activate && $tax ) {
4607
  $price = woo_feed_get_price_with_tax( $price, $product );
5029
  function woo_feed_modify_google_color_attribute_value( $attribute_value, $product, $feed_config, $merchant_attribute ) {
5030
  // Replace Google Color attribute value according to requirements
5031
  if ( ( 'g:color' === $merchant_attribute || 'color' === $merchant_attribute )
5032
+ && in_array(
5033
+ $feed_config['provider'],
5034
+ array(
5035
+ 'google',
5036
+ 'facebook',
5037
+ 'pinterest',
5038
+ 'bing',
5039
+ 'snapchat',
5040
+ ),
5041
+ true
5042
+ ) ) {
5043
  return str_replace( ', ', '/', $attribute_value );
5044
  }
5045
 
5059
  */
5060
  function woo_feed_modify_weight_attribute_value( $attribute_value, $product, $feed_config ) {
5061
  if ( isset( $feed_config['attributes'] )
5062
+ && in_array(
5063
+ $feed_config['provider'],
5064
+ array(
5065
+ 'google',
5066
+ 'facebook',
5067
+ 'pinterest',
5068
+ 'bing',
5069
+ 'snapchat',
5070
+ )
5071
+ ) ) {
5072
  $attributes = $feed_config['attributes'];
5073
  $key = array_search( 'weight', $attributes, true );
5074
  if ( isset( $feed_config['suffix'] ) && ! empty( $key ) && array_key_exists( $key, $feed_config['suffix'] ) ) {
5114
  function woo_feed_availability_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5115
  if ( 'bestprice' === $feed_config['provider'] ) {
5116
  if ( 'in stock' === $attribute_value ) {
5117
+ return 'Y';
5118
  }
5119
 
5120
+ return 'N';
5121
  }
5122
 
5123
  if ( 'skroutz' === $feed_config['provider'] ) {
5133
 
5134
  if ( 'pricerunner' === $feed_config['provider'] ) {
5135
  if ( 'in stock' === $attribute_value ) {
5136
+ return 'Yes';
5137
  }
5138
 
5139
+ return 'No';
5140
  }
5141
 
5142
  if ( 'google' === $feed_config['provider'] || 'pinterest' === $feed_config['provider'] ) {
5145
  }
5146
 
5147
  if ( 'google' === $feed_config['provider'] ) {
5148
+ if ( ! in_array( $attribute_value, array( 'in_stock', 'out_of_stock', 'on_backorder' ) ) ) {
5149
  return 'in_stock';
5150
  }
5151
+ } elseif ( ! in_array( $attribute_value, array( 'in stock', 'out of stock', 'on backorder' ) ) ) {
5152
  return 'in stock';
5153
  }
5154
  }
5156
  if ( 'facebook' === $feed_config['provider'] ) {
5157
  if ( 'on backorder' === $attribute_value ) {
5158
  return 'available for order';
5159
+ } elseif ( ! in_array( $attribute_value, array( 'in stock', 'out of stock', 'on backorder' ) ) ) {
5160
  return 'in stock';
5161
  }
5162
  }
5178
  function woo_feed_spartoo_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5179
  if ( 'spartoo.fi' === $feed_config['provider'] ) {
5180
  if ( 'variation' === $attribute_value ) {
5181
+ return 'child';
5182
  }
5183
 
5184
+ return 'parent';
5185
  }
5186
 
5187
  return $attribute_value;
5272
  * @author Nazrul Islam Nayan
5273
  */
5274
  function woo_feed_is_google_group_merchant( $provider ) {
5275
+ return in_array( $provider, array( 'google', 'facebook', 'pinterest', 'bing' ) );
5276
  }
5277
  }
5278
 
5316
  return '';
5317
  }
5318
 
5319
+ if ( isset( $config['provider'] ) && in_array(
5320
+ $config['provider'],
5321
+ array(
5322
  'google',
5323
  'facebook',
5324
  'pinterest',
5325
+ 'bing',
5326
+ )
5327
+ ) ) {
5328
  if ( strlen( $title ) > 150 ) {
5329
+ $title = substr( $title, 0, 149 );
5330
+
5331
  }
5332
  }
5333
 
5364
  * @since 4.4.43
5365
  */
5366
  function woo_feed_get_js_dequeue_handles_list() {
5367
+ $js_files_handles = array( 'common_aramex', 'jquery_chained', 'validate_aramex' ); //aramex shipping plugin handles
5368
 
5369
+ return apply_filters( 'woo_feed_filter_js_dequeue_handles', $js_files_handles );
5370
  }
5371
  }
5372
 
5379
  * @since 4.4.44
5380
  */
5381
  function woo_feed_get_plugin_pages_slugs() {
5382
+ $woo_feed_plugin_pages = array(
5383
  'webappick-manage-feeds',
5384
  'webappick-new-feed',
5385
  'webappick-wp-options',
5389
  'webappick-wp-status',
5390
  'webappick-feed-category-mapping',
5391
  'webappick-wp-options',
5392
+ );
5393
 
5394
  return apply_filters( 'woo_feed_plugin_pages_slugs', $woo_feed_plugin_pages );
5395
  }
5399
  function woo_feed_make_feed_big_data( $data, $ids, $config ) {
5400
 
5401
  //setup feed shipping data @TODO: need to make a class when another data setup will be added
5402
+ if ( isset( $config['attributes'] ) && in_array( 'shipping', $config['attributes'] ) ) {
5403
  if ( class_exists( 'WC_Shipping_Zones' ) ) {
5404
  $data['shipping_zones'] = WC_Shipping_Zones::get_zones();
5405
  }
5432
  $attribute_names = array_keys( $attributes );
5433
 
5434
  if ( isset( $attribute_names ) && is_array( $attribute_names ) ) {
5435
+ $meta_query_items = array();
5436
  $meta_query_items['relation'] = 'AND';
5437
 
5438
  foreach ( $attribute_names as $attr_name ) {
5439
  $attribute_name = 'attribute_' . $attr_name;
5440
 
5441
  if ( isset( $params[ $attribute_name ] ) ) {
5442
+ $new_query_item = array();
5443
  $new_query_item['key'] = $attribute_name;
5444
  $new_query_item['value'] = $params[ $attribute_name ];
5445
  $new_query_item['compare'] = 'LIKE';
5465
  if ( $variation_product instanceof WC_Product_Variation ) {
5466
  $variation_price = $variation_product->get_price();
5467
 
5468
+ $markup['offers'][0]['@type'] = 'Offer';
5469
  $markup['offers'][0]['price'] = $variation_price;
5470
  $markup['offers'][0]['priceSpecification']['price'] = $variation_price;
5471
  $markup['offers'][0]['priceSpecification']['priceCurrency'] = $currency;
5472
  $markup['offers'][0]['priceCurrency'] = $currency;
5473
  }
 
5474
  }
 
5475
  }
5476
  }
 
5477
  }
5478
 
5479
  return $markup;
5521
  $exist_shipping_keys = array_keys( $cart_shippings );
5522
 
5523
  if ( isset( $cart_shippings ) && is_array( $cart_shippings ) ) {
5524
+ $adv_shipping = array();
5525
  foreach ( $cart_shippings as $key => $cart_shipping ) {
5526
+ $new_adv_shipping = array();
5527
 
5528
  if ( in_array( $key, $ids ) ) {
5529
  $new_adv_shipping['country'] = $config['feed_country'];
5546
 
5547
  array_push( $adv_shipping, $new_adv_shipping );
5548
  }
 
5549
  }
5550
  }
 
5551
  }
5552
 
5553
  // Make sure to empty the cart again
5554
  $woocommerce->cart->empty_cart();
5555
 
 
5556
  if ( ! empty( $adv_shipping ) ) {
5557
  $shipping_info = array_merge( $shipping_info, $adv_shipping );
5558
  }
 
5559
  }
5560
 
 
5561
  return $shipping_info;
5562
 
5563
  }
5574
  * @return Array
5575
  */
5576
  function woo_feed_get_acf_field_list() {
5577
+ $options = array();
5578
  if ( class_exists( 'ACF' ) ) {
5579
  $acf_fields = woo_feed_get_cached_data( 'acf_field_list' );
5580
  if ( false === $acf_fields ) {
5582
  foreach ( $field_groups as $group ) {
5583
  // DO NOT USE here: $fields = acf_get_fields($group['key']);
5584
  // because it causes repeater field bugs and returns "trashed" fields
5585
+ $fields = get_posts(
5586
+ array(
5587
+ 'posts_per_page' => - 1,
5588
+ 'post_type' => 'acf-field',
5589
+ 'orderby' => 'menu_order',
5590
+ 'order' => 'ASC',
5591
+ 'suppress_filters' => true, // DO NOT allow WPML to modify the query
5592
+ 'post_parent' => $group['ID'],
5593
+ 'post_status' => 'any',
5594
+ 'update_post_meta_cache' => false,
5595
+ )
5596
+ );
5597
  foreach ( $fields as $field ) {
5598
  $options[ 'acf_fields_' . $field->post_name ] = $field->post_title;
5599
  }
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.10
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -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
@@ -133,7 +133,10 @@ if ( ! function_exists( 'run_woo_feed' ) ) {
133
  */
134
  add_action( 'plugins_loaded', array( $plugin, 'run' ), PHP_INT_MAX );
135
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
136
- //add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
 
 
 
137
 
138
  WooFeedWebAppickAPI::getInstance();
139
 
@@ -483,14 +486,14 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
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.
@@ -568,7 +571,7 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
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 );
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.11
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
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
133
  */
134
  add_action( 'plugins_loaded', array( $plugin, 'run' ), PHP_INT_MAX );
135
  add_action( 'admin_notices', 'wooFeed_Admin_Notices' );
136
+
137
+ if ( isset( $_GET['page'] ) && preg_match( '/^webappick\W+/', $_GET['page'] ) ) {
138
+ add_action( 'admin_notices', 'woo_feed_black_friday_notice' );
139
+ }
140
 
141
  WooFeedWebAppickAPI::getInstance();
142
 
486
  */
487
  function woo_feed_manage_feed() {
488
 
489
+ $provider = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['provider'], 'text' );
490
+ $feed_id = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['feed_id'], 'text' );
491
+ $feed_option_name = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['feed_option_name'], 'text' );
492
+ $filename = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['filename'], 'file_name' );
493
+ $feedType = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['feedType'], 'text' );
494
 
495
+ $getaction = apply_filters( 'CTXFEED_filter_securing_input', 'GET', @$_GET['action'], 'text' );
496
+ $getfeed = apply_filters( 'CTXFEED_filter_securing_input', 'GET', @$_GET['feed'], 'text' );
497
 
498
  // @TODO use admin_post_ action for form handling.
499
  // Manage action for category mapping.
571
  }
572
  } else {
573
  // Update Interval.
574
+ $wf_schedule = apply_filters( 'CTXFEED_filter_securing_input', 'POST', @$_POST['wf_schedule'], 'text' );
575
  if ( $wf_schedule ) {
576
  if ( isset( $_POST['wf_schedule_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wf_schedule_nonce'] ) ), 'wf_schedule' ) ) {
577
  $interval = absint( $wf_schedule );