AfterShip – WooCommerce Tracking - Version 1.11.5

Version Description

  • Fix tracking button url issue.
Download this release

Release Info

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

Code changes from version 1.11.4 to 1.11.5

aftership-woocommerce-tracking.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ecommerce Order Tracking and Shipment Notifications - AfterShip
4
  Plugin URI: http://aftership.com/
5
  Description: Effortless order tracking synced from all shipping providers for your ecommerce customers. Include a branded tracking page and automated delivery notifications.
6
- Version: 1.11.4
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
- define( 'AFTERSHIP_VERSION', '1.11.4' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
3
  Plugin Name: Ecommerce Order Tracking and Shipment Notifications - AfterShip
4
  Plugin URI: http://aftership.com/
5
  Description: Effortless order tracking synced from all shipping providers for your ecommerce customers. Include a branded tracking page and automated delivery notifications.
6
+ Version: 1.11.5
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
+ define( 'AFTERSHIP_VERSION', '1.11.5' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
includes/api/v4/class-aftership-api-settings.php CHANGED
@@ -44,6 +44,22 @@ class AfterShip_API_V4_Settings extends AfterShip_API_Resource {
44
  return array( 'settings' => get_option( 'aftership_option_name' ) );
45
  }
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  /**
48
  * Update plugin settings.
49
  *
@@ -58,7 +74,7 @@ class AfterShip_API_V4_Settings extends AfterShip_API_Resource {
58
 
59
  if ( isset( $data['custom_domain'] ) && $data['custom_domain'] ) {
60
  if ( 'track.aftership.com' === $custom_domain || '' === $custom_domain ) {
61
- $options['custom_domain'] = $data['custom_domain'];
62
  }
63
  }
64
 
44
  return array( 'settings' => get_option( 'aftership_option_name' ) );
45
  }
46
 
47
+
48
+ /**
49
+ * Normalize custom domain.
50
+ *
51
+ * @param string $url input url.
52
+ * @return string
53
+ */
54
+ public function normalize_custom_domain( $url ) {
55
+ if ( filter_var( $url, FILTER_VALIDATE_URL ) === false ) {
56
+ return $url;
57
+
58
+ }
59
+ $domain = parse_url( $url, PHP_URL_HOST );
60
+ return $domain;
61
+ }
62
+
63
  /**
64
  * Update plugin settings.
65
  *
74
 
75
  if ( isset( $data['custom_domain'] ) && $data['custom_domain'] ) {
76
  if ( 'track.aftership.com' === $custom_domain || '' === $custom_domain ) {
77
+ $options['custom_domain'] = $this->normalize_custom_domain( $data['custom_domain'] );
78
  }
79
  }
80
 
includes/class-aftership-actions.php CHANGED
@@ -135,6 +135,34 @@ class AfterShip_Actions {
135
  return 'https://' . $custom_domain . "/${item['slug']}/${item['tracking_number']}";
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  * Show the meta box for shipment info on the order page
140
  */
@@ -143,6 +171,8 @@ class AfterShip_Actions {
143
 
144
  $this->convert_old_meta_in_order( $post->ID );
145
 
 
 
146
  $tracking_items = $this->get_tracking_items( $post->ID );
147
 
148
  echo '<div id="tracking-items">';
135
  return 'https://' . $custom_domain . "/${item['slug']}/${item['tracking_number']}";
136
  }
137
 
138
+ /**
139
+ * Normalize custom domain.
140
+ *
141
+ * @param string $url input url.
142
+ * @return string
143
+ */
144
+ public function normalize_custom_domain( $url ) {
145
+ if ( filter_var( $url, FILTER_VALIDATE_URL ) === false ) {
146
+ return $url;
147
+
148
+ }
149
+ $domain = parse_url( $url, PHP_URL_HOST );
150
+ return $domain;
151
+ }
152
+
153
+ /**
154
+ * Do some migrate staff
155
+ */
156
+ public function migrate() {
157
+ // CNT-7928
158
+ $options = get_option( 'aftership_option_name' );
159
+ $domain = $this->normalize_custom_domain( $options['custom_domain'] );
160
+ if ( $domain != $options['custom_domain'] ) {
161
+ $options['custom_domain'] = $domain;
162
+ update_option( 'aftership_option_name', $options );
163
+ }
164
+ }
165
+
166
  /**
167
  * Show the meta box for shipment info on the order page
168
  */
171
 
172
  $this->convert_old_meta_in_order( $post->ID );
173
 
174
+ $this->migrate();
175
+
176
  $tracking_items = $this->get_tracking_items( $post->ID );
177
 
178
  echo '<div id="tracking-items">';
includes/class-aftership-settings.php CHANGED
@@ -167,6 +167,21 @@ class AfterShip_Settings {
167
  // print 'Enter your settings below:';.
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  /**
171
  * Call this func before shown on pages.
172
  */
@@ -188,7 +203,7 @@ class AfterShip_Settings {
188
  public function custom_domain_callback() {
189
  printf(
190
  '<input type="text" id="custom_domain" name="aftership_option_name[custom_domain]" value="%s" style="width:100%%">',
191
- isset( $this->options['custom_domain'] ) ? $this->options['custom_domain'] : 'track.aftership.com'
192
  );
193
  }
194
 
167
  // print 'Enter your settings below:';.
168
  }
169
 
170
+ /**
171
+ * Normalize custom domain.
172
+ *
173
+ * @param string $url input url.
174
+ * @return string
175
+ */
176
+ public function normalize_custom_domain( $url ) {
177
+ if ( filter_var( $url, FILTER_VALIDATE_URL ) === false ) {
178
+ return $url;
179
+
180
+ }
181
+ $domain = parse_url( $url, PHP_URL_HOST );
182
+ return $domain;
183
+ }
184
+
185
  /**
186
  * Call this func before shown on pages.
187
  */
203
  public function custom_domain_callback() {
204
  printf(
205
  '<input type="text" id="custom_domain" name="aftership_option_name[custom_domain]" value="%s" style="width:100%%">',
206
+ isset( $this->options['custom_domain'] ) ? $this->normalize_custom_domain( $this->options['custom_domain'] ) : 'track.aftership.com'
207
  );
208
  }
209
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.aftership.com/
4
  Tags: ecommerce, shipping, shipment, order, ups, usps, fedex, dhl, tnt, dpd, post, carrier, courier, woocommerce, tracking number, aftership, package tracking, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 5.6
7
- Stable tag: 1.11.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -95,6 +95,9 @@ You'll find the FAQ on [AfterShip.com](https://aftership.uservoice.com/knowledge
95
 
96
  == Changelog ==
97
 
 
 
 
98
  = 1.11.4 =
99
  * Fix tracking missing when update plugin.
100
 
4
  Tags: ecommerce, shipping, shipment, order, ups, usps, fedex, dhl, tnt, dpd, post, carrier, courier, woocommerce, tracking number, aftership, package tracking, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 5.6
7
+ Stable tag: 1.11.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
95
 
96
  == Changelog ==
97
 
98
+ = 1.11.5 =
99
+ * Fix tracking button url issue.
100
+
101
  = 1.11.4 =
102
  * Fix tracking missing when update plugin.
103