AfterShip – WooCommerce Tracking - Version 1.11.3

Version Description

  • Fix some plugin conflict issue
Download this release

Release Info

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

Code changes from version 1.11.2 to 1.11.3

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.2
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.2' );
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.3
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.3' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
assets/js/setting.js CHANGED
@@ -1,4 +1,6 @@
1
  jQuery(function () {
 
 
2
  function set_aftership_tracking_provider(selected_couriers) {
3
  var couriers = sort_couriers(get_couriers());
4
  jQuery.each(couriers, function (key, courier) {
@@ -8,22 +10,22 @@ jQuery(function () {
8
  str += 'selected="selected"';
9
  }
10
  str += '>' + courier['name'] + '</option>';
11
- jQuery('#couriers_select').append(str);
12
  });
13
 
14
- jQuery('#couriers_select').val(selected_couriers);
15
- jQuery('#couriers_select').chosen();
16
- jQuery('#couriers_select').trigger('chosen:updated');
17
  }
18
 
19
- jQuery('#couriers_select').change(function () {
20
- var couriers_select = jQuery('#couriers_select').val();
21
  var value = (couriers_select) ? couriers_select.join(',') : '';
22
- jQuery('#couriers').val(value);
23
  });
24
 
25
- if (jQuery('#couriers')) {
26
- var couriers_select = jQuery('#couriers').val();
27
  var couriers_select_array = (couriers_select) ? couriers_select.split(',') : [];
28
  set_aftership_tracking_provider(couriers_select_array);
29
  }
1
  jQuery(function () {
2
+ var aftership_couriers_select = jQuery('#aftership_couriers_select');
3
+ var aftership_couriers = jQuery('#aftership_couriers');
4
  function set_aftership_tracking_provider(selected_couriers) {
5
  var couriers = sort_couriers(get_couriers());
6
  jQuery.each(couriers, function (key, courier) {
10
  str += 'selected="selected"';
11
  }
12
  str += '>' + courier['name'] + '</option>';
13
+ aftership_couriers_select.append(str);
14
  });
15
 
16
+ aftership_couriers_select.val(selected_couriers);
17
+ aftership_couriers_select.chosen();
18
+ aftership_couriers_select.trigger('chosen:updated');
19
  }
20
 
21
+ aftership_couriers_select.change(function () {
22
+ var couriers_select = aftership_couriers_select.val();
23
  var value = (couriers_select) ? couriers_select.join(',') : '';
24
+ aftership_couriers.val(value);
25
  });
26
 
27
+ if (aftership_couriers) {
28
+ var couriers_select = aftership_couriers.val();
29
  var couriers_select_array = (couriers_select) ? couriers_select.split(',') : [];
30
  set_aftership_tracking_provider(couriers_select_array);
31
  }
includes/class-aftership-settings.php CHANGED
@@ -1,26 +1,33 @@
1
  <?php
2
- /**
3
- * AfterShip Admin
4
- *
5
- * Handles AfterShip-Admin endpoint requests
6
- *
7
- * @author AfterShip
8
- * @category Admin
9
- * @package AfterShip
10
- * @since 1.0
11
- */
12
-
13
  if ( ! defined( 'ABSPATH' ) ) {
14
- exit; // Exit if accessed directly
15
  }
16
 
 
 
 
17
  class AfterShip_Settings {
18
 
19
  /**
20
  * Holds the values to be used in the fields callbacks
 
 
21
  */
22
  private $options;
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  /**
25
  * Start up
26
  */
@@ -32,10 +39,16 @@ class AfterShip_Settings {
32
  }
33
 
34
 
 
 
 
35
  public function admin_styles() {
36
  wp_enqueue_style( 'aftership_styles_chosen', aftership()->plugin_url . '/assets/plugin/chosen/chosen.min.css' );
37
  }
38
 
 
 
 
39
  public function library_scripts() {
40
  $plugin_url = aftership()->plugin_url;
41
  wp_enqueue_script( 'aftership_styles_chosen_jquery', $plugin_url . '/assets/plugin/chosen/chosen.jquery.min.js' );
@@ -49,7 +62,7 @@ class AfterShip_Settings {
49
  * Add options page
50
  */
51
  public function add_plugin_page() {
52
- // This page will be under "Settings"
53
  add_options_page(
54
  'AfterShip Settings Admin',
55
  'AfterShip',
@@ -63,7 +76,7 @@ class AfterShip_Settings {
63
  * Options page callback
64
  */
65
  public function create_admin_page() {
66
- // Set class property
67
  $this->options = get_option( 'aftership_option_name' );
68
  ?>
69
  <div class="wrap">
@@ -71,7 +84,7 @@ class AfterShip_Settings {
71
 
72
  <form method="post" action="options.php">
73
  <?php
74
- // This prints out all hidden setting fields
75
  settings_fields( 'aftership_option_group' );
76
  do_settings_sections( 'aftership-setting-admin' );
77
  submit_button();
@@ -86,20 +99,20 @@ class AfterShip_Settings {
86
  */
87
  public function page_init() {
88
  register_setting(
89
- 'aftership_option_group', // Option group
90
- 'aftership_option_name', // Option name
91
- array( $this, 'sanitize' ) // Sanitize
92
  );
93
 
94
  add_settings_section(
95
- 'aftership_setting_section_id', // ID
96
- '', // Title
97
- array( $this, 'print_section_info' ), // Callback
98
- 'aftership-setting-admin' // Page
99
  );
100
 
101
  add_settings_field(
102
- 'couriers',
103
  'Couriers',
104
  array( $this, 'couriers_callback' ),
105
  'aftership-setting-admin',
@@ -126,7 +139,7 @@ class AfterShip_Settings {
126
  /**
127
  * Sanitize each setting field as needed
128
  *
129
- * @param array $input Contains all settings fields as array keys
130
  * @return array
131
  */
132
  public function sanitize( $input ) {
@@ -151,21 +164,27 @@ class AfterShip_Settings {
151
  * Print the Section text
152
  */
153
  public function print_section_info() {
154
- // print 'Enter your settings below:';
155
  }
156
 
 
 
 
157
  public function couriers_callback() {
158
 
159
  $couriers = array();
160
  if ( isset( $this->options['couriers'] ) ) {
161
  $couriers = explode( ',', $this->options['couriers'] );
162
  }
163
- echo '<select data-placeholder="Please select couriers" id="couriers_select" multiple style="width:100%">';
164
  echo '</select>';
165
- echo '<input type="hidden" id="couriers" name="aftership_option_name[couriers]" value="' . implode( ',', $couriers ) . '"/>';
166
 
167
  }
168
 
 
 
 
169
  public function custom_domain_callback() {
170
  printf(
171
  '<input type="text" id="custom_domain" name="aftership_option_name[custom_domain]" value="%s" style="width:100%%">',
@@ -173,10 +192,13 @@ class AfterShip_Settings {
173
  );
174
  }
175
 
 
 
 
176
  public function track_button_callback() {
177
  printf(
178
  '<label><input type="checkbox" id="use_track_button" name="aftership_option_name[use_track_button]" %s>Use Track Button</label>',
179
- ( isset( $this->options['use_track_button'] ) && $this->options['use_track_button'] === true ) ? 'checked="checked"' : ''
180
  );
181
  }
182
  }
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
  }
5
 
6
+ /**
7
+ * AfterShip Settings
8
+ */
9
  class AfterShip_Settings {
10
 
11
  /**
12
  * Holds the values to be used in the fields callbacks
13
+ *
14
+ * @var array $options aftership options.
15
  */
16
  private $options;
17
 
18
+ /**
19
+ * DOM id for courier select element.
20
+ *
21
+ * @var string $dom_id_courier_select
22
+ */
23
+ private $dom_id_courier_select = 'aftership_couriers_select';
24
+ /**
25
+ * DOM id for hidden input couriers.
26
+ *
27
+ * @var string $dom_id_couriers
28
+ */
29
+ private $dom_id_couriers = 'aftership_couriers';
30
+
31
  /**
32
  * Start up
33
  */
39
  }
40
 
41
 
42
+ /**
43
+ * Inject css
44
+ */
45
  public function admin_styles() {
46
  wp_enqueue_style( 'aftership_styles_chosen', aftership()->plugin_url . '/assets/plugin/chosen/chosen.min.css' );
47
  }
48
 
49
+ /**
50
+ * Inject javascripts
51
+ */
52
  public function library_scripts() {
53
  $plugin_url = aftership()->plugin_url;
54
  wp_enqueue_script( 'aftership_styles_chosen_jquery', $plugin_url . '/assets/plugin/chosen/chosen.jquery.min.js' );
62
  * Add options page
63
  */
64
  public function add_plugin_page() {
65
+ // This page will be under "Settings".
66
  add_options_page(
67
  'AfterShip Settings Admin',
68
  'AfterShip',
76
  * Options page callback
77
  */
78
  public function create_admin_page() {
79
+ // Set class property.
80
  $this->options = get_option( 'aftership_option_name' );
81
  ?>
82
  <div class="wrap">
84
 
85
  <form method="post" action="options.php">
86
  <?php
87
+ // This prints out all hidden setting fields.
88
  settings_fields( 'aftership_option_group' );
89
  do_settings_sections( 'aftership-setting-admin' );
90
  submit_button();
99
  */
100
  public function page_init() {
101
  register_setting(
102
+ 'aftership_option_group',
103
+ 'aftership_option_name',
104
+ array( $this, 'sanitize' )
105
  );
106
 
107
  add_settings_section(
108
+ 'aftership_setting_section_id',
109
+ '',
110
+ array( $this, 'print_section_info' ),
111
+ 'aftership-setting-admin'
112
  );
113
 
114
  add_settings_field(
115
+ $this->dom_id_couriers,
116
  'Couriers',
117
  array( $this, 'couriers_callback' ),
118
  'aftership-setting-admin',
139
  /**
140
  * Sanitize each setting field as needed
141
  *
142
+ * @param array $input Contains all settings fields as array keys.
143
  * @return array
144
  */
145
  public function sanitize( $input ) {
164
  * Print the Section text
165
  */
166
  public function print_section_info() {
167
+ // print 'Enter your settings below:';.
168
  }
169
 
170
+ /**
171
+ * Call this func before shown on pages.
172
+ */
173
  public function couriers_callback() {
174
 
175
  $couriers = array();
176
  if ( isset( $this->options['couriers'] ) ) {
177
  $couriers = explode( ',', $this->options['couriers'] );
178
  }
179
+ echo '<select data-placeholder="Please select couriers" id="' . $this->dom_id_courier_select . '" multiple style="width:100%">';
180
  echo '</select>';
181
+ echo '<input type="hidden" id="' . $this->dom_id_couriers . '" name="aftership_option_name[couriers]" value="' . implode( ',', $couriers ) . '"/>';
182
 
183
  }
184
 
185
+ /**
186
+ * Call this func before shown on pages.
187
+ */
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%%">',
192
  );
193
  }
194
 
195
+ /**
196
+ * Call this func before shown on pages.
197
+ */
198
  public function track_button_callback() {
199
  printf(
200
  '<label><input type="checkbox" id="use_track_button" name="aftership_option_name[use_track_button]" %s>Use Track Button</label>',
201
+ ( isset( $this->options['use_track_button'] ) && true === $this->options['use_track_button'] ) ? 'checked="checked"' : ''
202
  );
203
  }
204
  }
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.2
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.2 =
99
  * Add new couriers
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.3
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.3 =
99
+ * Fix some plugin conflict issue
100
+
101
  = 1.11.2 =
102
  * Add new couriers
103