AfterShip – WooCommerce Tracking - Version 1.1.3

Version Description

  • Fix Bug - WC Dependency
  • i18N change to AfterShip
Download this release

Release Info

Developer aftership
Plugin Icon 128x128 AfterShip – WooCommerce Tracking
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

aftership.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AfterShip - WooCommerce Tracking
4
  Plugin URI: http://aftership.com/
5
  Description: Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
6
- Version: 1.1.2
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
3
  Plugin Name: AfterShip - WooCommerce Tracking
4
  Plugin URI: http://aftership.com/
5
  Description: Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
6
+ Version: 1.1.3
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
api/class-aftership-api-authentication.php CHANGED
@@ -117,7 +117,7 @@ class AfterShip_API_Authentication
117
  $users = $user_query->get_results();
118
 
119
  if (empty($users[0]))
120
- throw new Exception(__('AfterShip\'s WordPress API Key is invalid', 'woocommerce'), 401);
121
 
122
  return $users[0];
123
 
117
  $users = $user_query->get_results();
118
 
119
  if (empty($users[0]))
120
+ throw new Exception(__('AfterShip\'s WordPress API Key is invalid', 'aftership'), 401);
121
 
122
  return $users[0];
123
 
api/class-aftership-api-json-handler.php CHANGED
@@ -57,7 +57,7 @@ class AfterShip_API_JSON_Handler implements AfterShip_API_Handler
57
 
58
  WC()->api->server->send_status(400);
59
 
60
- $data = array(array('code' => 'aftership_api_jsonp_disabled', 'message' => __('JSONP support is disabled on this site', 'woocommerce')));
61
  }
62
 
63
  // Check for invalid characters (only alphanumeric allowed)
@@ -65,7 +65,7 @@ class AfterShip_API_JSON_Handler implements AfterShip_API_Handler
65
 
66
  WC()->api->server->send_status(400);
67
 
68
- $data = array(array('code' => 'aftership_api_jsonp_callback_invalid', __('The JSONP callback function is invalid', 'woocommerce')));
69
  }
70
 
71
  return $_GET['_jsonp'] . '(' . json_encode($data) . ')';
57
 
58
  WC()->api->server->send_status(400);
59
 
60
+ $data = array(array('code' => 'aftership_api_jsonp_disabled', 'message' => __('JSONP support is disabled on this site', 'aftership')));
61
  }
62
 
63
  // Check for invalid characters (only alphanumeric allowed)
65
 
66
  WC()->api->server->send_status(400);
67
 
68
+ $data = array(array('code' => 'aftership_api_jsonp_callback_invalid', __('The JSONP callback function is invalid', 'aftership')));
69
  }
70
 
71
  return $_GET['_jsonp'] . '(' . json_encode($data) . ')';
api/class-aftership-api-orders.php CHANGED
@@ -275,7 +275,7 @@ class AfterShip_API_Orders extends AfterShip_API_Resource
275
  $query = $this->query_orders($filter);
276
 
277
  if (!current_user_can('read_private_shop_orders'))
278
- return new WP_Error('aftership_api_user_cannot_read_orders_count', __('You do not have permission to read the orders count', 'woocommerce'), array('status' => 401));
279
 
280
  return array('count' => (int)$query->found_posts);
281
  }
275
  $query = $this->query_orders($filter);
276
 
277
  if (!current_user_can('read_private_shop_orders'))
278
+ return new WP_Error('aftership_api_user_cannot_read_orders_count', __('You do not have permission to read the orders count', 'aftership'), array('status' => 401));
279
 
280
  return array('count' => (int)$query->found_posts);
281
  }
api/class-aftership-api-resource.php CHANGED
@@ -71,7 +71,7 @@ class AfterShip_API_Resource
71
 
72
  // validate ID
73
  if (empty($id))
74
- return new WP_Error("aftership_api_invalid_{$resource_name}_id", sprintf(__('Invalid %s ID', 'woocommerce'), $type), array('status' => 404));
75
 
76
  // only custom post types have per-post type/permission checks
77
  if ('customer' !== $type) {
@@ -83,24 +83,24 @@ class AfterShip_API_Resource
83
 
84
  // validate post type
85
  if ($type !== $post_type)
86
- return new WP_Error("aftership_api_invalid_{$resource_name}", sprintf(__('Invalid %s', 'woocommerce'), $resource_name), array('status' => 404));
87
 
88
  // validate permissions
89
  switch ($context) {
90
 
91
  case 'read':
92
  if (!$this->is_readable($post))
93
- return new WP_Error("aftership_api_user_cannot_read_{$resource_name}", sprintf(__('You do not have permission to read this %s', 'woocommerce'), $resource_name), array('status' => 401));
94
  break;
95
 
96
  case 'edit':
97
  if (!$this->is_editable($post))
98
- return new WP_Error("aftership_api_user_cannot_edit_{$resource_name}", sprintf(__('You do not have permission to edit this %s', 'woocommerce'), $resource_name), array('status' => 401));
99
  break;
100
 
101
  case 'delete':
102
  if (!$this->is_deletable($post))
103
- return new WP_Error("aftership_api_user_cannot_delete_{$resource_name}", sprintf(__('You do not have permission to delete this %s', 'woocommerce'), $resource_name), array('status' => 401));
104
  break;
105
  }
106
  }
@@ -306,9 +306,9 @@ class AfterShip_API_Resource
306
  $result = wp_delete_user($id);
307
 
308
  if ($result)
309
- return array('message' => __('Permanently deleted customer', 'woocommerce'));
310
  else
311
- return new WP_Error('aftership_api_cannot_delete_customer', __('The customer cannot be deleted', 'woocommerce'), array('status' => 500));
312
 
313
  } else {
314
 
@@ -317,16 +317,16 @@ class AfterShip_API_Resource
317
  $result = ($force) ? wp_delete_post($id, true) : wp_trash_post($id);
318
 
319
  if (!$result)
320
- return new WP_Error("aftership_api_cannot_delete_{$resource_name}", sprintf(__('This %s cannot be deleted', 'woocommerce'), $resource_name), array('status' => 500));
321
 
322
  if ($force) {
323
- return array('message' => sprintf(__('Permanently deleted %s', 'woocommerce'), $resource_name));
324
 
325
  } else {
326
 
327
  $this->server->send_status('202');
328
 
329
- return array('message' => sprintf(__('Deleted %s', 'woocommerce'), $resource_name));
330
  }
331
  }
332
  }
71
 
72
  // validate ID
73
  if (empty($id))
74
+ return new WP_Error("aftership_api_invalid_{$resource_name}_id", sprintf(__('Invalid %s ID', 'aftership'), $type), array('status' => 404));
75
 
76
  // only custom post types have per-post type/permission checks
77
  if ('customer' !== $type) {
83
 
84
  // validate post type
85
  if ($type !== $post_type)
86
+ return new WP_Error("aftership_api_invalid_{$resource_name}", sprintf(__('Invalid %s', 'aftership'), $resource_name), array('status' => 404));
87
 
88
  // validate permissions
89
  switch ($context) {
90
 
91
  case 'read':
92
  if (!$this->is_readable($post))
93
+ return new WP_Error("aftership_api_user_cannot_read_{$resource_name}", sprintf(__('You do not have permission to read this %s', 'aftership'), $resource_name), array('status' => 401));
94
  break;
95
 
96
  case 'edit':
97
  if (!$this->is_editable($post))
98
+ return new WP_Error("aftership_api_user_cannot_edit_{$resource_name}", sprintf(__('You do not have permission to edit this %s', 'aftership'), $resource_name), array('status' => 401));
99
  break;
100
 
101
  case 'delete':
102
  if (!$this->is_deletable($post))
103
+ return new WP_Error("aftership_api_user_cannot_delete_{$resource_name}", sprintf(__('You do not have permission to delete this %s', 'aftership'), $resource_name), array('status' => 401));
104
  break;
105
  }
106
  }
306
  $result = wp_delete_user($id);
307
 
308
  if ($result)
309
+ return array('message' => __('Permanently deleted customer', 'aftership'));
310
  else
311
+ return new WP_Error('aftership_api_cannot_delete_customer', __('The customer cannot be deleted', 'aftership'), array('status' => 500));
312
 
313
  } else {
314
 
317
  $result = ($force) ? wp_delete_post($id, true) : wp_trash_post($id);
318
 
319
  if (!$result)
320
+ return new WP_Error("aftership_api_cannot_delete_{$resource_name}", sprintf(__('This %s cannot be deleted', 'aftership'), $resource_name), array('status' => 500));
321
 
322
  if ($force) {
323
+ return array('message' => sprintf(__('Permanently deleted %s', 'aftership'), $resource_name));
324
 
325
  } else {
326
 
327
  $this->server->send_status('202');
328
 
329
+ return array('message' => sprintf(__('Deleted %s', 'aftership'), $resource_name));
330
  }
331
  }
332
  }
api/class-aftership-api-server.php CHANGED
@@ -165,7 +165,7 @@ class AfterShip_API_Server
165
 
166
  // WP_Errors are handled in serve_request()
167
  elseif (!is_wp_error($user))
168
- $user = new WP_Error('aftership_api_authentication_error', __('Invalid authentication method', 'woocommerce'), array('code' => 500));
169
 
170
  return $user;
171
  }
@@ -320,7 +320,7 @@ class AfterShip_API_Server
320
  break;
321
  */
322
  default:
323
- return new WP_Error('aftership_api_unsupported_method', __('Unsupported request method', 'woocommerce'), array('status' => 400));
324
  }
325
 
326
  foreach ($this->get_routes() as $route => $handlers) {
@@ -337,7 +337,7 @@ class AfterShip_API_Server
337
  continue;
338
 
339
  if (!is_callable($callback))
340
- return new WP_Error('aftership_api_invalid_handler', __('The handler for the route is invalid', 'woocommerce'), array('status' => 500));
341
 
342
  $args = array_merge($args, $this->params['GET']);
343
  if ($method & self::METHOD_POST) {
@@ -372,7 +372,7 @@ class AfterShip_API_Server
372
  }
373
  }
374
 
375
- return new WP_Error('aftership_api_no_route', __('No route was found matching the URL and request method', 'woocommerce'), array('status' => 404));
376
  }
377
 
378
  /**
@@ -406,7 +406,7 @@ class AfterShip_API_Server
406
  $ordered_parameters[] = $param->getDefaultValue();
407
  } else {
408
  // We don't have this parameter and it wasn't optional, abort!
409
- return new WP_Error('aftership_api_missing_callback_param', sprintf(__('Missing parameter %s', 'woocommerce'), $param->getName()), array('status' => 400));
410
  }
411
  }
412
  return $ordered_parameters;
@@ -440,7 +440,7 @@ class AfterShip_API_Server
440
  'ssl_enabled' => ('yes' === get_option('aftership_force_ssl_checkout')),
441
  'permalinks_enabled' => ('' !== get_option('permalink_structure')),
442
  'links' => array(
443
- 'help' => 'http://woothemes.github.io/woocommerce/rest-api/',
444
  ),
445
  ),
446
  ));
165
 
166
  // WP_Errors are handled in serve_request()
167
  elseif (!is_wp_error($user))
168
+ $user = new WP_Error('aftership_api_authentication_error', __('Invalid authentication method', 'aftership'), array('code' => 500));
169
 
170
  return $user;
171
  }
320
  break;
321
  */
322
  default:
323
+ return new WP_Error('aftership_api_unsupported_method', __('Unsupported request method', 'aftership'), array('status' => 400));
324
  }
325
 
326
  foreach ($this->get_routes() as $route => $handlers) {
337
  continue;
338
 
339
  if (!is_callable($callback))
340
+ return new WP_Error('aftership_api_invalid_handler', __('The handler for the route is invalid', 'aftership'), array('status' => 500));
341
 
342
  $args = array_merge($args, $this->params['GET']);
343
  if ($method & self::METHOD_POST) {
372
  }
373
  }
374
 
375
+ return new WP_Error('aftership_api_no_route', __('No route was found matching the URL and request method', 'aftership'), array('status' => 404));
376
  }
377
 
378
  /**
406
  $ordered_parameters[] = $param->getDefaultValue();
407
  } else {
408
  // We don't have this parameter and it wasn't optional, abort!
409
+ return new WP_Error('aftership_api_missing_callback_param', sprintf(__('Missing parameter %s', 'aftership'), $param->getName()), array('status' => 400));
410
  }
411
  }
412
  return $ordered_parameters;
440
  'ssl_enabled' => ('yes' === get_option('aftership_force_ssl_checkout')),
441
  'permalinks_enabled' => ('' !== get_option('permalink_structure')),
442
  'links' => array(
443
+ 'help' => 'https://aftership.uservoice.com/knowledgebase',
444
  ),
445
  ),
446
  ));
class-aftership-settings.php CHANGED
@@ -12,6 +12,13 @@
12
 
13
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
 
 
 
 
 
 
 
 
15
  class AfterShip_Settings
16
  {
17
  /**
12
 
13
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
 
15
+ /**
16
+ * Required functions
17
+ */
18
+ if (!function_exists('is_woocommerce_active'))
19
+ require_once('woo-includes/woo-functions.php');
20
+
21
+
22
  class AfterShip_Settings
23
  {
24
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.aftership.com/
4
  Tags: shipping, tracking, ups, usps, fedex, dhl, tnt, dpd, post, shipment, woocommerce, tracking number, aftership, package tracking, fulfilment, tracking link, carrier, courier, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 3.9.2
7
- Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -93,6 +93,10 @@ You'll find the FAQ on [AfterShip.com](https://aftership.uservoice.com/knowledge
93
 
94
  == Changelog ==
95
 
 
 
 
 
96
  = 1.1.2 =
97
  * Updated the plugin name
98
 
4
  Tags: shipping, tracking, ups, usps, fedex, dhl, tnt, dpd, post, shipment, woocommerce, tracking number, aftership, package tracking, fulfilment, tracking link, carrier, courier, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 3.9.2
7
+ Stable tag: 1.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
93
 
94
  == Changelog ==
95
 
96
+ = 1.1.3 =
97
+ * Fix Bug - WC Dependency
98
+ * i18N change to AfterShip
99
+
100
  = 1.1.2 =
101
  * Updated the plugin name
102