Printful Integration for WooCommerce - Version 2.0.4

Version Description

Improvements and fixed various minor issues

Download this release

Release Info

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

Code changes from version 2.0.3 to 2.0.4

includes/class-printful-admin-status.php CHANGED
@@ -55,7 +55,7 @@ class Printful_Admin_Status {
55
  ),
56
  array(
57
  'name' => __('WooCommerce authentication URL access', 'printful'),
58
- 'description' => __('Some hosts have unnecessarily intrusive security checks in place that prevent WooCommerce API authentication from working (mod_security rule #1234234). If this check fails, you will not be able authorize Printful app.', 'printful'),
59
  'method' => 'check_WC_auth_url_access',
60
  ),
61
  array(
@@ -405,7 +405,7 @@ class Printful_Admin_Status {
405
  private function check_PHP_time_limit() {
406
  $time_limit = ini_get( 'max_execution_time' );
407
 
408
- if ( $time_limit >= 30 ) {
409
  return self::PF_STATUS_OK;
410
  }
411
 
55
  ),
56
  array(
57
  'name' => __('WooCommerce authentication URL access', 'printful'),
58
+ 'description' => __('Printful needs access to WooCommerce API authorize page. This sometimes may get blocked due to hosts having unnecessarily intrusive security checks in place that prevent WooCommerce API authentication from working (for example mod_security rule #1234234). If this check fails, you will not be able authorize Printful app.', 'printful'),
59
  'method' => 'check_WC_auth_url_access',
60
  ),
61
  array(
405
  private function check_PHP_time_limit() {
406
  $time_limit = ini_get( 'max_execution_time' );
407
 
408
+ if ( !$time_limit || $time_limit >= 30 ) {
409
  return self::PF_STATUS_OK;
410
  }
411
 
includes/class-printful-admin.php CHANGED
@@ -46,7 +46,9 @@ class Printful_Admin {
46
  * Loads stylesheet for printful toolbar element
47
  */
48
  public function add_global_style() {
49
- wp_enqueue_style( 'printful-global', plugins_url( '../assets/css/global.css', __FILE__ ) );
 
 
50
  }
51
 
52
  /**
46
  * Loads stylesheet for printful toolbar element
47
  */
48
  public function add_global_style() {
49
+ if ( is_user_logged_in() ) {
50
+ wp_enqueue_style( 'printful-global', plugins_url( '../assets/css/global.css', __FILE__ ) );
51
+ }
52
  }
53
 
54
  /**
includes/class-printful-rest-api.php CHANGED
@@ -97,25 +97,25 @@ class Printful_REST_API
97
  public static function post_size_guide( $data )
98
  {
99
  if ( empty( $data['size_chart'] ) ) {
100
- return new WP_Error( 'printful_api_size_chart_empty', __( 'No size chart was provided', 'printful' ), ['status' => 400]);
101
  }
102
 
103
  //product id is valid
104
  $product_id = intval( $data['product_id'] );
105
  if ( $product_id < 1 ) {
106
- return new WP_Error( 'printful_api_product_not_found', __( 'The product ID is invalid', 'printful' ), ['status' => 400]);
107
  }
108
 
109
  //product exists
110
  $product = get_post( $product_id );
111
  if ( empty( $product ) || $product->post_type != 'product' ) {
112
- return new WP_Error( 'printful_api_product_not_found', __( 'The product is not found', 'printful' ), ['status' => 400]);
113
  }
114
 
115
  //how about permissions?
116
  $post_type = get_post_type_object( $product->post_type );
117
  if ( ! current_user_can( $post_type->cap->edit_post, $product->ID ) ) {
118
- return new WP_Error( 'printful_api_user_cannot_edit_product_size_chart', __( 'You do not have permission to edit the size chart', 'printful' ), ['status' => 401]);
119
  }
120
 
121
  //lets do this
97
  public static function post_size_guide( $data )
98
  {
99
  if ( empty( $data['size_chart'] ) ) {
100
+ return new WP_Error( 'printful_api_size_chart_empty', __( 'No size chart was provided', 'printful' ), array('status' => 400));
101
  }
102
 
103
  //product id is valid
104
  $product_id = intval( $data['product_id'] );
105
  if ( $product_id < 1 ) {
106
+ return new WP_Error( 'printful_api_product_not_found', __( 'The product ID is invalid', 'printful' ), array('status' => 400));
107
  }
108
 
109
  //product exists
110
  $product = get_post( $product_id );
111
  if ( empty( $product ) || $product->post_type != 'product' ) {
112
+ return new WP_Error( 'printful_api_product_not_found', __( 'The product is not found', 'printful' ), array('status' => 400));
113
  }
114
 
115
  //how about permissions?
116
  $post_type = get_post_type_object( $product->post_type );
117
  if ( ! current_user_can( $post_type->cap->edit_post, $product->ID ) ) {
118
+ return new WP_Error( 'printful_api_user_cannot_edit_product_size_chart', __( 'You do not have permission to edit the size chart', 'printful' ), array('status' => 401));
119
  }
120
 
121
  //lets do this
includes/templates/stats.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="printful-stats">
2
  <div class="printful-stats-item">
3
- <h4>$<?php echo esc_html($stats['orders_today']['total']); ?></h4>
4
  <b>
5
  <?php
6
  echo esc_html($stats['orders_today']['orders']);
@@ -11,7 +11,7 @@
11
  </div>
12
  <div class="printful-stats-item">
13
  <h4>
14
- $<?php echo esc_html($stats['orders_last_7_days']['total']); ?>
15
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['orders_last_7_days']['trend']) .'-alt"></span>'; ?>
16
  </h4>
17
  <b>
@@ -24,7 +24,7 @@
24
  </div>
25
  <div class="printful-stats-item">
26
  <h4>
27
- $<?php echo esc_html($stats['orders_last_28_days']['total']); ?>
28
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['orders_last_28_days']['trend']) .'-alt"></span>'; ?>
29
  </h4>
30
  <b>
@@ -36,7 +36,7 @@
36
  </div>
37
  <div class="printful-stats-item">
38
  <h4>
39
- $<?php echo esc_attr($stats['profit_last_28_days']); ?>
40
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['profit_trend_last_28_days']) .'-alt"></span>'; ?>
41
  </h4>
42
  <b><?php esc_html_e('PROFIT', 'printful'); ?></b> <?php esc_html_e('last 28 days', 'printful'); ?>
1
  <div class="printful-stats">
2
  <div class="printful-stats-item">
3
+ <h4><?php echo esc_html(get_woocommerce_currency_symbol($stats['currency'])) . ' ' . esc_html($stats['orders_today']['total']); ?></h4>
4
  <b>
5
  <?php
6
  echo esc_html($stats['orders_today']['orders']);
11
  </div>
12
  <div class="printful-stats-item">
13
  <h4>
14
+ <?php echo esc_html(get_woocommerce_currency_symbol($stats['currency'])) . ' ' . esc_html($stats['orders_last_7_days']['total']); ?>
15
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['orders_last_7_days']['trend']) .'-alt"></span>'; ?>
16
  </h4>
17
  <b>
24
  </div>
25
  <div class="printful-stats-item">
26
  <h4>
27
+ <?php echo esc_html(get_woocommerce_currency_symbol($stats['currency'])) . ' ' . esc_html($stats['orders_last_28_days']['total']); ?>
28
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['orders_last_28_days']['trend']) .'-alt"></span>'; ?>
29
  </h4>
30
  <b>
36
  </div>
37
  <div class="printful-stats-item">
38
  <h4>
39
+ <?php echo esc_html(get_woocommerce_currency_symbol($stats['currency'])) . ' ' . esc_attr($stats['profit_last_28_days']); ?>
40
  <?php echo '<span class="dashicons dashicons-arrow-' . esc_attr($stats['profit_trend_last_28_days']) .'-alt"></span>'; ?>
41
  </h4>
42
  <b><?php esc_html_e('PROFIT', 'printful'); ?></b> <?php esc_html_e('last 28 days', 'printful'); ?>
printful-shipping.php CHANGED
@@ -3,7 +3,7 @@
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.3
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
@@ -20,7 +20,7 @@ if ( ! defined( 'PF_PLUGIN_FILE' ) ) {
20
 
21
  class Printful_Base {
22
 
23
- const VERSION = '2.0.3';
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.4
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
20
 
21
  class Printful_Base {
22
 
23
+ const VERSION = '2.0.4';
24
  const PF_HOST = 'https://www.printful.com/';
25
  const PF_API_HOST = 'https://api.printful.com/';
26
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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: 4.9
6
- Stable tag: 2.0.3
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.3 =
42
  Fixed various minor issues, enabled localization, Improved compatibility with WC 3.4.3
43
 
@@ -97,8 +100,12 @@ First release
97
 
98
  == Changelog ==
99
 
 
 
 
 
100
  = 2.0.3 =
101
- * Improved compatibility with WC 3.3.5
102
  * Wordpress localization support
103
  * Minor bug fixes
104
 
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: 4.9
6
+ Stable tag: 2.0.4
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.4 =
42
+ Improvements and fixed various minor issues
43
+
44
  = 2.0.3 =
45
  Fixed various minor issues, enabled localization, Improved compatibility with WC 3.4.3
46
 
100
 
101
  == Changelog ==
102
 
103
+ = 2.0.4 =
104
+ * Improved support for older PHP versions
105
+ * Other minor bug fixes
106
+
107
  = 2.0.3 =
108
+ * Improved compatibility with WC 3.4.3
109
  * Wordpress localization support
110
  * Minor bug fixes
111