Printful Integration for WooCommerce - Version 1.0.2

Version Description

Added option to disable SSL

Download this release

Release Info

Developer printful
Plugin Icon 128x128 Printful Integration for WooCommerce
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (3) hide show
  1. PrintfulClient.php +4 -2
  2. printful-shipping.php +10 -1
  3. readme.txt +10 -5
PrintfulClient.php CHANGED
@@ -14,8 +14,10 @@ class PrintfulClient {
14
private $lastResponseRaw;
15
private $lastResponse;
16
17
const API_URL = 'https://api.theprintful.com/';
18
- const USER_AGENT = 'Printful API WooCommerce Library 1.0.1';
19
20
/**
21
* @param string $key Printful Store API key
@@ -125,7 +127,7 @@ class PrintfulClient {
125
126
$version = curl_version();
127
$baseUrl = self::API_URL;
128
- if(!($version['features'] & CURL_VERSION_SSL)){ //Fallback to HTTP
129
$baseUrl = str_replace('https://', 'http://', $baseUrl);
130
}
131
14
private $lastResponseRaw;
15
private $lastResponse;
16
17
+ public $disableSSL = false;
18
+
19
const API_URL = 'https://api.theprintful.com/';
20
+ const USER_AGENT = 'Printful API WooCommerce Library 1.0.2';
21
22
/**
23
* @param string $key Printful Store API key
127
128
$version = curl_version();
129
$baseUrl = self::API_URL;
130
+ if($this->disableSSL || !($version['features'] & CURL_VERSION_SSL)){ //Fallback to HTTP
131
$baseUrl = str_replace('https://', 'http://', $baseUrl);
132
}
133
printful-shipping.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Printful Shipping Rates for WooCommerce
4
Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
5
Description: Printful shipping rates
6
- Version: 1.0.1
7
Author: Idea Bits LLC
8
License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
9
*/
@@ -29,6 +29,7 @@ function printful_shipping_init()
29
{
30
public $currency_rate = 1;
31
public $show_warnings = false;
32
private $last_error = false;
33
34
function __construct()
@@ -45,6 +46,7 @@ function printful_shipping_init()
45
$this->enabled = $this->get_option('enabled');
46
$this->title = $this->get_option('title');
47
$this->show_warnings = $this->get_option('show_warnings') == 'yes';
48
49
if (get_woocommerce_currency() != 'USD') {
50
$currency_rate = (float)$this->get_option('rate');
@@ -84,6 +86,12 @@ function printful_shipping_init()
84
'label' => 'Display Printful status messages if rate API request fails',
85
'default' => 'yes'
86
),
87
);
88
$currency = get_woocommerce_currency();
89
if ($currency != 'USD'){ //Require conversion rate
@@ -125,6 +133,7 @@ function printful_shipping_init()
125
126
try {
127
$printful = new PrintfulClient($this->get_option('printful_key'));
128
} catch( PrintfulException $e) {
129
$this->set_error($e);
130
return false;
3
Plugin Name: Printful Shipping Rates for WooCommerce
4
Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
5
Description: Printful shipping rates
6
+ Version: 1.0.2
7
Author: Idea Bits LLC
8
License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
9
*/
29
{
30
public $currency_rate = 1;
31
public $show_warnings = false;
32
+ public $disable_ssl = false;
33
private $last_error = false;
34
35
function __construct()
46
$this->enabled = $this->get_option('enabled');
47
$this->title = $this->get_option('title');
48
$this->show_warnings = $this->get_option('show_warnings') == 'yes';
49
+ $this->disable_ssl = $this->get_option('disable_ssl') == 'yes';
50
51
if (get_woocommerce_currency() != 'USD') {
52
$currency_rate = (float)$this->get_option('rate');
86
'label' => 'Display Printful status messages if rate API request fails',
87
'default' => 'yes'
88
),
89
+ 'disable_ssl' => array(
90
+ 'title' => 'Disable SSL',
91
+ 'type' => 'checkbox',
92
+ 'label' => 'Use HTTP instead of HTTPS to connect to the Printful API (may be required if the plugin does not work for some hosting configurations)',
93
+ 'default' => 'no'
94
+ ),
95
);
96
$currency = get_woocommerce_currency();
97
if ($currency != 'USD'){ //Require conversion rate
133
134
try {
135
$printful = new PrintfulClient($this->get_option('printful_key'));
136
+ $printful->disableSSL = $this->disable_ssl;
137
} catch( PrintfulException $e) {
138
$this->set_error($e);
139
return false;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: girts_u
3
Tags: woocommerce, printful, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout
4
Requires at least: 3.8
5
Tested up to: 4.0
6
- Stable tag: 1.0.1
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
@@ -37,18 +37,23 @@ Go to https://www.theprintful.com/dashboard/store , select your WooCommerce stor
37
38
== Upgrade Notice ==
39
40
- = 1.0 =
41
- First release
42
43
= 1.0.1 =
44
Minor improvements
45
46
== Changelog ==
47
48
- = 1.0 =
49
- * First release
50
51
= 1.0.1 =
52
* Removed CURLOPT_FOLLOWLOCATION that caused problems on some hosting environments
53
* Added option to display reason status messages if the rate API request has failed
54
3
Tags: woocommerce, printful, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout
4
Requires at least: 3.8
5
Tested up to: 4.0
6
+ Stable tag: 1.0.2
7
License: GPLv2 or later
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
37
38
== Upgrade Notice ==
39
40
+ = 1.0.2 =
41
+ Added option to disable SSL
42
43
= 1.0.1 =
44
Minor improvements
45
46
+ = 1.0 =
47
+ First release
48
+
49
== Changelog ==
50
51
+ = 1.0.2 =
52
+ * Added option to disable SSL for users that do not have a valid CA certificates in their PHP installation
53
54
= 1.0.1 =
55
* Removed CURLOPT_FOLLOWLOCATION that caused problems on some hosting environments
56
* Added option to display reason status messages if the rate API request has failed
57
58
+ = 1.0 =
59
+ * First release