WooCommerce Extra Checkout Fields for Brazil - Version 3.4.0

Version Description

  • Adicionado suporte para WooCommerce 2.4.
  • Removido suporte para WooCommerce 2.0 e 2.1.
  • Corrigida integrao com a API do WooCommerce quando usado filtros para campos.

=

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce Extra Checkout Fields for Brazil
Version 3.4.0
Comparing to
See all releases

Version 3.4.0

assets/css/admin/admin.css ADDED
@@ -0,0 +1 @@
 
1
+ #order_data .order_data_column ._billing_persontype_field,#order_data .order_data_column ._billing_cpf_field,#order_data .order_data_column ._billing_rg_field,#order_data .order_data_column ._billing_cnpj_field,#order_data .order_data_column ._billing_ie_field{clear:both !important;width:100% !important}#order_data .order_data_column ._billing_sex_field,#order_data .order_data_column ._billing_number_field,#order_data .order_data_column ._shipping_number_field{float:right !important}#order_data.panel .order_data_column .address{display:none}#order_data.panel .order_data .address{display:none}
assets/js/admin/admin.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jshint devel: true */
2
+ (function ( $ ) {
3
+ 'use strict';
4
+
5
+ $(function () {
6
+ $( '#person_type' ).on( 'change', function () {
7
+ var onlyBrazil = $( '.wrap form .form-table:eq(0) tr:eq(1)' ),
8
+ rg = $( '.wrap form .form-table:eq(0) tr:eq(2)' ),
9
+ ie = $( '.wrap form .form-table:eq(0) tr:eq(3)' ),
10
+ validate = $( '.wrap form h3:eq(2), .wrap form .form-table:eq(2)' ),
11
+ validateCPF = $( '.wrap form .form-table:eq(2) tr:eq(0)' ),
12
+ validateCNPJ = $( '.wrap form .form-table:eq(2) tr:eq(1)' ),
13
+ selected = $( this ).val();
14
+
15
+ onlyBrazil.hide();
16
+ rg.hide();
17
+ ie.hide();
18
+ validate.hide();
19
+ validateCPF.hide();
20
+ validateCNPJ.hide();
21
+
22
+ if ( '1' === selected ) {
23
+ onlyBrazil.show();
24
+ rg.show();
25
+ ie.show();
26
+ validate.show();
27
+ validateCPF.show();
28
+ validateCNPJ.show();
29
+ } else if ( '2' === selected ) {
30
+ onlyBrazil.show();
31
+ rg.show();
32
+ validate.show();
33
+ validateCPF.show();
34
+ } else if ( '3' === selected ) {
35
+ onlyBrazil.show();
36
+ ie.show();
37
+ validate.show();
38
+ validateCNPJ.show();
39
+ }
40
+ }).change();
41
+ });
42
+
43
+ }(jQuery));
assets/js/admin/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";a(function(){a("#person_type").on("change",function(){var b=a(".wrap form .form-table:eq(0) tr:eq(1)"),c=a(".wrap form .form-table:eq(0) tr:eq(2)"),d=a(".wrap form .form-table:eq(0) tr:eq(3)"),e=a(".wrap form h3:eq(2), .wrap form .form-table:eq(2)"),f=a(".wrap form .form-table:eq(2) tr:eq(0)"),g=a(".wrap form .form-table:eq(2) tr:eq(1)"),h=a(this).val();b.hide(),c.hide(),d.hide(),e.hide(),f.hide(),g.hide(),"1"===h?(b.show(),c.show(),d.show(),e.show(),f.show(),g.show()):"2"===h?(b.show(),c.show(),e.show(),f.show()):"3"===h&&(b.show(),d.show(),e.show(),g.show())}).change()})}(jQuery);
assets/js/admin/shop-order.js ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global wcbcf_shop_order_params, woocommerce_admin_meta_boxes */
2
+
3
+ /**
4
+ * Plugin settings.
5
+ */
6
+ (function ( $ ) {
7
+ 'use strict';
8
+
9
+ $( function () {
10
+
11
+ if ( '1' === wcbcf_shop_order_params.person_type ) {
12
+ $( '#_billing_persontype' ).on( 'change', function () {
13
+ var current = $( this ).val();
14
+
15
+ $( '._billing_cpf_field, ._billing_rg_field, ._billing_company_field, ._billing_cnpj_field, ._billing_ie_field' ).hide();
16
+
17
+ if ( '1' === current ) {
18
+ $( '._billing_cpf_field, ._billing_rg_field' ).show();
19
+ }
20
+
21
+ if ( '2' === current ) {
22
+ $( '._billing_company_field, ._billing_cnpj_field, ._billing_ie_field' ).show();
23
+ }
24
+ }).change();
25
+ }
26
+
27
+ $( '.load_customer_billing' ).on( 'click', function () {
28
+ var userId = $( '#customer_user' ).val(),
29
+ data;
30
+
31
+ if ( window.confirm( wcbcf_shop_order_params.load_message ) ) {
32
+ if ( ! userId ) {
33
+ window.alert( woocommerce_admin_meta_boxes.no_customer_selected );
34
+ return false;
35
+ }
36
+
37
+ data = {
38
+ user_id: userId,
39
+ type_to_load: 'billing',
40
+ action: 'woocommerce_get_customer_details',
41
+ security: woocommerce_admin_meta_boxes.get_customer_details_nonce
42
+ };
43
+
44
+ $( this ).closest( '.edit_address' ).block({
45
+ message: null,
46
+ overlayCSS: {
47
+ background: '#fff url(' + woocommerce_admin_meta_boxes.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center',
48
+ opacity: 0.6
49
+ }
50
+ });
51
+
52
+ $.ajax({
53
+ url: woocommerce_admin_meta_boxes.ajax_url,
54
+ data: data,
55
+ type: 'POST',
56
+ success: function( response ) {
57
+ if ( response ) {
58
+ $( 'input#_billing_number' ).val( response.billing_number );
59
+ $( 'input#_billing_neighborhood' ).val( response.billing_neighborhood );
60
+ $( 'input#_billing_persontype' ).val( response.billing_persontype );
61
+ $( 'input#_billing_cpf' ).val( response.billing_cpf );
62
+ $( 'input#_billing_rg' ).val( response.billing_rg );
63
+ $( 'input#_billing_cnpj' ).val( response.billing_cnpj );
64
+ $( 'input#_billing_ie' ).val( response.billing_ie );
65
+ $( 'input#_billing_birthdate' ).val( response.billing_birthdate );
66
+ $( 'input#_billing_sex' ).val( response.billing_sex );
67
+ $( 'input#_billing_cellphone' ).val( response.billing_cellphone );
68
+ }
69
+
70
+ $( '.edit_address' ).unblock();
71
+ }
72
+ });
73
+ }
74
+
75
+ return false;
76
+ });
77
+
78
+ $( '.load_customer_shipping' ).on( 'click', function () {
79
+ var userId = $( '#customer_user' ).val(),
80
+ data;
81
+
82
+ if ( window.confirm( wcbcf_shop_order_params.load_message ) ) {
83
+
84
+ if ( ! userId ) {
85
+ window.alert( woocommerce_admin_meta_boxes.no_customer_selected );
86
+ return false;
87
+ }
88
+
89
+ data = {
90
+ user_id: userId,
91
+ type_to_load: 'shipping',
92
+ action: 'woocommerce_get_customer_details',
93
+ security: woocommerce_admin_meta_boxes.get_customer_details_nonce
94
+ };
95
+
96
+ $( this ).closest( '.edit_address' ).block({
97
+ message: null,
98
+ overlayCSS: {
99
+ background: '#fff url(' + woocommerce_admin_meta_boxes.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center',
100
+ opacity: 0.6
101
+ }
102
+ });
103
+
104
+ $.ajax({
105
+ url: woocommerce_admin_meta_boxes.ajax_url,
106
+ data: data,
107
+ type: 'POST',
108
+ success: function( response ) {
109
+ if ( response ) {
110
+ $( 'input#_shipping_number' ).val( response.shipping_number );
111
+ $( 'input#_shipping_neighborhood' ).val( response.shipping_neighborhood );
112
+ }
113
+
114
+ $( '.edit_address' ).unblock();
115
+ }
116
+ });
117
+ }
118
+
119
+ return false;
120
+ });
121
+
122
+ $( 'button.billing-same-as-shipping' ).on( 'click', function () {
123
+ if ( window.confirm( wcbcf_shop_order_params.copy_message ) ) {
124
+ $( 'input#_shipping_number' ).val( $( 'input#_billing_number' ).val() );
125
+ $( 'input#_shipping_neighborhood' ).val( $( 'input#_billing_neighborhood' ).val() );
126
+ }
127
+
128
+ return false;
129
+ });
130
+
131
+ });
132
+
133
+ }( jQuery ) );
assets/js/admin/shop-order.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";a(function(){"1"===wcbcf_shop_order_params.person_type&&a("#_billing_persontype").on("change",function(){var b=a(this).val();a("._billing_cpf_field, ._billing_rg_field, ._billing_company_field, ._billing_cnpj_field, ._billing_ie_field").hide(),"1"===b&&a("._billing_cpf_field, ._billing_rg_field").show(),"2"===b&&a("._billing_company_field, ._billing_cnpj_field, ._billing_ie_field").show()}).change(),a(".load_customer_billing").on("click",function(){var b,c=a("#customer_user").val();if(window.confirm(wcbcf_shop_order_params.load_message)){if(!c)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;b={user_id:c,type_to_load:"billing",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce},a(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:b,type:"POST",success:function(b){b&&(a("input#_billing_number").val(b.billing_number),a("input#_billing_neighborhood").val(b.billing_neighborhood),a("input#_billing_persontype").val(b.billing_persontype),a("input#_billing_cpf").val(b.billing_cpf),a("input#_billing_rg").val(b.billing_rg),a("input#_billing_cnpj").val(b.billing_cnpj),a("input#_billing_ie").val(b.billing_ie),a("input#_billing_birthdate").val(b.billing_birthdate),a("input#_billing_sex").val(b.billing_sex),a("input#_billing_cellphone").val(b.billing_cellphone)),a(".edit_address").unblock()}})}return!1}),a(".load_customer_shipping").on("click",function(){var b,c=a("#customer_user").val();if(window.confirm(wcbcf_shop_order_params.load_message)){if(!c)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;b={user_id:c,type_to_load:"shipping",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce},a(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:b,type:"POST",success:function(b){b&&(a("input#_shipping_number").val(b.shipping_number),a("input#_shipping_neighborhood").val(b.shipping_neighborhood)),a(".edit_address").unblock()}})}return!1}),a("button.billing-same-as-shipping").on("click",function(){return window.confirm(wcbcf_shop_order_params.copy_message)&&(a("input#_shipping_number").val(a("input#_billing_number").val()),a("input#_shipping_neighborhood").val(a("input#_billing_neighborhood").val())),!1})})}(jQuery);
assets/js/frontend/frontend.js ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global wcbcf_public_params */
2
+ /*jshint devel: true */
3
+ jQuery( function( $ ) {
4
+
5
+ /**
6
+ * Frontend actions
7
+ */
8
+ var wc_ecfb_frontned = {
9
+
10
+ /**
11
+ * Initialize frontend actions
12
+ */
13
+ init: function() {
14
+ $( document.body ).on( 'country_to_state_changing', this.country_to_state_changing );
15
+
16
+ if ( '0' !== wcbcf_public_params.person_type ) {
17
+ this.person_type_fields();
18
+ }
19
+
20
+ if ( 'yes' === wcbcf_public_params.maskedinput ) {
21
+ this.masks();
22
+ }
23
+
24
+ if ( 'yes' === wcbcf_public_params.mailcheck ) {
25
+ this.emailCheck();
26
+ }
27
+
28
+ if ( 'yes' === wcbcf_public_params.addresscomplete ) {
29
+ // Auto complete billing address.
30
+ this.addressAutoComplete( 'billing' );
31
+ this.addressAutoCompleteOnChange( 'billing' );
32
+
33
+ // Auto complete shipping address.
34
+ this.addressAutoComplete( 'shipping' );
35
+ this.addressAutoCompleteOnChange( 'shipping' );
36
+ }
37
+ },
38
+
39
+ /**
40
+ * Country to state changing.
41
+ * Fix the fields order.
42
+ */
43
+ country_to_state_changing: function() {
44
+ // Billing.
45
+ $( '#billing_state_field label' ).html( wcbcf_public_params.state + ' <abbr class="required" title="' + wcbcf_public_params.required + '">*</abbr>' );
46
+ $( '#billing_postcode_field' ).insertAfter( '#billing_country_field' );
47
+
48
+ // Shipping.
49
+ if ( $( '#shipping_state_field' ).length ) {
50
+ $( '#shipping_state_field label' ).html( wcbcf_public_params.state + ' <abbr class="required" title="' + wcbcf_public_params.required + '">*</abbr>' );
51
+ $( '#shipping_postcode_field' ).insertAfter( '#shipping_country_field' );
52
+ }
53
+ },
54
+
55
+ person_type_fields: function() {
56
+ // Required fields.
57
+ if ( 'no' === wcbcf_public_params.only_brazil ) {
58
+ $( '.person-type-field' ).addClass( 'validate-required' );
59
+ $( '.person-type-field label' ).append( ' <abbr class="required" title="' + wcbcf_public_params.required + '">*</abbr>' );
60
+ } else {
61
+ $( '#billing_country' ).on( 'change', function () {
62
+ var current = $( this ).val();
63
+
64
+ if ( 'BR' === current ) {
65
+ $( '.person-type-field' ).addClass( 'validate-required' );
66
+ $( '.person-type-field label' ).append( ' <abbr class="required" title="' + wcbcf_public_params.required + '">*</abbr>' );
67
+ } else {
68
+ $( '.person-type-field' ).removeClass( 'validate-required' );
69
+ $( '.person-type-field label abbr' ).remove();
70
+ }
71
+ }).change();
72
+ }
73
+
74
+ if ( '1' === wcbcf_public_params.person_type ) {
75
+ $( '#billing_persontype' ).on( 'change', function () {
76
+ var current = $( this ).val();
77
+
78
+ $( '#billing_cpf_field' ).hide();
79
+ $( '#billing_rg_field' ).hide();
80
+ $( '#billing_company_field' ).hide();
81
+ $( '#billing_cnpj_field' ).hide();
82
+ $( '#billing_ie_field' ).hide();
83
+
84
+ if ( '1' === current ) {
85
+ $( '#billing_cpf_field' ).show();
86
+ $( '#billing_rg_field' ).show();
87
+ }
88
+
89
+ if ( '2' === current ) {
90
+ $( '#billing_company_field' ).show();
91
+ $( '#billing_cnpj_field' ).show();
92
+ $( '#billing_ie_field' ).show();
93
+ }
94
+ }).change();
95
+ }
96
+ },
97
+
98
+ masks: function() {
99
+ // CPF.
100
+ $( '#billing_cpf, #credit-card-cpf' ).mask( '999.999.999-99' );
101
+
102
+ // CPNJ.
103
+ $( '#billing_cnpj' ).mask( '99.999.999/9999-99' );
104
+
105
+ // Cell phone.
106
+ $( '#billing_phone, #billing_cellphone, #credit-card-phone' ).focusout( function () {
107
+ var phone, element;
108
+ element = $( this );
109
+ element.unmask();
110
+ phone = element.val().replace( /\D/g, '' );
111
+
112
+ if ( phone.length > 10 ) {
113
+ element.mask( '(99) 99999-999?9' );
114
+ } else {
115
+ element.mask( '(99) 9999-9999?9' );
116
+ }
117
+ }).trigger( 'focusout' );
118
+
119
+ // Birth Date.
120
+ $( '#billing_birthdate' ).mask( '99/99/9999' );
121
+
122
+ // Zip Code.
123
+ $( '#billing_postcode' ).mask( '99999-999' );
124
+ $( '#shipping_postcode' ).mask( '99999-999' );
125
+ },
126
+
127
+ emailCheck: function() {
128
+ if ( $( '#wcbcf-mailsuggest' ).length < 1 ) {
129
+ $( '#billing_email' ).after( '<div id="wcbcf-mailsuggest"></div>' );
130
+ }
131
+
132
+ $( '#billing_email' ).on( 'blur', function () {
133
+ $( '#wcbcf-mailsuggest' ).html( '' );
134
+ $( this ).mailcheck({
135
+ suggested: function( element, suggestion ) {
136
+ $( '#wcbcf-mailsuggest' ).html( 'Você quis dizer: ' + suggestion.full + '?' );
137
+ }
138
+ });
139
+ });
140
+
141
+ $( '#wcbcf-mailsuggest' ).css({
142
+ color: '#c00',
143
+ fontSize: 'small'
144
+ });
145
+ },
146
+
147
+ addressAutoComplete: function( field ) {
148
+ // Checks with *_postcode field exist.
149
+ if ( $( '#' + field + '_postcode' ).length ) {
150
+
151
+ // Valid CEP.
152
+ var cep = $( '#' + field + '_postcode' ).val().replace( '.', '' ).replace( '-', '' ),
153
+ country = $( '#' + field + '_country' ).val(),
154
+ address_1 = $( '#' + field + '_address_1' ).val();
155
+
156
+ // Check country is BR.
157
+ if ( cep !== '' && 8 === cep.length && 'BR' === country && 0 === address_1.length ) {
158
+
159
+ // Gets the address.
160
+ $.ajax({
161
+ type: 'GET',
162
+ url: '//correiosapi.apphb.com/cep/' + cep,
163
+ dataType: 'jsonp',
164
+ crossDomain: true,
165
+ contentType: 'application/json',
166
+ success: function ( address ) {
167
+
168
+ // Address.
169
+ if ( '' !== address.tipoDeLogradouro ) {
170
+ $( '#' + field + '_address_1' ).val( address.tipoDeLogradouro + ' ' + address.logradouro ).change();
171
+ } else {
172
+ $( '#' + field + '_address_1' ).val( address.logradouro ).change();
173
+ }
174
+
175
+ // Neighborhood.
176
+ $( '#' + field + '_neighborhood' ).val( address.bairro ).change();
177
+
178
+ // City.
179
+ $( '#' + field + '_city' ).val( address.cidade ).change();
180
+
181
+ // State.
182
+ $( '#' + field + '_state option:selected' ).attr( 'selected', false ).change();
183
+ $( '#' + field + '_state option[value="' + address.estado + '"]' ).attr( 'selected', 'selected' ).change();
184
+
185
+ // Chosen support.
186
+ $( '#' + field + '_state' ).trigger( 'liszt:updated' ).trigger( 'chosen:updated' );
187
+ }
188
+ });
189
+ }
190
+ }
191
+ },
192
+
193
+ addressAutoCompleteOnChange: function( field ) {
194
+ $( '#' + field + '_postcode' ).on( 'blur', function () {
195
+ wc_ecfb_frontned.addressAutoComplete( field );
196
+ });
197
+ }
198
+ };
199
+
200
+ wc_ecfb_frontned.init();
201
+ });
assets/js/frontend/frontend.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(a){var b={init:function(){a(document.body).on("country_to_state_changing",this.country_to_state_changing),"0"!==wcbcf_public_params.person_type&&this.person_type_fields(),"yes"===wcbcf_public_params.maskedinput&&this.masks(),"yes"===wcbcf_public_params.mailcheck&&this.emailCheck(),"yes"===wcbcf_public_params.addresscomplete&&(this.addressAutoComplete("billing"),this.addressAutoCompleteOnChange("billing"),this.addressAutoComplete("shipping"),this.addressAutoCompleteOnChange("shipping"))},country_to_state_changing:function(){a("#billing_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#billing_postcode_field").insertAfter("#billing_country_field"),a("#shipping_state_field").length&&(a("#shipping_state_field label").html(wcbcf_public_params.state+' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>'),a("#shipping_postcode_field").insertAfter("#shipping_country_field"))},person_type_fields:function(){"no"===wcbcf_public_params.only_brazil?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):a("#billing_country").on("change",function(){var b=a(this).val();"BR"===b?(a(".person-type-field").addClass("validate-required"),a(".person-type-field label").append(' <abbr class="required" title="'+wcbcf_public_params.required+'">*</abbr>')):(a(".person-type-field").removeClass("validate-required"),a(".person-type-field label abbr").remove())}).change(),"1"===wcbcf_public_params.person_type&&a("#billing_persontype").on("change",function(){var b=a(this).val();a("#billing_cpf_field").hide(),a("#billing_rg_field").hide(),a("#billing_company_field").hide(),a("#billing_cnpj_field").hide(),a("#billing_ie_field").hide(),"1"===b&&(a("#billing_cpf_field").show(),a("#billing_rg_field").show()),"2"===b&&(a("#billing_company_field").show(),a("#billing_cnpj_field").show(),a("#billing_ie_field").show())}).change()},masks:function(){a("#billing_cpf, #credit-card-cpf").mask("999.999.999-99"),a("#billing_cnpj").mask("99.999.999/9999-99"),a("#billing_phone, #billing_cellphone, #credit-card-phone").focusout(function(){var b,c;c=a(this),c.unmask(),b=c.val().replace(/\D/g,""),b.length>10?c.mask("(99) 99999-999?9"):c.mask("(99) 9999-9999?9")}).trigger("focusout"),a("#billing_birthdate").mask("99/99/9999"),a("#billing_postcode").mask("99999-999"),a("#shipping_postcode").mask("99999-999")},emailCheck:function(){a("#wcbcf-mailsuggest").length<1&&a("#billing_email").after('<div id="wcbcf-mailsuggest"></div>'),a("#billing_email").on("blur",function(){a("#wcbcf-mailsuggest").html(""),a(this).mailcheck({suggested:function(b,c){a("#wcbcf-mailsuggest").html("Você quis dizer: "+c.full+"?")}})}),a("#wcbcf-mailsuggest").css({color:"#c00",fontSize:"small"})},addressAutoComplete:function(b){if(a("#"+b+"_postcode").length){var c=a("#"+b+"_postcode").val().replace(".","").replace("-",""),d=a("#"+b+"_country").val(),e=a("#"+b+"_address_1").val();""!==c&&8===c.length&&"BR"===d&&0===e.length&&a.ajax({type:"GET",url:"//correiosapi.apphb.com/cep/"+c,dataType:"jsonp",crossDomain:!0,contentType:"application/json",success:function(c){""!==c.tipoDeLogradouro?a("#"+b+"_address_1").val(c.tipoDeLogradouro+" "+c.logradouro).change():a("#"+b+"_address_1").val(c.logradouro).change(),a("#"+b+"_neighborhood").val(c.bairro).change(),a("#"+b+"_city").val(c.cidade).change(),a("#"+b+"_state option:selected").attr("selected",!1).change(),a("#"+b+'_state option[value="'+c.estado+'"]').attr("selected","selected").change(),a("#"+b+"_state").trigger("liszt:updated").trigger("chosen:updated")}})}},addressAutoCompleteOnChange:function(c){a("#"+c+"_postcode").on("blur",function(){b.addressAutoComplete(c)})}};b.init()});
assets/js/jquery-maskedinput/jquery.maskedinput.js ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ jQuery Masked Input Plugin
3
+ Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
4
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
5
+ Version: 1.4.1
6
+ */
7
+ !function(factory) {
8
+ "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
9
+ }(function($) {
10
+ var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
11
+ $.mask = {
12
+ definitions: {
13
+ "9": "[0-9]",
14
+ a: "[A-Za-z]",
15
+ "*": "[A-Za-z0-9]"
16
+ },
17
+ autoclear: !0,
18
+ dataName: "rawMaskFn",
19
+ placeholder: "_"
20
+ }, $.fn.extend({
21
+ caret: function(begin, end) {
22
+ var range;
23
+ if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin,
24
+ this.each(function() {
25
+ this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(),
26
+ range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
27
+ range.select());
28
+ })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
29
+ begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
30
+ {
31
+ begin: begin,
32
+ end: end
33
+ });
34
+ },
35
+ unmask: function() {
36
+ return this.trigger("unmask");
37
+ },
38
+ mask: function(mask, settings) {
39
+ var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal;
40
+ if (!mask && this.length > 0) {
41
+ input = $(this[0]);
42
+ var fn = input.data($.mask.dataName);
43
+ return fn ? fn() : void 0;
44
+ }
45
+ return settings = $.extend({
46
+ autoclear: $.mask.autoclear,
47
+ placeholder: $.mask.placeholder,
48
+ completed: null
49
+ }, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length,
50
+ firstNonMaskPos = null, $.each(mask.split(""), function(i, c) {
51
+ "?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])),
52
+ null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null);
53
+ }), this.trigger("unmask").each(function() {
54
+ function tryFireCompleted() {
55
+ if (settings.completed) {
56
+ for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return;
57
+ settings.completed.call(input);
58
+ }
59
+ }
60
+ function getPlaceholder(i) {
61
+ return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0);
62
+ }
63
+ function seekNext(pos) {
64
+ for (;++pos < len && !tests[pos]; ) ;
65
+ return pos;
66
+ }
67
+ function seekPrev(pos) {
68
+ for (;--pos >= 0 && !tests[pos]; ) ;
69
+ return pos;
70
+ }
71
+ function shiftL(begin, end) {
72
+ var i, j;
73
+ if (!(0 > begin)) {
74
+ for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) {
75
+ if (!(len > j && tests[i].test(buffer[j]))) break;
76
+ buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j);
77
+ }
78
+ writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin));
79
+ }
80
+ }
81
+ function shiftR(pos) {
82
+ var i, c, j, t;
83
+ for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) {
84
+ if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break;
85
+ c = t;
86
+ }
87
+ }
88
+ function androidInputEvent() {
89
+ var curVal = input.val(), pos = input.caret();
90
+ if (oldVal && oldVal.length && oldVal.length > curVal.length) {
91
+ for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--;
92
+ if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++;
93
+ input.caret(pos.begin, pos.begin);
94
+ } else {
95
+ for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++;
96
+ input.caret(pos.begin, pos.begin);
97
+ }
98
+ tryFireCompleted();
99
+ }
100
+ function blurEvent() {
101
+ checkVal(), input.val() != focusText && input.change();
102
+ }
103
+ function keydownEvent(e) {
104
+ if (!input.prop("readonly")) {
105
+ var pos, begin, end, k = e.which || e.keyCode;
106
+ oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(),
107
+ begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1),
108
+ end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1),
109
+ e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText),
110
+ input.caret(0, checkVal()), e.preventDefault());
111
+ }
112
+ }
113
+ function keypressEvent(e) {
114
+ if (!input.prop("readonly")) {
115
+ var p, c, next, k = e.which || e.keyCode, pos = input.caret();
116
+ if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) {
117
+ if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)),
118
+ p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) {
119
+ if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) {
120
+ var proxy = function() {
121
+ $.proxy($.fn.caret, input, next)();
122
+ };
123
+ setTimeout(proxy, 0);
124
+ } else input.caret(next);
125
+ pos.begin <= lastRequiredNonMaskPos && tryFireCompleted();
126
+ }
127
+ e.preventDefault();
128
+ }
129
+ }
130
+ }
131
+ function clearBuffer(start, end) {
132
+ var i;
133
+ for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i));
134
+ }
135
+ function writeBuffer() {
136
+ input.val(buffer.join(""));
137
+ }
138
+ function checkVal(allow) {
139
+ var i, c, pos, test = input.val(), lastMatch = -1;
140
+ for (i = 0, pos = 0; len > i; i++) if (tests[i]) {
141
+ for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1),
142
+ tests[i].test(c)) {
143
+ buffer[i] = c, lastMatch = i;
144
+ break;
145
+ }
146
+ if (pos > test.length) {
147
+ clearBuffer(i + 1, len);
148
+ break;
149
+ }
150
+ } else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i);
151
+ return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""),
152
+ clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))),
153
+ partialPosition ? i : firstNonMaskPos;
154
+ }
155
+ var input = $(this), buffer = $.map(mask.split(""), function(c, i) {
156
+ return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0;
157
+ }), defaultBuffer = buffer.join(""), focusText = input.val();
158
+ input.data($.mask.dataName, function() {
159
+ return $.map(buffer, function(c, i) {
160
+ return tests[i] && c != getPlaceholder(i) ? c : null;
161
+ }).join("");
162
+ }), input.one("unmask", function() {
163
+ input.off(".mask").removeData($.mask.dataName);
164
+ }).on("focus.mask", function() {
165
+ if (!input.prop("readonly")) {
166
+ clearTimeout(caretTimeoutId);
167
+ var pos;
168
+ focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() {
169
+ input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos));
170
+ }, 10);
171
+ }
172
+ }).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() {
173
+ input.prop("readonly") || setTimeout(function() {
174
+ var pos = checkVal(!0);
175
+ input.caret(pos), tryFireCompleted();
176
+ }, 0);
177
+ }), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent),
178
+ checkVal();
179
+ });
180
+ }
181
+ });
182
+ });
assets/js/jquery-maskedinput/jquery.maskedinput.min.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*
2
+ jQuery Masked Input Plugin
3
+ Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
4
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
5
+ Version: 1.4.1
6
+ */
7
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a<g.placeholder.length?a:0)}function q(a){for(;++a<n&&!j[a];);return a}function r(a){for(;--a>=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.begin<l&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}else{for(A(!0);b.begin<n&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}h()}function v(){A(),B.val()!=E&&B.change()}function w(a){if(!B.prop("readonly")){var b,c,e,f=a.which||a.keyCode;o=B.val(),8===f||46===f||d&&127===f?(b=B.caret(),c=b.begin,e=b.end,e-c===0&&(c=46!==f?r(c):e=q(c-1),e=46===f?q(e):e),y(c,e),s(c,e-1),a.preventDefault()):13===f?v.call(this,a):27===f&&(B.val(E),B.caret(0,A()),a.preventDefault())}}function x(b){if(!B.prop("readonly")){var c,d,e,g=b.which||b.keyCode,i=B.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>g)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++<e.length;)if(c=e.charAt(d-1),j[b].test(c)){C[b]=c,f=b;break}if(d>e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
assets/js/mailcheck/mailcheck.js ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Mailcheck https://github.com/mailcheck/mailcheck
3
+ * Author
4
+ * Derrick Ko (@derrickko)
5
+ *
6
+ * Released under the MIT License.
7
+ *
8
+ * v 1.1.1
9
+ */
10
+
11
+ var Mailcheck = {
12
+ domainThreshold: 2,
13
+ secondLevelThreshold: 2,
14
+ topLevelThreshold: 2,
15
+
16
+ defaultDomains: ['msn.com', 'bellsouth.net',
17
+ 'telus.net', 'comcast.net', 'optusnet.com.au',
18
+ 'earthlink.net', 'qq.com', 'sky.com', 'icloud.com',
19
+ 'mac.com', 'sympatico.ca', 'googlemail.com',
20
+ 'att.net', 'xtra.co.nz', 'web.de',
21
+ 'cox.net', 'gmail.com', 'ymail.com',
22
+ 'aim.com', 'rogers.com', 'verizon.net',
23
+ 'rocketmail.com', 'google.com', 'optonline.net',
24
+ 'sbcglobal.net', 'aol.com', 'me.com', 'btinternet.com',
25
+ 'charter.net', 'shaw.ca'],
26
+
27
+ defaultSecondLevelDomains: ["yahoo", "hotmail", "mail", "live", "outlook", "gmx"],
28
+
29
+ defaultTopLevelDomains: ["com", "com.au", "com.tw", "ca", "co.nz", "co.uk", "de",
30
+ "fr", "it", "ru", "net", "org", "edu", "gov", "jp", "nl", "kr", "se", "eu",
31
+ "ie", "co.il", "us", "at", "be", "dk", "hk", "es", "gr", "ch", "no", "cz",
32
+ "in", "net", "net.au", "info", "biz", "mil", "co.jp", "sg", "hu"],
33
+
34
+ run: function(opts) {
35
+ opts.domains = opts.domains || Mailcheck.defaultDomains;
36
+ opts.secondLevelDomains = opts.secondLevelDomains || Mailcheck.defaultSecondLevelDomains;
37
+ opts.topLevelDomains = opts.topLevelDomains || Mailcheck.defaultTopLevelDomains;
38
+ opts.distanceFunction = opts.distanceFunction || Mailcheck.sift3Distance;
39
+
40
+ var defaultCallback = function(result){ return result };
41
+ var suggestedCallback = opts.suggested || defaultCallback;
42
+ var emptyCallback = opts.empty || defaultCallback;
43
+
44
+ var result = Mailcheck.suggest(Mailcheck.encodeEmail(opts.email), opts.domains, opts.secondLevelDomains, opts.topLevelDomains, opts.distanceFunction);
45
+
46
+ return result ? suggestedCallback(result) : emptyCallback()
47
+ },
48
+
49
+ suggest: function(email, domains, secondLevelDomains, topLevelDomains, distanceFunction) {
50
+ email = email.toLowerCase();
51
+
52
+ var emailParts = this.splitEmail(email);
53
+
54
+ if (secondLevelDomains && topLevelDomains) {
55
+ // If the email is a valid 2nd-level + top-level, do not suggest anything.
56
+ if (secondLevelDomains.indexOf(emailParts.secondLevelDomain) !== -1 && topLevelDomains.indexOf(emailParts.topLevelDomain) !== -1) {
57
+ return false;
58
+ }
59
+ }
60
+
61
+ var closestDomain = this.findClosestDomain(emailParts.domain, domains, distanceFunction, this.domainThreshold);
62
+
63
+ if (closestDomain) {
64
+ if (closestDomain == emailParts.domain) {
65
+ // The email address exactly matches one of the supplied domains; do not return a suggestion.
66
+ return false;
67
+ } else {
68
+ // The email address closely matches one of the supplied domains; return a suggestion
69
+ return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain };
70
+ }
71
+ }
72
+
73
+ // The email address does not closely match one of the supplied domains
74
+ var closestSecondLevelDomain = this.findClosestDomain(emailParts.secondLevelDomain, secondLevelDomains, distanceFunction, this.secondLevelThreshold);
75
+ var closestTopLevelDomain = this.findClosestDomain(emailParts.topLevelDomain, topLevelDomains, distanceFunction, this.topLevelThreshold);
76
+
77
+ if (emailParts.domain) {
78
+ var closestDomain = emailParts.domain;
79
+ var rtrn = false;
80
+
81
+ if(closestSecondLevelDomain && closestSecondLevelDomain != emailParts.secondLevelDomain) {
82
+ // The email address may have a mispelled second-level domain; return a suggestion
83
+ closestDomain = closestDomain.replace(emailParts.secondLevelDomain, closestSecondLevelDomain);
84
+ rtrn = true;
85
+ }
86
+
87
+ if(closestTopLevelDomain && closestTopLevelDomain != emailParts.topLevelDomain) {
88
+ // The email address may have a mispelled top-level domain; return a suggestion
89
+ closestDomain = closestDomain.replace(emailParts.topLevelDomain, closestTopLevelDomain);
90
+ rtrn = true;
91
+ }
92
+
93
+ if (rtrn == true) {
94
+ return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain };
95
+ }
96
+ }
97
+
98
+ /* The email address exactly matches one of the supplied domains, does not closely
99
+ * match any domain and does not appear to simply have a mispelled top-level domain,
100
+ * or is an invalid email address; do not return a suggestion.
101
+ */
102
+ return false;
103
+ },
104
+
105
+ findClosestDomain: function(domain, domains, distanceFunction, threshold) {
106
+ threshold = threshold || this.topLevelThreshold;
107
+ var dist;
108
+ var minDist = 99;
109
+ var closestDomain = null;
110
+
111
+ if (!domain || !domains) {
112
+ return false;
113
+ }
114
+ if(!distanceFunction) {
115
+ distanceFunction = this.sift3Distance;
116
+ }
117
+
118
+ for (var i = 0; i < domains.length; i++) {
119
+ if (domain === domains[i]) {
120
+ return domain;
121
+ }
122
+ dist = distanceFunction(domain, domains[i]);
123
+ if (dist < minDist) {
124
+ minDist = dist;
125
+ closestDomain = domains[i];
126
+ }
127
+ }
128
+
129
+ if (minDist <= threshold && closestDomain !== null) {
130
+ return closestDomain;
131
+ } else {
132
+ return false;
133
+ }
134
+ },
135
+
136
+ sift3Distance: function(s1, s2) {
137
+ // sift3: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
138
+ if (s1 == null || s1.length === 0) {
139
+ if (s2 == null || s2.length === 0) {
140
+ return 0;
141
+ } else {
142
+ return s2.length;
143
+ }
144
+ }
145
+
146
+ if (s2 == null || s2.length === 0) {
147
+ return s1.length;
148
+ }
149
+
150
+ var c = 0;
151
+ var offset1 = 0;
152
+ var offset2 = 0;
153
+ var lcs = 0;
154
+ var maxOffset = 5;
155
+
156
+ while ((c + offset1 < s1.length) && (c + offset2 < s2.length)) {
157
+ if (s1.charAt(c + offset1) == s2.charAt(c + offset2)) {
158
+ lcs++;
159
+ } else {
160
+ offset1 = 0;
161
+ offset2 = 0;
162
+ for (var i = 0; i < maxOffset; i++) {
163
+ if ((c + i < s1.length) && (s1.charAt(c + i) == s2.charAt(c))) {
164
+ offset1 = i;
165
+ break;
166
+ }
167
+ if ((c + i < s2.length) && (s1.charAt(c) == s2.charAt(c + i))) {
168
+ offset2 = i;
169
+ break;
170
+ }
171
+ }
172
+ }
173
+ c++;
174
+ }
175
+ return (s1.length + s2.length) /2 - lcs;
176
+ },
177
+
178
+ splitEmail: function(email) {
179
+ var parts = email.trim().split('@');
180
+
181
+ if (parts.length < 2) {
182
+ return false;
183
+ }
184
+
185
+ for (var i = 0; i < parts.length; i++) {
186
+ if (parts[i] === '') {
187
+ return false;
188
+ }
189
+ }
190
+
191
+ var domain = parts.pop();
192
+ var domainParts = domain.split('.');
193
+ var sld = '';
194
+ var tld = '';
195
+
196
+ if (domainParts.length == 0) {
197
+ // The address does not have a top-level domain
198
+ return false;
199
+ } else if (domainParts.length == 1) {
200
+ // The address has only a top-level domain (valid under RFC)
201
+ tld = domainParts[0];
202
+ } else {
203
+ // The address has a domain and a top-level domain
204
+ sld = domainParts[0];
205
+ for (var i = 1; i < domainParts.length; i++) {
206
+ tld += domainParts[i] + '.';
207
+ }
208
+ tld = tld.substring(0, tld.length - 1);
209
+ }
210
+
211
+ return {
212
+ topLevelDomain: tld,
213
+ secondLevelDomain: sld,
214
+ domain: domain,
215
+ address: parts.join('@')
216
+ }
217
+ },
218
+
219
+ // Encode the email address to prevent XSS but leave in valid
220
+ // characters, following this official spec:
221
+ // http://en.wikipedia.org/wiki/Email_address#Syntax
222
+ encodeEmail: function(email) {
223
+ var result = encodeURI(email);
224
+ result = result.replace('%20', ' ').replace('%25', '%').replace('%5E', '^')
225
+ .replace('%60', '`').replace('%7B', '{').replace('%7C', '|')
226
+ .replace('%7D', '}');
227
+ return result;
228
+ }
229
+ };
230
+
231
+ // Export the mailcheck object if we're in a CommonJS env (e.g. Node).
232
+ // Modeled off of Underscore.js.
233
+ if (typeof module !== 'undefined' && module.exports) {
234
+ module.exports = Mailcheck;
235
+ }
236
+
237
+ // Support AMD style definitions
238
+ // Based on jQuery (see http://stackoverflow.com/a/17954882/1322410)
239
+ if (typeof define === "function" && define.amd) {
240
+ define("mailcheck", [], function() {
241
+ return Mailcheck;
242
+ });
243
+ }
244
+
245
+ if (typeof window !== 'undefined' && window.jQuery) {
246
+ (function($){
247
+ $.fn.mailcheck = function(opts) {
248
+ var self = this;
249
+ if (opts.suggested) {
250
+ var oldSuggested = opts.suggested;
251
+ opts.suggested = function(result) {
252
+ oldSuggested(self, result);
253
+ };
254
+ }
255
+
256
+ if (opts.empty) {
257
+ var oldEmpty = opts.empty;
258
+ opts.empty = function() {
259
+ oldEmpty.call(null, self);
260
+ };
261
+ }
262
+
263
+ opts.email = this.val();
264
+ Mailcheck.run(opts);
265
+ }
266
+ })(jQuery);
267
+ }
assets/js/mailcheck/mailcheck.min.js ADDED
@@ -0,0 +1 @@
 
1
+ /*! mailcheck v1.1.1 @licence MIT */var Mailcheck={domainThreshold:2,secondLevelThreshold:2,topLevelThreshold:2,defaultDomains:["msn.com","bellsouth.net","telus.net","comcast.net","optusnet.com.au","earthlink.net","qq.com","sky.com","icloud.com","mac.com","sympatico.ca","googlemail.com","att.net","xtra.co.nz","web.de","cox.net","gmail.com","ymail.com","aim.com","rogers.com","verizon.net","rocketmail.com","google.com","optonline.net","sbcglobal.net","aol.com","me.com","btinternet.com","charter.net","shaw.ca"],defaultSecondLevelDomains:["yahoo","hotmail","mail","live","outlook","gmx"],defaultTopLevelDomains:["com","com.au","com.tw","ca","co.nz","co.uk","de","fr","it","ru","net","org","edu","gov","jp","nl","kr","se","eu","ie","co.il","us","at","be","dk","hk","es","gr","ch","no","cz","in","net","net.au","info","biz","mil","co.jp","sg","hu"],run:function(a){a.domains=a.domains||Mailcheck.defaultDomains,a.secondLevelDomains=a.secondLevelDomains||Mailcheck.defaultSecondLevelDomains,a.topLevelDomains=a.topLevelDomains||Mailcheck.defaultTopLevelDomains,a.distanceFunction=a.distanceFunction||Mailcheck.sift3Distance;var b=function(a){return a},c=a.suggested||b,d=a.empty||b,e=Mailcheck.suggest(Mailcheck.encodeEmail(a.email),a.domains,a.secondLevelDomains,a.topLevelDomains,a.distanceFunction);return e?c(e):d()},suggest:function(a,b,c,d,e){a=a.toLowerCase();var f=this.splitEmail(a);if(c&&d&&-1!==c.indexOf(f.secondLevelDomain)&&-1!==d.indexOf(f.topLevelDomain))return!1;var g=this.findClosestDomain(f.domain,b,e,this.domainThreshold);if(g)return g==f.domain?!1:{address:f.address,domain:g,full:f.address+"@"+g};var h=this.findClosestDomain(f.secondLevelDomain,c,e,this.secondLevelThreshold),i=this.findClosestDomain(f.topLevelDomain,d,e,this.topLevelThreshold);if(f.domain){var g=f.domain,j=!1;if(h&&h!=f.secondLevelDomain&&(g=g.replace(f.secondLevelDomain,h),j=!0),i&&i!=f.topLevelDomain&&(g=g.replace(f.topLevelDomain,i),j=!0),1==j)return{address:f.address,domain:g,full:f.address+"@"+g}}return!1},findClosestDomain:function(a,b,c,d){d=d||this.topLevelThreshold;var e,f=99,g=null;if(!a||!b)return!1;c||(c=this.sift3Distance);for(var h=0;h<b.length;h++){if(a===b[h])return a;e=c(a,b[h]),f>e&&(f=e,g=b[h])}return d>=f&&null!==g?g:!1},sift3Distance:function(a,b){if(null==a||0===a.length)return null==b||0===b.length?0:b.length;if(null==b||0===b.length)return a.length;for(var c=0,d=0,e=0,f=0,g=5;c+d<a.length&&c+e<b.length;){if(a.charAt(c+d)==b.charAt(c+e))f++;else{d=0,e=0;for(var h=0;g>h;h++){if(c+h<a.length&&a.charAt(c+h)==b.charAt(c)){d=h;break}if(c+h<b.length&&a.charAt(c)==b.charAt(c+h)){e=h;break}}}c++}return(a.length+b.length)/2-f},splitEmail:function(a){var b=a.trim().split("@");if(b.length<2)return!1;for(var c=0;c<b.length;c++)if(""===b[c])return!1;var d=b.pop(),e=d.split("."),f="",g="";if(0==e.length)return!1;if(1==e.length)g=e[0];else{f=e[0];for(var c=1;c<e.length;c++)g+=e[c]+".";g=g.substring(0,g.length-1)}return{topLevelDomain:g,secondLevelDomain:f,domain:d,address:b.join("@")}},encodeEmail:function(a){var b=encodeURI(a);return b=b.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};"undefined"!=typeof module&&module.exports&&(module.exports=Mailcheck),"function"==typeof define&&define.amd&&define("mailcheck",[],function(){return Mailcheck}),"undefined"!=typeof window&&window.jQuery&&!function(a){a.fn.mailcheck=function(a){var b=this;if(a.suggested){var c=a.suggested;a.suggested=function(a){c(b,a)}}if(a.empty){var d=a.empty;a.empty=function(){d.call(null,b)}}a.email=this.val(),Mailcheck.run(a)}}(jQuery);
includes/admin/class-wc-ecfb-admin.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Plugin admin class.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Admin {
10
+
11
+ /**
12
+ * Initialize the plugin admin.
13
+ */
14
+ public function __construct() {
15
+ // Load admin style sheet and JavaScript.
16
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
17
+
18
+ $this->maybe_install();
19
+ }
20
+
21
+ /**
22
+ * Admin scripts
23
+ */
24
+ public function admin_scripts() {
25
+ $screen = get_current_screen();
26
+
27
+ if ( 'shop_order' == $screen->id ) {
28
+
29
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
30
+
31
+ // Get plugin settings.
32
+ $settings = get_option( 'wcbcf_settings' );
33
+
34
+ // Styles.
35
+ wp_enqueue_style( 'woocommerce-extra-checkout-fields-for-brazil-admin', Extra_Checkout_Fields_For_Brazil::get_assets_url() . 'css/admin/admin.css', array(), Extra_Checkout_Fields_For_Brazil::VERSION );
36
+
37
+ // Shop order.
38
+ wp_enqueue_script( 'woocommerce-extra-checkout-fields-for-brazil-shop-order', Extra_Checkout_Fields_For_Brazil::get_assets_url() . 'js/admin/shop-order' . $suffix .'.js', array( 'jquery' ), Extra_Checkout_Fields_For_Brazil::VERSION, true );
39
+
40
+ // Localize strings.
41
+ wp_localize_script(
42
+ 'woocommerce-extra-checkout-fields-for-brazil-shop-order',
43
+ 'wcbcf_shop_order_params',
44
+ array(
45
+ 'load_message' => esc_js( __( 'Load the customer extras data?', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
46
+ 'copy_message' => esc_js( __( 'Also copy the data of number and neighborhood?', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
47
+ 'person_type' => absint( $settings['person_type'] )
48
+ )
49
+ );
50
+ }
51
+
52
+ if ( 'woocommerce_page_woocommerce-extra-checkout-fields-for-brazil' == $screen->id ) {
53
+ wp_enqueue_script( 'woocommerce-extra-checkout-fields-for-brazil-admin', Extra_Checkout_Fields_For_Brazil::get_assets_url() . 'js/admin/admin' . $suffix .'.js', array( 'jquery' ), Extra_Checkout_Fields_For_Brazil::VERSION );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Maybe install.
59
+ */
60
+ public function maybe_install() {
61
+ if ( $version = get_option( 'wcbcf_version' ) ) {
62
+ if ( version_compare( $version, Extra_Checkout_Fields_For_Brazil::VERSION, '<' ) ) {
63
+ $options = get_option( 'wcbcf_settings' );
64
+
65
+ // Update to version 3.0.0.
66
+ if ( version_compare( $version, '3.0.0', '<' ) ) {
67
+ if ( isset( $options['person_type'] ) ) {
68
+ $options['person_type'] = 1;
69
+ } else {
70
+ $options['person_type'] = 0;
71
+ }
72
+ }
73
+
74
+ update_option( 'wcbcf_settings', $options );
75
+ update_option( 'wcbcf_version', Extra_Checkout_Fields_For_Brazil::VERSION );
76
+ }
77
+ } else {
78
+ $default = array(
79
+ 'person_type' => 1,
80
+ // 'only_brazil' => 0,
81
+ // 'ie' => 0,
82
+ // 'rg' => 0,
83
+ // 'birthdate_sex' => 0,
84
+ 'cell_phone' => 1,
85
+ 'mailcheck' => 1,
86
+ 'maskedinput' => 1,
87
+ 'addresscomplete' => 1,
88
+ 'validate_cpf' => 1,
89
+ 'validate_cnpj' => 1
90
+ );
91
+
92
+ add_option( 'wcbcf_settings', $default );
93
+ add_option( 'wcbcf_version', Extra_Checkout_Fields_For_Brazil::VERSION );
94
+ }
95
+ }
96
+ }
97
+
98
+ new Extra_Checkout_Fields_For_Brazil_Admin();
includes/admin/class-wc-ecfb-customer.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Customer class.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Customer {
10
+
11
+ /**
12
+ * Initialize the customer actions.
13
+ */
14
+ public function __construct() {
15
+ add_filter( 'woocommerce_customer_meta_fields', array( $this, 'customer_meta_fields' ) );
16
+ add_filter( 'woocommerce_user_column_billing_address', array( $this, 'user_column_billing_address' ), 1, 2 );
17
+ add_filter( 'woocommerce_user_column_shipping_address', array( $this, 'user_column_shipping_address' ), 1, 2 );
18
+ }
19
+
20
+ /**
21
+ * Custom user edit fields.
22
+ *
23
+ * @param array $fields Default fields.
24
+ *
25
+ * @return array Custom fields.
26
+ */
27
+ public function customer_meta_fields( $fields ) {
28
+ unset( $fields );
29
+
30
+ // Get plugin settings.
31
+ $settings = get_option( 'wcbcf_settings' );
32
+
33
+ // Billing fields.
34
+ $fields['billing']['title'] = __( 'Customer Billing Address', 'woocommerce-extra-checkout-fields-for-brazil' );
35
+ $fields['billing']['fields']['billing_first_name'] = array(
36
+ 'label' => __( 'First name', 'woocommerce-extra-checkout-fields-for-brazil' ),
37
+ 'description' => ''
38
+ );
39
+ $fields['billing']['fields']['billing_last_name'] = array(
40
+ 'label' => __( 'Last name', 'woocommerce-extra-checkout-fields-for-brazil' ),
41
+ 'description' => ''
42
+ );
43
+
44
+ if ( 0 != $settings['person_type'] ) {
45
+
46
+ if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
47
+ $fields['billing']['fields']['billing_cpf'] = array(
48
+ 'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
49
+ 'description' => ''
50
+ );
51
+
52
+ if ( isset( $settings['rg'] ) ) {
53
+ $fields['billing']['fields']['billing_rg'] = array(
54
+ 'label' => __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ),
55
+ 'description' => ''
56
+ );
57
+ }
58
+ }
59
+
60
+ if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
61
+ $fields['billing']['fields']['billing_company'] = array(
62
+ 'label' => __( 'Company Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
63
+ 'description' => ''
64
+ );
65
+ $fields['billing']['fields']['billing_cnpj'] = array(
66
+ 'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
67
+ 'description' => ''
68
+ );
69
+
70
+ if ( isset( $settings['ie'] ) ) {
71
+ $fields['billing']['fields']['billing_ie'] = array(
72
+ 'label' => __( 'State Registration', 'woocommerce-extra-checkout-fields-for-brazil' ),
73
+ 'description' => ''
74
+ );
75
+ }
76
+ }
77
+ } else {
78
+ $fields['billing']['fields']['billing_company'] = array(
79
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
80
+ 'description' => ''
81
+ );
82
+ }
83
+
84
+ if ( isset( $settings['birthdate_sex'] ) ) {
85
+ $fields['billing']['fields']['billing_birthdate'] = array(
86
+ 'label' => __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' ),
87
+ 'description' => ''
88
+ );
89
+ $fields['billing']['fields']['billing_sex'] = array(
90
+ 'label' => __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' ),
91
+ 'description' => ''
92
+ );
93
+ }
94
+
95
+ $fields['billing']['fields']['billing_country'] = array(
96
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
97
+ 'description' => __( '2 letter Country code', 'woocommerce-extra-checkout-fields-for-brazil' )
98
+ );
99
+ $fields['billing']['fields']['billing_postcode'] = array(
100
+ 'label' => __( 'Postcode', 'woocommerce-extra-checkout-fields-for-brazil' ),
101
+ 'description' => ''
102
+ );
103
+ $fields['billing']['fields']['billing_address_1'] = array(
104
+ 'label' => __( 'Address 1', 'woocommerce-extra-checkout-fields-for-brazil' ),
105
+ 'description' => ''
106
+ );
107
+ $fields['billing']['fields']['billing_number'] = array(
108
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
109
+ 'description' => ''
110
+ );
111
+ $fields['billing']['fields']['billing_address_2'] = array(
112
+ 'label' => __( 'Address 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
113
+ 'description' => ''
114
+ );
115
+ $fields['billing']['fields']['billing_neighborhood'] = array(
116
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
117
+ 'description' => ''
118
+ );
119
+ $fields['billing']['fields']['billing_city'] = array(
120
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
121
+ 'description' => ''
122
+ );
123
+ $fields['billing']['fields']['billing_state'] = array(
124
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
125
+ 'description' => __( 'State code', 'woocommerce-extra-checkout-fields-for-brazil' )
126
+ );
127
+ $fields['billing']['fields']['billing_phone'] = array(
128
+ 'label' => __( 'Telephone', 'woocommerce-extra-checkout-fields-for-brazil' ),
129
+ 'description' => ''
130
+ );
131
+
132
+ if ( isset( $settings['cell_phone'] ) ) {
133
+ $fields['billing']['fields']['billing_cellphone'] = array(
134
+ 'label' => __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
135
+ 'description' => ''
136
+ );
137
+ }
138
+
139
+ $fields['billing']['fields']['billing_email'] = array(
140
+ 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
141
+ 'description' => ''
142
+ );
143
+
144
+ // Shipping fields.
145
+ $fields['shipping']['title'] = __( 'Customer Shipping Address', 'woocommerce-extra-checkout-fields-for-brazil' );
146
+ $fields['shipping']['fields']['shipping_first_name'] = array(
147
+ 'label' => __( 'First name', 'woocommerce-extra-checkout-fields-for-brazil' ),
148
+ 'description' => ''
149
+ );
150
+ $fields['shipping']['fields']['shipping_last_name'] = array(
151
+ 'label' => __( 'Last name', 'woocommerce-extra-checkout-fields-for-brazil' ),
152
+ 'description' => ''
153
+ );
154
+ $fields['shipping']['fields']['shipping_company'] = array(
155
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
156
+ 'description' => ''
157
+ );
158
+ $fields['shipping']['fields']['shipping_country'] = array(
159
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
160
+ 'description' => __( '2 letter Country code', 'woocommerce-extra-checkout-fields-for-brazil' )
161
+ );
162
+ $fields['shipping']['fields']['shipping_postcode'] = array(
163
+ 'label' => __( 'Postcode', 'woocommerce-extra-checkout-fields-for-brazil' ),
164
+ 'description' => ''
165
+ );
166
+ $fields['shipping']['fields']['shipping_address_1'] = array(
167
+ 'label' => __( 'Address 1', 'woocommerce-extra-checkout-fields-for-brazil' ),
168
+ 'description' => ''
169
+ );
170
+ $fields['shipping']['fields']['shipping_number'] = array(
171
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
172
+ 'description' => ''
173
+ );
174
+ $fields['shipping']['fields']['shipping_address_2'] = array(
175
+ 'label' => __( 'Address 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
176
+ 'description' => ''
177
+ );
178
+ $fields['shipping']['fields']['shipping_neighborhood'] = array(
179
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
180
+ 'description' => ''
181
+ );
182
+ $fields['shipping']['fields']['shipping_city'] = array(
183
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
184
+ 'description' => ''
185
+ );
186
+ $fields['shipping']['fields']['shipping_state'] = array(
187
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
188
+ 'description' => __( 'State code', 'woocommerce-extra-checkout-fields-for-brazil' )
189
+ );
190
+
191
+ $new_fields = apply_filters( 'wcbcf_customer_meta_fields', $fields );
192
+
193
+ return $new_fields;
194
+ }
195
+
196
+ /**
197
+ * Custom user column billing address information.
198
+ *
199
+ * @param array $address Default address.
200
+ * @param int $user_id User id.
201
+ *
202
+ * @return array New address format.
203
+ */
204
+ public function user_column_billing_address( $address, $user_id ) {
205
+ $address['number'] = get_user_meta( $user_id, 'billing_number', true );
206
+ $address['neighborhood'] = get_user_meta( $user_id, 'billing_neighborhood', true );
207
+
208
+ return $address;
209
+ }
210
+
211
+ /**
212
+ * Custom user column shipping address information.
213
+ *
214
+ * @param array $address Default address.
215
+ * @param int $user_id User id.
216
+ *
217
+ * @return array New address format.
218
+ */
219
+ public function user_column_shipping_address( $address, $user_id ) {
220
+ $address['number'] = get_user_meta( $user_id, 'shipping_number', true );
221
+ $address['neighborhood'] = get_user_meta( $user_id, 'shipping_neighborhood', true );
222
+
223
+ return $address;
224
+ }
225
+ }
226
+
227
+ new Extra_Checkout_Fields_For_Brazil_Customer();
includes/admin/class-wc-ecfb-order.php ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Shop order class.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Order {
10
+
11
+ /**
12
+ * Initialize the order actions.
13
+ */
14
+ public function __construct() {
15
+ add_filter( 'woocommerce_admin_billing_fields', array( $this, 'shop_order_billing_fields' ) );
16
+ add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'shop_order_shipping_fields' ) );
17
+ add_filter( 'woocommerce_found_customer_details', array( $this, 'customer_details_ajax' ) );
18
+ add_action( 'woocommerce_admin_order_data_after_billing_address', array( $this, 'order_data_after_billing_address' ) );
19
+ add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'order_data_after_shipping_address' ) );
20
+ add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_custom_shop_data' ) );
21
+ }
22
+
23
+ /**
24
+ * Custom shop order billing fields.
25
+ *
26
+ * @param array $data Default order billing fields.
27
+ *
28
+ * @return array Custom order billing fields.
29
+ */
30
+ public function shop_order_billing_fields( $data ) {
31
+ // Get plugin settings.
32
+ $settings = get_option( 'wcbcf_settings' );
33
+
34
+ $billing_data['first_name'] = array(
35
+ 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
36
+ 'show' => false
37
+ );
38
+ $billing_data['last_name'] = array(
39
+ 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
40
+ 'show' => false
41
+ );
42
+
43
+ if ( 0 != $settings['person_type'] ) {
44
+ if ( 1 == $settings['person_type'] ) {
45
+ $billing_data['persontype'] = array(
46
+ 'type' => 'select',
47
+ 'label' => __( 'Person type', 'woocommerce-extra-checkout-fields-for-brazil' ),
48
+ 'options' => array(
49
+ '0' => __( 'Select', 'woocommerce-extra-checkout-fields-for-brazil' ),
50
+ '1' => __( 'Individuals', 'woocommerce-extra-checkout-fields-for-brazil' ),
51
+ '2' => __( 'Legal Person', 'woocommerce-extra-checkout-fields-for-brazil' )
52
+ )
53
+ );
54
+ }
55
+
56
+ if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
57
+ $billing_data['cpf'] = array(
58
+ 'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
59
+ );
60
+ if ( isset( $settings['rg'] ) ) {
61
+ $billing_data['rg'] = array(
62
+ 'label' => __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ),
63
+ );
64
+ }
65
+ }
66
+
67
+ if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
68
+ $billing_data['company'] = array(
69
+ 'label' => __( 'Company Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
70
+ );
71
+ $billing_data['cnpj'] = array(
72
+ 'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
73
+ );
74
+ if ( isset( $settings['ie'] ) ) {
75
+ $billing_data['ie'] = array(
76
+ 'label' => __( 'State Registration', 'woocommerce-extra-checkout-fields-for-brazil' ),
77
+ );
78
+ }
79
+ }
80
+
81
+ } else {
82
+ $billing_data['company'] = array(
83
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
84
+ 'show' => false
85
+ );
86
+ }
87
+
88
+ if ( isset( $settings['birthdate_sex'] ) ) {
89
+ $billing_data['birthdate'] = array(
90
+ 'label' => __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' )
91
+ );
92
+ $billing_data['sex'] = array(
93
+ 'label' => __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' )
94
+ );
95
+ }
96
+
97
+ $billing_data['address_1'] = array(
98
+ 'label' => __( 'Address 1', 'woocommerce-extra-checkout-fields-for-brazil' ),
99
+ 'show' => false
100
+ );
101
+ $billing_data['number'] = array(
102
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
103
+ 'show' => false
104
+ );
105
+ $billing_data['address_2'] = array(
106
+ 'label' => __( 'Address 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
107
+ 'show' => false
108
+ );
109
+ $billing_data['neighborhood'] = array(
110
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
111
+ 'show' => false
112
+ );
113
+ $billing_data['city'] = array(
114
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
115
+ 'show' => false
116
+ );
117
+ $billing_data['state'] = array(
118
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
119
+ 'show' => false
120
+ );
121
+ $billing_data['country'] = array(
122
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
123
+ 'show' => false,
124
+ 'type' => 'select',
125
+ 'options' => array(
126
+ '' => __( 'Select a country&hellip;', 'woocommerce-extra-checkout-fields-for-brazil' )
127
+ ) + WC()->countries->get_allowed_countries()
128
+ );
129
+ $billing_data['postcode'] = array(
130
+ 'label' => __( 'Postcode', 'woocommerce-extra-checkout-fields-for-brazil' ),
131
+ 'show' => false
132
+ );
133
+
134
+ $billing_data['phone'] = array(
135
+ 'label' => __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
136
+ );
137
+
138
+ if ( isset( $settings['cell_phone'] ) ) {
139
+ $billing_data['cellphone'] = array(
140
+ 'label' => __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
141
+ );
142
+ }
143
+
144
+ $billing_data['email'] = array(
145
+ 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
146
+ );
147
+
148
+
149
+ return apply_filters( 'wcbcf_admin_billing_fields', $billing_data );
150
+ }
151
+
152
+ /**
153
+ * Custom shop order shipping fields.
154
+ *
155
+ * @param array $data Default order shipping fields.
156
+ *
157
+ * @return array Custom order shipping fields.
158
+ */
159
+ public function shop_order_shipping_fields( $data ) {
160
+ $shipping_data['first_name'] = array(
161
+ 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
162
+ 'show' => false
163
+ );
164
+ $shipping_data['last_name'] = array(
165
+ 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
166
+ 'show' => false
167
+ );
168
+ $shipping_data['company'] = array(
169
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
170
+ 'show' => false
171
+ );
172
+ $shipping_data['address_1'] = array(
173
+ 'label' => __( 'Address 1', 'woocommerce-extra-checkout-fields-for-brazil' ),
174
+ 'show' => false
175
+ );
176
+ $shipping_data['number'] = array(
177
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
178
+ 'show' => false
179
+ );
180
+ $shipping_data['address_2'] = array(
181
+ 'label' => __( 'Address 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
182
+ 'show' => false
183
+ );
184
+ $shipping_data['neighborhood'] = array(
185
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
186
+ 'show' => false
187
+ );
188
+ $shipping_data['city'] = array(
189
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
190
+ 'show' => false
191
+ );
192
+ $shipping_data['state'] = array(
193
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
194
+ 'show' => false
195
+ );
196
+ $shipping_data['country'] = array(
197
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
198
+ 'show' => false,
199
+ 'type' => 'select',
200
+ 'options' => array(
201
+ '' => __( 'Select a country&hellip;', 'woocommerce-extra-checkout-fields-for-brazil' )
202
+ ) + WC()->countries->get_allowed_countries()
203
+ );
204
+ $shipping_data['postcode'] = array(
205
+ 'label' => __( 'Postcode', 'woocommerce-extra-checkout-fields-for-brazil' ),
206
+ 'show' => false
207
+ );
208
+
209
+ return apply_filters( 'wcbcf_admin_shipping_fields', $shipping_data );
210
+ }
211
+
212
+ /**
213
+ * Add custom fields in customer details ajax.
214
+ */
215
+ public function customer_details_ajax( $customer_data ) {
216
+ $user_id = (int) trim( stripslashes( $_POST['user_id'] ) );
217
+ $type_to_load = esc_attr( trim( stripslashes( $_POST['type_to_load'] ) ) );
218
+
219
+ $custom_data = array(
220
+ $type_to_load . '_number' => get_user_meta( $user_id, $type_to_load . '_number', true ),
221
+ $type_to_load . '_neighborhood' => get_user_meta( $user_id, $type_to_load . '_neighborhood', true ),
222
+ $type_to_load . '_persontype' => get_user_meta( $user_id, $type_to_load . '_persontype', true ),
223
+ $type_to_load . '_cpf' => get_user_meta( $user_id, $type_to_load . '_cpf', true ),
224
+ $type_to_load . '_rg' => get_user_meta( $user_id, $type_to_load . '_rg', true ),
225
+ $type_to_load . '_cnpj' => get_user_meta( $user_id, $type_to_load . '_cnpj', true ),
226
+ $type_to_load . '_ie' => get_user_meta( $user_id, $type_to_load . '_ie', true ),
227
+ $type_to_load . '_birthdate' => get_user_meta( $user_id, $type_to_load . '_birthdate', true ),
228
+ $type_to_load . '_sex' => get_user_meta( $user_id, $type_to_load . '_sex', true ),
229
+ $type_to_load . '_cellphone' => get_user_meta( $user_id, $type_to_load . '_cellphone', true )
230
+ );
231
+
232
+ return array_merge( $customer_data, $custom_data );
233
+ }
234
+
235
+ /**
236
+ * Custom billing admin fields.
237
+ *
238
+ * @param object $order Order data.
239
+ *
240
+ * @return string Custom information.
241
+ */
242
+ public function order_data_after_billing_address( $order ) {
243
+ // Get plugin settings.
244
+ $settings = get_option( 'wcbcf_settings' );
245
+
246
+ $html = '<div class="clear"></div>';
247
+ $html .= '<div class="wcbcf-address">';
248
+
249
+ if ( ! $order->get_formatted_billing_address() ) {
250
+ $html .= '<p class="none_set"><strong>' . __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce-extra-checkout-fields-for-brazil' ) . '</p>';
251
+ } else {
252
+
253
+ $html .= '<p><strong>' . __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ) . ':</strong><br />';
254
+ $html .= $order->get_formatted_billing_address();
255
+ $html .= '</p>';
256
+ }
257
+
258
+ $html .= '<h4>' . __( 'Customer data', 'woocommerce-extra-checkout-fields-for-brazil' ) . '</h4>';
259
+
260
+ $html .= '<p>';
261
+
262
+ if ( 0 != $settings['person_type'] ) {
263
+
264
+ // Person type information.
265
+ if ( ( 1 == $order->billing_persontype && 1 == $settings['person_type'] ) || 2 == $settings['person_type'] ) {
266
+ $html .= '<strong>' . __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_cpf . '<br />';
267
+
268
+ if ( isset( $settings['rg'] ) ) {
269
+ $html .= '<strong>' . __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_rg . '<br />';
270
+ }
271
+ }
272
+
273
+ if ( ( 2 == $order->billing_persontype && 1 == $settings['person_type'] ) || 3 == $settings['person_type'] ) {
274
+ $html .= '<strong>' . __( 'Company Name', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_company . '<br />';
275
+ $html .= '<strong>' . __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_cnpj . '<br />';
276
+
277
+ if ( isset( $settings['ie'] ) ) {
278
+ $html .= '<strong>' . __( 'State Registration', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_ie . '<br />';
279
+ }
280
+ }
281
+ } else {
282
+ $html .= '<strong>' . __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_company . '<br />';
283
+ }
284
+
285
+ if ( isset( $settings['birthdate_sex'] ) ) {
286
+
287
+ // Birthdate information.
288
+ $html .= '<strong>' . __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_birthdate . '<br />';
289
+
290
+ // Sex Information.
291
+ $html .= '<strong>' . __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_sex . '<br />';
292
+ }
293
+
294
+ $html .= '<strong>' . __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_phone . '<br />';
295
+
296
+ // Cell Phone Information.
297
+ if ( isset( $settings['cell_phone'] ) ) {
298
+ $html .= '<strong>' . __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_cellphone . '<br />';
299
+ }
300
+
301
+ $html .= '<strong>' . __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ) . ': </strong>' . $order->billing_email . '<br />';
302
+
303
+ $html .= '</p>';
304
+
305
+ $html .= '</div>';
306
+
307
+ echo $html;
308
+ }
309
+
310
+ /**
311
+ * Custom billing admin fields.
312
+ *
313
+ * @param object $order Order data.
314
+ *
315
+ * @return string Custom information.
316
+ */
317
+ public function order_data_after_shipping_address( $order ) {
318
+ global $post;
319
+
320
+ // Get plugin settings.
321
+ $settings = get_option( 'wcbcf_settings' );
322
+
323
+ $html = '<div class="clear"></div>';
324
+ $html .= '<div class="wcbcf-address">';
325
+
326
+ if ( ! $order->get_formatted_shipping_address() ) {
327
+ $html .= '<p class="none_set"><strong>' . __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce-extra-checkout-fields-for-brazil' ) . '</p>';
328
+ } else {
329
+
330
+ $html .= '<p><strong>' . __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ) . ':</strong><br />';
331
+ $html .= $order->get_formatted_shipping_address();
332
+ $html .= '</p>';
333
+ }
334
+
335
+ if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) && $post->post_excerpt ) {
336
+ $html .= '<p><strong>' . __( 'Customer Note', 'woocommerce-extra-checkout-fields-for-brazil' ) . ':</strong><br />' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
337
+ }
338
+
339
+ $html .= '</div>';
340
+
341
+ echo $html;
342
+ }
343
+
344
+ /**
345
+ * Save custom shop data fields.
346
+ *
347
+ * @param int $post_id Post ID.
348
+ *
349
+ * @return mixed
350
+ */
351
+ public function save_custom_shop_data( $post_id ) {
352
+ // Get plugin settings.
353
+ $settings = get_option( 'wcbcf_settings' );
354
+
355
+ // Update options.
356
+ update_post_meta( $post_id, '_billing_number', woocommerce_clean( $_POST['_billing_number'] ) );
357
+ update_post_meta( $post_id, '_billing_neighborhood', woocommerce_clean( $_POST['_billing_neighborhood'] ) );
358
+ update_post_meta( $post_id, '_shipping_number', woocommerce_clean( $_POST['_shipping_number'] ) );
359
+ update_post_meta( $post_id, '_shipping_neighborhood', woocommerce_clean( $_POST['_shipping_neighborhood'] ) );
360
+
361
+ if ( 0 != $settings['person_type'] ) {
362
+ if ( 1 == $settings['person_type'] ) {
363
+ update_post_meta( $post_id, '_billing_persontype', woocommerce_clean( $_POST['_billing_persontype'] ) );
364
+ }
365
+
366
+ if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
367
+ update_post_meta( $post_id, '_billing_cpf', woocommerce_clean( $_POST['_billing_cpf'] ) );
368
+
369
+ if ( isset( $settings['rg'] ) ) {
370
+ update_post_meta( $post_id, '_billing_rg', woocommerce_clean( $_POST['_billing_rg'] ) );
371
+ }
372
+ }
373
+
374
+ if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
375
+ update_post_meta( $post_id, '_billing_cnpj', woocommerce_clean( $_POST['_billing_cnpj'] ) );
376
+
377
+ if ( isset( $settings['ie'] ) ) {
378
+ update_post_meta( $post_id, '_billing_ie', woocommerce_clean( $_POST['_billing_ie'] ) );
379
+ }
380
+ }
381
+ }
382
+
383
+ if ( isset( $settings['birthdate_sex'] ) ) {
384
+ update_post_meta( $post_id, '_billing_birthdate', woocommerce_clean( $_POST['_billing_birthdate'] ) );
385
+ update_post_meta( $post_id, '_billing_sex', woocommerce_clean( $_POST['_billing_sex'] ) );
386
+ }
387
+
388
+ if ( isset( $settings['cell_phone'] ) ) {
389
+ update_post_meta( $post_id, '_billing_cellphone', woocommerce_clean( $_POST['_billing_cellphone'] ) );
390
+ }
391
+ }
392
+ }
393
+
394
+ new Extra_Checkout_Fields_For_Brazil_Order();
includes/admin/class-wc-ecfb-settings.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Plugin settings class.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Settings {
10
+
11
+ /**
12
+ * Initialize the settings.
13
+ */
14
+ public function __construct() {
15
+ add_action( 'admin_menu', array( $this, 'settings_menu' ), 59 );
16
+ add_action( 'admin_init', array( $this, 'plugin_settings' ) );
17
+ }
18
+
19
+ /**
20
+ * Add the settings page.
21
+ */
22
+ public function settings_menu() {
23
+ add_submenu_page(
24
+ 'woocommerce',
25
+ __( 'Checkout Fields', 'woocommerce-extra-checkout-fields-for-brazil' ),
26
+ __( 'Checkout Fields', 'woocommerce-extra-checkout-fields-for-brazil' ),
27
+ 'manage_options',
28
+ 'woocommerce-extra-checkout-fields-for-brazil',
29
+ array( $this, 'html_settings_page' )
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Render the settings page for this plugin.
35
+ */
36
+ public function html_settings_page() {
37
+ include_once 'views/html-settings-page.php';
38
+ }
39
+
40
+ /**
41
+ * Plugin settings form fields.
42
+ */
43
+ public function plugin_settings() {
44
+ $option = 'wcbcf_settings';
45
+
46
+ // Set Custom Fields cection.
47
+ add_settings_section(
48
+ 'options_section',
49
+ __( 'Checkout Custom Fields:', 'woocommerce-extra-checkout-fields-for-brazil' ),
50
+ array( $this, 'section_options_callback' ),
51
+ $option
52
+ );
53
+
54
+ // Person Type option.
55
+ add_settings_field(
56
+ 'person_type',
57
+ __( 'Display Person Type:', 'woocommerce-extra-checkout-fields-for-brazil' ),
58
+ array( $this, 'select_element_callback' ),
59
+ $option,
60
+ 'options_section',
61
+ array(
62
+ 'menu' => $option,
63
+ 'id' => 'person_type',
64
+ 'description' => __( 'Individuals enables CPF field and Legal Person enables CNPJ field.', 'woocommerce-extra-checkout-fields-for-brazil' ),
65
+ 'options' => array(
66
+ 0 => __( 'None', 'woocommerce-extra-checkout-fields-for-brazil' ),
67
+ 1 => __( 'Individuals and Legal Person', 'woocommerce-extra-checkout-fields-for-brazil' ),
68
+ 2 => __( 'Individuals only', 'woocommerce-extra-checkout-fields-for-brazil' ),
69
+ 3 => __( 'Legal Person only', 'woocommerce-extra-checkout-fields-for-brazil' ),
70
+ )
71
+ )
72
+ );
73
+
74
+ // Person Type is Required option.
75
+ add_settings_field(
76
+ 'only_brazil',
77
+ __( 'Person Type is requered only in Brazil?', 'woocommerce-extra-checkout-fields-for-brazil' ),
78
+ array( $this, 'checkbox_element_callback' ),
79
+ $option,
80
+ 'options_section',
81
+ array(
82
+ 'menu' => $option,
83
+ 'id' => 'only_brazil',
84
+ 'label' => __( 'If checked the Individuals and Legal Person options will be mandatory only in Brazil.', 'woocommerce-extra-checkout-fields-for-brazil' )
85
+ )
86
+ );
87
+
88
+ // RG option.
89
+ add_settings_field(
90
+ 'rg',
91
+ __( 'Display RG:', 'woocommerce-extra-checkout-fields-for-brazil' ),
92
+ array( $this, 'checkbox_element_callback' ),
93
+ $option,
94
+ 'options_section',
95
+ array(
96
+ 'menu' => $option,
97
+ 'id' => 'rg',
98
+ 'label' => __( 'If checked show the RG field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil' )
99
+ )
100
+ );
101
+
102
+ // State Registration option.
103
+ add_settings_field(
104
+ 'ie',
105
+ __( 'Display State Registration:', 'woocommerce-extra-checkout-fields-for-brazil' ),
106
+ array( $this, 'checkbox_element_callback' ),
107
+ $option,
108
+ 'options_section',
109
+ array(
110
+ 'menu' => $option,
111
+ 'id' => 'ie',
112
+ 'label' => __( 'If checked show the State Registration field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil' )
113
+ )
114
+ );
115
+
116
+ // Birthdate and Sex option.
117
+ add_settings_field(
118
+ 'birthdate_sex',
119
+ __( 'Display Birthdate and Sex:', 'woocommerce-extra-checkout-fields-for-brazil' ),
120
+ array( $this, 'checkbox_element_callback' ),
121
+ $option,
122
+ 'options_section',
123
+ array(
124
+ 'menu' => $option,
125
+ 'id' => 'birthdate_sex',
126
+ 'label' => __( 'If checked show the Birthdate and Sex field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil' )
127
+ )
128
+ );
129
+
130
+ // Cell Phone option.
131
+ add_settings_field(
132
+ 'cell_phone',
133
+ __( 'Display Cell Phone:', 'woocommerce-extra-checkout-fields-for-brazil' ),
134
+ array( $this, 'checkbox_element_callback' ),
135
+ $option,
136
+ 'options_section',
137
+ array(
138
+ 'menu' => $option,
139
+ 'id' => 'cell_phone',
140
+ 'label' => __( 'If checked show the Cell Phone field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil' )
141
+ )
142
+ );
143
+
144
+ // Set Custom Fields cection.
145
+ add_settings_section(
146
+ 'jquery_section',
147
+ __( 'jQuery Options:', 'woocommerce-extra-checkout-fields-for-brazil' ),
148
+ array( $this, 'section_options_callback' ),
149
+ $option
150
+ );
151
+
152
+ // Mail Check option.
153
+ add_settings_field(
154
+ 'mailcheck',
155
+ __( 'Enable Mail Check:', 'woocommerce-extra-checkout-fields-for-brazil' ),
156
+ array( $this, 'checkbox_element_callback' ),
157
+ $option,
158
+ 'jquery_section',
159
+ array(
160
+ 'menu' => $option,
161
+ 'id' => 'mailcheck',
162
+ 'label' => __( 'If checked informs typos in email to users.', 'woocommerce-extra-checkout-fields-for-brazil' )
163
+ )
164
+ );
165
+
166
+ // Input Mask option.
167
+ add_settings_field(
168
+ 'maskedinput',
169
+ __( 'Enable Input Mask:', 'woocommerce-extra-checkout-fields-for-brazil' ),
170
+ array( $this, 'checkbox_element_callback' ),
171
+ $option,
172
+ 'jquery_section',
173
+ array(
174
+ 'menu' => $option,
175
+ 'id' => 'maskedinput',
176
+ 'label' => __( 'If checked create masks fill for in fields of CPF, CNPJ, Birthdate, Phone and Cell Phone.', 'woocommerce-extra-checkout-fields-for-brazil' )
177
+ )
178
+ );
179
+
180
+ // Address Autocomplete option.
181
+ add_settings_field(
182
+ 'addresscomplete',
183
+ __( 'Enable Address Autocomplete:', 'woocommerce-extra-checkout-fields-for-brazil' ),
184
+ array( $this, 'checkbox_element_callback' ),
185
+ $option,
186
+ 'jquery_section',
187
+ array(
188
+ 'menu' => $option,
189
+ 'id' => 'addresscomplete',
190
+ 'label' => __( 'If checked automatically complete the address fields based on the zip code.', 'woocommerce-extra-checkout-fields-for-brazil' )
191
+ )
192
+ );
193
+
194
+ // Set Custom Fields cection.
195
+ add_settings_section(
196
+ 'validation_section',
197
+ __( 'Validation:', 'woocommerce-extra-checkout-fields-for-brazil' ),
198
+ array( $this, 'section_options_callback' ),
199
+ $option
200
+ );
201
+
202
+ // Validate CPF option.
203
+ add_settings_field(
204
+ 'validate_cpf',
205
+ __( 'Validate CPF:', 'woocommerce-extra-checkout-fields-for-brazil' ),
206
+ array( $this, 'checkbox_element_callback' ),
207
+ $option,
208
+ 'validation_section',
209
+ array(
210
+ 'menu' => $option,
211
+ 'id' => 'validate_cpf',
212
+ 'label' => __( 'Checks if the CPF is valid.', 'woocommerce-extra-checkout-fields-for-brazil' )
213
+ )
214
+ );
215
+
216
+ // Validate CPF option.
217
+ add_settings_field(
218
+ 'validate_cnpj',
219
+ __( 'Validate CNPJ:', 'woocommerce-extra-checkout-fields-for-brazil' ),
220
+ array( $this, 'checkbox_element_callback' ),
221
+ $option,
222
+ 'validation_section',
223
+ array(
224
+ 'menu' => $option,
225
+ 'id' => 'validate_cnpj',
226
+ 'label' => __( 'Checks if the CNPJ is valid.', 'woocommerce-extra-checkout-fields-for-brazil' )
227
+ )
228
+ );
229
+
230
+ // Register settings.
231
+ register_setting( $option, $option, array( $this, 'validate_options' ) );
232
+ }
233
+
234
+ /**
235
+ * Section null fallback.
236
+ */
237
+ public function section_options_callback() {
238
+
239
+ }
240
+
241
+ /**
242
+ * Checkbox element fallback.
243
+ *
244
+ * @return string Checkbox field.
245
+ */
246
+ public function checkbox_element_callback( $args ) {
247
+ $menu = $args['menu'];
248
+ $id = $args['id'];
249
+ $options = get_option( $menu );
250
+
251
+ if ( isset( $options[ $id ] ) ) {
252
+ $current = $options[ $id ];
253
+ } else {
254
+ $current = isset( $args['default'] ) ? $args['default'] : '0';
255
+ }
256
+
257
+ $html = '<input type="checkbox" id="' . $id . '" name="' . $menu . '[' . $id . ']" value="1"' . checked( 1, $current, false ) . '/>';
258
+
259
+ if ( isset( $args['label'] ) ) {
260
+ $html .= ' <label for="' . $id . '">' . $args['label'] . '</label>';
261
+ }
262
+
263
+ if ( isset( $args['description'] ) ) {
264
+ $html .= '<p class="description">' . $args['description'] . '</p>';
265
+ }
266
+
267
+ echo $html;
268
+ }
269
+
270
+ /**
271
+ * Select element fallback.
272
+ *
273
+ * @return string Select field.
274
+ */
275
+ public function select_element_callback( $args ) {
276
+ $menu = $args['menu'];
277
+ $id = $args['id'];
278
+ $options = get_option( $menu );
279
+
280
+ if ( isset( $options[ $id ] ) ) {
281
+ $current = $options[ $id ];
282
+ } else {
283
+ $current = isset( $args['default'] ) ? $args['default'] : 0;
284
+ }
285
+
286
+ $html = '<select id="' . $id . '" name="' . $menu . '[' . $id . ']">';
287
+ foreach ( $args['options'] as $key => $value ) {
288
+ $html .= sprintf( '<option value="%s" %s>%s</option>', $key, selected( $current, $key, false ), $value );
289
+ }
290
+ $html .= '</select>';
291
+
292
+ if ( isset( $args['description'] ) ) {
293
+ $html .= '<p class="description">' . $args['description'] . '</p>';
294
+ }
295
+
296
+ echo $html;
297
+ }
298
+
299
+ /**
300
+ * Valid options.
301
+ *
302
+ * @param array $input options to valid.
303
+ *
304
+ * @return array validated options.
305
+ */
306
+ public function validate_options( $input ) {
307
+ $output = array();
308
+
309
+ // Loop through each of the incoming options.
310
+ foreach ( $input as $key => $value ) {
311
+ // Check to see if the current option has a value. If so, process it.
312
+ if ( isset( $input[ $key ] ) ) {
313
+ $output[ $key ] = woocommerce_clean( $input[ $key ] );
314
+ }
315
+ }
316
+
317
+ return $output;
318
+ }
319
+ }
320
+
321
+ new Extra_Checkout_Fields_For_Brazil_Settings();
includes/admin/views/html-settings-page.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly.
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+ ?>
7
+
8
+ <div class="wrap">
9
+
10
+ <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
11
+
12
+ <?php settings_errors(); ?>
13
+ <form method="post" action="options.php">
14
+
15
+ <?php
16
+ settings_fields( 'wcbcf_settings' );
17
+ do_settings_sections( 'wcbcf_settings' );
18
+
19
+ submit_button();
20
+ ?>
21
+
22
+ </form>
23
+
24
+ </div>
includes/class-wc-ecfb-api.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * API integration.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_API {
10
+
11
+ /**
12
+ * Initialize integrations.
13
+ */
14
+ public function __construct() {
15
+ add_filter( 'woocommerce_api_order_response', array( $this, 'orders' ), 100, 4 );
16
+ add_filter( 'woocommerce_api_customer_response', array( $this, 'customer' ), 100, 4 );
17
+ }
18
+
19
+ /**
20
+ * Format number.
21
+ *
22
+ * @param string $string
23
+ *
24
+ * @return string
25
+ */
26
+ protected function format_number( $string ) {
27
+ return str_replace( array( '.', '-', '/' ), '', $string );
28
+ }
29
+
30
+ /**
31
+ * Get formatted birthdate.
32
+ *
33
+ * @param string $date
34
+ * @param WC_API_Server $server
35
+ *
36
+ * @return string
37
+ */
38
+ protected function get_formatted_birthdate( $date, $server ) {
39
+ $birthdate = explode( '/', $date );
40
+
41
+ if ( isset( $birthdate[1] ) && ! empty( $birthdate[1] ) ) {
42
+ return $server->format_datetime( $birthdate[1] . '/' . $birthdate[0] . '/' . $birthdate[2] );
43
+ }
44
+
45
+ return '';
46
+ }
47
+
48
+ /**
49
+ * Get person type.
50
+ *
51
+ * @param int $type
52
+ *
53
+ * @return string
54
+ */
55
+ protected function get_person_type( $type ) {
56
+ $settings = get_option( 'wcbcf_settings' );
57
+
58
+ switch ( $settings['person_type'] ) {
59
+ case 1:
60
+ $persontype = ( 2 == $type ) ? 'J' : 'F';
61
+ break;
62
+ case 2:
63
+ $persontype = 'F';
64
+ break;
65
+ case 3:
66
+ $persontype = 'J';
67
+ break;
68
+
69
+ default:
70
+ $persontype = '';
71
+ break;
72
+ }
73
+
74
+ return $persontype;
75
+ }
76
+
77
+ /**
78
+ * Add extra fields in order API.
79
+ *
80
+ * @param array $order_data
81
+ * @param WC_Order $order
82
+ * @param array $fields
83
+ * @param WC_API_Server $server
84
+ *
85
+ * @return array
86
+ */
87
+ public function orders( $order_data, $order, $fields, $server ) {
88
+
89
+ // Billing fields.
90
+ $order_data['billing_address']['persontype'] = $this->get_person_type( $order->billing_persontype );
91
+ $order_data['billing_address']['cpf'] = $this->format_number( $order->billing_cpf );
92
+ $order_data['billing_address']['rg'] = $this->format_number( $order->billing_rg );
93
+ $order_data['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
94
+ $order_data['billing_address']['ie'] = $this->format_number( $order->billing_ie );
95
+ $order_data['billing_address']['birthdate'] = $this->get_formatted_birthdate( $order->billing_birthdate, $server );
96
+ $order_data['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
97
+ $order_data['billing_address']['number'] = $order->billing_number;
98
+ $order_data['billing_address']['neighborhood'] = $order->billing_neighborhood;
99
+ $order_data['billing_address']['cellphone'] = $order->billing_cellphone;
100
+
101
+ // Shipping fields.
102
+ $order_data['shipping_address']['number'] = $order->shipping_number;
103
+ $order_data['shipping_address']['neighborhood'] = $order->shipping_neighborhood;
104
+
105
+ // Customer fields.
106
+ if ( 0 == $order->customer_user && isset( $order_data['customer'] ) ) {
107
+ // Customer billing fields.
108
+ $order_data['customer']['billing_address']['persontype'] = $this->get_person_type( $order->billing_persontype );
109
+ $order_data['customer']['billing_address']['cpf'] = $this->format_number( $order->billing_cpf );
110
+ $order_data['customer']['billing_address']['rg'] = $this->format_number( $order->billing_rg );
111
+ $order_data['customer']['billing_address']['cnpj'] = $this->format_number( $order->billing_cnpj );
112
+ $order_data['customer']['billing_address']['ie'] = $this->format_number( $order->billing_ie );
113
+ $order_data['customer']['billing_address']['birthdate'] = $this->get_formatted_birthdate( $order->billing_birthdate, $server );
114
+ $order_data['customer']['billing_address']['sex'] = substr( $order->billing_sex, 0, 1 );
115
+ $order_data['customer']['billing_address']['number'] = $order->billing_number;
116
+ $order_data['customer']['billing_address']['neighborhood'] = $order->billing_neighborhood;
117
+ $order_data['customer']['billing_address']['cellphone'] = $order->billing_cellphone;
118
+
119
+ // Customer shipping fields.
120
+ $order_data['customer']['shipping_address']['number'] = $order->shipping_number;
121
+ $order_data['customer']['shipping_address']['neighborhood'] = $order->shipping_neighborhood;
122
+ }
123
+
124
+ if ( $fields ) {
125
+ $order_data = WC()->api->WC_API_Customers->filter_response_fields( $order_data, $order, $fields );
126
+ }
127
+
128
+ return $order_data;
129
+ }
130
+
131
+ /**
132
+ * Add extra fields in customer API.
133
+ *
134
+ * @param array $customer_data
135
+ * @param WC_Order $customer
136
+ * @param array $fields
137
+ * @param WC_API_Server $server
138
+ *
139
+ * @return array
140
+ */
141
+ public function customer( $customer_data, $customer, $fields, $server ) {
142
+ // Billing fields.
143
+ $customer_data['billing_address']['persontype'] = $this->get_person_type( $customer->billing_persontype );
144
+ $customer_data['billing_address']['cpf'] = $this->format_number( $customer->billing_cpf );
145
+ $customer_data['billing_address']['rg'] = $this->format_number( $customer->billing_rg );
146
+ $customer_data['billing_address']['cnpj'] = $this->format_number( $customer->billing_cnpj );
147
+ $customer_data['billing_address']['ie'] = $this->format_number( $customer->billing_ie );
148
+ $customer_data['billing_address']['birthdate'] = $this->get_formatted_birthdate( $customer->billing_birthdate, $server );
149
+ $customer_data['billing_address']['sex'] = substr( $customer->billing_sex, 0, 1 );
150
+ $customer_data['billing_address']['number'] = $customer->billing_number;
151
+ $customer_data['billing_address']['neighborhood'] = $customer->billing_neighborhood;
152
+ $customer_data['billing_address']['cellphone'] = $customer->billing_cellphone;
153
+
154
+ // Shipping fields.
155
+ $customer_data['shipping_address']['number'] = $customer->shipping_number;
156
+ $customer_data['shipping_address']['neighborhood'] = $customer->shipping_neighborhood;
157
+
158
+ if ( $fields ) {
159
+ $customer_data = WC()->api->WC_API_Customers->filter_response_fields( $customer_data, $customer, $fields );
160
+ }
161
+
162
+ return $customer_data;
163
+ }
164
+ }
165
+
166
+ new Extra_Checkout_Fields_For_Brazil_API();
includes/class-wc-ecfb-formatting.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Formatting class.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Formatting {
10
+
11
+ /**
12
+ * Checks if the CPF is valid.
13
+ *
14
+ * @param string $cpf
15
+ *
16
+ * @return bool
17
+ */
18
+ public static function is_cpf( $cpf ) {
19
+ $cpf = preg_replace( '/[^0-9]/', '', $cpf );
20
+
21
+ if ( 11 != strlen( $cpf ) || preg_match( '/^([0-9])\1+$/', $cpf ) ) {
22
+ return false;
23
+ }
24
+
25
+ $digit = substr( $cpf, 0, 9 );
26
+
27
+ for ( $j = 10; $j <= 11; $j++ ) {
28
+ $sum = 0;
29
+
30
+ for( $i = 0; $i< $j-1; $i++ ) {
31
+ $sum += ( $j - $i ) * ( (int) $digit[ $i ] );
32
+ }
33
+
34
+ $summod11 = $sum % 11;
35
+ $digit[ $j - 1 ] = $summod11 < 2 ? 0 : 11 - $summod11;
36
+ }
37
+
38
+ return $digit[9] == ( (int) $cpf[9] ) && $digit[10] == ( (int) $cpf[10] );
39
+ }
40
+
41
+ /**
42
+ * Checks if the CNPJ is valid.
43
+ *
44
+ * @param string $cnpj
45
+ *
46
+ * @return bool
47
+ */
48
+ public static function is_cnpj( $cnpj ) {
49
+ $cnpj = sprintf( '%014s', preg_replace( '{\D}', '', $cnpj ) );
50
+
51
+ if ( 14 != ( strlen( $cnpj ) ) || ( 0 == intval( substr( $cnpj, -4 ) ) ) ) {
52
+ return false;
53
+ }
54
+
55
+ for ( $t = 11; $t < 13; ) {
56
+ for ( $d = 0, $p = 2, $c = $t; $c >= 0; $c--, ( $p < 9 ) ? $p++ : $p = 2 ) {
57
+ $d += $cnpj[ $c ] * $p;
58
+ }
59
+
60
+ if ( $cnpj[ ++$t ] != ( $d = ( ( 10 * $d ) % 11 ) % 10 ) ) {
61
+ return false;
62
+ }
63
+ }
64
+
65
+ return true;
66
+ }
67
+ }
includes/class-wc-ecfb-front-end.php ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Front-end actions.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Front_End {
10
+
11
+ /**
12
+ * Initialize the front-end actions.
13
+ */
14
+ public function __construct() {
15
+ // Load custom order data.
16
+ add_filter( 'woocommerce_load_order_data', array( $this, 'load_order_data' ) );
17
+
18
+ // Load public-facing style sheet and JavaScript.
19
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
20
+
21
+ // New checkout fields.
22
+ add_filter( 'woocommerce_billing_fields', array( $this, 'checkout_billing_fields' ) );
23
+ add_filter( 'woocommerce_shipping_fields', array( $this, 'checkout_shipping_fields' ) );
24
+
25
+ // Valid checkout fields.
26
+ add_action( 'woocommerce_checkout_process', array( $this, 'valid_checkout_fields' ) );
27
+
28
+ // Custom address format.
29
+ add_filter( 'woocommerce_localisation_address_formats', array( $this, 'localisation_address_formats' ) );
30
+ add_filter( 'woocommerce_formatted_address_replacements', array( $this, 'formatted_address_replacements' ), 1, 2 );
31
+ add_filter( 'woocommerce_order_formatted_billing_address', array( $this, 'order_formatted_billing_address' ), 1, 2 );
32
+ add_filter( 'woocommerce_order_formatted_shipping_address', array( $this, 'order_formatted_shipping_address' ), 1, 2 );
33
+ add_filter( 'woocommerce_my_account_my_address_formatted_address', array( $this, 'my_account_my_address_formatted_address' ), 1, 3 );
34
+ }
35
+
36
+ /**
37
+ * Load order custom data.
38
+ *
39
+ * @param array $data Default WC_Order data.
40
+ *
41
+ * @return array Custom WC_Order data.
42
+ */
43
+ public function load_order_data( $data ) {
44
+
45
+ // Billing
46
+ $data['billing_persontype'] = '';
47
+ $data['billing_cpf'] = '';
48
+ $data['billing_rg'] = '';
49
+ $data['billing_cnpj'] = '';
50
+ $data['billing_ie'] = '';
51
+ $data['billing_birthdate'] = '';
52
+ $data['billing_sex'] = '';
53
+ $data['billing_number'] = '';
54
+ $data['billing_neighborhood'] = '';
55
+ $data['billing_cellphone'] = '';
56
+
57
+ // Shipping
58
+ $data['shipping_number'] = '';
59
+ $data['shipping_neighborhood'] = '';
60
+
61
+ return $data;
62
+ }
63
+
64
+ /**
65
+ * Register and enqueues public-facing style sheet and JavaScript files.
66
+ */
67
+ public function enqueue_scripts() {
68
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
69
+
70
+ wp_register_script( 'jquery-maskedinput', plugins_url( 'assets/js/jquery-maskedinput/jquery.maskedinput' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), '1.4.1', true );
71
+
72
+ wp_register_script( 'mailcheck', plugins_url( 'assets/js/mailcheck/mailcheck' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery' ), '1.1.1', true );
73
+
74
+ // Load scripts only in checkout.
75
+ if ( is_checkout() || is_account_page() ) {
76
+
77
+ // Get plugin settings.
78
+ $settings = get_option( 'wcbcf_settings' );
79
+
80
+ // Fix checkout fields.
81
+ wp_enqueue_script( 'woocommerce-extra-checkout-fields-for-brazil-front', plugins_url( 'assets/js/frontend/frontend' . $suffix . '.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'jquery-maskedinput', 'mailcheck' ), Extra_Checkout_Fields_For_Brazil::VERSION, true );
82
+ wp_localize_script(
83
+ 'woocommerce-extra-checkout-fields-for-brazil-front',
84
+ 'wcbcf_public_params',
85
+ array(
86
+ 'state' => esc_js( __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
87
+ 'required' => esc_js( __( 'required', 'woocommerce-extra-checkout-fields-for-brazil' ) ),
88
+ 'mailcheck' => isset( $settings['mailcheck'] ) ? 'yes' : 'no',
89
+ 'maskedinput' => isset( $settings['maskedinput'] ) ? 'yes' : 'no',
90
+ 'addresscomplete' => isset( $settings['addresscomplete'] ) ? 'yes' : 'no',
91
+ 'person_type' => absint( $settings['person_type'] ),
92
+ 'only_brazil' => isset( $settings['only_brazil'] ) ? 'yes' : 'no'
93
+ )
94
+ );
95
+ }
96
+ }
97
+
98
+ /**
99
+ * New checkout billing fields.
100
+ *
101
+ * @param array $fields Default fields.
102
+ *
103
+ * @return array New fields.
104
+ */
105
+ public function checkout_billing_fields( $fields ) {
106
+
107
+ $new_fields = array();
108
+
109
+ // Get plugin settings.
110
+ $settings = get_option( 'wcbcf_settings' );
111
+
112
+ // Billing First Name.
113
+ $new_fields['billing_first_name'] = array(
114
+ 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
115
+ 'placeholder' => _x( 'First Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
116
+ 'class' => array( 'form-row-first' ),
117
+ 'required' => true
118
+ );
119
+
120
+ // Billing Last Name.
121
+ $new_fields['billing_last_name'] = array(
122
+ 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
123
+ 'placeholder' => _x( 'Last Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
124
+ 'class' => array( 'form-row-last' ),
125
+ 'clear' => true,
126
+ 'required' => true
127
+ );
128
+
129
+ if ( 0 != $settings['person_type'] ) {
130
+
131
+ // Billing Person Type.
132
+ if ( 1 == $settings['person_type'] ) {
133
+ $new_fields['billing_persontype'] = array(
134
+ 'type' => 'select',
135
+ 'label' => __( 'Person type', 'woocommerce-extra-checkout-fields-for-brazil' ),
136
+ 'class' => array( 'form-row-wide', 'person-type-field' ),
137
+ 'required' => false,
138
+ 'options' => array(
139
+ '0' => __( 'Select', 'woocommerce-extra-checkout-fields-for-brazil' ),
140
+ '1' => __( 'Individuals', 'woocommerce-extra-checkout-fields-for-brazil' ),
141
+ '2' => __( 'Legal Person', 'woocommerce-extra-checkout-fields-for-brazil' )
142
+ )
143
+ );
144
+ }
145
+
146
+ if ( 1 == $settings['person_type'] || 2 == $settings['person_type'] ) {
147
+ if ( isset( $settings['rg'] ) ) {
148
+ // Billing CPF.
149
+ $new_fields['billing_cpf'] = array(
150
+ 'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
151
+ 'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
152
+ 'class' => array( 'form-row-first', 'person-type-field' ),
153
+ 'required' => false
154
+ );
155
+
156
+ // Billing RG.
157
+ $new_fields['billing_rg'] = array(
158
+ 'label' => __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ),
159
+ 'placeholder' => _x( 'RG', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
160
+ 'class' => array( 'form-row-last', 'person-type-field' ),
161
+ 'required' => false
162
+ );
163
+ } else {
164
+ // Billing CPF.
165
+ $new_fields['billing_cpf'] = array(
166
+ 'label' => __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ),
167
+ 'placeholder' => _x( 'CPF', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
168
+ 'class' => array( 'form-row-wide', 'person-type-field' ),
169
+ 'required' => false
170
+ );
171
+ }
172
+ }
173
+
174
+ if ( 1 == $settings['person_type'] || 3 == $settings['person_type'] ) {
175
+ // Billing Company.
176
+ $new_fields['billing_company'] = array(
177
+ 'label' => __( 'Company Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
178
+ 'placeholder' => _x( 'Company Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
179
+ 'class' => array( 'form-row-wide', 'person-type-field' ),
180
+ 'required' => false
181
+ );
182
+
183
+ // Billing State Registration.
184
+ if ( isset( $settings['ie'] ) ) {
185
+ // Billing CNPJ.
186
+ $new_fields['billing_cnpj'] = array(
187
+ 'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
188
+ 'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
189
+ 'class' => array( 'form-row-first', 'person-type-field' ),
190
+ 'required' => false
191
+ );
192
+
193
+ $new_fields['billing_ie'] = array(
194
+ 'label' => __( 'State Registration', 'woocommerce-extra-checkout-fields-for-brazil' ),
195
+ 'placeholder' => _x( 'State Registration', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
196
+ 'class' => array( 'form-row-last', 'person-type-field' ),
197
+ 'required' => false
198
+ );
199
+ } else {
200
+ // Billing CNPJ.
201
+ $new_fields['billing_cnpj'] = array(
202
+ 'label' => __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ),
203
+ 'placeholder' => _x( 'CNPJ', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
204
+ 'class' => array( 'form-row-wide', 'person-type-field' ),
205
+ 'required' => false
206
+ );
207
+ }
208
+ }
209
+
210
+ } else {
211
+ // Billing Company.
212
+ $new_fields['billing_company'] = array(
213
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
214
+ 'placeholder' => _x( 'Company', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
215
+ 'class' => array( 'form-row-wide' ),
216
+ 'required' => false
217
+ );
218
+ }
219
+
220
+ if ( isset( $settings['birthdate_sex'] ) ) {
221
+
222
+ // Billing Birthdate.
223
+ $new_fields['billing_birthdate'] = array(
224
+ 'label' => __( 'Birthdate', 'woocommerce-extra-checkout-fields-for-brazil' ),
225
+ 'placeholder' => _x( 'Birthdate', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
226
+ 'class' => array( 'form-row-first' ),
227
+ 'clear' => false,
228
+ 'required' => true
229
+ );
230
+
231
+ // Billing Sex.
232
+ $new_fields['billing_sex'] = array(
233
+ 'type' => 'select',
234
+ 'label' => __( 'Sex', 'woocommerce-extra-checkout-fields-for-brazil' ),
235
+ 'class' => array( 'form-row-last' ),
236
+ 'clear' => true,
237
+ 'required' => true,
238
+ 'options' => array(
239
+ '0' => __( 'Select', 'woocommerce-extra-checkout-fields-for-brazil' ),
240
+ __( 'Female', 'woocommerce-extra-checkout-fields-for-brazil' ) => __( 'Female', 'woocommerce-extra-checkout-fields-for-brazil' ),
241
+ __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' ) => __( 'Male', 'woocommerce-extra-checkout-fields-for-brazil' )
242
+ )
243
+ );
244
+
245
+ }
246
+
247
+ // Billing Country.
248
+ $new_fields['billing_country'] = array(
249
+ 'type' => 'country',
250
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
251
+ 'placeholder' => _x( 'Country', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
252
+ 'class' => array( 'form-row-first', 'update_totals_on_change', 'address-field' ),
253
+ 'clear' => false,
254
+ 'required' => true,
255
+ );
256
+
257
+ // Billing Post Code.
258
+ $new_fields['billing_postcode'] = array(
259
+ 'label' => __( 'Post Code', 'woocommerce-extra-checkout-fields-for-brazil' ),
260
+ 'placeholder' => _x( 'Post Code', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
261
+ 'class' => array( 'form-row-last', 'update_totals_on_change', 'address-field' ),
262
+ 'clear' => true,
263
+ 'required' => true
264
+ );
265
+
266
+ // Billing Anddress 01.
267
+ $new_fields['billing_address_1'] = array(
268
+ 'label' => __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ),
269
+ 'placeholder' => _x( 'Address', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
270
+ 'class' => array( 'form-row-first', 'address-field' ),
271
+ 'required' => true
272
+ );
273
+
274
+ // Billing Number.
275
+ $new_fields['billing_number'] = array(
276
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
277
+ 'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
278
+ 'class' => array( 'form-row-last', 'address-field' ),
279
+ 'clear' => true,
280
+ 'required' => true
281
+ );
282
+
283
+ // Billing Anddress 02.
284
+ $new_fields['billing_address_2'] = array(
285
+ 'label' => __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
286
+ 'placeholder' => _x( 'Address line 2', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
287
+ 'class' => array( 'form-row-first', 'address-field' )
288
+ );
289
+
290
+ // Billing Neighborhood.
291
+ $new_fields['billing_neighborhood'] = array(
292
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
293
+ 'placeholder' => _x( 'Neighborhood', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
294
+ 'class' => array( 'form-row-last', 'address-field' ),
295
+ 'clear' => true,
296
+ );
297
+
298
+ // Billing City.
299
+ $new_fields['billing_city'] = array(
300
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
301
+ 'placeholder' => _x( 'City', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
302
+ 'class' => array( 'form-row-first', 'address-field' ),
303
+ 'required' => true
304
+ );
305
+
306
+ // Billing State.
307
+ $new_fields['billing_state'] = array(
308
+ 'type' => 'state',
309
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
310
+ 'placeholder' => _x( 'State', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
311
+ 'class' => array( 'form-row-last', 'address-field' ),
312
+ 'clear' => true,
313
+ 'required' => true
314
+ );
315
+
316
+ if ( isset( $settings['cell_phone'] ) ) {
317
+
318
+ // Billing Phone.
319
+ $new_fields['billing_phone'] = array(
320
+ 'label' => __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
321
+ 'placeholder' => _x( 'Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
322
+ 'class' => array( 'form-row-first' ),
323
+ 'required' => true
324
+ );
325
+
326
+ // Billing Cell Phone.
327
+ $new_fields['billing_cellphone'] = array(
328
+ 'label' => __( 'Cell Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
329
+ 'placeholder' => _x( 'Cell Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
330
+ 'class' => array( 'form-row-last' ),
331
+ 'clear' => true
332
+ );
333
+
334
+ // Billing Email.
335
+ $new_fields['billing_email'] = array(
336
+ 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
337
+ 'placeholder' => _x( 'Email', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
338
+ 'class' => array( 'form-row-wide' ),
339
+ 'validate' => array( 'email' ),
340
+ 'clear' => true,
341
+ 'required' => true
342
+ );
343
+
344
+ } else {
345
+
346
+ // Billing Phone.
347
+ $new_fields['billing_phone'] = array(
348
+ 'label' => __( 'Phone', 'woocommerce-extra-checkout-fields-for-brazil' ),
349
+ 'placeholder' => _x( 'Phone', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
350
+ 'class' => array( 'form-row-wide' ),
351
+ 'required' => true
352
+ );
353
+
354
+ // Billing Email.
355
+ $new_fields['billing_email'] = array(
356
+ 'label' => __( 'Email', 'woocommerce-extra-checkout-fields-for-brazil' ),
357
+ 'placeholder' => _x( 'Email', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
358
+ 'class' => array( 'form-row-wide' ),
359
+ 'required' => true
360
+ );
361
+
362
+ }
363
+
364
+ return apply_filters( 'wcbcf_billing_fields', $new_fields );
365
+ }
366
+
367
+ /**
368
+ * New checkout shipping fields
369
+ *
370
+ * @param array $fields Default fields.
371
+ *
372
+ * @return array New fields.
373
+ */
374
+ public function checkout_shipping_fields( $fields ) {
375
+
376
+ $new_fields = array();
377
+
378
+ // Get plugin settings.
379
+ $settings = get_option( 'wcbcf_settings' );
380
+
381
+ // Shipping First Name.
382
+ $new_fields['shipping_first_name'] = array(
383
+ 'label' => __( 'First Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
384
+ 'placeholder' => _x( 'First Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
385
+ 'class' => array( 'form-row-first' ),
386
+ 'required' => true
387
+ );
388
+
389
+ // Shipping Last Name.
390
+ $new_fields['shipping_last_name'] = array(
391
+ 'label' => __( 'Last Name', 'woocommerce-extra-checkout-fields-for-brazil' ),
392
+ 'placeholder' => _x( 'Last Name', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
393
+ 'class' => array( 'form-row-last' ),
394
+ 'clear' => true,
395
+ 'required' => true
396
+ );
397
+
398
+ // Shipping Company.
399
+ $new_fields['shipping_company'] = array(
400
+ 'label' => __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ),
401
+ 'placeholder' => _x( 'Company', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
402
+ 'class' => array( 'form-row-wide' )
403
+ );
404
+
405
+ // Shipping Country.
406
+ $new_fields['shipping_country'] = array(
407
+ 'type' => 'country',
408
+ 'label' => __( 'Country', 'woocommerce-extra-checkout-fields-for-brazil' ),
409
+ 'placeholder' => _x( 'Country', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
410
+ 'class' => array( 'form-row-first', 'update_totals_on_change', 'address-field' ),
411
+ 'required' => true
412
+ );
413
+
414
+ // Shipping Post Code.
415
+ $new_fields['shipping_postcode'] = array(
416
+ 'label' => __( 'Post Code', 'woocommerce-extra-checkout-fields-for-brazil' ),
417
+ 'placeholder' => _x( 'Post Code', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
418
+ 'class' => array( 'form-row-last', 'update_totals_on_change', 'address-field' ),
419
+ 'clear' => true,
420
+ 'required' => true
421
+ );
422
+
423
+ // Shipping Anddress 01.
424
+ $new_fields['shipping_address_1'] = array(
425
+ 'label' => __( 'Address', 'woocommerce-extra-checkout-fields-for-brazil' ),
426
+ 'placeholder' => _x( 'Address', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
427
+ 'class' => array( 'form-row-first', 'address-field' ),
428
+ 'required' => true
429
+ );
430
+
431
+ // Shipping Number.
432
+ $new_fields['shipping_number'] = array(
433
+ 'label' => __( 'Number', 'woocommerce-extra-checkout-fields-for-brazil' ),
434
+ 'placeholder' => _x( 'Number', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
435
+ 'class' => array( 'form-row-last', 'address-field' ),
436
+ 'clear' => true,
437
+ 'required' => true
438
+ );
439
+
440
+ // Shipping Anddress 02.
441
+ $new_fields['shipping_address_2'] = array(
442
+ 'label' => __( 'Address line 2', 'woocommerce-extra-checkout-fields-for-brazil' ),
443
+ 'placeholder' => _x( 'Address line 2', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
444
+ 'class' => array( 'form-row-first', 'address-field' )
445
+ );
446
+
447
+ // Shipping Neighborhood.
448
+ $new_fields['shipping_neighborhood'] = array(
449
+ 'label' => __( 'Neighborhood', 'woocommerce-extra-checkout-fields-for-brazil' ),
450
+ 'placeholder' => _x( 'Neighborhood', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
451
+ 'class' => array( 'form-row-last', 'address-field' ),
452
+ 'clear' => true
453
+ );
454
+
455
+ // Shipping City.
456
+ $new_fields['shipping_city'] = array(
457
+ 'label' => __( 'City', 'woocommerce-extra-checkout-fields-for-brazil' ),
458
+ 'placeholder' => _x( 'City', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
459
+ 'class' => array( 'form-row-first', 'address-field' ),
460
+ 'required' => true
461
+ );
462
+
463
+ // Shipping State.
464
+ $new_fields['shipping_state'] = array(
465
+ 'type' => 'state',
466
+ 'label' => __( 'State', 'woocommerce-extra-checkout-fields-for-brazil' ),
467
+ 'placeholder' => _x( 'State', 'placeholder', 'woocommerce-extra-checkout-fields-for-brazil' ),
468
+ 'class' => array( 'form-row-last', 'address-field' ),
469
+ 'clear' => true,
470
+ 'required' => true
471
+ );
472
+
473
+ return apply_filters( 'wcbcf_shipping_fields', $new_fields );
474
+ }
475
+
476
+ /**
477
+ * Valid checkout fields.
478
+ *
479
+ * @return string Displays the error message.
480
+ */
481
+ public function valid_checkout_fields() {
482
+
483
+ // Get plugin settings.
484
+ $settings = get_option( 'wcbcf_settings' );
485
+ $only_brazil = isset( $settings['only_brazil'] ) ? true : false;
486
+ $billing_persontype = isset( $_POST['billing_persontype'] ) ? $_POST['billing_persontype'] : 0;
487
+
488
+ if ( $only_brazil && 'BR' != $_POST['billing_country'] || 0 == $settings['person_type'] ) {
489
+ return;
490
+ }
491
+
492
+ if ( 0 == $billing_persontype && 1 == $settings['person_type'] ) {
493
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'Person type', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
494
+ } else {
495
+
496
+ // Check CPF.
497
+ if ( ( 1 == $settings['person_type'] && 1 == $billing_persontype ) || 2 == $settings['person_type'] ) {
498
+ if ( empty( $_POST['billing_cpf'] ) ) {
499
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
500
+ }
501
+
502
+ if ( isset( $settings['validate_cpf'] ) && ! empty( $_POST['billing_cpf'] ) && ! Extra_Checkout_Fields_For_Brazil_Formatting::is_cpf( $_POST['billing_cpf'] ) ) {
503
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'CPF', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is not valid', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
504
+ }
505
+
506
+ if ( isset( $settings['rg'] ) && empty( $_POST['billing_rg'] ) ) {
507
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'RG', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
508
+ }
509
+ }
510
+
511
+ // Check Company and CPNJ.
512
+ if ( ( 1 == $settings['person_type'] && 2 == $billing_persontype ) || 3 == $settings['person_type'] ) {
513
+ if ( empty( $_POST['billing_company'] ) ) {
514
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'Company', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
515
+ }
516
+
517
+ if ( empty( $_POST['billing_cnpj'] ) ) {
518
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
519
+ }
520
+
521
+ if ( isset( $settings['validate_cnpj'] ) && ! empty( $_POST['billing_cnpj'] ) && ! Extra_Checkout_Fields_For_Brazil_Formatting::is_cnpj( $_POST['billing_cnpj'] ) ) {
522
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'CNPJ', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is not valid', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
523
+ }
524
+
525
+ if ( isset( $settings['ie'] ) && empty( $_POST['billing_ie'] ) ) {
526
+ wc_add_notice( sprintf( '<strong>%s</strong> %s.', __( 'State Registration', 'woocommerce-extra-checkout-fields-for-brazil' ), __( 'is a required field', 'woocommerce-extra-checkout-fields-for-brazil' ) ), 'error' );
527
+ }
528
+ }
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Custom country address formats.
534
+ *
535
+ * @param array $formats Defaul formats.
536
+ *
537
+ * @return array New BR format.
538
+ */
539
+ public function localisation_address_formats( $formats ) {
540
+ $formats['BR'] = "{name}\n{address_1}, {number}\n{address_2}\n{neighborhood}\n{city}\n{state}\n{postcode}\n{country}";
541
+
542
+ return $formats;
543
+ }
544
+
545
+ /**
546
+ * Custom country address format.
547
+ *
548
+ * @param array $replacements Default replacements.
549
+ * @param array $args Arguments to replace.
550
+ *
551
+ * @return array New replacements.
552
+ */
553
+ public function formatted_address_replacements( $replacements, $args ) {
554
+ extract( $args );
555
+
556
+ $replacements['{number}'] = $number;
557
+ $replacements['{neighborhood}'] = $neighborhood;
558
+
559
+ return $replacements;
560
+ }
561
+
562
+ /**
563
+ * Custom order formatted billing address.
564
+ *
565
+ * @param array $address Default address.
566
+ * @param object $order Order data.
567
+ *
568
+ * @return array New address format.
569
+ */
570
+ public function order_formatted_billing_address( $address, $order ) {
571
+ $address['number'] = $order->billing_number;
572
+ $address['neighborhood'] = $order->billing_neighborhood;
573
+
574
+ return $address;
575
+ }
576
+
577
+ /**
578
+ * Custom order formatted shipping address.
579
+ *
580
+ * @param array $address Default address.
581
+ * @param object $order Order data.
582
+ *
583
+ * @return array New address format.
584
+ */
585
+ public function order_formatted_shipping_address( $address, $order ) {
586
+ $address['number'] = $order->shipping_number;
587
+ $address['neighborhood'] = $order->shipping_neighborhood;
588
+
589
+ return $address;
590
+ }
591
+
592
+ /**
593
+ * Custom my address formatted address.
594
+ *
595
+ * @param array $address Default address.
596
+ * @param int $customer_id Customer ID.
597
+ * @param string $name Field name (billing or shipping).
598
+ *
599
+ * @return array New address format.
600
+ */
601
+ public function my_account_my_address_formatted_address( $address, $customer_id, $name ) {
602
+ $address['number'] = get_user_meta( $customer_id, $name . '_number', true );
603
+ $address['neighborhood'] = get_user_meta( $customer_id, $name . '_neighborhood', true );
604
+
605
+ return $address;
606
+ }
607
+ }
608
+
609
+ new Extra_Checkout_Fields_For_Brazil_Front_End();
includes/class-wc-ecfb-plugins-support.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * Methods to make integrations with others plugins.
8
+ */
9
+ class Extra_Checkout_Fields_For_Brazil_Plugins_Support {
10
+
11
+ /**
12
+ * Initialize integrations.
13
+ */
14
+ public function __construct() {
15
+ add_filter( 'woocommerce_bcash_args', array( $this, 'bcash' ), 1, 2 );
16
+ add_filter( 'woocommerce_moip_args', array( $this, 'moip' ), 1, 2 );
17
+ add_filter( 'woocommerce_moip_holder_data', array( $this, 'moip_transparent_checkout' ), 1, 2 );
18
+ }
19
+
20
+ /**
21
+ * Custom Bcash arguments.
22
+ *
23
+ * @param array $args Bcash default arguments.
24
+ * @param object $order Order data.
25
+ *
26
+ * @return array New arguments.
27
+ */
28
+ public function bcash( $args, $order ) {
29
+ $args['numero'] = $order->billing_number;
30
+
31
+ if ( isset( $order->billing_persontype ) ) {
32
+ if ( 1 == $order->billing_persontype ) {
33
+ $args['cpf'] = str_replace( array( '-', '.' ), '', $order->billing_cpf );
34
+ }
35
+
36
+ if ( 2 == $order->billing_persontype ) {
37
+ $args['cliente_cnpj'] = str_replace( array( '-', '.' ), '', $order->billing_cnpj );
38
+ $args['cliente_razao_social'] = $order->billing_company;
39
+ }
40
+ }
41
+
42
+ return $args;
43
+ }
44
+
45
+ /**
46
+ * Custom Moip arguments.
47
+ *
48
+ * @param array $args Moip default arguments.
49
+ * @param object $order Order data.
50
+ *
51
+ * @return array New arguments.
52
+ */
53
+ public function moip( $args, $order ) {
54
+ $args['pagador_numero'] = $order->billing_number;
55
+ $args['pagador_bairro'] = $order->billing_neighborhood;
56
+
57
+ return $args;
58
+ }
59
+
60
+ /**
61
+ * Custom Moip Transparent Checkout arguments.
62
+ *
63
+ * @param array $args Moip Transparent Checkout default arguments.
64
+ * @param object $order Order data.
65
+ *
66
+ * @return array New arguments.
67
+ */
68
+ public function moip_transparent_checkout( $args, $order ) {
69
+
70
+ if ( isset( $order->billing_cpf ) ) {
71
+ $args['cpf'] = $order->billing_cpf;
72
+ }
73
+
74
+ if ( isset( $order->billing_birthdate ) ) {
75
+ $birthdate = explode( '/', $order->billing_birthdate );
76
+
77
+ $args['birthdate_day'] = $birthdate[0];
78
+ $args['birthdate_month'] = $birthdate[1];
79
+ $args['birthdate_year'] = $birthdate[2];
80
+ }
81
+
82
+ return $args;
83
+ }
84
+ }
85
+
86
+ new Extra_Checkout_Fields_For_Brazil_Plugins_Support();
languages/woocommerce-extra-checkout-fields-for-brazil-pt_BR.mo ADDED
Binary file
languages/woocommerce-extra-checkout-fields-for-brazil-pt_BR.po ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce Extra Checkout Fields for Brazil v3.3.0\n"
4
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-extra-"
5
+ "checkout-fields-for-brazil\n"
6
+ "POT-Creation-Date: 2015-08-18 23:28:45+00:00\n"
7
+ "PO-Revision-Date: 2015-08-18 20:29-0300\n"
8
+ "Last-Translator: Claudio Sanches <contato@claudiosmweb.com>\n"
9
+ "Language-Team: \n"
10
+ "Language: pt_BR\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
+ "X-Generator: Poedit 1.5.4\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
18
+ "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
19
+ "X-Poedit-Basepath: ../\n"
20
+ "X-Textdomain-Support: yes\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+
23
+ # @ woocommerce-extra-checkout-fields-for-brazil
24
+ #: includes/admin/class-wc-ecfb-admin.php:45
25
+ msgid "Load the customer extras data?"
26
+ msgstr "Carregar informações adicionais do cliente?"
27
+
28
+ # @ woocommerce-extra-checkout-fields-for-brazil
29
+ #: includes/admin/class-wc-ecfb-admin.php:46
30
+ msgid "Also copy the data of number and neighborhood?"
31
+ msgstr "Copiar também as informações de número e bairro?"
32
+
33
+ # @ woocommerce-extra-checkout-fields-for-brazil
34
+ #: includes/admin/class-wc-ecfb-customer.php:34
35
+ msgid "Customer Billing Address"
36
+ msgstr "Endereço de Cobrança do Cliente"
37
+
38
+ # @ woocommerce-extra-checkout-fields-for-brazil
39
+ #: includes/admin/class-wc-ecfb-customer.php:36
40
+ #: includes/admin/class-wc-ecfb-customer.php:147
41
+ msgid "First name"
42
+ msgstr "Nome"
43
+
44
+ # @ woocommerce-extra-checkout-fields-for-brazil
45
+ #: includes/admin/class-wc-ecfb-customer.php:40
46
+ #: includes/admin/class-wc-ecfb-customer.php:151
47
+ msgid "Last name"
48
+ msgstr "Sobrenome"
49
+
50
+ # @ woocommerce-extra-checkout-fields-for-brazil
51
+ #: includes/admin/class-wc-ecfb-customer.php:48
52
+ #: includes/admin/class-wc-ecfb-order.php:58
53
+ #: includes/admin/class-wc-ecfb-order.php:266
54
+ #: includes/class-wc-ecfb-front-end.php:150
55
+ #: includes/class-wc-ecfb-front-end.php:166
56
+ #: includes/class-wc-ecfb-front-end.php:499
57
+ #: includes/class-wc-ecfb-front-end.php:503
58
+ msgid "CPF"
59
+ msgstr "CPF"
60
+
61
+ # @ woocommerce-extra-checkout-fields-for-brazil
62
+ #: includes/admin/class-wc-ecfb-customer.php:54
63
+ #: includes/admin/class-wc-ecfb-order.php:62
64
+ #: includes/admin/class-wc-ecfb-order.php:269
65
+ #: includes/class-wc-ecfb-front-end.php:158
66
+ #: includes/class-wc-ecfb-front-end.php:507
67
+ msgid "RG"
68
+ msgstr "RG"
69
+
70
+ # @ woocommerce-extra-checkout-fields-for-brazil
71
+ #: includes/admin/class-wc-ecfb-customer.php:62
72
+ #: includes/admin/class-wc-ecfb-order.php:69
73
+ #: includes/admin/class-wc-ecfb-order.php:274
74
+ #: includes/class-wc-ecfb-front-end.php:177
75
+ msgid "Company Name"
76
+ msgstr "Razão Social"
77
+
78
+ # @ woocommerce-extra-checkout-fields-for-brazil
79
+ #: includes/admin/class-wc-ecfb-customer.php:66
80
+ #: includes/admin/class-wc-ecfb-order.php:72
81
+ #: includes/admin/class-wc-ecfb-order.php:275
82
+ #: includes/class-wc-ecfb-front-end.php:187
83
+ #: includes/class-wc-ecfb-front-end.php:202
84
+ #: includes/class-wc-ecfb-front-end.php:518
85
+ #: includes/class-wc-ecfb-front-end.php:522
86
+ msgid "CNPJ"
87
+ msgstr "CNPJ"
88
+
89
+ # @ woocommerce-extra-checkout-fields-for-brazil
90
+ #: includes/admin/class-wc-ecfb-customer.php:72
91
+ #: includes/admin/class-wc-ecfb-order.php:76
92
+ #: includes/admin/class-wc-ecfb-order.php:278
93
+ #: includes/class-wc-ecfb-front-end.php:194
94
+ #: includes/class-wc-ecfb-front-end.php:526
95
+ msgid "State Registration"
96
+ msgstr "Inscrição Estadual"
97
+
98
+ # @ woocommerce-extra-checkout-fields-for-brazil
99
+ #: includes/admin/class-wc-ecfb-customer.php:79
100
+ #: includes/admin/class-wc-ecfb-customer.php:155
101
+ #: includes/admin/class-wc-ecfb-order.php:83
102
+ #: includes/admin/class-wc-ecfb-order.php:169
103
+ #: includes/admin/class-wc-ecfb-order.php:282
104
+ #: includes/class-wc-ecfb-front-end.php:213
105
+ #: includes/class-wc-ecfb-front-end.php:400
106
+ #: includes/class-wc-ecfb-front-end.php:514
107
+ msgid "Company"
108
+ msgstr "Empresa"
109
+
110
+ # @ woocommerce-extra-checkout-fields-for-brazil
111
+ #: includes/admin/class-wc-ecfb-customer.php:86
112
+ #: includes/admin/class-wc-ecfb-order.php:90
113
+ #: includes/admin/class-wc-ecfb-order.php:288
114
+ #: includes/class-wc-ecfb-front-end.php:224
115
+ msgid "Birthdate"
116
+ msgstr "Data de Nascimento"
117
+
118
+ # @ woocommerce-extra-checkout-fields-for-brazil
119
+ #: includes/admin/class-wc-ecfb-customer.php:90
120
+ #: includes/admin/class-wc-ecfb-order.php:93
121
+ #: includes/admin/class-wc-ecfb-order.php:291
122
+ #: includes/class-wc-ecfb-front-end.php:234
123
+ msgid "Sex"
124
+ msgstr "Sexo"
125
+
126
+ # @ woocommerce-extra-checkout-fields-for-brazil
127
+ #: includes/admin/class-wc-ecfb-customer.php:96
128
+ #: includes/admin/class-wc-ecfb-customer.php:159
129
+ #: includes/admin/class-wc-ecfb-order.php:122
130
+ #: includes/admin/class-wc-ecfb-order.php:197
131
+ #: includes/class-wc-ecfb-front-end.php:250
132
+ #: includes/class-wc-ecfb-front-end.php:408
133
+ msgid "Country"
134
+ msgstr "País"
135
+
136
+ # @ woocommerce-extra-checkout-fields-for-brazil
137
+ #: includes/admin/class-wc-ecfb-customer.php:97
138
+ #: includes/admin/class-wc-ecfb-customer.php:160
139
+ msgid "2 letter Country code"
140
+ msgstr "Código de duas letras"
141
+
142
+ # @ woocommerce-extra-checkout-fields-for-brazil
143
+ #: includes/admin/class-wc-ecfb-customer.php:100
144
+ #: includes/admin/class-wc-ecfb-customer.php:163
145
+ #: includes/admin/class-wc-ecfb-order.php:130
146
+ #: includes/admin/class-wc-ecfb-order.php:205
147
+ msgid "Postcode"
148
+ msgstr "CEP"
149
+
150
+ # @ woocommerce-extra-checkout-fields-for-brazil
151
+ #: includes/admin/class-wc-ecfb-customer.php:104
152
+ #: includes/admin/class-wc-ecfb-customer.php:167
153
+ #: includes/admin/class-wc-ecfb-order.php:98
154
+ #: includes/admin/class-wc-ecfb-order.php:173
155
+ msgid "Address 1"
156
+ msgstr "Endereço"
157
+
158
+ # @ woocommerce-extra-checkout-fields-for-brazil
159
+ #: includes/admin/class-wc-ecfb-customer.php:108
160
+ #: includes/admin/class-wc-ecfb-customer.php:171
161
+ #: includes/admin/class-wc-ecfb-order.php:102
162
+ #: includes/admin/class-wc-ecfb-order.php:177
163
+ #: includes/class-wc-ecfb-front-end.php:276
164
+ #: includes/class-wc-ecfb-front-end.php:433
165
+ msgid "Number"
166
+ msgstr "Número"
167
+
168
+ # @ woocommerce-extra-checkout-fields-for-brazil
169
+ #: includes/admin/class-wc-ecfb-customer.php:112
170
+ #: includes/admin/class-wc-ecfb-customer.php:175
171
+ #: includes/admin/class-wc-ecfb-order.php:106
172
+ #: includes/admin/class-wc-ecfb-order.php:181
173
+ msgid "Address 2"
174
+ msgstr "Complemento"
175
+
176
+ # @ woocommerce-extra-checkout-fields-for-brazil
177
+ #: includes/admin/class-wc-ecfb-customer.php:116
178
+ #: includes/admin/class-wc-ecfb-customer.php:179
179
+ #: includes/admin/class-wc-ecfb-order.php:110
180
+ #: includes/admin/class-wc-ecfb-order.php:185
181
+ #: includes/class-wc-ecfb-front-end.php:292
182
+ #: includes/class-wc-ecfb-front-end.php:449
183
+ msgid "Neighborhood"
184
+ msgstr "Bairro"
185
+
186
+ # @ woocommerce-extra-checkout-fields-for-brazil
187
+ #: includes/admin/class-wc-ecfb-customer.php:120
188
+ #: includes/admin/class-wc-ecfb-customer.php:183
189
+ #: includes/admin/class-wc-ecfb-order.php:114
190
+ #: includes/admin/class-wc-ecfb-order.php:189
191
+ #: includes/class-wc-ecfb-front-end.php:300
192
+ #: includes/class-wc-ecfb-front-end.php:457
193
+ msgid "City"
194
+ msgstr "Cidade"
195
+
196
+ # @ woocommerce-extra-checkout-fields-for-brazil
197
+ #: includes/admin/class-wc-ecfb-customer.php:124
198
+ #: includes/admin/class-wc-ecfb-customer.php:187
199
+ #: includes/admin/class-wc-ecfb-order.php:118
200
+ #: includes/admin/class-wc-ecfb-order.php:193
201
+ #: includes/class-wc-ecfb-front-end.php:86
202
+ #: includes/class-wc-ecfb-front-end.php:309
203
+ #: includes/class-wc-ecfb-front-end.php:466
204
+ msgid "State"
205
+ msgstr "Estado"
206
+
207
+ # @ woocommerce-extra-checkout-fields-for-brazil
208
+ #: includes/admin/class-wc-ecfb-customer.php:125
209
+ #: includes/admin/class-wc-ecfb-customer.php:188
210
+ msgid "State code"
211
+ msgstr "UF"
212
+
213
+ # @ woocommerce-extra-checkout-fields-for-brazil
214
+ #: includes/admin/class-wc-ecfb-customer.php:128
215
+ msgid "Telephone"
216
+ msgstr "Telefone"
217
+
218
+ # @ woocommerce-extra-checkout-fields-for-brazil
219
+ #: includes/admin/class-wc-ecfb-customer.php:134
220
+ #: includes/admin/class-wc-ecfb-order.php:140
221
+ #: includes/admin/class-wc-ecfb-order.php:298
222
+ #: includes/class-wc-ecfb-front-end.php:328
223
+ msgid "Cell Phone"
224
+ msgstr "Celular"
225
+
226
+ # @ woocommerce-extra-checkout-fields-for-brazil
227
+ #: includes/admin/class-wc-ecfb-customer.php:140
228
+ #: includes/admin/class-wc-ecfb-order.php:145
229
+ #: includes/admin/class-wc-ecfb-order.php:301
230
+ #: includes/class-wc-ecfb-front-end.php:336
231
+ #: includes/class-wc-ecfb-front-end.php:356
232
+ msgid "Email"
233
+ msgstr "E-mail"
234
+
235
+ # @ woocommerce-extra-checkout-fields-for-brazil
236
+ #: includes/admin/class-wc-ecfb-customer.php:145
237
+ msgid "Customer Shipping Address"
238
+ msgstr "Endereço de Envio do Cliente"
239
+
240
+ # @ woocommerce-extra-checkout-fields-for-brazil
241
+ #: includes/admin/class-wc-ecfb-order.php:35
242
+ #: includes/admin/class-wc-ecfb-order.php:161
243
+ #: includes/class-wc-ecfb-front-end.php:114
244
+ #: includes/class-wc-ecfb-front-end.php:383
245
+ msgid "First Name"
246
+ msgstr "Nome"
247
+
248
+ # @ woocommerce-extra-checkout-fields-for-brazil
249
+ #: includes/admin/class-wc-ecfb-order.php:39
250
+ #: includes/admin/class-wc-ecfb-order.php:165
251
+ #: includes/class-wc-ecfb-front-end.php:122
252
+ #: includes/class-wc-ecfb-front-end.php:391
253
+ msgid "Last Name"
254
+ msgstr "Sobrenome"
255
+
256
+ # @ woocommerce-extra-checkout-fields-for-brazil
257
+ #: includes/admin/class-wc-ecfb-order.php:47
258
+ #: includes/class-wc-ecfb-front-end.php:135
259
+ #: includes/class-wc-ecfb-front-end.php:493
260
+ msgid "Person type"
261
+ msgstr "Tipo de Pessoa"
262
+
263
+ # @ woocommerce-extra-checkout-fields-for-brazil
264
+ #: includes/admin/class-wc-ecfb-order.php:49
265
+ #: includes/class-wc-ecfb-front-end.php:139
266
+ #: includes/class-wc-ecfb-front-end.php:239
267
+ msgid "Select"
268
+ msgstr "Selecionar"
269
+
270
+ # @ woocommerce-extra-checkout-fields-for-brazil
271
+ #: includes/admin/class-wc-ecfb-order.php:50
272
+ #: includes/class-wc-ecfb-front-end.php:140
273
+ msgid "Individuals"
274
+ msgstr "Pessoa Física"
275
+
276
+ # @ woocommerce-extra-checkout-fields-for-brazil
277
+ #: includes/admin/class-wc-ecfb-order.php:51
278
+ #: includes/class-wc-ecfb-front-end.php:141
279
+ msgid "Legal Person"
280
+ msgstr "Pessoa Jurídica"
281
+
282
+ # @ woocommerce-extra-checkout-fields-for-brazil
283
+ #: includes/admin/class-wc-ecfb-order.php:126
284
+ #: includes/admin/class-wc-ecfb-order.php:201
285
+ msgid "Select a country&hellip;"
286
+ msgstr "Selecionar País&hellip;"
287
+
288
+ # @ woocommerce-extra-checkout-fields-for-brazil
289
+ #: includes/admin/class-wc-ecfb-order.php:135
290
+ #: includes/admin/class-wc-ecfb-order.php:294
291
+ #: includes/class-wc-ecfb-front-end.php:320
292
+ #: includes/class-wc-ecfb-front-end.php:348
293
+ msgid "Phone"
294
+ msgstr "Telefone"
295
+
296
+ # @ woocommerce-extra-checkout-fields-for-brazil
297
+ #: includes/admin/class-wc-ecfb-order.php:250
298
+ #: includes/admin/class-wc-ecfb-order.php:253
299
+ #: includes/admin/class-wc-ecfb-order.php:327
300
+ #: includes/admin/class-wc-ecfb-order.php:330
301
+ #: includes/class-wc-ecfb-front-end.php:268
302
+ #: includes/class-wc-ecfb-front-end.php:425
303
+ msgid "Address"
304
+ msgstr "Endereço"
305
+
306
+ # @ woocommerce-extra-checkout-fields-for-brazil
307
+ #: includes/admin/class-wc-ecfb-order.php:250
308
+ msgid "No billing address set."
309
+ msgstr "Nenhum endereço de pagamento foi definido."
310
+
311
+ # @ woocommerce-extra-checkout-fields-for-brazil
312
+ #: includes/admin/class-wc-ecfb-order.php:258
313
+ msgid "Customer data"
314
+ msgstr "Informações do cliente"
315
+
316
+ # @ woocommerce-extra-checkout-fields-for-brazil
317
+ #: includes/admin/class-wc-ecfb-order.php:327
318
+ msgid "No shipping address set."
319
+ msgstr "Nenhum endereço de entrega foi definido."
320
+
321
+ # @ woocommerce-extra-checkout-fields-for-brazil
322
+ #: includes/admin/class-wc-ecfb-order.php:336
323
+ msgid "Customer Note"
324
+ msgstr "Nota do cliente"
325
+
326
+ # @ woocommerce-extra-checkout-fields-for-brazil
327
+ #: includes/admin/class-wc-ecfb-settings.php:25
328
+ #: includes/admin/class-wc-ecfb-settings.php:26
329
+ msgid "Checkout Fields"
330
+ msgstr "Campos do Checkout"
331
+
332
+ # @ woocommerce-extra-checkout-fields-for-brazil
333
+ #: includes/admin/class-wc-ecfb-settings.php:49
334
+ msgid "Checkout Custom Fields:"
335
+ msgstr "Campos personalizados de Checkout:"
336
+
337
+ # @ woocommerce-extra-checkout-fields-for-brazil
338
+ #: includes/admin/class-wc-ecfb-settings.php:57
339
+ msgid "Display Person Type:"
340
+ msgstr "Exibir Tipo de Pessoa:"
341
+
342
+ # @ woocommerce-extra-checkout-fields-for-brazil
343
+ #: includes/admin/class-wc-ecfb-settings.php:64
344
+ msgid "Individuals enables CPF field and Legal Person enables CNPJ field."
345
+ msgstr ""
346
+ "Pessoa Física habilita o campo CPF e Pessoa Jurídica habilita o campo CNPJ."
347
+
348
+ # @ woocommerce-extra-checkout-fields-for-brazil
349
+ #: includes/admin/class-wc-ecfb-settings.php:66
350
+ msgid "None"
351
+ msgstr "Nenhum"
352
+
353
+ # @ woocommerce-extra-checkout-fields-for-brazil
354
+ #: includes/admin/class-wc-ecfb-settings.php:67
355
+ msgid "Individuals and Legal Person"
356
+ msgstr "Pessoa Física e Pessoa Jurídica"
357
+
358
+ # @ woocommerce-extra-checkout-fields-for-brazil
359
+ #: includes/admin/class-wc-ecfb-settings.php:68
360
+ msgid "Individuals only"
361
+ msgstr "Pessoa Física apenas"
362
+
363
+ # @ woocommerce-extra-checkout-fields-for-brazil
364
+ #: includes/admin/class-wc-ecfb-settings.php:69
365
+ msgid "Legal Person only"
366
+ msgstr "Pessoa Jurídica apenas"
367
+
368
+ # @ woocommerce-extra-checkout-fields-for-brazil
369
+ #: includes/admin/class-wc-ecfb-settings.php:77
370
+ msgid "Person Type is requered only in Brazil?"
371
+ msgstr "Tipo de Pessoa é obrigatório apenas no Brasil?"
372
+
373
+ # @ woocommerce-extra-checkout-fields-for-brazil
374
+ #: includes/admin/class-wc-ecfb-settings.php:84
375
+ msgid ""
376
+ "If checked the Individuals and Legal Person options will be mandatory only "
377
+ "in Brazil."
378
+ msgstr ""
379
+ "Caso esteja marcado os campos de Pessoa Física e Pessoa Jurídica serão "
380
+ "obrigatórios apenas no Brasil."
381
+
382
+ # @ woocommerce-extra-checkout-fields-for-brazil
383
+ #: includes/admin/class-wc-ecfb-settings.php:91
384
+ msgid "Display RG:"
385
+ msgstr "Exibir RG:"
386
+
387
+ # @ woocommerce-extra-checkout-fields-for-brazil
388
+ #: includes/admin/class-wc-ecfb-settings.php:98
389
+ msgid "If checked show the RG field in billing options."
390
+ msgstr "Caso esteja marcado exibe o campo de RG nas informações de cobrança."
391
+
392
+ # @ woocommerce-extra-checkout-fields-for-brazil
393
+ #: includes/admin/class-wc-ecfb-settings.php:105
394
+ msgid "Display State Registration:"
395
+ msgstr "Exibir Inscrição Estadual:"
396
+
397
+ # @ woocommerce-extra-checkout-fields-for-brazil
398
+ #: includes/admin/class-wc-ecfb-settings.php:112
399
+ msgid "If checked show the State Registration field in billing options."
400
+ msgstr ""
401
+ "Caso esteja marcado exibe o campo de Inscrição Estadual nas informações de "
402
+ "cobrança."
403
+
404
+ # @ woocommerce-extra-checkout-fields-for-brazil
405
+ #: includes/admin/class-wc-ecfb-settings.php:119
406
+ msgid "Display Birthdate and Sex:"
407
+ msgstr "Exibir Data de Nascimento e Sexo:"
408
+
409
+ # @ woocommerce-extra-checkout-fields-for-brazil
410
+ #: includes/admin/class-wc-ecfb-settings.php:126
411
+ msgid "If checked show the Birthdate and Sex field in billing options."
412
+ msgstr ""
413
+ "Caso esteja marcado exibe os campos de Data de nascimento e Sexo nas "
414
+ "informações de cobrança."
415
+
416
+ # @ woocommerce-extra-checkout-fields-for-brazil
417
+ #: includes/admin/class-wc-ecfb-settings.php:133
418
+ msgid "Display Cell Phone:"
419
+ msgstr "Exibir Celular:"
420
+
421
+ # @ woocommerce-extra-checkout-fields-for-brazil
422
+ #: includes/admin/class-wc-ecfb-settings.php:140
423
+ msgid "If checked show the Cell Phone field in billing options."
424
+ msgstr ""
425
+ "Caso esteja marcado exibe o campo de Celular nas informações de cobrança."
426
+
427
+ # @ woocommerce-extra-checkout-fields-for-brazil
428
+ #: includes/admin/class-wc-ecfb-settings.php:147
429
+ msgid "jQuery Options:"
430
+ msgstr "Opções de jQuery:"
431
+
432
+ # @ woocommerce-extra-checkout-fields-for-brazil
433
+ #: includes/admin/class-wc-ecfb-settings.php:155
434
+ msgid "Enable Mail Check:"
435
+ msgstr "Habilitar Sugestões de E-mail:"
436
+
437
+ # @ woocommerce-extra-checkout-fields-for-brazil
438
+ #: includes/admin/class-wc-ecfb-settings.php:162
439
+ msgid "If checked informs typos in email to users."
440
+ msgstr ""
441
+ "Caso esteja marcado exibe dicas quando o usuário digita o e-mail de forma "
442
+ "errada."
443
+
444
+ # @ woocommerce-extra-checkout-fields-for-brazil
445
+ #: includes/admin/class-wc-ecfb-settings.php:169
446
+ msgid "Enable Input Mask:"
447
+ msgstr "Habilitar Máscara de Campos:"
448
+
449
+ # @ woocommerce-extra-checkout-fields-for-brazil
450
+ #: includes/admin/class-wc-ecfb-settings.php:176
451
+ msgid ""
452
+ "If checked create masks fill for in fields of CPF, CNPJ, Birthdate, Phone "
453
+ "and Cell Phone."
454
+ msgstr ""
455
+ "Caso esteja marcado adiciona máscaras de preenchimento para os campos de "
456
+ "CPF, CNPJ, Data de Nascimento, Telefone e Celular."
457
+
458
+ # @ woocommerce-extra-checkout-fields-for-brazil
459
+ #: includes/admin/class-wc-ecfb-settings.php:183
460
+ msgid "Enable Address Autocomplete:"
461
+ msgstr "Habilitar Auto Preenchimento de Endereço:"
462
+
463
+ # @ woocommerce-extra-checkout-fields-for-brazil
464
+ #: includes/admin/class-wc-ecfb-settings.php:190
465
+ msgid ""
466
+ "If checked automatically complete the address fields based on the zip code."
467
+ msgstr ""
468
+ "Caso esteja marcado as informações de endereço serão preenchidas "
469
+ "automaticamente com base no país como Brasil e pelo CEP."
470
+
471
+ # @ woocommerce-extra-checkout-fields-for-brazil
472
+ #: includes/admin/class-wc-ecfb-settings.php:197
473
+ msgid "Validation:"
474
+ msgstr "Validação:"
475
+
476
+ # @ woocommerce-extra-checkout-fields-for-brazil
477
+ #: includes/admin/class-wc-ecfb-settings.php:205
478
+ msgid "Validate CPF:"
479
+ msgstr "Validar CPF:"
480
+
481
+ # @ woocommerce-extra-checkout-fields-for-brazil
482
+ #: includes/admin/class-wc-ecfb-settings.php:212
483
+ msgid "Checks if the CPF is valid."
484
+ msgstr "Verifica se o CPF é válido."
485
+
486
+ # @ woocommerce-extra-checkout-fields-for-brazil
487
+ #: includes/admin/class-wc-ecfb-settings.php:219
488
+ msgid "Validate CNPJ:"
489
+ msgstr "Validar CNPJ:"
490
+
491
+ # @ woocommerce-extra-checkout-fields-for-brazil
492
+ #: includes/admin/class-wc-ecfb-settings.php:226
493
+ msgid "Checks if the CNPJ is valid."
494
+ msgstr "Verifica se o CNPJ é válido."
495
+
496
+ # @ woocommerce-extra-checkout-fields-for-brazil
497
+ #: includes/class-wc-ecfb-front-end.php:87
498
+ msgid "required"
499
+ msgstr "obrigatório"
500
+
501
+ # @ woocommerce-extra-checkout-fields-for-brazil
502
+ #: includes/class-wc-ecfb-front-end.php:115
503
+ #: includes/class-wc-ecfb-front-end.php:384
504
+ msgctxt "placeholder"
505
+ msgid "First Name"
506
+ msgstr "Nome"
507
+
508
+ # @ woocommerce-extra-checkout-fields-for-brazil
509
+ #: includes/class-wc-ecfb-front-end.php:123
510
+ #: includes/class-wc-ecfb-front-end.php:392
511
+ msgctxt "placeholder"
512
+ msgid "Last Name"
513
+ msgstr "Sobrenome"
514
+
515
+ # @ woocommerce-extra-checkout-fields-for-brazil
516
+ #: includes/class-wc-ecfb-front-end.php:151
517
+ #: includes/class-wc-ecfb-front-end.php:167
518
+ msgctxt "placeholder"
519
+ msgid "CPF"
520
+ msgstr "CPF"
521
+
522
+ # @ woocommerce-extra-checkout-fields-for-brazil
523
+ #: includes/class-wc-ecfb-front-end.php:159
524
+ msgctxt "placeholder"
525
+ msgid "RG"
526
+ msgstr "RG"
527
+
528
+ # @ woocommerce-extra-checkout-fields-for-brazil
529
+ #: includes/class-wc-ecfb-front-end.php:178
530
+ msgctxt "placeholder"
531
+ msgid "Company Name"
532
+ msgstr "Razão Social"
533
+
534
+ # @ woocommerce-extra-checkout-fields-for-brazil
535
+ #: includes/class-wc-ecfb-front-end.php:188
536
+ #: includes/class-wc-ecfb-front-end.php:203
537
+ msgctxt "placeholder"
538
+ msgid "CNPJ"
539
+ msgstr "CNPJ"
540
+
541
+ # @ woocommerce-extra-checkout-fields-for-brazil
542
+ #: includes/class-wc-ecfb-front-end.php:195
543
+ msgctxt "placeholder"
544
+ msgid "State Registration"
545
+ msgstr "Inscrição Estadual"
546
+
547
+ # @ woocommerce-extra-checkout-fields-for-brazil
548
+ #: includes/class-wc-ecfb-front-end.php:214
549
+ #: includes/class-wc-ecfb-front-end.php:401
550
+ msgctxt "placeholder"
551
+ msgid "Company"
552
+ msgstr "Empresa"
553
+
554
+ # @ woocommerce-extra-checkout-fields-for-brazil
555
+ #: includes/class-wc-ecfb-front-end.php:225
556
+ msgctxt "placeholder"
557
+ msgid "Birthdate"
558
+ msgstr "Data de Nascimento"
559
+
560
+ # @ woocommerce-extra-checkout-fields-for-brazil
561
+ #: includes/class-wc-ecfb-front-end.php:240
562
+ msgid "Female"
563
+ msgstr "Feminino"
564
+
565
+ # @ woocommerce-extra-checkout-fields-for-brazil
566
+ #: includes/class-wc-ecfb-front-end.php:241
567
+ msgid "Male"
568
+ msgstr "Masculino"
569
+
570
+ # @ woocommerce-extra-checkout-fields-for-brazil
571
+ #: includes/class-wc-ecfb-front-end.php:251
572
+ #: includes/class-wc-ecfb-front-end.php:409
573
+ msgctxt "placeholder"
574
+ msgid "Country"
575
+ msgstr "País"
576
+
577
+ # @ woocommerce-extra-checkout-fields-for-brazil
578
+ #: includes/class-wc-ecfb-front-end.php:259
579
+ #: includes/class-wc-ecfb-front-end.php:416
580
+ msgid "Post Code"
581
+ msgstr "CEP"
582
+
583
+ # @ woocommerce-extra-checkout-fields-for-brazil
584
+ #: includes/class-wc-ecfb-front-end.php:260
585
+ #: includes/class-wc-ecfb-front-end.php:417
586
+ msgctxt "placeholder"
587
+ msgid "Post Code"
588
+ msgstr "CEP"
589
+
590
+ # @ woocommerce-extra-checkout-fields-for-brazil
591
+ #: includes/class-wc-ecfb-front-end.php:269
592
+ #: includes/class-wc-ecfb-front-end.php:426
593
+ msgctxt "placeholder"
594
+ msgid "Address"
595
+ msgstr "Endereço"
596
+
597
+ # @ woocommerce-extra-checkout-fields-for-brazil
598
+ #: includes/class-wc-ecfb-front-end.php:277
599
+ #: includes/class-wc-ecfb-front-end.php:434
600
+ msgctxt "placeholder"
601
+ msgid "Number"
602
+ msgstr "Número"
603
+
604
+ # @ woocommerce-extra-checkout-fields-for-brazil
605
+ #: includes/class-wc-ecfb-front-end.php:285
606
+ #: includes/class-wc-ecfb-front-end.php:442
607
+ msgid "Address line 2"
608
+ msgstr "Complemento"
609
+
610
+ # @ woocommerce-extra-checkout-fields-for-brazil
611
+ #: includes/class-wc-ecfb-front-end.php:286
612
+ #: includes/class-wc-ecfb-front-end.php:443
613
+ msgctxt "placeholder"
614
+ msgid "Address line 2"
615
+ msgstr "Complemento"
616
+
617
+ # @ woocommerce-extra-checkout-fields-for-brazil
618
+ #: includes/class-wc-ecfb-front-end.php:293
619
+ #: includes/class-wc-ecfb-front-end.php:450
620
+ msgctxt "placeholder"
621
+ msgid "Neighborhood"
622
+ msgstr "Bairro"
623
+
624
+ # @ woocommerce-extra-checkout-fields-for-brazil
625
+ #: includes/class-wc-ecfb-front-end.php:301
626
+ #: includes/class-wc-ecfb-front-end.php:458
627
+ msgctxt "placeholder"
628
+ msgid "City"
629
+ msgstr "Cidade"
630
+
631
+ # @ woocommerce-extra-checkout-fields-for-brazil
632
+ #: includes/class-wc-ecfb-front-end.php:310
633
+ #: includes/class-wc-ecfb-front-end.php:467
634
+ msgctxt "placeholder"
635
+ msgid "State"
636
+ msgstr "Estado"
637
+
638
+ # @ woocommerce-extra-checkout-fields-for-brazil
639
+ #: includes/class-wc-ecfb-front-end.php:321
640
+ #: includes/class-wc-ecfb-front-end.php:349
641
+ msgctxt "placeholder"
642
+ msgid "Phone"
643
+ msgstr "Telefone"
644
+
645
+ # @ woocommerce-extra-checkout-fields-for-brazil
646
+ #: includes/class-wc-ecfb-front-end.php:329
647
+ msgctxt "placeholder"
648
+ msgid "Cell Phone"
649
+ msgstr "Celular"
650
+
651
+ # @ woocommerce-extra-checkout-fields-for-brazil
652
+ #: includes/class-wc-ecfb-front-end.php:337
653
+ #: includes/class-wc-ecfb-front-end.php:357
654
+ msgctxt "placeholder"
655
+ msgid "Email"
656
+ msgstr "E-mail"
657
+
658
+ # @ woocommerce-extra-checkout-fields-for-brazil
659
+ #: includes/class-wc-ecfb-front-end.php:493
660
+ #: includes/class-wc-ecfb-front-end.php:499
661
+ #: includes/class-wc-ecfb-front-end.php:507
662
+ #: includes/class-wc-ecfb-front-end.php:514
663
+ #: includes/class-wc-ecfb-front-end.php:518
664
+ #: includes/class-wc-ecfb-front-end.php:526
665
+ msgid "is a required field"
666
+ msgstr "é um campo obrigatório"
667
+
668
+ # @ woocommerce-extra-checkout-fields-for-brazil
669
+ #: includes/class-wc-ecfb-front-end.php:503
670
+ #: includes/class-wc-ecfb-front-end.php:522
671
+ msgid "is not valid"
672
+ msgstr "é inválido"
673
+
674
+ # @ woocommerce-extra-checkout-fields-for-brazil
675
+ #: woocommerce-extra-checkout-fields-for-brazil.php:119
676
+ msgid "WooCommerce Extra Checkout Fields for Brazil depends on %s to work!"
677
+ msgstr ""
678
+ "WooCommerce Extra Checkout Fields for Brazil depende do %s para funcionar!"
679
+
680
+ # @ woocommerce-extra-checkout-fields-for-brazil
681
+ #: woocommerce-extra-checkout-fields-for-brazil.php:119
682
+ msgid "WooCommerce"
683
+ msgstr "WooCommerce"
684
+
685
+ # @ woocommerce-extra-checkout-fields-for-brazil
686
+ #. Plugin Name of the plugin/theme
687
+ msgid "WooCommerce Extra Checkout Fields for Brazil"
688
+ msgstr "WooCommerce Extra Checkout Fields for Brazil"
689
+
690
+ # @ woocommerce-extra-checkout-fields-for-brazil
691
+ #. Plugin URI of the plugin/theme
692
+ msgid ""
693
+ "https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil"
694
+ msgstr ""
695
+ "https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil"
696
+
697
+ # @ woocommerce-extra-checkout-fields-for-brazil
698
+ #. Description of the plugin/theme
699
+ msgid ""
700
+ "Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, "
701
+ "Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail "
702
+ "incorreto e auto preenchimento dos campos de endereço pelo CEP."
703
+ msgstr ""
704
+ "Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, "
705
+ "Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail "
706
+ "incorreto e auto preenchimento dos campos de endereço pelo CEP."
707
+
708
+ # @ woocommerce-extra-checkout-fields-for-brazil
709
+ #. Author of the plugin/theme
710
+ msgid "Claudio Sanches"
711
+ msgstr "Claudio Sanches"
712
+
713
+ # @ woocommerce-extra-checkout-fields-for-brazil
714
+ #. Author URI of the plugin/theme
715
+ msgid "http://claudiosmweb.com/"
716
+ msgstr "http://claudiosmweb.com/"
languages/woocommerce-extra-checkout-fields-for-brazil.pot ADDED
@@ -0,0 +1,586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2015 WooCommerce Extra Checkout Fields for Brazil
2
+ # This file is distributed under the same license as the WooCommerce Extra Checkout Fields for Brazil package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce Extra Checkout Fields for Brazil 3.4.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-extra-"
7
+ "checkout-fields-for-brazil\n"
8
+ "POT-Creation-Date: 2015-08-18 23:28:45+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: includes/admin/class-wc-ecfb-admin.php:45
17
+ msgid "Load the customer extras data?"
18
+ msgstr ""
19
+
20
+ #: includes/admin/class-wc-ecfb-admin.php:46
21
+ msgid "Also copy the data of number and neighborhood?"
22
+ msgstr ""
23
+
24
+ #: includes/admin/class-wc-ecfb-customer.php:34
25
+ msgid "Customer Billing Address"
26
+ msgstr ""
27
+
28
+ #: includes/admin/class-wc-ecfb-customer.php:36
29
+ #: includes/admin/class-wc-ecfb-customer.php:147
30
+ msgid "First name"
31
+ msgstr ""
32
+
33
+ #: includes/admin/class-wc-ecfb-customer.php:40
34
+ #: includes/admin/class-wc-ecfb-customer.php:151
35
+ msgid "Last name"
36
+ msgstr ""
37
+
38
+ #: includes/admin/class-wc-ecfb-customer.php:48
39
+ #: includes/admin/class-wc-ecfb-order.php:58
40
+ #: includes/admin/class-wc-ecfb-order.php:266
41
+ #: includes/class-wc-ecfb-front-end.php:150
42
+ #: includes/class-wc-ecfb-front-end.php:166
43
+ #: includes/class-wc-ecfb-front-end.php:499
44
+ #: includes/class-wc-ecfb-front-end.php:503
45
+ msgid "CPF"
46
+ msgstr ""
47
+
48
+ #: includes/admin/class-wc-ecfb-customer.php:54
49
+ #: includes/admin/class-wc-ecfb-order.php:62
50
+ #: includes/admin/class-wc-ecfb-order.php:269
51
+ #: includes/class-wc-ecfb-front-end.php:158
52
+ #: includes/class-wc-ecfb-front-end.php:507
53
+ msgid "RG"
54
+ msgstr ""
55
+
56
+ #: includes/admin/class-wc-ecfb-customer.php:62
57
+ #: includes/admin/class-wc-ecfb-order.php:69
58
+ #: includes/admin/class-wc-ecfb-order.php:274
59
+ #: includes/class-wc-ecfb-front-end.php:177
60
+ msgid "Company Name"
61
+ msgstr ""
62
+
63
+ #: includes/admin/class-wc-ecfb-customer.php:66
64
+ #: includes/admin/class-wc-ecfb-order.php:72
65
+ #: includes/admin/class-wc-ecfb-order.php:275
66
+ #: includes/class-wc-ecfb-front-end.php:187
67
+ #: includes/class-wc-ecfb-front-end.php:202
68
+ #: includes/class-wc-ecfb-front-end.php:518
69
+ #: includes/class-wc-ecfb-front-end.php:522
70
+ msgid "CNPJ"
71
+ msgstr ""
72
+
73
+ #: includes/admin/class-wc-ecfb-customer.php:72
74
+ #: includes/admin/class-wc-ecfb-order.php:76
75
+ #: includes/admin/class-wc-ecfb-order.php:278
76
+ #: includes/class-wc-ecfb-front-end.php:194
77
+ #: includes/class-wc-ecfb-front-end.php:526
78
+ msgid "State Registration"
79
+ msgstr ""
80
+
81
+ #: includes/admin/class-wc-ecfb-customer.php:79
82
+ #: includes/admin/class-wc-ecfb-customer.php:155
83
+ #: includes/admin/class-wc-ecfb-order.php:83
84
+ #: includes/admin/class-wc-ecfb-order.php:169
85
+ #: includes/admin/class-wc-ecfb-order.php:282
86
+ #: includes/class-wc-ecfb-front-end.php:213
87
+ #: includes/class-wc-ecfb-front-end.php:400
88
+ #: includes/class-wc-ecfb-front-end.php:514
89
+ msgid "Company"
90
+ msgstr ""
91
+
92
+ #: includes/admin/class-wc-ecfb-customer.php:86
93
+ #: includes/admin/class-wc-ecfb-order.php:90
94
+ #: includes/admin/class-wc-ecfb-order.php:288
95
+ #: includes/class-wc-ecfb-front-end.php:224
96
+ msgid "Birthdate"
97
+ msgstr ""
98
+
99
+ #: includes/admin/class-wc-ecfb-customer.php:90
100
+ #: includes/admin/class-wc-ecfb-order.php:93
101
+ #: includes/admin/class-wc-ecfb-order.php:291
102
+ #: includes/class-wc-ecfb-front-end.php:234
103
+ msgid "Sex"
104
+ msgstr ""
105
+
106
+ #: includes/admin/class-wc-ecfb-customer.php:96
107
+ #: includes/admin/class-wc-ecfb-customer.php:159
108
+ #: includes/admin/class-wc-ecfb-order.php:122
109
+ #: includes/admin/class-wc-ecfb-order.php:197
110
+ #: includes/class-wc-ecfb-front-end.php:250
111
+ #: includes/class-wc-ecfb-front-end.php:408
112
+ msgid "Country"
113
+ msgstr ""
114
+
115
+ #: includes/admin/class-wc-ecfb-customer.php:97
116
+ #: includes/admin/class-wc-ecfb-customer.php:160
117
+ msgid "2 letter Country code"
118
+ msgstr ""
119
+
120
+ #: includes/admin/class-wc-ecfb-customer.php:100
121
+ #: includes/admin/class-wc-ecfb-customer.php:163
122
+ #: includes/admin/class-wc-ecfb-order.php:130
123
+ #: includes/admin/class-wc-ecfb-order.php:205
124
+ msgid "Postcode"
125
+ msgstr ""
126
+
127
+ #: includes/admin/class-wc-ecfb-customer.php:104
128
+ #: includes/admin/class-wc-ecfb-customer.php:167
129
+ #: includes/admin/class-wc-ecfb-order.php:98
130
+ #: includes/admin/class-wc-ecfb-order.php:173
131
+ msgid "Address 1"
132
+ msgstr ""
133
+
134
+ #: includes/admin/class-wc-ecfb-customer.php:108
135
+ #: includes/admin/class-wc-ecfb-customer.php:171
136
+ #: includes/admin/class-wc-ecfb-order.php:102
137
+ #: includes/admin/class-wc-ecfb-order.php:177
138
+ #: includes/class-wc-ecfb-front-end.php:276
139
+ #: includes/class-wc-ecfb-front-end.php:433
140
+ msgid "Number"
141
+ msgstr ""
142
+
143
+ #: includes/admin/class-wc-ecfb-customer.php:112
144
+ #: includes/admin/class-wc-ecfb-customer.php:175
145
+ #: includes/admin/class-wc-ecfb-order.php:106
146
+ #: includes/admin/class-wc-ecfb-order.php:181
147
+ msgid "Address 2"
148
+ msgstr ""
149
+
150
+ #: includes/admin/class-wc-ecfb-customer.php:116
151
+ #: includes/admin/class-wc-ecfb-customer.php:179
152
+ #: includes/admin/class-wc-ecfb-order.php:110
153
+ #: includes/admin/class-wc-ecfb-order.php:185
154
+ #: includes/class-wc-ecfb-front-end.php:292
155
+ #: includes/class-wc-ecfb-front-end.php:449
156
+ msgid "Neighborhood"
157
+ msgstr ""
158
+
159
+ #: includes/admin/class-wc-ecfb-customer.php:120
160
+ #: includes/admin/class-wc-ecfb-customer.php:183
161
+ #: includes/admin/class-wc-ecfb-order.php:114
162
+ #: includes/admin/class-wc-ecfb-order.php:189
163
+ #: includes/class-wc-ecfb-front-end.php:300
164
+ #: includes/class-wc-ecfb-front-end.php:457
165
+ msgid "City"
166
+ msgstr ""
167
+
168
+ #: includes/admin/class-wc-ecfb-customer.php:124
169
+ #: includes/admin/class-wc-ecfb-customer.php:187
170
+ #: includes/admin/class-wc-ecfb-order.php:118
171
+ #: includes/admin/class-wc-ecfb-order.php:193
172
+ #: includes/class-wc-ecfb-front-end.php:86
173
+ #: includes/class-wc-ecfb-front-end.php:309
174
+ #: includes/class-wc-ecfb-front-end.php:466
175
+ msgid "State"
176
+ msgstr ""
177
+
178
+ #: includes/admin/class-wc-ecfb-customer.php:125
179
+ #: includes/admin/class-wc-ecfb-customer.php:188
180
+ msgid "State code"
181
+ msgstr ""
182
+
183
+ #: includes/admin/class-wc-ecfb-customer.php:128
184
+ msgid "Telephone"
185
+ msgstr ""
186
+
187
+ #: includes/admin/class-wc-ecfb-customer.php:134
188
+ #: includes/admin/class-wc-ecfb-order.php:140
189
+ #: includes/admin/class-wc-ecfb-order.php:298
190
+ #: includes/class-wc-ecfb-front-end.php:328
191
+ msgid "Cell Phone"
192
+ msgstr ""
193
+
194
+ #: includes/admin/class-wc-ecfb-customer.php:140
195
+ #: includes/admin/class-wc-ecfb-order.php:145
196
+ #: includes/admin/class-wc-ecfb-order.php:301
197
+ #: includes/class-wc-ecfb-front-end.php:336
198
+ #: includes/class-wc-ecfb-front-end.php:356
199
+ msgid "Email"
200
+ msgstr ""
201
+
202
+ #: includes/admin/class-wc-ecfb-customer.php:145
203
+ msgid "Customer Shipping Address"
204
+ msgstr ""
205
+
206
+ #: includes/admin/class-wc-ecfb-order.php:35
207
+ #: includes/admin/class-wc-ecfb-order.php:161
208
+ #: includes/class-wc-ecfb-front-end.php:114
209
+ #: includes/class-wc-ecfb-front-end.php:383
210
+ msgid "First Name"
211
+ msgstr ""
212
+
213
+ #: includes/admin/class-wc-ecfb-order.php:39
214
+ #: includes/admin/class-wc-ecfb-order.php:165
215
+ #: includes/class-wc-ecfb-front-end.php:122
216
+ #: includes/class-wc-ecfb-front-end.php:391
217
+ msgid "Last Name"
218
+ msgstr ""
219
+
220
+ #: includes/admin/class-wc-ecfb-order.php:47
221
+ #: includes/class-wc-ecfb-front-end.php:135
222
+ #: includes/class-wc-ecfb-front-end.php:493
223
+ msgid "Person type"
224
+ msgstr ""
225
+
226
+ #: includes/admin/class-wc-ecfb-order.php:49
227
+ #: includes/class-wc-ecfb-front-end.php:139
228
+ #: includes/class-wc-ecfb-front-end.php:239
229
+ msgid "Select"
230
+ msgstr ""
231
+
232
+ #: includes/admin/class-wc-ecfb-order.php:50
233
+ #: includes/class-wc-ecfb-front-end.php:140
234
+ msgid "Individuals"
235
+ msgstr ""
236
+
237
+ #: includes/admin/class-wc-ecfb-order.php:51
238
+ #: includes/class-wc-ecfb-front-end.php:141
239
+ msgid "Legal Person"
240
+ msgstr ""
241
+
242
+ #: includes/admin/class-wc-ecfb-order.php:126
243
+ #: includes/admin/class-wc-ecfb-order.php:201
244
+ msgid "Select a country&hellip;"
245
+ msgstr ""
246
+
247
+ #: includes/admin/class-wc-ecfb-order.php:135
248
+ #: includes/admin/class-wc-ecfb-order.php:294
249
+ #: includes/class-wc-ecfb-front-end.php:320
250
+ #: includes/class-wc-ecfb-front-end.php:348
251
+ msgid "Phone"
252
+ msgstr ""
253
+
254
+ #: includes/admin/class-wc-ecfb-order.php:250
255
+ #: includes/admin/class-wc-ecfb-order.php:253
256
+ #: includes/admin/class-wc-ecfb-order.php:327
257
+ #: includes/admin/class-wc-ecfb-order.php:330
258
+ #: includes/class-wc-ecfb-front-end.php:268
259
+ #: includes/class-wc-ecfb-front-end.php:425
260
+ msgid "Address"
261
+ msgstr ""
262
+
263
+ #: includes/admin/class-wc-ecfb-order.php:250
264
+ msgid "No billing address set."
265
+ msgstr ""
266
+
267
+ #: includes/admin/class-wc-ecfb-order.php:258
268
+ msgid "Customer data"
269
+ msgstr ""
270
+
271
+ #: includes/admin/class-wc-ecfb-order.php:327
272
+ msgid "No shipping address set."
273
+ msgstr ""
274
+
275
+ #: includes/admin/class-wc-ecfb-order.php:336
276
+ msgid "Customer Note"
277
+ msgstr ""
278
+
279
+ #: includes/admin/class-wc-ecfb-settings.php:25
280
+ #: includes/admin/class-wc-ecfb-settings.php:26
281
+ msgid "Checkout Fields"
282
+ msgstr ""
283
+
284
+ #: includes/admin/class-wc-ecfb-settings.php:49
285
+ msgid "Checkout Custom Fields:"
286
+ msgstr ""
287
+
288
+ #: includes/admin/class-wc-ecfb-settings.php:57
289
+ msgid "Display Person Type:"
290
+ msgstr ""
291
+
292
+ #: includes/admin/class-wc-ecfb-settings.php:64
293
+ msgid "Individuals enables CPF field and Legal Person enables CNPJ field."
294
+ msgstr ""
295
+
296
+ #: includes/admin/class-wc-ecfb-settings.php:66
297
+ msgid "None"
298
+ msgstr ""
299
+
300
+ #: includes/admin/class-wc-ecfb-settings.php:67
301
+ msgid "Individuals and Legal Person"
302
+ msgstr ""
303
+
304
+ #: includes/admin/class-wc-ecfb-settings.php:68
305
+ msgid "Individuals only"
306
+ msgstr ""
307
+
308
+ #: includes/admin/class-wc-ecfb-settings.php:69
309
+ msgid "Legal Person only"
310
+ msgstr ""
311
+
312
+ #: includes/admin/class-wc-ecfb-settings.php:77
313
+ msgid "Person Type is requered only in Brazil?"
314
+ msgstr ""
315
+
316
+ #: includes/admin/class-wc-ecfb-settings.php:84
317
+ msgid ""
318
+ "If checked the Individuals and Legal Person options will be mandatory only "
319
+ "in Brazil."
320
+ msgstr ""
321
+
322
+ #: includes/admin/class-wc-ecfb-settings.php:91
323
+ msgid "Display RG:"
324
+ msgstr ""
325
+
326
+ #: includes/admin/class-wc-ecfb-settings.php:98
327
+ msgid "If checked show the RG field in billing options."
328
+ msgstr ""
329
+
330
+ #: includes/admin/class-wc-ecfb-settings.php:105
331
+ msgid "Display State Registration:"
332
+ msgstr ""
333
+
334
+ #: includes/admin/class-wc-ecfb-settings.php:112
335
+ msgid "If checked show the State Registration field in billing options."
336
+ msgstr ""
337
+
338
+ #: includes/admin/class-wc-ecfb-settings.php:119
339
+ msgid "Display Birthdate and Sex:"
340
+ msgstr ""
341
+
342
+ #: includes/admin/class-wc-ecfb-settings.php:126
343
+ msgid "If checked show the Birthdate and Sex field in billing options."
344
+ msgstr ""
345
+
346
+ #: includes/admin/class-wc-ecfb-settings.php:133
347
+ msgid "Display Cell Phone:"
348
+ msgstr ""
349
+
350
+ #: includes/admin/class-wc-ecfb-settings.php:140
351
+ msgid "If checked show the Cell Phone field in billing options."
352
+ msgstr ""
353
+
354
+ #: includes/admin/class-wc-ecfb-settings.php:147
355
+ msgid "jQuery Options:"
356
+ msgstr ""
357
+
358
+ #: includes/admin/class-wc-ecfb-settings.php:155
359
+ msgid "Enable Mail Check:"
360
+ msgstr ""
361
+
362
+ #: includes/admin/class-wc-ecfb-settings.php:162
363
+ msgid "If checked informs typos in email to users."
364
+ msgstr ""
365
+
366
+ #: includes/admin/class-wc-ecfb-settings.php:169
367
+ msgid "Enable Input Mask:"
368
+ msgstr ""
369
+
370
+ #: includes/admin/class-wc-ecfb-settings.php:176
371
+ msgid ""
372
+ "If checked create masks fill for in fields of CPF, CNPJ, Birthdate, Phone "
373
+ "and Cell Phone."
374
+ msgstr ""
375
+
376
+ #: includes/admin/class-wc-ecfb-settings.php:183
377
+ msgid "Enable Address Autocomplete:"
378
+ msgstr ""
379
+
380
+ #: includes/admin/class-wc-ecfb-settings.php:190
381
+ msgid ""
382
+ "If checked automatically complete the address fields based on the zip code."
383
+ msgstr ""
384
+
385
+ #: includes/admin/class-wc-ecfb-settings.php:197
386
+ msgid "Validation:"
387
+ msgstr ""
388
+
389
+ #: includes/admin/class-wc-ecfb-settings.php:205
390
+ msgid "Validate CPF:"
391
+ msgstr ""
392
+
393
+ #: includes/admin/class-wc-ecfb-settings.php:212
394
+ msgid "Checks if the CPF is valid."
395
+ msgstr ""
396
+
397
+ #: includes/admin/class-wc-ecfb-settings.php:219
398
+ msgid "Validate CNPJ:"
399
+ msgstr ""
400
+
401
+ #: includes/admin/class-wc-ecfb-settings.php:226
402
+ msgid "Checks if the CNPJ is valid."
403
+ msgstr ""
404
+
405
+ #: includes/class-wc-ecfb-front-end.php:87
406
+ msgid "required"
407
+ msgstr ""
408
+
409
+ #: includes/class-wc-ecfb-front-end.php:115
410
+ #: includes/class-wc-ecfb-front-end.php:384
411
+ msgctxt "placeholder"
412
+ msgid "First Name"
413
+ msgstr ""
414
+
415
+ #: includes/class-wc-ecfb-front-end.php:123
416
+ #: includes/class-wc-ecfb-front-end.php:392
417
+ msgctxt "placeholder"
418
+ msgid "Last Name"
419
+ msgstr ""
420
+
421
+ #: includes/class-wc-ecfb-front-end.php:151
422
+ #: includes/class-wc-ecfb-front-end.php:167
423
+ msgctxt "placeholder"
424
+ msgid "CPF"
425
+ msgstr ""
426
+
427
+ #: includes/class-wc-ecfb-front-end.php:159
428
+ msgctxt "placeholder"
429
+ msgid "RG"
430
+ msgstr ""
431
+
432
+ #: includes/class-wc-ecfb-front-end.php:178
433
+ msgctxt "placeholder"
434
+ msgid "Company Name"
435
+ msgstr ""
436
+
437
+ #: includes/class-wc-ecfb-front-end.php:188
438
+ #: includes/class-wc-ecfb-front-end.php:203
439
+ msgctxt "placeholder"
440
+ msgid "CNPJ"
441
+ msgstr ""
442
+
443
+ #: includes/class-wc-ecfb-front-end.php:195
444
+ msgctxt "placeholder"
445
+ msgid "State Registration"
446
+ msgstr ""
447
+
448
+ #: includes/class-wc-ecfb-front-end.php:214
449
+ #: includes/class-wc-ecfb-front-end.php:401
450
+ msgctxt "placeholder"
451
+ msgid "Company"
452
+ msgstr ""
453
+
454
+ #: includes/class-wc-ecfb-front-end.php:225
455
+ msgctxt "placeholder"
456
+ msgid "Birthdate"
457
+ msgstr ""
458
+
459
+ #: includes/class-wc-ecfb-front-end.php:240
460
+ msgid "Female"
461
+ msgstr ""
462
+
463
+ #: includes/class-wc-ecfb-front-end.php:241
464
+ msgid "Male"
465
+ msgstr ""
466
+
467
+ #: includes/class-wc-ecfb-front-end.php:251
468
+ #: includes/class-wc-ecfb-front-end.php:409
469
+ msgctxt "placeholder"
470
+ msgid "Country"
471
+ msgstr ""
472
+
473
+ #: includes/class-wc-ecfb-front-end.php:259
474
+ #: includes/class-wc-ecfb-front-end.php:416
475
+ msgid "Post Code"
476
+ msgstr ""
477
+
478
+ #: includes/class-wc-ecfb-front-end.php:260
479
+ #: includes/class-wc-ecfb-front-end.php:417
480
+ msgctxt "placeholder"
481
+ msgid "Post Code"
482
+ msgstr ""
483
+
484
+ #: includes/class-wc-ecfb-front-end.php:269
485
+ #: includes/class-wc-ecfb-front-end.php:426
486
+ msgctxt "placeholder"
487
+ msgid "Address"
488
+ msgstr ""
489
+
490
+ #: includes/class-wc-ecfb-front-end.php:277
491
+ #: includes/class-wc-ecfb-front-end.php:434
492
+ msgctxt "placeholder"
493
+ msgid "Number"
494
+ msgstr ""
495
+
496
+ #: includes/class-wc-ecfb-front-end.php:285
497
+ #: includes/class-wc-ecfb-front-end.php:442
498
+ msgid "Address line 2"
499
+ msgstr ""
500
+
501
+ #: includes/class-wc-ecfb-front-end.php:286
502
+ #: includes/class-wc-ecfb-front-end.php:443
503
+ msgctxt "placeholder"
504
+ msgid "Address line 2"
505
+ msgstr ""
506
+
507
+ #: includes/class-wc-ecfb-front-end.php:293
508
+ #: includes/class-wc-ecfb-front-end.php:450
509
+ msgctxt "placeholder"
510
+ msgid "Neighborhood"
511
+ msgstr ""
512
+
513
+ #: includes/class-wc-ecfb-front-end.php:301
514
+ #: includes/class-wc-ecfb-front-end.php:458
515
+ msgctxt "placeholder"
516
+ msgid "City"
517
+ msgstr ""
518
+
519
+ #: includes/class-wc-ecfb-front-end.php:310
520
+ #: includes/class-wc-ecfb-front-end.php:467
521
+ msgctxt "placeholder"
522
+ msgid "State"
523
+ msgstr ""
524
+
525
+ #: includes/class-wc-ecfb-front-end.php:321
526
+ #: includes/class-wc-ecfb-front-end.php:349
527
+ msgctxt "placeholder"
528
+ msgid "Phone"
529
+ msgstr ""
530
+
531
+ #: includes/class-wc-ecfb-front-end.php:329
532
+ msgctxt "placeholder"
533
+ msgid "Cell Phone"
534
+ msgstr ""
535
+
536
+ #: includes/class-wc-ecfb-front-end.php:337
537
+ #: includes/class-wc-ecfb-front-end.php:357
538
+ msgctxt "placeholder"
539
+ msgid "Email"
540
+ msgstr ""
541
+
542
+ #: includes/class-wc-ecfb-front-end.php:493
543
+ #: includes/class-wc-ecfb-front-end.php:499
544
+ #: includes/class-wc-ecfb-front-end.php:507
545
+ #: includes/class-wc-ecfb-front-end.php:514
546
+ #: includes/class-wc-ecfb-front-end.php:518
547
+ #: includes/class-wc-ecfb-front-end.php:526
548
+ msgid "is a required field"
549
+ msgstr ""
550
+
551
+ #: includes/class-wc-ecfb-front-end.php:503
552
+ #: includes/class-wc-ecfb-front-end.php:522
553
+ msgid "is not valid"
554
+ msgstr ""
555
+
556
+ #: woocommerce-extra-checkout-fields-for-brazil.php:119
557
+ msgid "WooCommerce Extra Checkout Fields for Brazil depends on %s to work!"
558
+ msgstr ""
559
+
560
+ #: woocommerce-extra-checkout-fields-for-brazil.php:119
561
+ msgid "WooCommerce"
562
+ msgstr ""
563
+
564
+ #. Plugin Name of the plugin/theme
565
+ msgid "WooCommerce Extra Checkout Fields for Brazil"
566
+ msgstr ""
567
+
568
+ #. Plugin URI of the plugin/theme
569
+ msgid ""
570
+ "https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil"
571
+ msgstr ""
572
+
573
+ #. Description of the plugin/theme
574
+ msgid ""
575
+ "Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, "
576
+ "Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail "
577
+ "incorreto e auto preenchimento dos campos de endereço pelo CEP."
578
+ msgstr ""
579
+
580
+ #. Author of the plugin/theme
581
+ msgid "Claudio Sanches"
582
+ msgstr ""
583
+
584
+ #. Author URI of the plugin/theme
585
+ msgid "http://claudiosmweb.com/"
586
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WooCommerce Extra Checkout Fields for Brazil ===
2
+ Contributors: claudiosanches
3
+ Donate link: http://claudiosmweb.com/doacoes/
4
+ Tags: woocommerce, checkout, brazil, cpf, cpnj, rg, ie
5
+ Requires at least: 3.5
6
+ Tested up to: 4.3
7
+ Stable tag: 3.4.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Adds Brazilian checkout fields in WooCommerce
12
+
13
+ == Description ==
14
+
15
+ Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail incorreto e auto preenchimento dos campos de endereço pelo CEP.
16
+
17
+ É necessário estar utilizando uma versão do [WooCommerce](http://wordpress.org/extend/plugins/woocommerce/) para que o WooCommerce Extra Checkout Fields for Brazil funcione.
18
+
19
+ A partir da versão 3.1.0 é feita integração também com a [API](http://docs.woothemes.com/document/woocommerce-rest-api/) de pedidos e de clientes do WooCommerce.
20
+
21
+ = Compatibilidade =
22
+
23
+ Compatível com as versões 2.2.x, 2.3.x e 2.4.x do WooCommerce.
24
+
25
+ Funciona com os plugins:
26
+
27
+ * [WooCommerce Bcash](http://wordpress.org/extend/plugins/woocommerce-bcash/) (adiciona as informações de **número**, **CPF**, **Razão Social** e **CNPJ**)
28
+ * [WooCommerce Moip](http://wordpress.org/extend/plugins/woocommerce-moip/) (adiciona as informações de **bairro** e **número** e melhora o Checkout Transparente)
29
+ * [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/) (adiciona as informações de **bairro**, **CPF** e **número**)
30
+
31
+ = Dúvidas? =
32
+
33
+ Você pode esclarecer suas dúvidas usando:
34
+
35
+ * Utilizando o nosso [fórum no Github](https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil/issues).
36
+ * Criando um tópico no [fórum de ajuda do WordPress](https://wordpress.org/support/plugin/woocommerce-extra-checkout-fields-for-brazil).
37
+
38
+ = Créditos =
39
+
40
+ Foram utilizados os seguintes scripts/serviços de terceiros:
41
+
42
+ * [MailCheck jQuery](https://github.com/Kicksend/mailcheck).
43
+ * [Masked Input jQuery](https://github.com/digitalBush/jquery.maskedinput).
44
+ * [Correios RESTful API por Emerson Soares](http://correiosapi.apphb.com/).
45
+
46
+ = Coloborar =
47
+
48
+ Você pode contribuir com código-fonte em nossa página no [GitHub](https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil).
49
+
50
+ == Installation ==
51
+
52
+ * Upload plugin files to your plugins folder, or install using WordPress built-in Add New Plugin installer;
53
+ * Activate the plugin.
54
+
55
+ = Instalação e configuração em Português: =
56
+
57
+ * Envie os arquivos do plugin para a pasta wp-content/plugins ou usando o instalador de plugins do WordPress.
58
+ * Ative o plugin.
59
+
60
+ == Frequently Asked Questions ==
61
+
62
+ = Qual é a licença do plugin? =
63
+
64
+ * Este plugin esta licenciado como GPL.
65
+
66
+ = O que eu preciso para utilizar este plugin? =
67
+
68
+ * Ter instalado o plugin WooCommerce.
69
+
70
+ == Screenshots ==
71
+
72
+ 1. Página de Checkout
73
+ 2. Página de edição de endereço
74
+ 3. Página de dados do pedido
75
+ 4. Configurações do plugin
76
+ 5. Sugestão de e-mail
77
+
78
+ == Changelog ==
79
+
80
+ = 3.4.0 - 2015/08/18 =
81
+
82
+ * Adicionado suporte para WooCommerce 2.4.
83
+ * Removido suporte para WooCommerce 2.0 e 2.1.
84
+ * Corrigida integração com a API do WooCommerce quando é usado filtros para campos.
85
+
86
+ = 3.3.1 - 2014/10/13 =
87
+
88
+ * Corrigido o método de instalação e atualização do plugin.
89
+
90
+ = 3.3.0 - 2014/10/11 =
91
+
92
+ * Adicionada opção para não tornar os campos de Pessoa Física ou Jurídica obrigatórios quando o cliente é estrangeiro.
93
+ * Removida máscara numerica para o campo de RG. Alguns RG antigos possuem também letras.
94
+ * Corrigida a validação com javascript dos campos de Pessoa Física e Jurídica.
95
+
96
+ = 3.2.0 - 2014/09/07 =
97
+
98
+ * Melhorada a integração com o WooCommerce 2.2.
99
+ * Adicionada a exibição da nota do cliente na página de detalhes do pedido.
100
+
101
+ = 3.1.0 - 2014/09/07 =
102
+
103
+ * Adicionada integração com a API de pedidos e clientes do WooCommerce.
104
+
105
+ = 3.0.1 - 2014/08/25 =
106
+
107
+ * Corrigido o autopreenchimento de endereço por CEP quando esta ativada a opção "Habilitar caixas de seleção de país aprimoradas".
108
+
109
+ = 3.0.0 - 2014/07/06 =
110
+
111
+ * Adicionada opção para controlar os campos de "tipo de pessoa", agora é possível usar apenas como "pessoa física" ou apenas como "pessoa jurídica".
112
+ * Removido script para integrar com o WooCommerce PagSeguro, a partir da versão 2.5.0 do WooCommerce PagSeguro o suporte é feito direto, sem necessidade de código extra.
113
+ * Melhorado o script que faz preenchimento automático dos campos de endereço com base no CEP.
114
+
115
+ = 2.9.2 - 2014/05/24 =
116
+
117
+ * Adicionada informações sobre o método de pagamento (WooCommerce 2.1 ou superior).
118
+
119
+ = 2.9.1 - 2014/02/23 =
120
+
121
+ * Melhorada a máscara para telefone, agora aceita também o nono dígito.
122
+ * Melhorada a máscara do RG, agora não limita a quantidade de caracteres e aceita apenas números.
123
+
124
+ = 2.9.0 - 2014/02/13 =
125
+
126
+ * Correção do campo "tipo de pessoa" na página de edição do pedido no admin.
127
+ * Correção do carregamento das informações do cliente para pagamento e envio na tela de edição do pedido no admin.
128
+ * Melhoria na inicialização do plugin.
129
+ * Melhoria na compatibilidade com as novas versões do WooCommerce
130
+ * Adicionado campo de RG.
131
+ * Adicionado campo de Inscrição Estadual.
132
+
133
+ = 2.8.2 - 2014/01/05 =
134
+
135
+ * Correção da mensagem que avisa sobre a falta do WooCommerce na instalação.
136
+
137
+ = 2.8.1 - 2014/01/05 =
138
+
139
+ * Corrigido os ganchos e filtros da classe `Extra_Checkout_Fields_For_Brazil`.
140
+
141
+ = 2.8.0 - 2013/12/21 =
142
+
143
+ * Melhorada a compatibilidade com o WooCommerce 2.1.
144
+ * Correção nas traduções.
145
+ * Melhoria em todo o código PHP, JavaScript e CSS.
146
+
147
+ = 2.7.1 - 2013/09/06 =
148
+
149
+ * Adicionado suporte para a versão 2.1 do WooCommerce.
150
+ * Correção de standards de código.
151
+
152
+ = 2.7.0 - 2013/09/19 =
153
+
154
+ * Adicionado script para corrigir a posição do campo de CEP.
155
+ * Melhorado o script de auto preenchimento de endereço quando não existe opções de endereço de entrega.
156
+
157
+ = 2.6.1 - 2013/09/11 =
158
+
159
+ * Adicionada condição para não auto completar o endereço caso ele já esteja preenchido.
160
+
161
+ = 2.6.0 - 2013/09/11 =
162
+
163
+ * Adicionada nova api de busca de CEP: [Correios RESTful API](http://correiosapi.apphb.com/).
164
+ * Correção do erro causado ao buscar CEP utilizando HTTPS/SSL.
165
+
166
+ = 2.5.0 - 2013/08/30 =
167
+
168
+ * Melhoria no auto preenchimento de endereços. Agora preenche os dados ao carregar a janela.
169
+ * Adicionado suporte ao Chosen no auto preenchimento de endereços.
170
+
171
+ = 2.4.1 - 2013/08/19 =
172
+
173
+ * Melhorada a compatibilidade com o [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/).
174
+
175
+ = 2.4.0 - 2013/08/18 =
176
+
177
+ * Adicionado suporte ao [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/) 2.0.0.
178
+
179
+ = 2.3.0 - 2013/07/26 =
180
+
181
+ * Melhorada a integração com o [WooCommerce Bcash](http://wordpress.org/extend/plugins/woocommerce-bcash/).
182
+ * Melhorada a integração com o [WooCommerce Moip](http://wordpress.org/extend/plugins/woocommerce-moip/).
183
+ * Melhorada a integração com o [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/).
184
+ * Adicionada integração com o Checkout Transparente do [WooCommerce Moip](http://wordpress.org/extend/plugins/woocommerce-moip/).
185
+ * Corrigido um bug na validação de CPF e CNPJ.
186
+
187
+ = 2.2.0 - 2013/06/24 =
188
+
189
+ * Adicionado suporte para o WooCommerce 2.1 ou superior.
190
+ * Adicionada opção para validar CPF.
191
+ * Adicionada opção para validar CNPJ.
192
+ * Correçao da função que instala as opções padrões na instalação.
193
+ * Removido o método `shop_order_head` em favor da função `wp_localize_script`.
194
+ * Melhorada a tradução.
195
+
196
+ = 2.1.1 - 2013/04/26 =
197
+
198
+ * Correção da formatação de endereços para o WooCommerce 1.6.6 ou anterior.
199
+
200
+ = 2.1 - 2013/04/13 =
201
+
202
+ * Adicionada nova formatação de endereços (funciona para o WooCommerce 2.0.6 ou superior).
203
+
204
+ = 2.0.1 - 2013/04/01 =
205
+
206
+ * Correção da compatibilidade com o [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/).
207
+
208
+ = 2.0 - 2013/03/10 =
209
+
210
+ * Compatível com o WooCommerce 2.0.0 ou superior.
211
+ * Adicionado campo de **número**.
212
+ * Adicionada compatibilidade com o [WooCommerce PagSeguro](http://wordpress.org/extend/plugins/woocommerce-pagseguro/).
213
+ * Campo de **bairro** agora é nativo do plugin.
214
+ * Adicionado campos personalizados na página de edição do perfil do cliente.
215
+ * Correção da página de detalhes do pedido.
216
+
217
+ = 1.2.1 - 2012/12/10 =
218
+
219
+ * Corrigida a máscara do campo *Data de Nascimento*.
220
+
221
+ = 1.2 - 2012/12/10 =
222
+
223
+ * Adicionadas máscaras para campos de CEP.
224
+
225
+ = 1.1 =
226
+
227
+ * Trocado o Webservice de CEP da http://www.republicavirtual.com.br/ para http://www.toolsweb.com.br/.
228
+
229
+ = 1.0 =
230
+
231
+ * Primeira versão.
232
+
233
+ == Upgrade Notice ==
234
+
235
+ = 3.4.0 =
236
+
237
+ * Adicionado suporte para WooCommerce 2.4.
238
+ * Removido suporte para WooCommerce 2.0 e 2.1.
239
+ * Corrigida integração com a API do WooCommerce quando é usado filtros para campos.
240
+
241
+ == License ==
242
+
243
+ WooCommerce Extra Checkout Fields for Brazil is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
244
+
245
+ WooCommerce Extra Checkout Fields for Brazil is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
246
+
247
+ You should have received a copy of the GNU General Public License along with WooCommerce Extra Checkout Fields for Brazil. If not, see <http://www.gnu.org/licenses/>.
uninstall.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // If uninstall not called from WordPress exit.
3
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
+ exit();
5
+ }
6
+
7
+ delete_option( 'wcbcf_settings' );
8
+ delete_option( 'wcbcf_version' );
woocommerce-extra-checkout-fields-for-brazil.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: WooCommerce Extra Checkout Fields for Brazil
4
+ * Plugin URI: https://github.com/claudiosmweb/woocommerce-extra-checkout-fields-for-brazil
5
+ * Description: Adiciona novos campos para Pessoa Física ou Jurídica, Data de Nascimento, Sexo, Número, Bairro e Celular. Além de máscaras em campos, aviso de e-mail incorreto e auto preenchimento dos campos de endereço pelo CEP.
6
+ * Version: 3.4.0
7
+ * Author: Claudio Sanches
8
+ * Author URI: http://claudiosmweb.com/
9
+ * Text Domain: woocommerce-extra-checkout-fields-for-brazil
10
+ * License: GPL-2.0+
11
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12
+ * Domain Path: /languages
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ if ( ! class_exists( 'Extra_Checkout_Fields_For_Brazil' ) ) :
21
+
22
+ /**
23
+ * Plugin main class.
24
+ */
25
+ class Extra_Checkout_Fields_For_Brazil {
26
+
27
+ /**
28
+ * Plugin version.
29
+ *
30
+ * @var string
31
+ */
32
+ const VERSION = '3.4.0';
33
+
34
+ /**
35
+ * Instance of this class.
36
+ *
37
+ * @var object
38
+ */
39
+ protected static $instance = null;
40
+
41
+ /**
42
+ * Initialize the plugin.
43
+ *
44
+ */
45
+ private function __construct() {
46
+ // Load plugin text domain.
47
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
48
+
49
+ if ( class_exists( 'WooCommerce' ) ) {
50
+ if ( is_admin() ) {
51
+ $this->admin_includes();
52
+ }
53
+
54
+ $this->includes();
55
+ } else {
56
+ add_action( 'admin_notices', array( $this, 'woocommerce_fallback_notice' ) );
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Return an instance of this class.
62
+ *
63
+ * @return object A single instance of this class.
64
+ */
65
+ public static function get_instance() {
66
+ // If the single instance hasn't been set, set it now.
67
+ if ( null == self::$instance ) {
68
+ self::$instance = new self;
69
+ }
70
+
71
+ return self::$instance;
72
+ }
73
+
74
+ /**
75
+ * Get assets url.
76
+ *
77
+ * @return string
78
+ */
79
+ public static function get_assets_url() {
80
+ return plugins_url( 'assets/', __FILE__ );
81
+ }
82
+
83
+ /**
84
+ * Load the plugin text domain for translation.
85
+ */
86
+ public function load_plugin_textdomain() {
87
+ $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-extra-checkout-fields-for-brazil' );
88
+
89
+ load_textdomain( 'woocommerce-extra-checkout-fields-for-brazil', trailingslashit( WP_LANG_DIR ) . 'woocommerce-extra-checkout-fields-for-brazil/woocommerce-extra-checkout-fields-for-brazil-' . $locale . '.mo' );
90
+ load_plugin_textdomain( 'woocommerce-extra-checkout-fields-for-brazil', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
91
+ }
92
+
93
+ /**
94
+ * Includes.
95
+ */
96
+ private function includes() {
97
+ include_once 'includes/class-wc-ecfb-formatting.php';
98
+ include_once 'includes/class-wc-ecfb-front-end.php';
99
+ include_once 'includes/class-wc-ecfb-plugins-support.php';
100
+ include_once 'includes/class-wc-ecfb-api.php';
101
+ }
102
+
103
+ /**
104
+ * Admin includes.
105
+ */
106
+ private function admin_includes() {
107
+ include_once 'includes/admin/class-wc-ecfb-admin.php';
108
+ include_once 'includes/admin/class-wc-ecfb-settings.php';
109
+ include_once 'includes/admin/class-wc-ecfb-order.php';
110
+ include_once 'includes/admin/class-wc-ecfb-customer.php';
111
+ }
112
+
113
+ /**
114
+ * WooCommerce fallback notice.
115
+ *
116
+ * @return string Fallack notice.
117
+ */
118
+ public function woocommerce_fallback_notice() {
119
+ echo '<div class="error"><p>' . sprintf( __( 'WooCommerce Extra Checkout Fields for Brazil depends on %s to work!', 'woocommerce-extra-checkout-fields-for-brazil' ), '<a href="http://wordpress.org/extend/plugins/woocommerce/">' . __( 'WooCommerce', 'woocommerce-extra-checkout-fields-for-brazil' ) . '</a>' ) . '</p></div>';
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Initialize the plugin.
125
+ */
126
+ add_action( 'plugins_loaded', array( 'Extra_Checkout_Fields_For_Brazil', 'get_instance' ) );
127
+
128
+ endif;