Version Description
(2021-07-05) = * Fixed: Google empty Category issue fixed.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.4.12 |
Comparing to | |
See all releases |
Code changes from version 4.4.11 to 4.4.12
- README.txt +4 -1
- includes/class-woo-feed.php +0 -1
- includes/helper.php +3 -33
- includes/pluggable.php +43 -0
- includes/classes/class-woo-feed-sftp.php → libs/WebAppick/FTP/SFTPConnection.php +41 -27
- libs/autoload.php +24 -0
- woo-feed.php +10 -2
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
|
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.7
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -516,6 +516,9 @@ Using pro version:
|
|
516 |
|
517 |
== Changelog ==
|
518 |
|
|
|
|
|
|
|
519 |
= 4.4.11 (2021-07-02) =
|
520 |
* Added: Shipping handling time and transit time attributes added.
|
521 |
* Fixed: Variations can't be dragged separately issue has been fixed.
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.7
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.4.12
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
516 |
|
517 |
== Changelog ==
|
518 |
|
519 |
+
= 4.4.12 (2021-07-05) =
|
520 |
+
* Fixed: Google empty Category issue fixed.
|
521 |
+
|
522 |
= 4.4.11 (2021-07-02) =
|
523 |
* Added: Shipping handling time and transit time attributes added.
|
524 |
* Fixed: Variations can't be dragged separately issue has been fixed.
|
includes/class-woo-feed.php
CHANGED
@@ -196,7 +196,6 @@ class Woo_Feed {
|
|
196 |
*/
|
197 |
require_once WOO_FEED_FREE_PATH . 'admin/class-woo-feed-category-list.php';
|
198 |
|
199 |
-
require_once WOO_FEED_FREE_PATH . 'includes/classes/class-woo-feed-sftp.php';
|
200 |
require_once WOO_FEED_FREE_PATH . 'includes/widget.php';
|
201 |
require_once WOO_FEED_FREE_PATH . 'includes/feeds/merchant_templates_override.php';
|
202 |
|
196 |
*/
|
197 |
require_once WOO_FEED_FREE_PATH . 'admin/class-woo-feed-category-list.php';
|
198 |
|
|
|
199 |
require_once WOO_FEED_FREE_PATH . 'includes/widget.php';
|
200 |
require_once WOO_FEED_FREE_PATH . 'includes/feeds/merchant_templates_override.php';
|
201 |
|
includes/helper.php
CHANGED
@@ -2971,39 +2971,6 @@ if ( ! function_exists( 'woo_feed_render_categories' ) ) {
|
|
2971 |
}
|
2972 |
}
|
2973 |
|
2974 |
-
if ( ! function_exists( 'woo_feed_get_category_mapping_value' ) ) {
|
2975 |
-
/**
|
2976 |
-
* Return Category Mapping Values by Parent Product Id
|
2977 |
-
*
|
2978 |
-
* @param string $cmappingName Category Mapping Name
|
2979 |
-
* @param int $parent Parent id of the product
|
2980 |
-
*
|
2981 |
-
* @return mixed
|
2982 |
-
*/
|
2983 |
-
function woo_feed_get_category_mapping_value( $cmappingName, $parent ) {
|
2984 |
-
$getValue = maybe_unserialize( get_option( $cmappingName ) );
|
2985 |
-
if ( ! isset( $getValue['cmapping'] ) ) {
|
2986 |
-
return '';
|
2987 |
-
}
|
2988 |
-
$cmapping = is_array( $getValue['cmapping'] ) ? array_reverse( $getValue['cmapping'], true ) : $getValue['cmapping'];
|
2989 |
-
$categories = '';
|
2990 |
-
if ( get_the_terms( $parent, 'product_cat' ) ) {
|
2991 |
-
$categories = array_reverse( get_the_terms( $parent, 'product_cat' ) );
|
2992 |
-
}
|
2993 |
-
if ( ! empty( $categories ) && is_array( $categories ) && count( $categories ) ) {
|
2994 |
-
foreach ( $categories as $key => $category ) {
|
2995 |
-
if ( isset( $cmapping[ $category->term_id ] ) && ! empty( $cmapping[ $category->term_id ] ) ) {
|
2996 |
-
return $cmapping[ $category->term_id ];
|
2997 |
-
} else {
|
2998 |
-
return '';
|
2999 |
-
}
|
3000 |
-
}
|
3001 |
-
}
|
3002 |
-
|
3003 |
-
return '';
|
3004 |
-
}
|
3005 |
-
}
|
3006 |
-
|
3007 |
if ( ! function_exists( 'woo_feed_clear_cache_button' ) ) {
|
3008 |
/**
|
3009 |
* Clear cache button.
|
@@ -4709,4 +4676,7 @@ if( ! function_exists( 'woo_feed_get_yoast_identifiers_value' ) ) {
|
|
4709 |
}
|
4710 |
}
|
4711 |
|
|
|
|
|
|
|
4712 |
// End of file helper.php.
|
2971 |
}
|
2972 |
}
|
2973 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2974 |
if ( ! function_exists( 'woo_feed_clear_cache_button' ) ) {
|
2975 |
/**
|
2976 |
* Clear cache button.
|
4676 |
}
|
4677 |
}
|
4678 |
|
4679 |
+
// Including pluggable functions file
|
4680 |
+
require_once 'pluggable.php';
|
4681 |
+
|
4682 |
// End of file helper.php.
|
includes/pluggable.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Definition of pluggable functions
|
4 |
+
*
|
5 |
+
* @since 4.4
|
6 |
+
*
|
7 |
+
* */
|
8 |
+
defined( 'ABSPATH' ) || die();
|
9 |
+
|
10 |
+
if ( ! function_exists( 'woo_feed_get_category_mapping_value' ) ) {
|
11 |
+
/**
|
12 |
+
* Return Category Mapping Values by Parent Product Id
|
13 |
+
*
|
14 |
+
* @param string $cmappingName Category Mapping Name
|
15 |
+
* @param int $parent Parent id of the product
|
16 |
+
*
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
function woo_feed_get_category_mapping_value( $cmappingName, $parent ) {
|
20 |
+
$getValue = maybe_unserialize( get_option( $cmappingName ) );
|
21 |
+
$cat_map_value = '';
|
22 |
+
|
23 |
+
if ( ! isset( $getValue['cmapping'] ) ) {
|
24 |
+
return '';
|
25 |
+
}
|
26 |
+
$cmapping = is_array( $getValue['cmapping'] ) ? array_reverse( $getValue['cmapping'], true ) : $getValue['cmapping'];
|
27 |
+
$categories = '';
|
28 |
+
|
29 |
+
if ( get_the_terms( $parent, 'product_cat' ) ) {
|
30 |
+
$categories = array_reverse( get_the_terms( $parent, 'product_cat' ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( ! empty( $categories ) && is_array( $categories ) && count( $categories ) ) {
|
34 |
+
foreach ( $categories as $key => $category ) {
|
35 |
+
if ( isset( $cmapping[ $category->term_id ] ) && ! empty( $cmapping[ $category->term_id ] ) ) {
|
36 |
+
return $cmapping[ $category->term_id ];
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
return $cat_map_value;
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
includes/classes/class-woo-feed-sftp.php → libs/WebAppick/FTP/SFTPConnection.php
RENAMED
@@ -1,29 +1,38 @@
|
|
1 |
<?php
|
2 |
/** @noinspection PhpUnhandledExceptionInspection */
|
3 |
-
|
4 |
-
{
|
|
|
5 |
private $connection;
|
6 |
private $sftp;
|
7 |
-
|
8 |
-
|
9 |
if ( ! extension_loaded( 'ssh2' ) ) {
|
10 |
-
|
11 |
-
|
12 |
}
|
13 |
$this->connection = ssh2_connect( $host, $port );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
-
|
16 |
public function login( $username, $password ) {
|
17 |
if ( ! ssh2_auth_password( $this->connection, $username, $password ) ) {
|
18 |
-
throw new Exception("Could not authenticate with username $username " . "and password $password.");
|
19 |
}
|
20 |
-
|
21 |
$this->sftp = ssh2_sftp( $this->connection );
|
22 |
if ( ! $this->sftp ) {
|
23 |
throw new Exception( 'Could not initialize SFTP subsystem.' );
|
24 |
}
|
25 |
}
|
26 |
-
|
27 |
/**
|
28 |
* @param string $local_file local file to upload
|
29 |
* @param string $remote_file remote file name
|
@@ -33,7 +42,7 @@ class SFTPConnection
|
|
33 |
* @throws Exception
|
34 |
*/
|
35 |
public function upload_file( $local_file, $remote_file, $path ) {
|
36 |
-
|
37 |
if ( ! file_exists( $local_file ) ) {
|
38 |
throw new Exception( "Local file does't exists.: $local_file." );
|
39 |
}
|
@@ -41,30 +50,35 @@ class SFTPConnection
|
|
41 |
if ( false === $data_to_send ) {
|
42 |
throw new Exception( "Could not open local file: $local_file." );
|
43 |
}
|
44 |
-
|
45 |
-
|
46 |
if ( ! is_dir( "ssh2.sftp://$sftp$path" ) ) {
|
47 |
-
throw new Exception("Invalid Remote Path: $path");
|
48 |
}
|
49 |
-
|
50 |
if ( ! is_writeable( "ssh2.sftp://$sftp$path" ) ) { // phpcs:ignore
|
51 |
-
|
|
|
|
|
|
|
52 |
}
|
53 |
-
|
54 |
$stream = fopen( "ssh2.sftp://$sftp$path$remote_file", 'w' ); // phpcs:ignore
|
55 |
-
|
56 |
-
|
57 |
}
|
58 |
-
|
59 |
if ( false === fwrite( $stream, $data_to_send ) ) { // phpcs:ignore
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
fclose( $stream ); // phpcs:ignore
|
64 |
return true;
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
68 |
unlink("ssh2.sftp://$sftp$remote_file"); // phpcs:ignore
|
69 |
-
|
70 |
}
|
1 |
<?php
|
2 |
/** @noinspection PhpUnhandledExceptionInspection */
|
3 |
+
|
4 |
+
class SFTPConnection {
|
5 |
+
|
6 |
private $connection;
|
7 |
private $sftp;
|
8 |
+
|
9 |
+
public function __construct( $host, $port = 22, $f_print = false ) {
|
10 |
if ( ! extension_loaded( 'ssh2' ) ) {
|
11 |
+
/* translators: 1: server host, 2: server port */
|
12 |
+
throw new Exception( sprintf( esc_html__( 'Could not connect to %1$s:%2$s. SSH2 is not enabled on this server.', 'woo-feed' ), $host, $port ) );
|
13 |
}
|
14 |
$this->connection = ssh2_connect( $host, $port );
|
15 |
+
|
16 |
+
// Security: Man in the middle attack protection
|
17 |
+
if ( $f_print ) {
|
18 |
+
$fingerprint = ssh2_fingerprint($this->connection, SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
|
19 |
+
if ( $fingerprint !== $f_print ) {
|
20 |
+
throw new Exception(sprintf('Known host fingerprint "%s" does not match %s:%s fingerprint "%s". Possible man-in-the-middle attack ?', $config['fingerprint'], $config['host'], $config['port'], $fingerprint));
|
21 |
+
}
|
22 |
+
}
|
23 |
}
|
24 |
+
|
25 |
public function login( $username, $password ) {
|
26 |
if ( ! ssh2_auth_password( $this->connection, $username, $password ) ) {
|
27 |
+
throw new Exception( "Could not authenticate with username $username " . "and password $password." );
|
28 |
}
|
29 |
+
|
30 |
$this->sftp = ssh2_sftp( $this->connection );
|
31 |
if ( ! $this->sftp ) {
|
32 |
throw new Exception( 'Could not initialize SFTP subsystem.' );
|
33 |
}
|
34 |
}
|
35 |
+
|
36 |
/**
|
37 |
* @param string $local_file local file to upload
|
38 |
* @param string $remote_file remote file name
|
42 |
* @throws Exception
|
43 |
*/
|
44 |
public function upload_file( $local_file, $remote_file, $path ) {
|
45 |
+
|
46 |
if ( ! file_exists( $local_file ) ) {
|
47 |
throw new Exception( "Local file does't exists.: $local_file." );
|
48 |
}
|
50 |
if ( false === $data_to_send ) {
|
51 |
throw new Exception( "Could not open local file: $local_file." );
|
52 |
}
|
53 |
+
|
54 |
+
$sftp = $this->sftp;
|
55 |
if ( ! is_dir( "ssh2.sftp://$sftp$path" ) ) {
|
56 |
+
throw new Exception( "Invalid Remote Path: $path" );
|
57 |
}
|
58 |
+
|
59 |
if ( ! is_writeable( "ssh2.sftp://$sftp$path" ) ) { // phpcs:ignore
|
60 |
+
|
61 |
+
// Not throwing an exception because only upload permission is required.
|
62 |
+
error_log( "CTX feed sftp upload issue: Can't write to remote. @" . $path );
|
63 |
+
|
64 |
}
|
65 |
+
|
66 |
$stream = fopen( "ssh2.sftp://$sftp$path$remote_file", 'w' ); // phpcs:ignore
|
67 |
+
if ( ! $stream ) {
|
68 |
+
throw new Exception( "Could not open file: $path$remote_file" );
|
69 |
}
|
70 |
+
|
71 |
if ( false === fwrite( $stream, $data_to_send ) ) { // phpcs:ignore
|
72 |
+
throw new Exception( "Could not send data from file: $local_file." );
|
73 |
+
}
|
74 |
+
|
75 |
fclose( $stream ); // phpcs:ignore
|
76 |
return true;
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
public function delete_file( $remote_file ) {
|
81 |
+
$sftp = $this->sftp;
|
82 |
unlink("ssh2.sftp://$sftp$remote_file"); // phpcs:ignore
|
83 |
+
}
|
84 |
}
|
libs/autoload.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Autoloading file & classes
|
4 |
+
*
|
5 |
+
* @since 4.7
|
6 |
+
*
|
7 |
+
* */
|
8 |
+
|
9 |
+
defined( 'ABSPATH' ) || die();
|
10 |
+
|
11 |
+
spl_autoload_register( 'woo_feed_autoloader' );
|
12 |
+
|
13 |
+
function woo_feed_autoloader($class){
|
14 |
+
|
15 |
+
if( strpos( $class, 'WebAppick' ) !== false ){
|
16 |
+
|
17 |
+
$file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . str_replace( '\\', '/', $class );
|
18 |
+
|
19 |
+
if( file_exists( $file_path ) )
|
20 |
+
require_once $file_path;
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
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.4.
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
@@ -39,7 +39,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
|
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
-
define( 'WOO_FEED_FREE_VERSION', '4.4.
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
@@ -139,6 +139,14 @@ if ( ! defined( 'WOO_FEED_CACHE_TTL' ) ) {
|
|
139 |
define( 'WOO_FEED_CACHE_TTL', $_cache_ttl['cache_ttl'] );
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/**
|
143 |
* Load Uses Tracker
|
144 |
*/
|
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.4.12
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
+
define( 'WOO_FEED_FREE_VERSION', '4.4.12' );
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
139 |
define( 'WOO_FEED_CACHE_TTL', $_cache_ttl['cache_ttl'] );
|
140 |
}
|
141 |
|
142 |
+
/*
|
143 |
+
* Autoloader
|
144 |
+
*
|
145 |
+
* @since 4.7
|
146 |
+
*
|
147 |
+
* */
|
148 |
+
require_once WOO_FEED_LIBS_PATH . 'autoload.php';
|
149 |
+
|
150 |
/**
|
151 |
* Load Uses Tracker
|
152 |
*/
|