Version Description
(2020-02-23) = * Fix: Duplicate content in CSV feeds.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 3.3.2 |
Comparing to | |
See all releases |
Code changes from version 3.3.0 to 3.3.2
- README.txt +7 -1
- admin/class-woo-feed-manage-list.php +1 -1
- admin/partials/woo-feed-ftp-sftp-template.php +0 -69
- admin/partials/woo-feed-search-category.php +0 -29
- includes/classes/class-woo-feed-auto-update.php +0 -343
- includes/helper.php +12 -6
- woo-feed.php +3 -13
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags:product feed,woocommerce product feed,google shopping feed,google shopping,
|
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.3.2
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -305,6 +305,12 @@ Using pro version:
|
|
305 |
|
306 |
== Changelog ==
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
= 3.3.0 (2020-02-17) =
|
309 |
* Improvement: Validate all source code using WPCS (PHPCS) to match WordPress coding standard.
|
310 |
* Improvement: Sanitization and Nonce checking.
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.3.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.3.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
305 |
|
306 |
== Changelog ==
|
307 |
|
308 |
+
= 3.3.2 (2020-02-23) =
|
309 |
+
* Fix: Duplicate content in CSV feeds.
|
310 |
+
|
311 |
+
= 3.3.1 (2020-02-20) =
|
312 |
+
* Fixed: function name conflict with Post SMTP plugin is solved
|
313 |
+
|
314 |
= 3.3.0 (2020-02-17) =
|
315 |
* Improvement: Validate all source code using WPCS (PHPCS) to match WordPress coding standard.
|
316 |
* Improvement: Sanitization and Nonce checking.
|
admin/class-woo-feed-manage-list.php
CHANGED
@@ -462,7 +462,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
|
|
462 |
*/
|
463 |
$data = $this->get_feeds();
|
464 |
|
465 |
-
usort( $data, '
|
466 |
|
467 |
|
468 |
/***********************************************************************
|
462 |
*/
|
463 |
$data = $this->get_feeds();
|
464 |
|
465 |
+
usort( $data, 'woo_feed_usort_reorder' );
|
466 |
|
467 |
|
468 |
/***********************************************************************
|
admin/partials/woo-feed-ftp-sftp-template.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<li>
|
2 |
-
<input type="radio" name="wf_tabs" id="tab3"/>
|
3 |
-
<label class="wf-tab-name" for="tab3"><?php _e( 'FTP / SFTP', 'woo-feed' ); ?></label>
|
4 |
-
|
5 |
-
<div id="wf-tab-content3" class="wf-tab-content">
|
6 |
-
<table class="table widefat fixed mtable" width="100%">
|
7 |
-
<?php if ( ! checkFTP_connection() && ! checkSFTP_connection() ) { ?>
|
8 |
-
<tbody>
|
9 |
-
<tr>
|
10 |
-
<th><?php esc_attr_e( 'FTP/SFTP module is not found in your server. Please contact your service provider or system administrator to install/enable FTP/SFTP module.', 'woo-feed' ); ?></th>
|
11 |
-
</tr>
|
12 |
-
</tbody>
|
13 |
-
<?php } else { ?>
|
14 |
-
<tbody>
|
15 |
-
<tr>
|
16 |
-
<td><?php _e( 'Enabled', 'woo-feed' ); ?></td>
|
17 |
-
<td>
|
18 |
-
<select name="ftpenabled" >
|
19 |
-
<option value="0"><?php _e( 'Disabled', 'woo-feed' ); ?></option>
|
20 |
-
<option value="1"><?php _e( 'Enabled', 'woo-feed' ); ?></option>
|
21 |
-
</select>
|
22 |
-
|
23 |
-
</td>
|
24 |
-
</tr>
|
25 |
-
<tr>
|
26 |
-
<td><?php _e( 'Server Type', 'woo-feed' ); ?></td>
|
27 |
-
<td>
|
28 |
-
<select name="ftporsftp" class="ftporsftp">
|
29 |
-
<option value="ftp"><?php _e( 'FTP', 'woo-feed' ); ?></option>
|
30 |
-
<option value="sftp"><?php _e( 'SFTP', 'woo-feed' ); ?></option>
|
31 |
-
</select>
|
32 |
-
<span class="ssh2_status"></span>
|
33 |
-
</td>
|
34 |
-
</tr>
|
35 |
-
<tr>
|
36 |
-
<td><?php _e( 'Host Name', 'woo-feed' ); ?></td>
|
37 |
-
<td><input type="text" name="ftphost"/></td>
|
38 |
-
</tr>
|
39 |
-
<tr>
|
40 |
-
<td><?php _e( 'User Name', 'woo-feed' ); ?></td>
|
41 |
-
<td><input type="text" name="ftpuser"/></td>
|
42 |
-
</tr>
|
43 |
-
<tr>
|
44 |
-
<td><?php _e( 'Password', 'woo-feed' ); ?></td>
|
45 |
-
<td><input type="password" name="ftppassword"/></td>
|
46 |
-
</tr>
|
47 |
-
<tr>
|
48 |
-
<td><?php _e( 'Port', 'woo-feed' ); ?></td>
|
49 |
-
<td><input type="text" name="ftpport" value="21"/></td>
|
50 |
-
</tr>
|
51 |
-
<tr>
|
52 |
-
<td><?php _e( 'Path (Optional)', 'woo-feed' ); ?></td>
|
53 |
-
<td><input type="text" name="ftppath"/></td>
|
54 |
-
</tr>
|
55 |
-
</tbody>
|
56 |
-
<?php } ?>
|
57 |
-
</table>
|
58 |
-
<table class=" widefat fixed">
|
59 |
-
<tr>
|
60 |
-
<td align="left" class="makeFeedResponse">
|
61 |
-
|
62 |
-
</td>
|
63 |
-
<td align="right">
|
64 |
-
<button type="submit" class="wfbtn"><?php _e( 'Save & Generate Feed', 'woo-feed' ); ?></button>
|
65 |
-
</td>
|
66 |
-
</tr>
|
67 |
-
</table>
|
68 |
-
</div>
|
69 |
-
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/partials/woo-feed-search-category.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Auto suggest merchant category
|
4 |
-
*
|
5 |
-
* @link https://webappick.com/
|
6 |
-
* @since 1.0.0
|
7 |
-
* @author Ohidul Islam <wahid@webappick.com>
|
8 |
-
*/
|
9 |
-
if ( isset($_POST['q']) ) {
|
10 |
-
$searchfor = sanitize_text_field( $_POST['q'] );
|
11 |
-
$provider = sanitize_text_field( $_POST['provider'] );
|
12 |
-
if ( $provider != 'custom' ) {
|
13 |
-
$file = "$provider/categories.txt";
|
14 |
-
$matches = array();
|
15 |
-
|
16 |
-
$handle = @fopen($file, "r");
|
17 |
-
if ( $handle ) {
|
18 |
-
while ( ! feof($handle) ) {
|
19 |
-
$buffer = fgets($handle);
|
20 |
-
if (strpos($buffer, $searchfor) !== FALSE)
|
21 |
-
$matches[] = $buffer;
|
22 |
-
}
|
23 |
-
fclose($handle);
|
24 |
-
}
|
25 |
-
|
26 |
-
//show results:
|
27 |
-
echo json_encode($matches);
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/class-woo-feed-auto-update.php
DELETED
@@ -1,343 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A class definition responsible for processing auto feed update
|
4 |
-
*
|
5 |
-
* @link https://webappick.com/
|
6 |
-
* @since 1.0.0
|
7 |
-
*
|
8 |
-
* @package Woo_Feed
|
9 |
-
* @subpackage Woo_Feed/includes
|
10 |
-
* @author Ohidul Islam <wahid@webappick.com>
|
11 |
-
*/
|
12 |
-
|
13 |
-
class WOO_FEED_AUTO_UPDATE{
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @var $feedNames array contains all the available feed name
|
17 |
-
*/
|
18 |
-
private $feedNames;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var $executionTime int Hold execution time to update feed at a time
|
22 |
-
*/
|
23 |
-
private $executionTime;
|
24 |
-
|
25 |
-
public function __construct(){
|
26 |
-
$this->feedNames = $this->get_feed_names();
|
27 |
-
$this->executionTime = $this->getExecutionTime();
|
28 |
-
$this->executeUpdate();
|
29 |
-
$this->executeUpdate();
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
-
public function get_feed_names() {
|
34 |
-
global $wpdb;
|
35 |
-
$query = $wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s;", "wf_feed_%");
|
36 |
-
$result = $wpdb->get_results($query, 'ARRAY_A');
|
37 |
-
$feeds = array();
|
38 |
-
$i = 1;
|
39 |
-
foreach ( $result as $key => $value ) {
|
40 |
-
$feedInfo = unserialize(get_option($value['option_name']));
|
41 |
-
$feeds[ $i ]['last_updated'] = $feedInfo['last_updated'];
|
42 |
-
$feeds[ $i ]['feed_name'] = $value['option_name'];
|
43 |
-
$i++;
|
44 |
-
}
|
45 |
-
|
46 |
-
return $feeds;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function getExecutionTime() {
|
50 |
-
return ini_get("max_execution_time");
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getFeedInfo( $feedName ) {
|
54 |
-
$feedInfo = get_option("wf_cron_info_".$feedName);
|
55 |
-
if ( $feedInfo ) {
|
56 |
-
return $feedInfo;
|
57 |
-
}else {
|
58 |
-
$totalProducts = $this->getTotalProducts($feedName);
|
59 |
-
$batches = ceil($totalProducts / 200);
|
60 |
-
$feedInfo = array(
|
61 |
-
"totalProducts" => $totalProducts,
|
62 |
-
"batches" => $batches,
|
63 |
-
);
|
64 |
-
update_option("wf_cron_info_".$feedName,$feedInfo);
|
65 |
-
return $feedInfo;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getTotalProducts( $feedName ) {
|
70 |
-
$feedName = sanitize_text_field(str_replace("wf_feed_","wf_config",$feedName));
|
71 |
-
$feedInfo = get_option($feedName);
|
72 |
-
|
73 |
-
if ( ! $feedInfo ) {
|
74 |
-
$getFeedConfig = unserialize(get_option($feedName));
|
75 |
-
$feedInfo = $getFeedConfig['feedrules'];
|
76 |
-
}
|
77 |
-
$arg = array(
|
78 |
-
'post_type' => array( 'product', 'product_variation' ),
|
79 |
-
'post_status' => 'publish',
|
80 |
-
'ignore_sticky_posts' => 1,
|
81 |
-
'posts_per_page' => -1,
|
82 |
-
'orderby' => 'date',
|
83 |
-
'order' => 'desc',
|
84 |
-
'fields' => 'ids',
|
85 |
-
);
|
86 |
-
|
87 |
-
if ( get_option('woocommerce_product_feed_pro_activated') && get_option('woocommerce_product_feed_pro_activated') == "Activated" ) {
|
88 |
-
|
89 |
-
# Argument for Product search by ID
|
90 |
-
if ( isset($feedInfo['fattribute']) && is_array($feedInfo['fattribute']) ) {
|
91 |
-
if ( count($feedInfo['fattribute']) ) {
|
92 |
-
$condition = $feedInfo['condition'];
|
93 |
-
$compare = $feedInfo['filterCompare'];
|
94 |
-
$ids_in = array();
|
95 |
-
$ids_not_in = array();
|
96 |
-
foreach ( $feedInfo['fattribute'] as $key => $rule ) {
|
97 |
-
if ( $rule == 'id' && in_array($condition[ $key ],array( "==", "contain" )) ) {
|
98 |
-
unset($feedInfo['fattribute'][ $key ]);
|
99 |
-
unset($feedInfo['condition'][ $key ]);
|
100 |
-
unset($feedInfo['filterCompare'][ $key ]);
|
101 |
-
if ( strpos($compare[ $key ],',') !== false ) {
|
102 |
-
foreach ( explode(",",$compare[ $key ]) as $key => $id ) {
|
103 |
-
array_push($ids_in,$id);
|
104 |
-
}
|
105 |
-
}else {
|
106 |
-
array_push($ids_in,$compare[ $key ]);
|
107 |
-
}
|
108 |
-
}elseif ( $rule == 'id' && in_array($condition[ $key ],array( "!=", "nContains" )) ) {
|
109 |
-
unset($feedInfo['fattribute'][ $key ]);
|
110 |
-
unset($feedInfo['condition'][ $key ]);
|
111 |
-
unset($feedInfo['filterCompare'][ $key ]);
|
112 |
-
if ( strpos($compare[ $key ],',') !== false ) {
|
113 |
-
foreach ( explode(",",$compare[ $key ]) as $key => $id ) {
|
114 |
-
array_push($ids_not_in,$id);
|
115 |
-
}
|
116 |
-
}else {
|
117 |
-
array_push($ids_not_in,$compare[ $key ]);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
if ( count($ids_in) ) {
|
123 |
-
$arg['post__in'] = $ids_in;
|
124 |
-
}
|
125 |
-
|
126 |
-
if ( count($ids_not_in) ) {
|
127 |
-
$arg['post__not_in'] = $ids_not_in;
|
128 |
-
}
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
if ( isset($feedInfo['categories']) && is_array($feedInfo['categories']) && ! empty($feedInfo['categories'][0]) ) {
|
133 |
-
$i = 0;
|
134 |
-
$arg['tax_query']['relation'] = "OR";
|
135 |
-
foreach ( $feedInfo['categories'] as $key => $value ) {
|
136 |
-
if ( ! empty($value) ) {
|
137 |
-
$arg['tax_query'][ $i ]["taxonomy"] = "product_cat";
|
138 |
-
$arg['tax_query'][ $i ]["field"] = "slug";
|
139 |
-
$arg['tax_query'][ $i ]["terms"] = $value;
|
140 |
-
$i++;
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
# Query Database for products
|
147 |
-
$loop = new WP_Query($arg);
|
148 |
-
|
149 |
-
return $loop->post_count;
|
150 |
-
}
|
151 |
-
|
152 |
-
public function updateBatchInfo( $feedName,$Info,$lastBatch,$status ) {
|
153 |
-
$feedInfo = get_option("wf_cron_info_".$feedName);
|
154 |
-
if ( $feedInfo ) {
|
155 |
-
$feedInfo['lastBatch'] = $lastBatch;
|
156 |
-
$feedInfo['completed'] = $status;
|
157 |
-
update_option("wf_cron_info_".$feedName,$feedInfo);
|
158 |
-
}else {
|
159 |
-
$nInfo = array(
|
160 |
-
"totalProducts" => $Info['totalProducts'],
|
161 |
-
"batches" => $Info['batches'],
|
162 |
-
"lastBatch" => $lastBatch,
|
163 |
-
"completed" => $status,
|
164 |
-
);
|
165 |
-
update_option("wf_cron_info_".$feedName,$nInfo);
|
166 |
-
}
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
public function executeUpdate() {
|
171 |
-
if ( ! empty($this->feedNames) ) {
|
172 |
-
foreach ( $this->feedNames as $name ) {
|
173 |
-
$info = $this->getFeedInfo($name['feed_name']);
|
174 |
-
if ( isset($info['update']) ) {
|
175 |
-
|
176 |
-
}elseif ( ! empty($info['batches']) && $info['batches'] > 0 ) {
|
177 |
-
$offset = 0;
|
178 |
-
$limit = 200;
|
179 |
-
for ( $i = 1;$i < $info['batches'];$i++ ) {
|
180 |
-
$this->woo_feed_make_batch_feed($name['feed_name'],200,$offset);
|
181 |
-
$offset = $offset + $limit;
|
182 |
-
}
|
183 |
-
$this->woo_feed_save_feed_file($name['feed_name']);
|
184 |
-
}
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
public function woo_feed_generate_feed_data( $info ) {
|
190 |
-
if ( count($info) && isset($info['provider']) ) {
|
191 |
-
# GEt Post data
|
192 |
-
if ( $info['provider'] == 'google' ) {
|
193 |
-
$merchant = "Woo_Feed_Google";
|
194 |
-
} elseif ( $info['provider'] == 'facebook' ) {
|
195 |
-
$merchant = "Woo_Feed_Facebook";
|
196 |
-
}elseif ( strpos($info['provider'],'amazon') !== FALSE ) {
|
197 |
-
$merchant = "Woo_Feed_Amazon";
|
198 |
-
}elseif ( $info['provider'] == 'custom2' ) {
|
199 |
-
$merchant = "Woo_Feed_Custom2";
|
200 |
-
} else {
|
201 |
-
$merchant = "Woo_Feed_Custom";
|
202 |
-
}
|
203 |
-
|
204 |
-
$feedService = sanitize_text_field($info['provider']);
|
205 |
-
$fileName = str_replace(" ", "", sanitize_text_field($info['filename']));
|
206 |
-
$type = sanitize_text_field($info['feedType']);
|
207 |
-
|
208 |
-
$feedRules = $info;
|
209 |
-
|
210 |
-
# Get Feed info
|
211 |
-
$products = new Woo_Generate_Feed($merchant, $feedRules);
|
212 |
-
$feed = $products->getProducts();
|
213 |
-
if ( ! empty($feed['body']) ) {
|
214 |
-
$feedHeader = "wf_cron_feed_header_info_".$fileName;
|
215 |
-
$feedBody = "wf_cron_feed_body_info_".$fileName;
|
216 |
-
$feedFooter = "wf_cron_feed_footer_info_".$fileName;
|
217 |
-
$prevFeed = woo_feed_get_batch_feed_info($feedService,$type,$feedBody);//get_option($feedBody);
|
218 |
-
if ( $prevFeed ) {
|
219 |
-
if ( $type == 'csv' ) {
|
220 |
-
$newFeed = array_merge($prevFeed, $feed['body']);
|
221 |
-
}else {
|
222 |
-
$newFeed = $prevFeed.$feed['body'];
|
223 |
-
}
|
224 |
-
//update_option($feedBody,$newFeed);
|
225 |
-
woo_feed_save_batch_feed_info($feedService,$type,$newFeed,$feedBody,$info);
|
226 |
-
}else {
|
227 |
-
//update_option($feedBody,$feed['body']);
|
228 |
-
woo_feed_save_batch_feed_info($feedService,$type,$feed['body'],$feedBody,$info);
|
229 |
-
}
|
230 |
-
//update_option($feedHeader,$feed['header']);
|
231 |
-
woo_feed_save_batch_feed_info($feedService,$type,$feed['header'],$feedHeader,$info);
|
232 |
-
//update_option($feedFooter,$feed['footer']);
|
233 |
-
woo_feed_save_batch_feed_info($feedService,$type,$feed['footer'],$feedFooter,$info);
|
234 |
-
|
235 |
-
return true;
|
236 |
-
}else {
|
237 |
-
return false;
|
238 |
-
}
|
239 |
-
}
|
240 |
-
return false;
|
241 |
-
}
|
242 |
-
|
243 |
-
|
244 |
-
public function woo_feed_make_batch_feed( $feedName,$limit,$offset ) {
|
245 |
-
$limit = sanitize_text_field($limit);
|
246 |
-
$offset = sanitize_text_field($offset);
|
247 |
-
$feedName = sanitize_text_field(str_replace("wf_feed_","wf_config",$feedName));
|
248 |
-
$feedInfo = get_option($feedName);
|
249 |
-
|
250 |
-
if ( ! $feedInfo ) {
|
251 |
-
$getFeedConfig = unserialize(get_option($feedName));
|
252 |
-
$feedInfo = $getFeedConfig['feedrules'];
|
253 |
-
}
|
254 |
-
|
255 |
-
$feedInfo['Limit'] = $limit;
|
256 |
-
$feedInfo['Offset'] = $offset;
|
257 |
-
return $this->woo_feed_generate_feed_data($feedInfo);
|
258 |
-
}
|
259 |
-
|
260 |
-
|
261 |
-
public function woo_feed_save_feed_file( $feedName ) {
|
262 |
-
|
263 |
-
$feed = str_replace("wf_feed_", "",$feedName);
|
264 |
-
$info = get_option($feed);
|
265 |
-
if ( ! $info ) {
|
266 |
-
$getInfo = unserialize(get_option($feedName));
|
267 |
-
$info = $getInfo['feedrules'];
|
268 |
-
}
|
269 |
-
$feedService = $info['provider'];
|
270 |
-
$fileName = str_replace(" ", "",$info['filename']);
|
271 |
-
$type = $info['feedType'];
|
272 |
-
|
273 |
-
//$feedHeader=get_option("wf_store_feed_header_info_".$fileName);
|
274 |
-
$feedHeader = woo_feed_get_batch_feed_info($feedService,$type,"wf_cron_feed_header_info_".$fileName);
|
275 |
-
//$feedBody=get_option("wf_store_feed_body_info_".$fileName);
|
276 |
-
$feedBody = woo_feed_get_batch_feed_info($feedService,$type,"wf_cron_feed_body_info_".$fileName);
|
277 |
-
//$feedFooter=get_option("wf_store_feed_footer_info_".$fileName);
|
278 |
-
$feedFooter = woo_feed_get_batch_feed_info($feedService,$type,"wf_cron_feed_footer_info_".$fileName);
|
279 |
-
|
280 |
-
// echo "<pre>"; print_r($feedHeader); print_r($feedBody);
|
281 |
-
if ( $type == 'csv' ) {
|
282 |
-
$csvHead[0] = $feedHeader;
|
283 |
-
$string = array_merge($csvHead,$feedBody);
|
284 |
-
}else {
|
285 |
-
$string = $feedHeader.$feedBody.$feedFooter;
|
286 |
-
}
|
287 |
-
// print_r($string);
|
288 |
-
// $data=array($string);
|
289 |
-
// wp_send_json_error($data);
|
290 |
-
// wp_die();
|
291 |
-
|
292 |
-
$upload_dir = wp_upload_dir();
|
293 |
-
$base = $upload_dir['basedir'];
|
294 |
-
$path = $base . "/woo-feed/" . $feedService . "/" . $type;
|
295 |
-
$saveFile = false;
|
296 |
-
# Check If any products founds
|
297 |
-
if ( $string ) {
|
298 |
-
# Save File
|
299 |
-
|
300 |
-
$file = $path . "/" . $fileName . "." . $type;
|
301 |
-
$save = new Woo_Feed_Savefile();
|
302 |
-
if ( $type == "csv" ) {
|
303 |
-
$saveFile = $save->saveCSVFile($path, $file, $string, $info);
|
304 |
-
} else {
|
305 |
-
$saveFile = $save->saveFile($path, $file, $string);
|
306 |
-
}
|
307 |
-
}else {
|
308 |
-
$data = array(
|
309 |
-
"success" => false,
|
310 |
-
"message" => "No Product Found with your feed configuration. Please Update & Generate the feed again.",
|
311 |
-
);
|
312 |
-
}
|
313 |
-
|
314 |
-
|
315 |
-
# Save Info into database
|
316 |
-
$url = $upload_dir['baseurl'] . "/woo-feed/" . $feedService . "/" . $type . "/" . $fileName . "." . $type;
|
317 |
-
$feedInfo = array(
|
318 |
-
'feedrules' => $info,
|
319 |
-
'url' => $url,
|
320 |
-
'last_updated' => gmdate("Y-m-d H:i:s"),
|
321 |
-
);
|
322 |
-
|
323 |
-
if ( ! empty($name) && $name != "wf_feed_" . $fileName ) {
|
324 |
-
delete_option($name);
|
325 |
-
}
|
326 |
-
|
327 |
-
//delete_option("wf_config".$fileName);
|
328 |
-
delete_option("wf_store_feed_header_info_".$fileName);
|
329 |
-
delete_option("wf_store_feed_body_info_".$fileName);
|
330 |
-
delete_option("wf_store_feed_footer_info_".$fileName);
|
331 |
-
if ( $type == "csv" ) {
|
332 |
-
$type = "json";
|
333 |
-
}
|
334 |
-
// unlink($path . "/" . "wf_cron_feed_header_info_".$fileName . "." . $type);
|
335 |
-
// unlink($path . "/" . "wf_cron_feed_body_info_".$fileName . "." . $type);
|
336 |
-
// unlink($path . "/" . "wf_cron_feed_footer_info_".$fileName . "." . $type);
|
337 |
-
|
338 |
-
update_option('wf_feed_' . $fileName, serialize($feedInfo));
|
339 |
-
|
340 |
-
}
|
341 |
-
|
342 |
-
|
343 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/helper.php
CHANGED
@@ -1051,10 +1051,16 @@ if ( ! function_exists( 'woo_feed_unlink_tempFiles' ) ) {
|
|
1051 |
* @return bool
|
1052 |
*/
|
1053 |
function woo_feed_unlink_tempFiles( $feedService, $fileName, $type ) {
|
1054 |
-
$path
|
1055 |
-
$
|
1056 |
-
|
1057 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
|
1059 |
if ( ! empty( $files ) ) {
|
1060 |
// woo_feed_log_feed_process( $fileName, sprintf( 'Deleting Temporary Files (%s).', implode( ', ', array_values( $tempFiles ) ) ) );
|
@@ -1142,7 +1148,7 @@ if ( ! function_exists( 'woo_feed_remove_query_args' ) ) {
|
|
1142 |
|
1143 |
add_filter( 'removable_query_args', 'woo_feed_remove_query_args', 10, 1 );
|
1144 |
}
|
1145 |
-
if ( ! function_exists( '
|
1146 |
/**
|
1147 |
* This checks for sorting input and sorts the data in our array accordingly.
|
1148 |
*
|
@@ -1156,7 +1162,7 @@ if ( ! function_exists( 'usort_reorder' ) ) {
|
|
1156 |
*
|
1157 |
* @return bool
|
1158 |
*/
|
1159 |
-
function
|
1160 |
// If no sort, default to title
|
1161 |
$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'option_name'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
1162 |
// If no order, default to asc
|
1051 |
* @return bool
|
1052 |
*/
|
1053 |
function woo_feed_unlink_tempFiles( $feedService, $fileName, $type ) {
|
1054 |
+
$path = woo_feed_get_file_dir( $feedService, $type );
|
1055 |
+
$ext = $type;
|
1056 |
+
if ( 'csv' == $type ) {
|
1057 |
+
$ext = 'json';
|
1058 |
+
}
|
1059 |
+
$files = [
|
1060 |
+
'headerFile' => $path . '/' . 'wf_store_feed_header_info_' . $fileName . '.' . $ext,
|
1061 |
+
'bodyFile' => $path . '/' . 'wf_store_feed_body_info_' . $fileName . '.' . $ext,
|
1062 |
+
'footerFile' => $path . '/' . 'wf_store_feed_footer_info_' . $fileName . '.' . $ext,
|
1063 |
+
];
|
1064 |
|
1065 |
if ( ! empty( $files ) ) {
|
1066 |
// woo_feed_log_feed_process( $fileName, sprintf( 'Deleting Temporary Files (%s).', implode( ', ', array_values( $tempFiles ) ) ) );
|
1148 |
|
1149 |
add_filter( 'removable_query_args', 'woo_feed_remove_query_args', 10, 1 );
|
1150 |
}
|
1151 |
+
if ( ! function_exists( 'woo_feed_usort_reorder' ) ) {
|
1152 |
/**
|
1153 |
* This checks for sorting input and sorts the data in our array accordingly.
|
1154 |
*
|
1162 |
*
|
1163 |
* @return bool
|
1164 |
*/
|
1165 |
+
function woo_feed_usort_reorder( $a, $b ) {
|
1166 |
// If no sort, default to title
|
1167 |
$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( $_REQUEST['orderby'] ) : 'option_name'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
1168 |
// If no order, default to asc
|
woo-feed.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines
|
13 |
* like Google Shopping, Facebook Product Feed, eBay, Amazon, Idealo and many more.
|
14 |
*
|
15 |
-
* Version: 3.3.
|
16 |
* Author: WebAppick
|
17 |
* Author URI: https://webappick.com/
|
18 |
* License: GPL v2
|
@@ -27,7 +27,7 @@
|
|
27 |
*
|
28 |
* WC Requirement & Test
|
29 |
* WC requires at least: 3.2
|
30 |
-
* WC tested up to: 3.9.
|
31 |
*/
|
32 |
|
33 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -40,7 +40,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
|
|
40 |
* @var string
|
41 |
* @since 3.1.6
|
42 |
*/
|
43 |
-
define( 'WOO_FEED_FREE_VERSION', '3.3.
|
44 |
}
|
45 |
|
46 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
@@ -324,9 +324,6 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
|
|
324 |
if ( 0 == $offset ) {
|
325 |
$type = $feedInfo['feedType'];
|
326 |
$feedService = $feedInfo['provider'];
|
327 |
-
if ( 'csv' == $type ) {
|
328 |
-
$type = 'json';
|
329 |
-
}
|
330 |
woo_feed_unlink_tempFiles( $feedService, $feedName, $type );
|
331 |
}
|
332 |
$feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
|
@@ -456,10 +453,6 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
|
|
456 |
$feedInfo['status'] = 1;
|
457 |
}
|
458 |
|
459 |
-
if ( 'csv' == $type ) {
|
460 |
-
$type = 'json';
|
461 |
-
}
|
462 |
-
|
463 |
woo_feed_unlink_tempFiles( $feedService, $feedName, $type );
|
464 |
|
465 |
// woo_feed_log_feed_process( $info['filename'], 'Updating Feed Information.' );
|
@@ -470,9 +463,6 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
|
|
470 |
// FTP File Upload Info
|
471 |
$ftpEnabled = sanitize_text_field( $info['ftpenabled'] );
|
472 |
|
473 |
-
if ( 'json' == $type ) {
|
474 |
-
$type = 'csv';
|
475 |
-
}
|
476 |
if ( $ftpEnabled ) {
|
477 |
woo_feed_handle_file_transfer( $file, $feedName . '.' . $type, $info );
|
478 |
}
|
12 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines
|
13 |
* like Google Shopping, Facebook Product Feed, eBay, Amazon, Idealo and many more.
|
14 |
*
|
15 |
+
* Version: 3.3.2
|
16 |
* Author: WebAppick
|
17 |
* Author URI: https://webappick.com/
|
18 |
* License: GPL v2
|
27 |
*
|
28 |
* WC Requirement & Test
|
29 |
* WC requires at least: 3.2
|
30 |
+
* WC tested up to: 3.9.2
|
31 |
*/
|
32 |
|
33 |
if ( ! defined( 'ABSPATH' ) ) {
|
40 |
* @var string
|
41 |
* @since 3.1.6
|
42 |
*/
|
43 |
+
define( 'WOO_FEED_FREE_VERSION', '3.3.2' );
|
44 |
}
|
45 |
|
46 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
324 |
if ( 0 == $offset ) {
|
325 |
$type = $feedInfo['feedType'];
|
326 |
$feedService = $feedInfo['provider'];
|
|
|
|
|
|
|
327 |
woo_feed_unlink_tempFiles( $feedService, $feedName, $type );
|
328 |
}
|
329 |
$feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
|
453 |
$feedInfo['status'] = 1;
|
454 |
}
|
455 |
|
|
|
|
|
|
|
|
|
456 |
woo_feed_unlink_tempFiles( $feedService, $feedName, $type );
|
457 |
|
458 |
// woo_feed_log_feed_process( $info['filename'], 'Updating Feed Information.' );
|
463 |
// FTP File Upload Info
|
464 |
$ftpEnabled = sanitize_text_field( $info['ftpenabled'] );
|
465 |
|
|
|
|
|
|
|
466 |
if ( $ftpEnabled ) {
|
467 |
woo_feed_handle_file_transfer( $file, $feedName . '.' . $type, $info );
|
468 |
}
|