Version Description
Improvement support for WordPress 5.0 and fixed various minor issues
Download this release
Release Info
Developer | printful |
Plugin | Printful Integration for WooCommerce |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- includes/class-printful-admin-settings.php +7 -2
- includes/class-printful-admin-status.php +3 -3
- includes/class-printful-api-resource.php +5 -5
- includes/class-printful-integration.php +1 -1
- includes/class-printful-rest-api.php +5 -5
- includes/templates/connect.php +1 -1
- includes/templates/status-report.php +5 -1
- printful-shipping.php +3 -3
- readme.txt +8 -2
includes/class-printful-admin-settings.php
CHANGED
@@ -199,6 +199,7 @@ class Printful_Admin_Settings {
|
|
199 |
if ( ! empty( $_POST ) ) {
|
200 |
|
201 |
check_admin_referer( 'printful_settings' );
|
|
|
202 |
|
203 |
//save carriers first, so API key change does not affect this
|
204 |
if ( Printful_Integration::instance()->is_connected(true) ) {
|
@@ -208,9 +209,9 @@ class Printful_Admin_Settings {
|
|
208 |
$result = Printful_Carriers::instance()->post_carriers( $request_body );
|
209 |
|
210 |
if ( ! $result ) {
|
211 |
-
|
212 |
} else if (isset($result['error'])) {
|
213 |
-
|
214 |
}
|
215 |
}
|
216 |
|
@@ -235,6 +236,10 @@ class Printful_Admin_Settings {
|
|
235 |
//save integration settings
|
236 |
Printful_Integration::instance()->update_settings( $options );
|
237 |
|
|
|
|
|
|
|
|
|
238 |
die('OK');
|
239 |
}
|
240 |
}
|
199 |
if ( ! empty( $_POST ) ) {
|
200 |
|
201 |
check_admin_referer( 'printful_settings' );
|
202 |
+
$error_msg = null;
|
203 |
|
204 |
//save carriers first, so API key change does not affect this
|
205 |
if ( Printful_Integration::instance()->is_connected(true) ) {
|
209 |
$result = Printful_Carriers::instance()->post_carriers( $request_body );
|
210 |
|
211 |
if ( ! $result ) {
|
212 |
+
$error_msg = 'Error: failed to save carriers';
|
213 |
} else if (isset($result['error'])) {
|
214 |
+
$error_msg = $result['error'];
|
215 |
}
|
216 |
}
|
217 |
|
236 |
//save integration settings
|
237 |
Printful_Integration::instance()->update_settings( $options );
|
238 |
|
239 |
+
if ( $error_msg ) {
|
240 |
+
die( $error_msg );
|
241 |
+
}
|
242 |
+
|
243 |
die('OK');
|
244 |
}
|
245 |
}
|
includes/class-printful-admin-status.php
CHANGED
@@ -9,7 +9,7 @@ class Printful_Admin_Status {
|
|
9 |
|
10 |
const API_KEY_SEARCH_STRING = 'Printful';
|
11 |
const PF_WEBHOOK_NAME = 'Printful Integration';
|
12 |
-
const PF_REMOTE_REQUEST_URL = '
|
13 |
const PF_REMOTE_REQUEST_TOPIC = 'woo.plugin.test';
|
14 |
const PF_STATUS_ISSUE_COUNT = 'printful_status_issue_count';
|
15 |
const PF_CACHED_CHECKLIST = 'printful_cached_checklist';
|
@@ -96,7 +96,7 @@ class Printful_Admin_Status {
|
|
96 |
),
|
97 |
array(
|
98 |
'name' => __('WP SpamShield', 'printful'),
|
99 |
-
'description' => __('If you are using WP SpamShield, you might
|
100 |
'method' => 'check_wp_spamshield',
|
101 |
'silent' => true,
|
102 |
),
|
@@ -548,7 +548,7 @@ class Printful_Admin_Status {
|
|
548 |
*/
|
549 |
private function check_WC_auth_url_access() {
|
550 |
|
551 |
-
$url = home_url( '/' ) . 'wc-auth/v1/authorize?app_name=Printful&scope=read_write&user_id=1&return_url=https%3A%2F%2Fwww.printful.com%2Fdashboard%2Fwoocommerce%2Freturn&callback_url=https%3A%2F%2Fapi.printful.com%
|
552 |
$http_args = array(
|
553 |
'timeout' => 60,
|
554 |
'method' => 'GET',
|
9 |
|
10 |
const API_KEY_SEARCH_STRING = 'Printful';
|
11 |
const PF_WEBHOOK_NAME = 'Printful Integration';
|
12 |
+
const PF_REMOTE_REQUEST_URL = 'hook/woocommerce?store=1';
|
13 |
const PF_REMOTE_REQUEST_TOPIC = 'woo.plugin.test';
|
14 |
const PF_STATUS_ISSUE_COUNT = 'printful_status_issue_count';
|
15 |
const PF_CACHED_CHECKLIST = 'printful_cached_checklist';
|
96 |
),
|
97 |
array(
|
98 |
'name' => __('WP SpamShield', 'printful'),
|
99 |
+
'description' => __('If you are using WP SpamShield, you might experience problems connecting to Printful and pushing products.', 'printful'),
|
100 |
'method' => 'check_wp_spamshield',
|
101 |
'silent' => true,
|
102 |
),
|
548 |
*/
|
549 |
private function check_WC_auth_url_access() {
|
550 |
|
551 |
+
$url = home_url( '/' ) . 'wc-auth/v1/authorize?app_name=Printful&scope=read_write&user_id=1&return_url=https%3A%2F%2Fwww.printful.com%2Fdashboard%2Fwoocommerce%2Freturn&callback_url=https%3A%2F%2Fapi.printful.com%2Fhook%2Fwoocommerce-auth-callback';
|
552 |
$http_args = array(
|
553 |
'timeout' => 60,
|
554 |
'method' => 'GET',
|
includes/class-printful-api-resource.php
CHANGED
@@ -109,20 +109,20 @@ class Printful_API_Resource extends WC_API_Resource {
|
|
109 |
|
110 |
$error = false;
|
111 |
|
|
|
|
|
112 |
$apiKey = $data['accessKey'];
|
113 |
$storeId = $data['storeId'];
|
114 |
-
|
115 |
-
$option = Printful_Integration::instance()->get_option( 'printful_settings', array() );
|
116 |
$storeId = intval( $storeId );
|
117 |
|
118 |
if ( ! is_string( $apiKey ) || strlen( $apiKey ) == 0 || $storeId == 0 ) {
|
119 |
$error = 'Failed to update access data';
|
120 |
}
|
121 |
|
122 |
-
$
|
123 |
-
$
|
124 |
|
125 |
-
Printful_Integration::instance()->update_settings( $
|
126 |
|
127 |
return array(
|
128 |
'error' => $error,
|
109 |
|
110 |
$error = false;
|
111 |
|
112 |
+
$options = get_option( 'woocommerce_printful_settings', array() );
|
113 |
+
|
114 |
$apiKey = $data['accessKey'];
|
115 |
$storeId = $data['storeId'];
|
|
|
|
|
116 |
$storeId = intval( $storeId );
|
117 |
|
118 |
if ( ! is_string( $apiKey ) || strlen( $apiKey ) == 0 || $storeId == 0 ) {
|
119 |
$error = 'Failed to update access data';
|
120 |
}
|
121 |
|
122 |
+
$options['printful_key'] = $apiKey;
|
123 |
+
$options['printful_store_id'] = $storeId;
|
124 |
|
125 |
+
Printful_Integration::instance()->update_settings( $options );
|
126 |
|
127 |
return array(
|
128 |
'error' => $error,
|
includes/class-printful-integration.php
CHANGED
@@ -91,7 +91,7 @@ class Printful_Integration
|
|
91 |
$this->set_connect_error( sprintf( $message, $settings_url, $printful_url ) );
|
92 |
set_transient( self::PF_API_CONNECT_STATUS, array( 'status' => 0 ), MINUTE_IN_SECONDS ); //try again in 1 minute
|
93 |
} else {
|
94 |
-
$this->set_connect_error( 'Could not connect to Printful API. Please try again later.' );
|
95 |
}
|
96 |
|
97 |
//do nothing
|
91 |
$this->set_connect_error( sprintf( $message, $settings_url, $printful_url ) );
|
92 |
set_transient( self::PF_API_CONNECT_STATUS, array( 'status' => 0 ), MINUTE_IN_SECONDS ); //try again in 1 minute
|
93 |
} else {
|
94 |
+
$this->set_connect_error( 'Could not connect to Printful API. Please try again later. (Error ' . $e->getCode() . ': ' . $e->getMessage() . ')' );
|
95 |
}
|
96 |
|
97 |
//do nothing
|
includes/class-printful-rest-api.php
CHANGED
@@ -69,20 +69,20 @@ class Printful_REST_API
|
|
69 |
{
|
70 |
$error = false;
|
71 |
|
|
|
|
|
72 |
$api_key = $request->get_param('accessKey');
|
73 |
$store_id = $request->get_param('storeId');
|
74 |
-
|
75 |
-
$option = Printful_Integration::instance()->get_option( 'printful_settings', array() );
|
76 |
$store_id = intval( $store_id );
|
77 |
|
78 |
if ( ! is_string( $api_key ) || strlen( $api_key ) == 0 || $store_id == 0 ) {
|
79 |
$error = 'Failed to update access data';
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
Printful_Integration::instance()->update_settings( $
|
86 |
|
87 |
return array(
|
88 |
'error' => $error,
|
69 |
{
|
70 |
$error = false;
|
71 |
|
72 |
+
$options = get_option( 'woocommerce_printful_settings', array() );
|
73 |
+
|
74 |
$api_key = $request->get_param('accessKey');
|
75 |
$store_id = $request->get_param('storeId');
|
|
|
|
|
76 |
$store_id = intval( $store_id );
|
77 |
|
78 |
if ( ! is_string( $api_key ) || strlen( $api_key ) == 0 || $store_id == 0 ) {
|
79 |
$error = 'Failed to update access data';
|
80 |
}
|
81 |
|
82 |
+
$options['printful_key'] = $api_key;
|
83 |
+
$options['printful_store_id'] = $store_id;
|
84 |
|
85 |
+
Printful_Integration::instance()->update_settings( $options );
|
86 |
|
87 |
return array(
|
88 |
'error' => $error,
|
includes/templates/connect.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
<ul>
|
15 |
<?php
|
16 |
foreach ( $issues as $issue ) {
|
17 |
-
echo '<li>' .
|
18 |
}
|
19 |
?>
|
20 |
</ul>
|
14 |
<ul>
|
15 |
<?php
|
16 |
foreach ( $issues as $issue ) {
|
17 |
+
echo '<li>' . wp_kses_post( $issue ) . '</li>';
|
18 |
}
|
19 |
?>
|
20 |
</ul>
|
includes/templates/status-report.php
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
<div class="support-report-wrap">
|
2 |
-
<p
|
|
|
|
|
|
|
|
|
3 |
<textarea class="support-report"><?php echo esc_html($status_report); ?></textarea>
|
4 |
<button class="button button-primary button-large support-report-btn"><?php esc_html_e('Copy', 'printful'); ?></button>
|
5 |
<script type="text/javascript">
|
1 |
<div class="support-report-wrap">
|
2 |
+
<p>
|
3 |
+
<?php esc_html_e('Copy the box content below and add it to your support message', 'printful'); ?>
|
4 |
+
<br/>
|
5 |
+
<?php esc_html_e('Note: this status report may not include an error log. Contact your hosting provider if you need help with acquiring error logs.'); ?>
|
6 |
+
</p>
|
7 |
<textarea class="support-report"><?php echo esc_html($status_report); ?></textarea>
|
8 |
<button class="button button-primary button-large support-report-btn"><?php esc_html_e('Copy', 'printful'); ?></button>
|
9 |
<script type="text/javascript">
|
printful-shipping.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Plugin Name: Printful Integration for WooCommerce
|
4 |
Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
|
5 |
Description: Calculate correct shipping and tax rates for your Printful-Woocommerce integration.
|
6 |
-
Version: 2.0.
|
7 |
Author: Printful
|
8 |
Author URI: http://www.printful.com
|
9 |
License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Text Domain: printful
|
11 |
WC requires at least: 3.0.0
|
12 |
-
WC tested up to: 3.
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
@@ -20,7 +20,7 @@ if ( ! defined( 'PF_PLUGIN_FILE' ) ) {
|
|
20 |
|
21 |
class Printful_Base {
|
22 |
|
23 |
-
const VERSION = '2.0.
|
24 |
const PF_HOST = 'https://www.printful.com/';
|
25 |
const PF_API_HOST = 'https://api.printful.com/';
|
26 |
|
3 |
Plugin Name: Printful Integration for WooCommerce
|
4 |
Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
|
5 |
Description: Calculate correct shipping and tax rates for your Printful-Woocommerce integration.
|
6 |
+
Version: 2.0.6
|
7 |
Author: Printful
|
8 |
Author URI: http://www.printful.com
|
9 |
License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Text Domain: printful
|
11 |
WC requires at least: 3.0.0
|
12 |
+
WC tested up to: 3.5
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
20 |
|
21 |
class Printful_Base {
|
22 |
|
23 |
+
const VERSION = '2.0.6';
|
24 |
const PF_HOST = 'https://www.printful.com/';
|
25 |
const PF_API_HOST = 'https://api.printful.com/';
|
26 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: girts_u, kievins, kberzins
|
3 |
Tags: woocommerce, printful, drop shipping, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout, t-shirts
|
4 |
Requires at least: 3.8
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -38,6 +38,9 @@ Go to https://www.printful.com/dashboard/store , select your WooCommerce store,
|
|
38 |
|
39 |
== Upgrade Notice ==
|
40 |
|
|
|
|
|
|
|
41 |
= 2.0.5 =
|
42 |
Improvements to Printful shipping carrier settings
|
43 |
|
@@ -103,6 +106,9 @@ First release
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
106 |
= 2.0.5 =
|
107 |
* Improvements to Printful shipping carrier settings
|
108 |
|
2 |
Contributors: girts_u, kievins, kberzins
|
3 |
Tags: woocommerce, printful, drop shipping, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout, t-shirts
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 5.0
|
6 |
+
Stable tag: 2.0.6
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
38 |
|
39 |
== Upgrade Notice ==
|
40 |
|
41 |
+
= 2.0.6 =
|
42 |
+
Improvement support for WordPress 5.0 and fixed various minor issues
|
43 |
+
|
44 |
= 2.0.5 =
|
45 |
Improvements to Printful shipping carrier settings
|
46 |
|
106 |
|
107 |
== Changelog ==
|
108 |
|
109 |
+
= 2.0.6 =
|
110 |
+
* Improvement support for WordPress 5.0 and fixed various minor issues
|
111 |
+
|
112 |
= 2.0.5 =
|
113 |
* Improvements to Printful shipping carrier settings
|
114 |
|