WooCommerce Correios - Version 3.6.0

Version Description

  • 2017/11/19 =

  • Atualizado o valor mnimo declarado para 18 reais.

  • Melhorias gerais no cdigo base do plugin.

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce Correios
Version 3.6.0
Comparing to
See all releases

Code changes from version 3.5.1 to 3.6.0

assets/js/admin/open-tracking-code.js CHANGED
@@ -27,7 +27,7 @@ jQuery( function( $ ) {
27
  $( '#wc-correios-tracking__form' ).remove();
28
 
29
  var code = $( this ).text();
30
- var form = '<form id="wc-correios-tracking__form" method="post" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" target="_blank" style="display: none;">';
31
  form += '<input type="hidden" name="objetos" value="' + code + '" />';
32
  form += '</form>';
33
 
27
  $( '#wc-correios-tracking__form' ).remove();
28
 
29
  var code = $( this ).text();
30
+ var form = '<form id="wc-correios-tracking__form" method="post" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" target="_blank" rel="nofollow noopener noreferrer" style="display: none;">';
31
  form += '<input type="hidden" name="objetos" value="' + code + '" />';
32
  form += '</form>';
33
 
includes/admin/class-wc-correios-admin-orders.php CHANGED
@@ -65,7 +65,7 @@ class WC_Correios_Admin_Orders {
65
  if ( 'edit-shop_order' === $screen->id ) {
66
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
67
 
68
- wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_Correios::VERSION, true );
69
  }
70
  }
71
 
@@ -92,9 +92,9 @@ class WC_Correios_Admin_Orders {
92
  $tracking_codes = wc_correios_get_tracking_codes( $post->ID );
93
 
94
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
95
- wp_enqueue_style( 'woocommerce-correios-orders-admin', plugins_url( 'assets/css/admin/orders' . $suffix . '.css', WC_Correios::get_main_file() ), array(), WC_Correios::VERSION );
96
- wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_Correios::VERSION, true );
97
- wp_enqueue_script( 'woocommerce-correios-orders-admin', plugins_url( 'assets/js/admin/orders' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui', 'wp-util' ), WC_Correios::VERSION, true );
98
  wp_localize_script(
99
  'woocommerce-correios-orders-admin',
100
  'WCCorreiosAdminOrdersParams',
65
  if ( 'edit-shop_order' === $screen->id ) {
66
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
67
 
68
+ wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_CORREIOS_VERSION, true );
69
  }
70
  }
71
 
92
  $tracking_codes = wc_correios_get_tracking_codes( $post->ID );
93
 
94
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
95
+ wp_enqueue_style( 'woocommerce-correios-orders-admin', plugins_url( 'assets/css/admin/orders' . $suffix . '.css', WC_Correios::get_main_file() ), array(), WC_CORREIOS_VERSION );
96
+ wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_CORREIOS_VERSION, true );
97
+ wp_enqueue_script( 'woocommerce-correios-orders-admin', plugins_url( 'assets/js/admin/orders' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui', 'wp-util' ), WC_CORREIOS_VERSION, true );
98
  wp_localize_script(
99
  'woocommerce-correios-orders-admin',
100
  'WCCorreiosAdminOrdersParams',
includes/admin/views/html-admin-help-message.php CHANGED
@@ -11,7 +11,13 @@ if ( ! defined( 'ABSPATH' ) ) {
11
 
12
  if ( apply_filters( 'woocommerce_correios_help_message', true ) ) : ?>
13
  <div class="updated woocommerce-message inline">
14
- <p><?php echo esc_html( sprintf( __( 'Help us keep the %s plugin free making a donation or rate &#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!', 'woocommerce-correios' ), __( 'WooCommerce Correios', 'woocommerce-correios' ) ) ); ?></p>
15
- <p><a href="https://claudiosanches.com/doacoes/" target="_blank" class="button button-primary"><?php esc_html_e( 'Make a donation', 'woocommerce-correios' ); ?></a> <a href="https://wordpress.org/support/plugin/woocommerce-correios/reviews/?filter=5#new-post" target="_blank" class="button button-secondary"><?php esc_html_e( 'Make a review', 'woocommerce-correios' ); ?></a></p>
 
 
 
 
 
16
  </div>
17
- <?php endif;
 
11
 
12
  if ( apply_filters( 'woocommerce_correios_help_message', true ) ) : ?>
13
  <div class="updated woocommerce-message inline">
14
+ <p>
15
+ <?php
16
+ /* translators: %s: plugin name */
17
+ echo esc_html( sprintf( esc_html__( 'Help us keep the %s plugin free making a donation or rate &#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!', 'woocommerce-correios' ), __( 'WooCommerce Correios', 'woocommerce-correios' ) ) );
18
+ ?>
19
+ </p>
20
+ <p><a href="https://claudiosanches.com/doacoes/" target="_blank" rel="nofollow noopener noreferrer" class="button button-primary"><?php esc_html_e( 'Make a donation', 'woocommerce-correios' ); ?></a> <a href="https://wordpress.org/support/plugin/woocommerce-correios/reviews/?filter=5#new-post" target="_blank" class="button button-secondary"><?php esc_html_e( 'Make a review', 'woocommerce-correios' ); ?></a></p>
21
  </div>
22
+ <?php
23
+ endif;
includes/admin/views/html-admin-shipping-method-settings.php CHANGED
@@ -10,12 +10,13 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  }
11
 
12
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
13
- wp_enqueue_script( 'wc-correios', plugins_url( 'assets/js/admin/shipping-methods' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_Correios::VERSION, true );
14
 
15
 
16
  $description = $this->get_method_description();
17
 
18
  if ( ! empty( $this->more_link ) ) {
 
19
  $description .= ' <a href="' . esc_url( $this->more_link ) . '">' . esc_html( sprintf( __( 'More about %s.', 'woocommerce-correios' ), $this->method_title ) ) . '</a>';
20
  }
21
 
@@ -23,4 +24,4 @@ echo wp_kses_post( wpautop( $description ) );
23
 
24
  include dirname( __FILE__ ) . '/html-admin-help-message.php';
25
 
26
- echo $this->get_admin_options_html();
10
  }
11
 
12
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
13
+ wp_enqueue_script( 'wc-correios', plugins_url( 'assets/js/admin/shipping-methods' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_CORREIOS_VERSION, true );
14
 
15
 
16
  $description = $this->get_method_description();
17
 
18
  if ( ! empty( $this->more_link ) ) {
19
+ /* translators: %s: method title */
20
  $description .= ' <a href="' . esc_url( $this->more_link ) . '">' . esc_html( sprintf( __( 'More about %s.', 'woocommerce-correios' ), $this->method_title ) ) . '</a>';
21
  }
22
 
24
 
25
  include dirname( __FILE__ ) . '/html-admin-help-message.php';
26
 
27
+ echo $this->get_admin_options_html(); // // WPCS: XSS ok.
includes/class-wc-correios-autofill-addresses.php CHANGED
@@ -102,8 +102,8 @@ class WC_Correios_Autofill_Addresses {
102
  return null;
103
  }
104
 
105
- $table = $wpdb->prefix . self::$table;
106
- $address = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE postcode = %s;", $postcode ) );
107
 
108
  if ( is_wp_error( $address ) || is_null( $address ) ) {
109
  $address = self::fetch_address( $postcode );
@@ -164,7 +164,7 @@ class WC_Correios_Autofill_Addresses {
164
  $wpdb->prefix . self::$table,
165
  $address,
166
  array( '%s', '%s', '%s', '%s', '%s', '%s' )
167
- );
168
 
169
  return false !== $result;
170
  }
@@ -177,7 +177,7 @@ class WC_Correios_Autofill_Addresses {
177
  protected static function delete_address( $postcode ) {
178
  global $wpdb;
179
 
180
- $wpdb->delete( $wpdb->prefix . self::$table, array( 'postcode' => $postcode ), array( '%s' ) );
181
  }
182
 
183
  /**
@@ -207,10 +207,10 @@ class WC_Correios_Autofill_Addresses {
207
  $address = null;
208
 
209
  try {
210
- $soap = new WC_Correios_Soap_Client( self::get_tracking_addresses_webservice_url() );
211
- $response = $soap->consultaCEP( array( 'cep' => $postcode ) );
212
- $data = $response->return;
213
- $address = new stdClass;
214
 
215
  $address->postcode = $data->cep;
216
  $address->address = $data->end;
@@ -223,7 +223,7 @@ class WC_Correios_Autofill_Addresses {
223
  }
224
 
225
  if ( ! is_null( $address ) ) {
226
- self::logger( sprintf( 'Address for "%s" found successfully: %s', $postcode, print_r( $address, true ) ) );
227
  }
228
 
229
  return $address;
@@ -236,7 +236,7 @@ class WC_Correios_Autofill_Addresses {
236
  if ( is_checkout() || is_account_page() ) {
237
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
238
 
239
- wp_enqueue_script( 'woocommerce-correios-autofill-addresses', plugins_url( 'assets/js/frontend/autofill-address' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui' ), WC_Correios::VERSION, true );
240
 
241
  wp_localize_script(
242
  'woocommerce-correios-autofill-addresses',
@@ -253,12 +253,12 @@ class WC_Correios_Autofill_Addresses {
253
  * Ajax autofill endpoint.
254
  */
255
  public function ajax_autofill() {
256
- if ( empty( $_GET['postcode'] ) ) {
257
  wp_send_json_error( array( 'message' => __( 'Missing postcode paramater.', 'woocommerce-correios' ) ) );
258
  exit;
259
  }
260
 
261
- $postcode = wc_correios_sanitize_postcode( wp_unslash( $_GET['postcode'] ) );
262
 
263
  if ( empty( $postcode ) || 8 !== strlen( $postcode ) ) {
264
  wp_send_json_error( array( 'message' => __( 'Invalid postcode.', 'woocommerce-correios' ) ) );
@@ -299,7 +299,7 @@ class WC_Correios_Autofill_Addresses {
299
  global $wpdb;
300
 
301
  $charset_collate = $wpdb->get_charset_collate();
302
- $table_name = $wpdb->prefix . self::$table;
303
 
304
  $sql = "CREATE TABLE $table_name (
305
  ID bigint(20) NOT NULL auto_increment,
102
  return null;
103
  }
104
 
105
+ $table = $wpdb->prefix . self::$table;
106
+ $address = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE postcode = %s;", $postcode ) ); // @codingStandardsIgnoreLine
107
 
108
  if ( is_wp_error( $address ) || is_null( $address ) ) {
109
  $address = self::fetch_address( $postcode );
164
  $wpdb->prefix . self::$table,
165
  $address,
166
  array( '%s', '%s', '%s', '%s', '%s', '%s' )
167
+ ); // WPCS: db call ok, cache ok.
168
 
169
  return false !== $result;
170
  }
177
  protected static function delete_address( $postcode ) {
178
  global $wpdb;
179
 
180
+ $wpdb->delete( $wpdb->prefix . self::$table, array( 'postcode' => $postcode ), array( '%s' ) ); // WPCS: db call ok, cache ok.
181
  }
182
 
183
  /**
207
  $address = null;
208
 
209
  try {
210
+ $soap = new WC_Correios_Soap_Client( self::get_tracking_addresses_webservice_url() );
211
+ $response = $soap->consultaCEP( array( 'cep' => $postcode ) );
212
+ $data = $response->return;
213
+ $address = new stdClass();
214
 
215
  $address->postcode = $data->cep;
216
  $address->address = $data->end;
223
  }
224
 
225
  if ( ! is_null( $address ) ) {
226
+ self::logger( sprintf( 'Address for "%s" found successfully: %s', $postcode, print_r( $address, true ) ) ); // @codingStandardsIgnoreLine
227
  }
228
 
229
  return $address;
236
  if ( is_checkout() || is_account_page() ) {
237
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
238
 
239
+ wp_enqueue_script( 'woocommerce-correios-autofill-addresses', plugins_url( 'assets/js/frontend/autofill-address' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui' ), WC_CORREIOS_VERSION, true );
240
 
241
  wp_localize_script(
242
  'woocommerce-correios-autofill-addresses',
253
  * Ajax autofill endpoint.
254
  */
255
  public function ajax_autofill() {
256
+ if ( empty( $_GET['postcode'] ) ) { // WPCS: input var okay, CSRF ok.
257
  wp_send_json_error( array( 'message' => __( 'Missing postcode paramater.', 'woocommerce-correios' ) ) );
258
  exit;
259
  }
260
 
261
+ $postcode = wc_correios_sanitize_postcode( wp_unslash( $_GET['postcode'] ) ); // WPCS: input var okay, CSRF ok.
262
 
263
  if ( empty( $postcode ) || 8 !== strlen( $postcode ) ) {
264
  wp_send_json_error( array( 'message' => __( 'Invalid postcode.', 'woocommerce-correios' ) ) );
299
  global $wpdb;
300
 
301
  $charset_collate = $wpdb->get_charset_collate();
302
+ $table_name = $wpdb->prefix . self::$table;
303
 
304
  $sql = "CREATE TABLE $table_name (
305
  ID bigint(20) NOT NULL auto_increment,
includes/class-wc-correios-install.php CHANGED
@@ -29,7 +29,7 @@ class WC_Correios_Install {
29
  * Update version.
30
  */
31
  private static function update_version() {
32
- update_option( 'woocommerce_correios_version', WC_Correios::VERSION );
33
  }
34
 
35
  /**
@@ -41,7 +41,7 @@ class WC_Correios_Install {
41
  $version = self::get_version();
42
 
43
  if ( empty( $version ) ) {
44
- $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_correios_tracking_code' WHERE meta_key = 'correios_tracking';" );
45
  }
46
  }
47
 
@@ -49,7 +49,8 @@ class WC_Correios_Install {
49
  * Upgrade to 3.0.0 while using WooCommerce 2.6.0.
50
  */
51
  public static function upgrade_300_from_wc_260() {
52
- if ( $old_options = get_option( 'woocommerce_correios_settings' ) ) {
 
53
  if ( isset( $old_options['tracking_history'] ) ) {
54
  $integration_options = get_option( 'woocommerce_correios-integration_settings', array(
55
  'general_options' => '',
29
  * Update version.
30
  */
31
  private static function update_version() {
32
+ update_option( 'woocommerce_correios_version', WC_CORREIOS_VERSION );
33
  }
34
 
35
  /**
41
  $version = self::get_version();
42
 
43
  if ( empty( $version ) ) {
44
+ $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_correios_tracking_code' WHERE meta_key = 'correios_tracking';" ); // WPCS: db call ok, cache ok.
45
  }
46
  }
47
 
49
  * Upgrade to 3.0.0 while using WooCommerce 2.6.0.
50
  */
51
  public static function upgrade_300_from_wc_260() {
52
+ $old_options = get_option( 'woocommerce_correios_settings' );
53
+ if ( $old_options ) {
54
  if ( isset( $old_options['tracking_history'] ) ) {
55
  $integration_options = get_option( 'woocommerce_correios-integration_settings', array(
56
  'general_options' => '',
includes/class-wc-correios.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Correios
4
+ *
5
+ * @package WooCommerce_Correios/Classes
6
+ * @since 3.6.0
7
+ * @version 3.6.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * WooCommerce Correios main class.
16
+ */
17
+ class WC_Correios {
18
+
19
+ /**
20
+ * Initialize the plugin public actions.
21
+ */
22
+ public static function init() {
23
+ add_action( 'init', array( __CLASS__, 'load_plugin_textdomain' ), -1 );
24
+
25
+ // Checks with WooCommerce is installed.
26
+ if ( class_exists( 'WC_Integration' ) ) {
27
+ self::includes();
28
+
29
+ if ( is_admin() ) {
30
+ self::admin_includes();
31
+ }
32
+
33
+ add_filter( 'woocommerce_integrations', array( __CLASS__, 'include_integrations' ) );
34
+ add_filter( 'woocommerce_shipping_methods', array( __CLASS__, 'include_methods' ) );
35
+ add_filter( 'woocommerce_email_classes', array( __CLASS__, 'include_emails' ) );
36
+ } else {
37
+ add_action( 'admin_notices', array( __CLASS__, 'woocommerce_missing_notice' ) );
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Load the plugin text domain for translation.
43
+ */
44
+ public static function load_plugin_textdomain() {
45
+ load_plugin_textdomain( 'woocommerce-correios', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
46
+ }
47
+
48
+ /**
49
+ * Includes.
50
+ */
51
+ private static function includes() {
52
+ include_once dirname( __FILE__ ) . '/wc-correios-functions.php';
53
+ include_once dirname( __FILE__ ) . '/class-wc-correios-install.php';
54
+ include_once dirname( __FILE__ ) . '/class-wc-correios-package.php';
55
+ include_once dirname( __FILE__ ) . '/class-wc-correios-webservice.php';
56
+ include_once dirname( __FILE__ ) . '/class-wc-correios-webservice-international.php';
57
+ include_once dirname( __FILE__ ) . '/class-wc-correios-autofill-addresses.php';
58
+ include_once dirname( __FILE__ ) . '/class-wc-correios-tracking-history.php';
59
+ include_once dirname( __FILE__ ) . '/class-wc-correios-rest-api.php';
60
+
61
+ // Integration.
62
+ include_once dirname( __FILE__ ) . '/integrations/class-wc-correios-integration.php';
63
+
64
+ // Shipping methods.
65
+ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
66
+ include_once dirname( __FILE__ ) . '/abstracts/abstract-wc-correios-shipping.php';
67
+ include_once dirname( __FILE__ ) . '/abstracts/abstract-wc-correios-shipping-carta.php';
68
+ include_once dirname( __FILE__ ) . '/abstracts/abstract-wc-correios-shipping-impresso.php';
69
+ include_once dirname( __FILE__ ) . '/abstracts/abstract-wc-correios-shipping-international.php';
70
+ foreach ( glob( plugin_dir_path( __FILE__ ) . '/shipping/*.php' ) as $filename ) {
71
+ include_once $filename;
72
+ }
73
+
74
+ // Update settings to 3.0.0 when using WooCommerce 2.6.0.
75
+ WC_Correios_Install::upgrade_300_from_wc_260();
76
+ } else {
77
+ include_once dirname( __FILE__ ) . '/shipping/class-wc-correios-shipping-legacy.php';
78
+ }
79
+
80
+ // Update to 3.0.0.
81
+ WC_Correios_Install::upgrade_300();
82
+ }
83
+
84
+ /**
85
+ * Admin includes.
86
+ */
87
+ private static function admin_includes() {
88
+ include_once dirname( __FILE__ ) . '/admin/class-wc-correios-admin-orders.php';
89
+ }
90
+
91
+ /**
92
+ * Include Correios integration to WooCommerce.
93
+ *
94
+ * @param array $integrations Default integrations.
95
+ *
96
+ * @return array
97
+ */
98
+ public static function include_integrations( $integrations ) {
99
+ $integrations[] = 'WC_Correios_Integration';
100
+
101
+ return $integrations;
102
+ }
103
+
104
+ /**
105
+ * Include Correios shipping methods to WooCommerce.
106
+ *
107
+ * @param array $methods Default shipping methods.
108
+ *
109
+ * @return array
110
+ */
111
+ public static function include_methods( $methods ) {
112
+ // Legacy method.
113
+ $methods['correios-legacy'] = 'WC_Correios_Shipping_Legacy';
114
+
115
+ // New methods.
116
+ if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
117
+ $methods['correios-pac'] = 'WC_Correios_Shipping_PAC';
118
+ $methods['correios-sedex'] = 'WC_Correios_Shipping_SEDEX';
119
+ $methods['correios-sedex10-envelope'] = 'WC_Correios_Shipping_SEDEX_10_Envelope';
120
+ $methods['correios-sedex10-pacote'] = 'WC_Correios_Shipping_SEDEX_10_Pacote';
121
+ $methods['correios-sedex12'] = 'WC_Correios_Shipping_SEDEX_12';
122
+ $methods['correios-sedex-hoje'] = 'WC_Correios_Shipping_SEDEX_Hoje';
123
+ $methods['correios-esedex'] = 'WC_Correios_Shipping_ESEDEX';
124
+ $methods['correios-carta-registrada'] = 'WC_Correios_Shipping_Carta_Registrada';
125
+ $methods['correios-impresso-normal'] = 'WC_Correios_Shipping_Impresso_Normal';
126
+ $methods['correios-impresso-urgente'] = 'WC_Correios_Shipping_Impresso_Urgente';
127
+ $methods['correios-mercadoria-expressa'] = 'WC_Correios_Shipping_Mercadoria_Expressa';
128
+ $methods['correios-mercadoria-economica'] = 'WC_Correios_Shipping_Mercadoria_Economica';
129
+ $methods['correios-leve-internacional'] = 'WC_Correios_Shipping_Leve_Internacional';
130
+
131
+ $old_options = get_option( 'woocommerce_correios_settings' );
132
+ if ( empty( $old_options ) ) {
133
+ unset( $methods['correios-legacy'] );
134
+ }
135
+ }
136
+
137
+ return $methods;
138
+ }
139
+
140
+ /**
141
+ * Include emails.
142
+ *
143
+ * @param array $emails Default emails.
144
+ *
145
+ * @return array
146
+ */
147
+ public static function include_emails( $emails ) {
148
+ if ( ! isset( $emails['WC_Correios_Tracking_Email'] ) ) {
149
+ $emails['WC_Correios_Tracking_Email'] = include dirname( __FILE__ ) . '/emails/class-wc-correios-tracking-email.php';
150
+ }
151
+
152
+ return $emails;
153
+ }
154
+
155
+ /**
156
+ * WooCommerce fallback notice.
157
+ */
158
+ public static function woocommerce_missing_notice() {
159
+ include_once dirname( __FILE__ ) . '/admin/views/html-admin-missing-dependencies.php';
160
+ }
161
+
162
+ /**
163
+ * Get main file.
164
+ *
165
+ * @return string
166
+ */
167
+ public static function get_main_file() {
168
+ return WC_CORREIOS_PLUGIN_FILE;
169
+ }
170
+
171
+ /**
172
+ * Get plugin path.
173
+ *
174
+ * @return string
175
+ */
176
+ public static function get_plugin_path() {
177
+ return plugin_dir_path( WC_CORREIOS_PLUGIN_FILE );
178
+ }
179
+
180
+ /**
181
+ * Get templates path.
182
+ *
183
+ * @return string
184
+ */
185
+ public static function get_templates_path() {
186
+ return self::get_plugin_path() . 'templates/';
187
+ }
188
+ }
includes/integrations/class-wc-correios-integration.php CHANGED
@@ -67,58 +67,70 @@ class WC_Correios_Integration extends WC_Integration {
67
  */
68
  public function init_form_fields() {
69
  $this->form_fields = array(
70
- 'tracking' => array(
71
  'title' => __( 'Tracking History Table', 'woocommerce-correios' ),
72
  'type' => 'title',
73
  'description' => __( 'Displays a table with informations about the shipping in My Account > View Order page.', 'woocommerce-correios' ),
74
  ),
75
- 'tracking_enable' => array(
76
  'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
77
  'type' => 'checkbox',
78
  'label' => __( 'Enable Tracking History Table', 'woocommerce-correios' ),
79
  'default' => 'no',
80
  ),
81
- 'tracking_debug' => array(
82
  'title' => __( 'Debug Log', 'woocommerce-correios' ),
83
  'type' => 'checkbox',
84
  'label' => __( 'Enable logging for Tracking History', 'woocommerce-correios' ),
85
  'default' => 'no',
 
86
  'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), __( 'Tracking History Table', 'woocommerce-correios' ) ) . $this->get_tracking_log_link(),
87
  ),
88
- 'autofill_addresses' => array(
89
  'title' => __( 'Autofill Addresses', 'woocommerce-correios' ),
90
  'type' => 'title',
91
  'description' => __( 'Displays a table with informations about the shipping in My Account > View Order page.', 'woocommerce-correios' ),
92
  ),
93
- 'autofill_enable' => array(
94
  'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
95
  'type' => 'checkbox',
96
  'label' => __( 'Enable Autofill Addresses', 'woocommerce-correios' ),
97
  'default' => 'no',
98
  ),
99
- 'autofill_validity' => array(
100
  'title' => __( 'Postcodes Validity', 'woocommerce-correios' ),
101
  'type' => 'select',
102
  'default' => 'forever',
103
  'class' => 'wc-enhanced-select',
104
  'description' => __( 'Defines how long a postcode will stay saved in the database before a new query.', 'woocommerce-correios' ),
105
  'options' => array(
106
- '1' => __( '1 month', 'woocommerce-correios' ),
107
- '2' => sprintf( __( '%d month', 'woocommerce-correios' ), 2 ),
108
- '3' => sprintf( __( '%d month', 'woocommerce-correios' ), 3 ),
109
- '4' => sprintf( __( '%d month', 'woocommerce-correios' ), 4 ),
110
- '5' => sprintf( __( '%d month', 'woocommerce-correios' ), 5 ),
111
- '6' => sprintf( __( '%d month', 'woocommerce-correios' ), 6 ),
112
- '7' => sprintf( __( '%d month', 'woocommerce-correios' ), 7 ),
113
- '8' => sprintf( __( '%d month', 'woocommerce-correios' ), 8 ),
114
- '9' => sprintf( __( '%d month', 'woocommerce-correios' ), 9 ),
115
- '10' => sprintf( __( '%d month', 'woocommerce-correios' ), 10 ),
116
- '11' => sprintf( __( '%d month', 'woocommerce-correios' ), 11 ),
117
- '12' => sprintf( __( '%d month', 'woocommerce-correios' ), 12 ),
 
 
 
 
 
 
 
 
 
 
 
118
  'forever' => __( 'Forever', 'woocommerce-correios' ),
119
  ),
120
  ),
121
- 'autofill_force' => array(
122
  'title' => __( 'Force Autofill', 'woocommerce-correios' ),
123
  'type' => 'checkbox',
124
  'label' => __( 'Enable Force Autofill', 'woocommerce-correios' ),
@@ -131,11 +143,12 @@ class WC_Correios_Integration extends WC_Integration {
131
  'label' => __( 'Empty Database', 'woocommerce-correios' ),
132
  'description' => __( 'Delete all the saved postcodes in the database, use this option if you have issues with outdated postcodes.', 'woocommerce-correios' ),
133
  ),
134
- 'autofill_debug' => array(
135
  'title' => __( 'Debug Log', 'woocommerce-correios' ),
136
  'type' => 'checkbox',
137
  'label' => __( 'Enable logging for Autofill Addresses', 'woocommerce-correios' ),
138
  'default' => 'no',
 
139
  'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), __( 'Autofill Addresses', 'woocommerce-correios' ) ) . $this->get_tracking_log_link(),
140
  ),
141
  );
@@ -152,14 +165,15 @@ class WC_Correios_Integration extends WC_Integration {
152
 
153
  if ( class_exists( 'SoapClient' ) ) {
154
  echo '<div><input type="hidden" name="section" value="' . esc_attr( $this->id ) . '" /></div>';
155
- echo '<table class="form-table">' . $this->generate_settings_html( $this->get_form_fields(), false ) . '</table>';
156
  } else {
157
  $GLOBALS['hide_save_button'] = true; // Hide save button.
158
- echo '<div class="notice notice-error inline"><p>' . sprintf( __( 'It\'s required have installed the %s on your server in order to integrate with the services of the Correios!', 'woocommerce-correios' ), '<a href="https://secure.php.net/manual/book.soap.php" target="_blank">' . __( 'SOAP module', 'woocommerce-correios' ) . '</a>' ) . '</p></div>';
 
159
  }
160
 
161
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
162
- wp_enqueue_script( $this->id . '-admin', plugins_url( 'assets/js/admin/integration' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui' ), WC_Correios::VERSION, true );
163
  wp_localize_script(
164
  $this->id . '-admin',
165
  'WCCorreiosIntegrationAdminParams',
@@ -173,8 +187,8 @@ class WC_Correios_Integration extends WC_Integration {
173
  /**
174
  * Generate Button Input HTML.
175
  *
176
- * @param string $key
177
- * @param array $data
178
  * @return string
179
  */
180
  public function generate_button_html( $key, $data ) {
@@ -193,13 +207,13 @@ class WC_Correios_Integration extends WC_Integration {
193
  <tr valign="top">
194
  <th scope="row" class="titledesc">
195
  <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
196
- <?php echo $this->get_tooltip_html( $data ); ?>
197
  </th>
198
  <td class="forminp">
199
  <fieldset>
200
  <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
201
  <button class="button-secondary" type="button" id="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['label'] ); ?></button>
202
- <?php echo $this->get_description_html( $data ); ?>
203
  </fieldset>
204
  </td>
205
  </tr>
@@ -268,18 +282,18 @@ class WC_Correios_Integration extends WC_Integration {
268
  public function ajax_empty_database() {
269
  global $wpdb;
270
 
271
- if ( ! isset( $_POST['nonce'] ) ) {
272
  wp_send_json_error( array( 'message' => __( 'Missing parameters!', 'woocommerce-correios' ) ) );
273
  exit;
274
  }
275
 
276
- if ( ! wp_verify_nonce( $_POST['nonce'], 'woocommerce_correios_autofill_addresses_nonce' ) ) {
277
  wp_send_json_error( array( 'message' => __( 'Invalid nonce!', 'woocommerce-correios' ) ) );
278
  exit;
279
  }
280
 
281
  $table_name = $wpdb->prefix . WC_Correios_Autofill_Addresses::$table;
282
- $wpdb->query( "DROP TABLE IF EXISTS $table_name;" );
283
 
284
  WC_Correios_Autofill_Addresses::create_database();
285
 
67
  */
68
  public function init_form_fields() {
69
  $this->form_fields = array(
70
+ 'tracking' => array(
71
  'title' => __( 'Tracking History Table', 'woocommerce-correios' ),
72
  'type' => 'title',
73
  'description' => __( 'Displays a table with informations about the shipping in My Account > View Order page.', 'woocommerce-correios' ),
74
  ),
75
+ 'tracking_enable' => array(
76
  'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
77
  'type' => 'checkbox',
78
  'label' => __( 'Enable Tracking History Table', 'woocommerce-correios' ),
79
  'default' => 'no',
80
  ),
81
+ 'tracking_debug' => array(
82
  'title' => __( 'Debug Log', 'woocommerce-correios' ),
83
  'type' => 'checkbox',
84
  'label' => __( 'Enable logging for Tracking History', 'woocommerce-correios' ),
85
  'default' => 'no',
86
+ /* translators: %s: log link */
87
  'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), __( 'Tracking History Table', 'woocommerce-correios' ) ) . $this->get_tracking_log_link(),
88
  ),
89
+ 'autofill_addresses' => array(
90
  'title' => __( 'Autofill Addresses', 'woocommerce-correios' ),
91
  'type' => 'title',
92
  'description' => __( 'Displays a table with informations about the shipping in My Account > View Order page.', 'woocommerce-correios' ),
93
  ),
94
+ 'autofill_enable' => array(
95
  'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
96
  'type' => 'checkbox',
97
  'label' => __( 'Enable Autofill Addresses', 'woocommerce-correios' ),
98
  'default' => 'no',
99
  ),
100
+ 'autofill_validity' => array(
101
  'title' => __( 'Postcodes Validity', 'woocommerce-correios' ),
102
  'type' => 'select',
103
  'default' => 'forever',
104
  'class' => 'wc-enhanced-select',
105
  'description' => __( 'Defines how long a postcode will stay saved in the database before a new query.', 'woocommerce-correios' ),
106
  'options' => array(
107
+ '1' => __( '1 month', 'woocommerce-correios' ),
108
+ /* translators: %s number of months */
109
+ '2' => sprintf( __( '%d months', 'woocommerce-correios' ), 2 ),
110
+ /* translators: %s number of months */
111
+ '3' => sprintf( __( '%d months', 'woocommerce-correios' ), 3 ),
112
+ /* translators: %s number of months */
113
+ '4' => sprintf( __( '%d months', 'woocommerce-correios' ), 4 ),
114
+ /* translators: %s number of months */
115
+ '5' => sprintf( __( '%d months', 'woocommerce-correios' ), 5 ),
116
+ /* translators: %s number of months */
117
+ '6' => sprintf( __( '%d months', 'woocommerce-correios' ), 6 ),
118
+ /* translators: %s number of months */
119
+ '7' => sprintf( __( '%d months', 'woocommerce-correios' ), 7 ),
120
+ /* translators: %s number of months */
121
+ '8' => sprintf( __( '%d months', 'woocommerce-correios' ), 8 ),
122
+ /* translators: %s number of months */
123
+ '9' => sprintf( __( '%d months', 'woocommerce-correios' ), 9 ),
124
+ /* translators: %s number of months */
125
+ '10' => sprintf( __( '%d months', 'woocommerce-correios' ), 10 ),
126
+ /* translators: %s number of months */
127
+ '11' => sprintf( __( '%d months', 'woocommerce-correios' ), 11 ),
128
+ /* translators: %s number of months */
129
+ '12' => sprintf( __( '%d months', 'woocommerce-correios' ), 12 ),
130
  'forever' => __( 'Forever', 'woocommerce-correios' ),
131
  ),
132
  ),
133
+ 'autofill_force' => array(
134
  'title' => __( 'Force Autofill', 'woocommerce-correios' ),
135
  'type' => 'checkbox',
136
  'label' => __( 'Enable Force Autofill', 'woocommerce-correios' ),
143
  'label' => __( 'Empty Database', 'woocommerce-correios' ),
144
  'description' => __( 'Delete all the saved postcodes in the database, use this option if you have issues with outdated postcodes.', 'woocommerce-correios' ),
145
  ),
146
+ 'autofill_debug' => array(
147
  'title' => __( 'Debug Log', 'woocommerce-correios' ),
148
  'type' => 'checkbox',
149
  'label' => __( 'Enable logging for Autofill Addresses', 'woocommerce-correios' ),
150
  'default' => 'no',
151
+ /* translators: %s: log link */
152
  'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), __( 'Autofill Addresses', 'woocommerce-correios' ) ) . $this->get_tracking_log_link(),
153
  ),
154
  );
165
 
166
  if ( class_exists( 'SoapClient' ) ) {
167
  echo '<div><input type="hidden" name="section" value="' . esc_attr( $this->id ) . '" /></div>';
168
+ echo '<table class="form-table">' . $this->generate_settings_html( $this->get_form_fields(), false ) . '</table>'; // WPCS: XSS ok.
169
  } else {
170
  $GLOBALS['hide_save_button'] = true; // Hide save button.
171
+ /* translators: %s: SOAP documentation link */
172
+ echo '<div class="notice notice-error inline"><p>' . sprintf( esc_html__( 'It\'s required have installed the %s on your server in order to integrate with the services of the Correios!', 'woocommerce-correios' ), '<a href="https://secure.php.net/manual/book.soap.php" target="_blank" rel="nofollow noopener noreferrer">' . esc_html__( 'SOAP module', 'woocommerce-correios' ) . '</a>' ) . '</p></div>';
173
  }
174
 
175
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
176
+ wp_enqueue_script( $this->id . '-admin', plugins_url( 'assets/js/admin/integration' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui' ), WC_CORREIOS_VERSION, true );
177
  wp_localize_script(
178
  $this->id . '-admin',
179
  'WCCorreiosIntegrationAdminParams',
187
  /**
188
  * Generate Button Input HTML.
189
  *
190
+ * @param string $key Input key.
191
+ * @param array $data Input data.
192
  * @return string
193
  */
194
  public function generate_button_html( $key, $data ) {
207
  <tr valign="top">
208
  <th scope="row" class="titledesc">
209
  <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
210
+ <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?>
211
  </th>
212
  <td class="forminp">
213
  <fieldset>
214
  <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
215
  <button class="button-secondary" type="button" id="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['label'] ); ?></button>
216
+ <?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?>
217
  </fieldset>
218
  </td>
219
  </tr>
282
  public function ajax_empty_database() {
283
  global $wpdb;
284
 
285
+ if ( ! isset( $_POST['nonce'] ) ) { // WPCS: input var okay, CSRF ok.
286
  wp_send_json_error( array( 'message' => __( 'Missing parameters!', 'woocommerce-correios' ) ) );
287
  exit;
288
  }
289
 
290
+ if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'woocommerce_correios_autofill_addresses_nonce' ) ) { // WPCS: input var okay, CSRF ok.
291
  wp_send_json_error( array( 'message' => __( 'Invalid nonce!', 'woocommerce-correios' ) ) );
292
  exit;
293
  }
294
 
295
  $table_name = $wpdb->prefix . WC_Correios_Autofill_Addresses::$table;
296
+ $wpdb->query( "DROP TABLE IF EXISTS $table_name;" ); // @codingStandardsIgnoreLine
297
 
298
  WC_Correios_Autofill_Addresses::create_database();
299
 
includes/shipping/{class-wc-correios-shipping-sedex10-envelope.php → class-wc-correios-shipping-sedex-10-envelope.php} RENAMED
@@ -44,7 +44,7 @@ class WC_Correios_Shipping_SEDEX_10_Envelope extends WC_Correios_Shipping {
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
- if ( 16 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
+ if ( 18 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
includes/shipping/{class-wc-correios-shipping-sedex10-pacote.php → class-wc-correios-shipping-sedex-10-pacote.php} RENAMED
@@ -44,7 +44,7 @@ class WC_Correios_Shipping_SEDEX_10_Pacote extends WC_Correios_Shipping {
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
- if ( 16 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
+ if ( 18 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
includes/shipping/{class-wc-correios-shipping-sedex12.php → class-wc-correios-shipping-sedex-12.php} RENAMED
@@ -44,7 +44,7 @@ class WC_Correios_Shipping_SEDEX_12 extends WC_Correios_Shipping {
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
- if ( 16 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
+ if ( 18 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
includes/shipping/class-wc-correios-shipping-sedex-hoje.php CHANGED
@@ -44,7 +44,7 @@ class WC_Correios_Shipping_SEDEX_Hoje extends WC_Correios_Shipping {
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
- if ( 16 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
44
  * @return float
45
  */
46
  protected function get_declared_value( $package ) {
47
+ if ( 18 >= $package['contents_cost'] ) {
48
  return 0;
49
  }
50
 
includes/shipping/class-wc-correios-shipping-sedex.php CHANGED
@@ -52,7 +52,7 @@ class WC_Correios_Shipping_SEDEX extends WC_Correios_Shipping {
52
  * @return float
53
  */
54
  protected function get_declared_value( $package ) {
55
- if ( 16 >= $package['contents_cost'] ) {
56
  return 0;
57
  }
58
 
52
  * @return float
53
  */
54
  protected function get_declared_value( $package ) {
55
+ if ( 18 >= $package['contents_cost'] ) {
56
  return 0;
57
  }
58
 
languages/woocommerce-correios.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Correios 3.5.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-correios\n"
8
- "POT-Creation-Date: 2017-10-26 23:40:49+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -30,7 +30,7 @@ msgstr ""
30
  #: includes/abstracts/abstract-wc-correios-shipping.php:125
31
  #: includes/emails/class-wc-correios-tracking-email.php:50
32
  #: includes/integrations/class-wc-correios-integration.php:76
33
- #: includes/integrations/class-wc-correios-integration.php:94
34
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
35
  msgid "Enable/Disable"
36
  msgstr ""
@@ -190,7 +190,7 @@ msgstr ""
190
  #: includes/abstracts/abstract-wc-correios-shipping-international.php:132
191
  #: includes/abstracts/abstract-wc-correios-shipping.php:292
192
  #: includes/integrations/class-wc-correios-integration.php:82
193
- #: includes/integrations/class-wc-correios-integration.php:135
194
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
195
  msgid "Debug Log"
196
  msgstr ""
@@ -207,8 +207,9 @@ msgstr ""
207
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:210
208
  #: includes/abstracts/abstract-wc-correios-shipping-international.php:136
209
  #: includes/abstracts/abstract-wc-correios-shipping.php:296
210
- #: includes/integrations/class-wc-correios-integration.php:86
211
- #: includes/integrations/class-wc-correios-integration.php:139
 
212
  msgid "Log %s events, such as WebServices requests."
213
  msgstr ""
214
 
@@ -414,7 +415,8 @@ msgstr ""
414
  msgid "Are you sure you want to remove this tracking code?"
415
  msgstr ""
416
 
417
- #: includes/admin/views/html-admin-help-message.php:14
 
418
  msgid ""
419
  "Help us keep the %s plugin free making a donation or rate "
420
  "&#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!"
@@ -424,11 +426,11 @@ msgstr ""
424
  msgid "WooCommerce Correios"
425
  msgstr ""
426
 
427
- #: includes/admin/views/html-admin-help-message.php:15
428
  msgid "Make a donation"
429
  msgstr ""
430
 
431
- #: includes/admin/views/html-admin-help-message.php:15
432
  msgid "Make a review"
433
  msgstr ""
434
 
@@ -444,7 +446,8 @@ msgstr ""
444
  msgid "Install WooCommerce"
445
  msgstr ""
446
 
447
- #: includes/admin/views/html-admin-shipping-method-settings.php:19
 
448
  msgid "More about %s."
449
  msgstr ""
450
 
@@ -581,12 +584,12 @@ msgid "Correios"
581
  msgstr ""
582
 
583
  #: includes/integrations/class-wc-correios-integration.php:71
584
- #: includes/integrations/class-wc-correios-integration.php:86
585
  msgid "Tracking History Table"
586
  msgstr ""
587
 
588
  #: includes/integrations/class-wc-correios-integration.php:73
589
- #: includes/integrations/class-wc-correios-integration.php:91
590
  msgid ""
591
  "Displays a table with informations about the shipping in My Account > View "
592
  "Order page."
@@ -600,99 +603,101 @@ msgstr ""
600
  msgid "Enable logging for Tracking History"
601
  msgstr ""
602
 
603
- #: includes/integrations/class-wc-correios-integration.php:89
604
- #: includes/integrations/class-wc-correios-integration.php:139
605
  msgid "Autofill Addresses"
606
  msgstr ""
607
 
608
- #: includes/integrations/class-wc-correios-integration.php:96
609
  msgid "Enable Autofill Addresses"
610
  msgstr ""
611
 
612
- #: includes/integrations/class-wc-correios-integration.php:100
613
  msgid "Postcodes Validity"
614
  msgstr ""
615
 
616
- #: includes/integrations/class-wc-correios-integration.php:104
617
  msgid ""
618
  "Defines how long a postcode will stay saved in the database before a new "
619
  "query."
620
  msgstr ""
621
 
622
- #: includes/integrations/class-wc-correios-integration.php:106
623
  msgid "1 month"
624
  msgstr ""
625
 
626
- #: includes/integrations/class-wc-correios-integration.php:107
627
- #: includes/integrations/class-wc-correios-integration.php:108
628
  #: includes/integrations/class-wc-correios-integration.php:109
629
- #: includes/integrations/class-wc-correios-integration.php:110
630
  #: includes/integrations/class-wc-correios-integration.php:111
631
- #: includes/integrations/class-wc-correios-integration.php:112
632
  #: includes/integrations/class-wc-correios-integration.php:113
633
- #: includes/integrations/class-wc-correios-integration.php:114
634
  #: includes/integrations/class-wc-correios-integration.php:115
635
- #: includes/integrations/class-wc-correios-integration.php:116
636
  #: includes/integrations/class-wc-correios-integration.php:117
637
- msgid "%d month"
 
 
 
 
 
 
 
638
  msgstr ""
639
 
640
- #: includes/integrations/class-wc-correios-integration.php:118
641
  msgid "Forever"
642
  msgstr ""
643
 
644
- #: includes/integrations/class-wc-correios-integration.php:122
645
  msgid "Force Autofill"
646
  msgstr ""
647
 
648
- #: includes/integrations/class-wc-correios-integration.php:124
649
  msgid "Enable Force Autofill"
650
  msgstr ""
651
 
652
- #: includes/integrations/class-wc-correios-integration.php:125
653
  msgid ""
654
  "When enabled will autofill all addresses after the user finish to fill the "
655
  "postcode, even if the addresses are already filled."
656
  msgstr ""
657
 
658
- #: includes/integrations/class-wc-correios-integration.php:129
659
- #: includes/integrations/class-wc-correios-integration.php:131
660
  msgid "Empty Database"
661
  msgstr ""
662
 
663
- #: includes/integrations/class-wc-correios-integration.php:132
664
  msgid ""
665
  "Delete all the saved postcodes in the database, use this option if you have "
666
  "issues with outdated postcodes."
667
  msgstr ""
668
 
669
- #: includes/integrations/class-wc-correios-integration.php:137
670
  msgid "Enable logging for Autofill Addresses"
671
  msgstr ""
672
 
673
- #: includes/integrations/class-wc-correios-integration.php:158
 
674
  msgid ""
675
  "It's required have installed the %s on your server in order to integrate "
676
  "with the services of the Correios!"
677
  msgstr ""
678
 
679
- #: includes/integrations/class-wc-correios-integration.php:158
680
  msgid "SOAP module"
681
  msgstr ""
682
 
683
- #: includes/integrations/class-wc-correios-integration.php:167
684
  msgid "Are you sure you want to delete all postcodes from the database?"
685
  msgstr ""
686
 
687
- #: includes/integrations/class-wc-correios-integration.php:272
688
  msgid "Missing parameters!"
689
  msgstr ""
690
 
691
- #: includes/integrations/class-wc-correios-integration.php:277
692
  msgid "Invalid nonce!"
693
  msgstr ""
694
 
695
- #: includes/integrations/class-wc-correios-integration.php:286
696
  msgid "Postcode database emptied successfully!"
697
  msgstr ""
698
 
@@ -871,15 +876,15 @@ msgstr ""
871
  msgid "Mercadoria Expressa"
872
  msgstr ""
873
 
874
- #: includes/shipping/class-wc-correios-shipping-sedex10-envelope.php:34
875
  msgid "SEDEX 10 Envelope"
876
  msgstr ""
877
 
878
- #: includes/shipping/class-wc-correios-shipping-sedex10-pacote.php:34
879
  msgid "SEDEX 10 Pacote"
880
  msgstr ""
881
 
882
- #: includes/shipping/class-wc-correios-shipping-sedex12.php:34
883
  msgid "SEDEX 12"
884
  msgstr ""
885
 
@@ -922,7 +927,7 @@ msgid "For your reference, your order details are shown below."
922
  msgstr ""
923
 
924
  #: templates/myaccount/tracking-codes.php:25
925
- #: templates/myaccount/tracking-history-table.php:48
926
  msgid "Query on Correios"
927
  msgstr ""
928
 
@@ -942,7 +947,8 @@ msgstr ""
942
  msgid "Status"
943
  msgstr ""
944
 
945
- #: templates/myaccount/tracking-history-table.php:34
 
946
  msgid "In transit to %s"
947
  msgstr ""
948
 
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Correios 3.6.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-correios\n"
8
+ "POT-Creation-Date: 2017-11-20 00:05:06+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
30
  #: includes/abstracts/abstract-wc-correios-shipping.php:125
31
  #: includes/emails/class-wc-correios-tracking-email.php:50
32
  #: includes/integrations/class-wc-correios-integration.php:76
33
+ #: includes/integrations/class-wc-correios-integration.php:95
34
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
35
  msgid "Enable/Disable"
36
  msgstr ""
190
  #: includes/abstracts/abstract-wc-correios-shipping-international.php:132
191
  #: includes/abstracts/abstract-wc-correios-shipping.php:292
192
  #: includes/integrations/class-wc-correios-integration.php:82
193
+ #: includes/integrations/class-wc-correios-integration.php:147
194
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
195
  msgid "Debug Log"
196
  msgstr ""
207
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:210
208
  #: includes/abstracts/abstract-wc-correios-shipping-international.php:136
209
  #: includes/abstracts/abstract-wc-correios-shipping.php:296
210
+ #: includes/integrations/class-wc-correios-integration.php:87
211
+ #: includes/integrations/class-wc-correios-integration.php:152
212
+ #. translators: %s: log link
213
  msgid "Log %s events, such as WebServices requests."
214
  msgstr ""
215
 
415
  msgid "Are you sure you want to remove this tracking code?"
416
  msgstr ""
417
 
418
+ #: includes/admin/views/html-admin-help-message.php:17
419
+ #. translators: %s: plugin name
420
  msgid ""
421
  "Help us keep the %s plugin free making a donation or rate "
422
  "&#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!"
426
  msgid "WooCommerce Correios"
427
  msgstr ""
428
 
429
+ #: includes/admin/views/html-admin-help-message.php:20
430
  msgid "Make a donation"
431
  msgstr ""
432
 
433
+ #: includes/admin/views/html-admin-help-message.php:20
434
  msgid "Make a review"
435
  msgstr ""
436
 
446
  msgid "Install WooCommerce"
447
  msgstr ""
448
 
449
+ #: includes/admin/views/html-admin-shipping-method-settings.php:20
450
+ #. translators: %s: method title
451
  msgid "More about %s."
452
  msgstr ""
453
 
584
  msgstr ""
585
 
586
  #: includes/integrations/class-wc-correios-integration.php:71
587
+ #: includes/integrations/class-wc-correios-integration.php:87
588
  msgid "Tracking History Table"
589
  msgstr ""
590
 
591
  #: includes/integrations/class-wc-correios-integration.php:73
592
+ #: includes/integrations/class-wc-correios-integration.php:92
593
  msgid ""
594
  "Displays a table with informations about the shipping in My Account > View "
595
  "Order page."
603
  msgid "Enable logging for Tracking History"
604
  msgstr ""
605
 
606
+ #: includes/integrations/class-wc-correios-integration.php:90
607
+ #: includes/integrations/class-wc-correios-integration.php:152
608
  msgid "Autofill Addresses"
609
  msgstr ""
610
 
611
+ #: includes/integrations/class-wc-correios-integration.php:97
612
  msgid "Enable Autofill Addresses"
613
  msgstr ""
614
 
615
+ #: includes/integrations/class-wc-correios-integration.php:101
616
  msgid "Postcodes Validity"
617
  msgstr ""
618
 
619
+ #: includes/integrations/class-wc-correios-integration.php:105
620
  msgid ""
621
  "Defines how long a postcode will stay saved in the database before a new "
622
  "query."
623
  msgstr ""
624
 
625
+ #: includes/integrations/class-wc-correios-integration.php:107
626
  msgid "1 month"
627
  msgstr ""
628
 
 
 
629
  #: includes/integrations/class-wc-correios-integration.php:109
 
630
  #: includes/integrations/class-wc-correios-integration.php:111
 
631
  #: includes/integrations/class-wc-correios-integration.php:113
 
632
  #: includes/integrations/class-wc-correios-integration.php:115
 
633
  #: includes/integrations/class-wc-correios-integration.php:117
634
+ #: includes/integrations/class-wc-correios-integration.php:119
635
+ #: includes/integrations/class-wc-correios-integration.php:121
636
+ #: includes/integrations/class-wc-correios-integration.php:123
637
+ #: includes/integrations/class-wc-correios-integration.php:125
638
+ #: includes/integrations/class-wc-correios-integration.php:127
639
+ #: includes/integrations/class-wc-correios-integration.php:129
640
+ #. translators: %s number of months
641
+ msgid "%d months"
642
  msgstr ""
643
 
644
+ #: includes/integrations/class-wc-correios-integration.php:130
645
  msgid "Forever"
646
  msgstr ""
647
 
648
+ #: includes/integrations/class-wc-correios-integration.php:134
649
  msgid "Force Autofill"
650
  msgstr ""
651
 
652
+ #: includes/integrations/class-wc-correios-integration.php:136
653
  msgid "Enable Force Autofill"
654
  msgstr ""
655
 
656
+ #: includes/integrations/class-wc-correios-integration.php:137
657
  msgid ""
658
  "When enabled will autofill all addresses after the user finish to fill the "
659
  "postcode, even if the addresses are already filled."
660
  msgstr ""
661
 
662
+ #: includes/integrations/class-wc-correios-integration.php:141
663
+ #: includes/integrations/class-wc-correios-integration.php:143
664
  msgid "Empty Database"
665
  msgstr ""
666
 
667
+ #: includes/integrations/class-wc-correios-integration.php:144
668
  msgid ""
669
  "Delete all the saved postcodes in the database, use this option if you have "
670
  "issues with outdated postcodes."
671
  msgstr ""
672
 
673
+ #: includes/integrations/class-wc-correios-integration.php:149
674
  msgid "Enable logging for Autofill Addresses"
675
  msgstr ""
676
 
677
+ #: includes/integrations/class-wc-correios-integration.php:172
678
+ #. translators: %s: SOAP documentation link
679
  msgid ""
680
  "It's required have installed the %s on your server in order to integrate "
681
  "with the services of the Correios!"
682
  msgstr ""
683
 
684
+ #: includes/integrations/class-wc-correios-integration.php:172
685
  msgid "SOAP module"
686
  msgstr ""
687
 
688
+ #: includes/integrations/class-wc-correios-integration.php:181
689
  msgid "Are you sure you want to delete all postcodes from the database?"
690
  msgstr ""
691
 
692
+ #: includes/integrations/class-wc-correios-integration.php:286
693
  msgid "Missing parameters!"
694
  msgstr ""
695
 
696
+ #: includes/integrations/class-wc-correios-integration.php:291
697
  msgid "Invalid nonce!"
698
  msgstr ""
699
 
700
+ #: includes/integrations/class-wc-correios-integration.php:300
701
  msgid "Postcode database emptied successfully!"
702
  msgstr ""
703
 
876
  msgid "Mercadoria Expressa"
877
  msgstr ""
878
 
879
+ #: includes/shipping/class-wc-correios-shipping-sedex-10-envelope.php:34
880
  msgid "SEDEX 10 Envelope"
881
  msgstr ""
882
 
883
+ #: includes/shipping/class-wc-correios-shipping-sedex-10-pacote.php:34
884
  msgid "SEDEX 10 Pacote"
885
  msgstr ""
886
 
887
+ #: includes/shipping/class-wc-correios-shipping-sedex-12.php:34
888
  msgid "SEDEX 12"
889
  msgstr ""
890
 
927
  msgstr ""
928
 
929
  #: templates/myaccount/tracking-codes.php:25
930
+ #: templates/myaccount/tracking-history-table.php:51
931
  msgid "Query on Correios"
932
  msgstr ""
933
 
947
  msgid "Status"
948
  msgstr ""
949
 
950
+ #: templates/myaccount/tracking-history-table.php:36
951
+ #. translators: %s: address
952
  msgid "In transit to %s"
953
  msgstr ""
954
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://claudiosanches.com/doacoes/
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
- Stable tag: 3.5.1
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -204,6 +204,11 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
204
 
205
  == Changelog ==
206
 
 
 
 
 
 
207
  = 3.5.1 - 2017/10/26 =
208
 
209
  - Usa por padrão o CEP de base do WooCommerce 3.2 ao adicionar um novo método de entrega.
@@ -329,8 +334,7 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
329
 
330
  == Upgrade Notice ==
331
 
332
- = 3.5.1 =
333
 
334
- - Usa por padrão o CEP de base do WooCommerce 3.2 ao adicionar um novo método de entrega.
335
- - Correção do valor declarado para PAC, que ainda não aceitava o pedido quando o valor era igual a 17 reais.
336
- - Correção do peso máximo para Impresso Normal.
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
+ Stable tag: 3.6.0
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
204
 
205
  == Changelog ==
206
 
207
+ = 3.6.0 - 2017/11/19 =
208
+
209
+ - Atualizado o valor mínimo declarado para 18 reais.
210
+ - Melhorias gerais no código base do plugin.
211
+
212
  = 3.5.1 - 2017/10/26 =
213
 
214
  - Usa por padrão o CEP de base do WooCommerce 3.2 ao adicionar um novo método de entrega.
334
 
335
  == Upgrade Notice ==
336
 
337
+ = 3.6.0 =
338
 
339
+ - Atualizado o valor mínimo declarado para 18 reais.
340
+ - Melhorias gerais no código base do plugin.
 
templates/myaccount/tracking-codes.php CHANGED
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
  <tr>
21
  <th><?php echo esc_html( $code ); ?></th>
22
  <td>
23
- <form method="POST" target="_blank" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" class="wc-correios-tracking__form">
24
  <input type="hidden" name="Objetos" value="<?php echo esc_attr( $code ); ?>">
25
  <input class="wc-correios-tracking__button button" type="submit" value="<?php esc_attr_e( 'Query on Correios', 'woocommerce-correios' ); ?>">
26
  </form>
20
  <tr>
21
  <th><?php echo esc_html( $code ); ?></th>
22
  <td>
23
+ <form method="POST" target="_blank" rel="nofollow noopener noreferrer" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" class="wc-correios-tracking__form">
24
  <input type="hidden" name="Objetos" value="<?php echo esc_attr( $code ); ?>">
25
  <input class="wc-correios-tracking__button button" type="submit" value="<?php esc_attr_e( 'Query on Correios', 'woocommerce-correios' ); ?>">
26
  </form>
templates/myaccount/tracking-history-table.php CHANGED
@@ -31,7 +31,10 @@ if ( ! defined( 'ABSPATH' ) ) {
31
 
32
  <?php if ( isset( $event->destino ) ) : ?>
33
  <br />
34
- <?php echo esc_html( sprintf( __( 'In transit to %s', 'woocommerce-correios' ), $event->destino->local . ' - ' . $event->destino->cidade . '/' . $event->destino->uf ) ); ?>
 
 
 
35
  <?php endif; ?>
36
  </td>
37
  <td>
@@ -43,7 +46,7 @@ if ( ! defined( 'ABSPATH' ) ) {
43
  <tfoot>
44
  <tr>
45
  <td colspan="3">
46
- <form method="POST" target="_blank" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" class="wc-correios-tracking__form">
47
  <input type="hidden" name="Objetos" value="<?php echo esc_attr( $code ); ?>">
48
  <input class="wc-correios-tracking__button button" type="submit" value="<?php esc_attr_e( 'Query on Correios', 'woocommerce-correios' ); ?>">
49
  </form>
31
 
32
  <?php if ( isset( $event->destino ) ) : ?>
33
  <br />
34
+ <?php
35
+ /* translators: %s: address */
36
+ echo esc_html( sprintf( __( 'In transit to %s', 'woocommerce-correios' ), $event->destino->local . ' - ' . $event->destino->cidade . '/' . $event->destino->uf ) );
37
+ ?>
38
  <?php endif; ?>
39
  </td>
40
  <td>
46
  <tfoot>
47
  <tr>
48
  <td colspan="3">
49
+ <form method="POST" target="_blank" rel="nofollow noopener noreferrer" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" class="wc-correios-tracking__form">
50
  <input type="hidden" name="Objetos" value="<?php echo esc_attr( $code ); ?>">
51
  <input class="wc-correios-tracking__button button" type="submit" value="<?php esc_attr_e( 'Query on Correios', 'woocommerce-correios' ); ?>">
52
  </form>
woocommerce-correios.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Adds Correios shipping methods to your WooCommerce store.
6
  * Author: Claudio Sanches
7
  * Author URI: https://claudiosanches.com
8
- * Version: 3.5.1
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
@@ -33,212 +33,11 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  exit; // Exit if accessed directly.
34
  }
35
 
36
- if ( ! class_exists( 'WC_Correios' ) ) :
 
37
 
38
- /**
39
- * WooCommerce Correios main class.
40
- */
41
- class WC_Correios {
42
 
43
- /**
44
- * Plugin version.
45
- *
46
- * @var string
47
- */
48
- const VERSION = '3.5.1';
49
-
50
- /**
51
- * Instance of this class.
52
- *
53
- * @var object
54
- */
55
- protected static $instance = null;
56
-
57
- /**
58
- * Initialize the plugin public actions.
59
- */
60
- private function __construct() {
61
- add_action( 'init', array( $this, 'load_plugin_textdomain' ), -1 );
62
-
63
- // Checks with WooCommerce is installed.
64
- if ( class_exists( 'WC_Integration' ) ) {
65
- $this->includes();
66
-
67
- if ( is_admin() ) {
68
- $this->admin_includes();
69
- }
70
-
71
- add_filter( 'woocommerce_integrations', array( $this, 'include_integrations' ) );
72
- add_filter( 'woocommerce_shipping_methods', array( $this, 'include_methods' ) );
73
- add_filter( 'woocommerce_email_classes', array( $this, 'include_emails' ) );
74
- } else {
75
- add_action( 'admin_notices', array( $this, 'woocommerce_missing_notice' ) );
76
- }
77
- }
78
-
79
- /**
80
- * Return an instance of this class.
81
- *
82
- * @return object A single instance of this class.
83
- */
84
- public static function get_instance() {
85
- // If the single instance hasn't been set, set it now.
86
- if ( null === self::$instance ) {
87
- self::$instance = new self;
88
- }
89
-
90
- return self::$instance;
91
- }
92
-
93
- /**
94
- * Load the plugin text domain for translation.
95
- */
96
- public function load_plugin_textdomain() {
97
- load_plugin_textdomain( 'woocommerce-correios', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
98
- }
99
-
100
- /**
101
- * Includes.
102
- */
103
- private function includes() {
104
- include_once dirname( __FILE__ ) . '/includes/wc-correios-functions.php';
105
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-install.php';
106
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-package.php';
107
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-webservice.php';
108
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-webservice-international.php';
109
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-autofill-addresses.php';
110
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-tracking-history.php';
111
- include_once dirname( __FILE__ ) . '/includes/class-wc-correios-rest-api.php';
112
-
113
- // Integration.
114
- include_once dirname( __FILE__ ) . '/includes/integrations/class-wc-correios-integration.php';
115
-
116
- // Shipping methods.
117
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
118
- include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping.php';
119
- include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-carta.php';
120
- include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-impresso.php';
121
- include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-international.php';
122
- foreach ( glob( plugin_dir_path( __FILE__ ) . '/includes/shipping/*.php' ) as $filename ) {
123
- include_once $filename;
124
- }
125
-
126
- // Update settings to 3.0.0 when using WooCommerce 2.6.0.
127
- WC_Correios_Install::upgrade_300_from_wc_260();
128
- } else {
129
- include_once dirname( __FILE__ ) . '/includes/shipping/class-wc-correios-shipping-legacy.php';
130
- }
131
-
132
- // Update to 3.0.0.
133
- WC_Correios_Install::upgrade_300();
134
- }
135
-
136
- /**
137
- * Admin includes.
138
- */
139
- private function admin_includes() {
140
- include_once dirname( __FILE__ ) . '/includes/admin/class-wc-correios-admin-orders.php';
141
- }
142
-
143
- /**
144
- * Include Correios integration to WooCommerce.
145
- *
146
- * @param array $integrations Default integrations.
147
- *
148
- * @return array
149
- */
150
- public function include_integrations( $integrations ) {
151
- $integrations[] = 'WC_Correios_Integration';
152
-
153
- return $integrations;
154
- }
155
-
156
- /**
157
- * Include Correios shipping methods to WooCommerce.
158
- *
159
- * @param array $methods Default shipping methods.
160
- *
161
- * @return array
162
- */
163
- public function include_methods( $methods ) {
164
- // Legacy method.
165
- $methods['correios-legacy'] = 'WC_Correios_Shipping_Legacy';
166
-
167
- // New methods.
168
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
169
- $methods['correios-pac'] = 'WC_Correios_Shipping_PAC';
170
- $methods['correios-sedex'] = 'WC_Correios_Shipping_SEDEX';
171
- $methods['correios-sedex10-envelope'] = 'WC_Correios_Shipping_SEDEX_10_Envelope';
172
- $methods['correios-sedex10-pacote'] = 'WC_Correios_Shipping_SEDEX_10_Pacote';
173
- $methods['correios-sedex12'] = 'WC_Correios_Shipping_SEDEX_12';
174
- $methods['correios-sedex-hoje'] = 'WC_Correios_Shipping_SEDEX_Hoje';
175
- $methods['correios-esedex'] = 'WC_Correios_Shipping_ESEDEX';
176
- $methods['correios-carta-registrada'] = 'WC_Correios_Shipping_Carta_Registrada';
177
- $methods['correios-impresso-normal'] = 'WC_Correios_Shipping_Impresso_Normal';
178
- $methods['correios-impresso-urgente'] = 'WC_Correios_Shipping_Impresso_Urgente';
179
- $methods['correios-mercadoria-expressa'] = 'WC_Correios_Shipping_Mercadoria_Expressa';
180
- $methods['correios-mercadoria-economica'] = 'WC_Correios_Shipping_Mercadoria_Economica';
181
- $methods['correios-leve-internacional'] = 'WC_Correios_Shipping_Leve_Internacional';
182
-
183
- $old_options = get_option( 'woocommerce_correios_settings' );
184
- if ( empty( $old_options ) ) {
185
- unset( $methods['correios-legacy'] );
186
- }
187
- }
188
-
189
- return $methods;
190
- }
191
-
192
- /**
193
- * Include emails.
194
- *
195
- * @param array $emails Default emails.
196
- *
197
- * @return array
198
- */
199
- public function include_emails( $emails ) {
200
- if ( ! isset( $emails['WC_Correios_Tracking_Email'] ) ) {
201
- $emails['WC_Correios_Tracking_Email'] = include( dirname( __FILE__ ) . '/includes/emails/class-wc-correios-tracking-email.php' );
202
- }
203
-
204
- return $emails;
205
- }
206
-
207
- /**
208
- * WooCommerce fallback notice.
209
- */
210
- public function woocommerce_missing_notice() {
211
- include_once dirname( __FILE__ ) . '/includes/admin/views/html-admin-missing-dependencies.php';
212
- }
213
-
214
- /**
215
- * Get main file.
216
- *
217
- * @return string
218
- */
219
- public static function get_main_file() {
220
- return __FILE__;
221
- }
222
-
223
- /**
224
- * Get plugin path.
225
- *
226
- * @return string
227
- */
228
- public static function get_plugin_path() {
229
- return plugin_dir_path( __FILE__ );
230
- }
231
-
232
- /**
233
- * Get templates path.
234
- *
235
- * @return string
236
- */
237
- public static function get_templates_path() {
238
- return self::get_plugin_path() . 'templates/';
239
- }
240
- }
241
-
242
- add_action( 'plugins_loaded', array( 'WC_Correios', 'get_instance' ) );
243
-
244
- endif;
5
  * Description: Adds Correios shipping methods to your WooCommerce store.
6
  * Author: Claudio Sanches
7
  * Author URI: https://claudiosanches.com
8
+ * Version: 3.6.0
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
33
  exit; // Exit if accessed directly.
34
  }
35
 
36
+ define( 'WC_CORREIOS_VERSION', '3.6.0' );
37
+ define( 'WC_CORREIOS_PLUGIN_FILE', __FILE__ );
38
 
39
+ if ( ! class_exists( 'WC_Correios' ) ) {
40
+ include_once dirname( __FILE__ ) . '/includes/class-wc-correios.php';
 
 
41
 
42
+ add_action( 'plugins_loaded', array( 'WC_Correios', 'init' ) );
43
+ }