Meta Box - Version 5.6.3

Version Description

  • 2022-04-18 =
  • Improve Google Maps search, allowing to search by place names
  • Fix incorrect the label ID for subfield in groups
  • Fix validation not working when a cloneable group collapse
  • Improve license key check
Download this release

Release Info

Developer rilwis
Plugin Icon 128x128 Meta Box
Version 5.6.3
Comparing to
See all releases

Code changes from version 5.6.2 to 5.6.3

inc/field.php CHANGED
@@ -93,12 +93,13 @@ abstract class RWMB_Field {
93
  public static function begin_html( $meta, $field ) {
94
  $field_label = '';
95
  if ( $field['name'] ) {
 
96
  $field_label = sprintf(
97
  '<div class="rwmb-label">
98
  <label for="%s">%s%s</label>
99
  %s
100
  </div>',
101
- esc_attr( $field['id'] ),
102
  $field['name'],
103
  $field['required'] || ! empty( $field['attributes']['required'] ) ? '<span class="rwmb-required">*</span>' : '',
104
  self::label_description( $field )
93
  public static function begin_html( $meta, $field ) {
94
  $field_label = '';
95
  if ( $field['name'] ) {
96
+ // Change "for" attribute in label
97
  $field_label = sprintf(
98
  '<div class="rwmb-label">
99
  <label for="%s">%s%s</label>
100
  %s
101
  </div>',
102
+ ( isset( $field['attributes']['id'] ) ) ? esc_attr( $field['attributes']['id'] ) : esc_attr( $field['id'] ),
103
  $field['name'],
104
  $field['required'] || ! empty( $field['attributes']['required'] ) ? '<span class="rwmb-required">*</span>' : '',
105
  self::label_description( $field )
inc/fields/map.php CHANGED
@@ -27,6 +27,7 @@ class RWMB_Map_Field extends RWMB_Field {
27
  array(
28
  'key' => $field['api_key'],
29
  'language' => $field['language'],
 
30
  ),
31
  'https://maps.google.com/maps/api/js'
32
  );
27
  array(
28
  'key' => $field['api_key'],
29
  'language' => $field['language'],
30
+ 'libraries' => 'places'
31
  ),
32
  'https://maps.google.com/maps/api/js'
33
  );
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
- define( 'RWMB_VER', '5.6.2' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
+ define( 'RWMB_VER', '5.6.3' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
inc/update/checker.php CHANGED
@@ -198,30 +198,9 @@ class RWMB_Update_Checker {
198
  );
199
  $args = array_filter( $args );
200
 
201
- $cache_key = 'meta_box_' . md5( serialize( $args ) );
202
- if ( $this->option->is_network_activated() ) {
203
- $cache = get_site_transient( $cache_key );
204
- } else {
205
- $cache = get_transient( $cache_key );
206
- }
207
- if ( $cache ) {
208
- return $cache;
209
- }
210
-
211
- $request = wp_remote_post(
212
- $this->api_url,
213
- array(
214
- 'body' => $args,
215
- )
216
- );
217
-
218
  $response = wp_remote_retrieve_body( $request );
219
  $response = $response ? @unserialize( $response ) : false;
220
- if ( $this->option->is_network_activated() ) {
221
- set_site_transient( $cache_key, $response, DAY_IN_SECONDS );
222
- } else {
223
- set_transient( $cache_key, $response, DAY_IN_SECONDS );
224
- }
225
 
226
  return $response;
227
  }
198
  );
199
  $args = array_filter( $args );
200
 
201
+ $request = wp_remote_get( add_query_arg( $args, $this->api_url ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  $response = wp_remote_retrieve_body( $request );
203
  $response = $response ? @unserialize( $response ) : false;
 
 
 
 
 
204
 
205
  return $response;
206
  }
inc/update/settings.php CHANGED
@@ -109,20 +109,17 @@ class RWMB_Update_Settings {
109
  <td>
110
  <?php
111
  $messages = array(
112
- // Translators: %1$s - URL to the pricing page.
113
- 'invalid' => __( 'Your license key is <b>invalid</b>. Please update your license key or <a href="%1$s" target="_blank">get a new one here</a>.', 'meta-box' ),
114
- // Translators: %1$s - URL to the pricing page.
115
- 'error' => __( 'Your license key is <b>invalid</b>. Please update your license key or <a href="%1$s" target="_blank">get a new one here</a>.', 'meta-box' ),
116
- // Translators: %2$s - URL to the My Account page.
117
- 'expired' => __( 'Your license key is <b>expired</b>. Please <a href="%2$s" target="_blank">renew your license</a>.', 'meta-box' ),
118
- 'active' => __( 'Your license key is <b>active</b>.', 'meta-box' ),
119
  );
120
  $status = $this->option->get_license_status();
121
- $api_key = in_array( $status, array( 'expired', 'active' ), true ) ? '********************************' : $this->option->get( 'api_key' );
122
  ?>
123
  <input class="regular-text" name="meta_box_updater[api_key]" value="<?php echo esc_attr( $api_key ); ?>" type="password">
124
  <?php if ( isset( $messages[ $status ] ) ) : ?>
125
- <p class="description"><?php echo wp_kses_post( sprintf( $messages[ $status ], 'https://metabox.io/pricing/', 'https://metabox.io/my-account/' ) ); ?></p>
126
  <?php endif; ?>
127
  </td>
128
  </tr>
109
  <td>
110
  <?php
111
  $messages = array(
112
+ 'invalid' => __( 'Your license key is <b style="color: #d63638">invalid</b>.', 'meta-box' ),
113
+ 'error' => __( 'Your license key is <b style="color: #d63638">invalid</b>.', 'meta-box' ),
114
+ 'expired' => __( 'Your license key is <b style="color: #d63638">expired</b>.', 'meta-box' ),
115
+ 'active' => __( 'Your license key is <b style="color: #00a32a">active</b>.', 'meta-box' ),
 
 
 
116
  );
117
  $status = $this->option->get_license_status();
118
+ $api_key = $this->option->get( 'api_key' );
119
  ?>
120
  <input class="regular-text" name="meta_box_updater[api_key]" value="<?php echo esc_attr( $api_key ); ?>" type="password">
121
  <?php if ( isset( $messages[ $status ] ) ) : ?>
122
+ <p class="description"><?php echo wp_kses_post( $messages[ $status ] ); ?></p>
123
  <?php endif; ?>
124
  </td>
125
  </tr>
js/map.js CHANGED
@@ -8,7 +8,8 @@
8
 
9
  // Geocoder service.
10
  var geocoder = new google.maps.Geocoder();
11
-
 
12
  // Use prototype for better performance
13
  MapField.prototype = {
14
  // Initialize everything
@@ -139,12 +140,14 @@
139
 
140
  $address.autocomplete( {
141
  source: function ( request, response ) {
 
142
  var options = {
143
- 'address': request.term,
144
- 'region': that.$canvas.data( 'region' )
145
  };
146
- geocoder.geocode( options, function ( results ) {
147
- if ( ! results.length ) {
 
148
  response( [ {
149
  value: '',
150
  label: i18n.no_results_string
@@ -153,19 +156,25 @@
153
  }
154
  response( results.map( function ( item ) {
155
  return {
156
- label: item.formatted_address,
157
- value: item.formatted_address,
158
- latitude: item.geometry.location.lat(),
159
- longitude: item.geometry.location.lng()
160
  };
161
  } ) );
162
  } );
163
  },
164
  select: function ( event, ui ) {
165
- var latLng = new google.maps.LatLng( ui.item.latitude, ui.item.longitude );
166
- that.map.setCenter( latLng );
167
- that.marker.setPosition( latLng );
168
- that.updateCoordinate( latLng );
 
 
 
 
 
 
 
169
  }
170
  } );
171
  },
8
 
9
  // Geocoder service.
10
  var geocoder = new google.maps.Geocoder();
11
+ // Autocomplete Service.
12
+ var autocomplete = new google.maps.places.AutocompleteService();
13
  // Use prototype for better performance
14
  MapField.prototype = {
15
  // Initialize everything
140
 
141
  $address.autocomplete( {
142
  source: function ( request, response ) {
143
+ // if add region only search in that region
144
  var options = {
145
+ 'input': request.term,
146
+ 'componentRestrictions': { country: that.$canvas.data( 'region' ) }
147
  };
148
+ // Change Geocode to getPlacePredictions .
149
+ autocomplete.getPlacePredictions( options, function ( results ) {
150
+ if ( results == null || ! results.length ) {
151
  response( [ {
152
  value: '',
153
  label: i18n.no_results_string
156
  }
157
  response( results.map( function ( item ) {
158
  return {
159
+ label: item.description,
160
+ value: item.description,
161
+ placeid: item.place_id,
 
162
  };
163
  } ) );
164
  } );
165
  },
166
  select: function ( event, ui ) {
167
+ geocoder.geocode( {
168
+ 'placeId': ui.item.placeid
169
+ },
170
+ function( responses, status ) {
171
+ if ( status == 'OK' ) {
172
+ var latLng = new google.maps.LatLng( responses[0].geometry.location.lat(), responses[0].geometry.location.lng() );
173
+ that.map.setCenter( latLng );
174
+ that.marker.setPosition( latLng );
175
+ that.updateCoordinate( latLng );
176
+ }
177
+ } );
178
  }
179
  } );
180
  },
js/validation.min.js CHANGED
@@ -15,4 +15,4 @@ function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof S
15
  * Copyright (c) 2019 Jörn Zaefferer
16
  * Released under the MIT license
17
  */
18
- function(t){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}((function(t){return function(){function e(t){return t.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}t.validator.addMethod("maxWords",(function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length<=a}),t.validator.format("Please enter {0} words or less.")),t.validator.addMethod("minWords",(function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length>=a}),t.validator.format("Please enter at least {0} words.")),t.validator.addMethod("rangeWords",(function(t,i,a){var r=e(t),n=/\b\w+\b/g;return this.optional(i)||r.match(n).length>=a[0]&&r.match(n).length<=a[1]}),t.validator.format("Please enter between {0} and {1} words."))}(),t.validator.addMethod("abaRoutingNumber",(function(t){var e=0,i=t.split(""),a=i.length;if(9!==a)return!1;for(var r=0;r<a;r+=3)e+=3*parseInt(i[r],10)+7*parseInt(i[r+1],10)+parseInt(i[r+2],10);return 0!==e&&e%10==0}),"Please enter a valid routing number."),t.validator.addMethod("accept",(function(e,i,a){var r,n,s="string"==typeof a?a.replace(/\s/g,""):"image/*",o=this.optional(i);if(o)return o;if("file"===t(i).attr("type")&&(s=s.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),i.files&&i.files.length))for(n=new RegExp(".?("+s+")$","i"),r=0;r<i.files.length;r++)if(!i.files[r].type.match(n))return!1;return!0}),t.validator.format("Please enter a value with a valid mimetype.")),t.validator.addMethod("alphanumeric",(function(t,e){return this.optional(e)||/^\w+$/i.test(t)}),"Letters, numbers, and underscores only please"),t.validator.addMethod("bankaccountNL",(function(t,e){if(this.optional(e))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(t))return!1;var i,a=t.replace(/ /g,""),r=0,n=a.length;for(i=0;i<n;i++)r+=(n-i)*a.substring(i,i+1);return r%11==0}),"Please specify a valid bank account number"),t.validator.addMethod("bankorgiroaccountNL",(function(e,i){return this.optional(i)||t.validator.methods.bankaccountNL.call(this,e,i)||t.validator.methods.giroaccountNL.call(this,e,i)}),"Please specify a valid bank or giro account number"),t.validator.addMethod("bic",(function(t,e){return this.optional(e)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(t.toUpperCase())}),"Please specify a valid BIC code"),t.validator.addMethod("cifES",(function(t,e){"use strict";if(this.optional(e))return!0;var i,a,r,n,s=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),o=t.substring(0,1),d=t.substring(1,8),l=t.substring(8,9),u=0,h=0;function c(t){return t%2==0}if(9!==t.length||!s.test(t))return!1;for(i=0;i<d.length;i++)a=parseInt(d[i],10),c(i)?h+=(a*=2)<10?a:a-9:u+=a;return r=(10-(u+h).toString().substr(-1)).toString(),r=parseInt(r,10)>9?"0":r,n="JABCDEFGHI".substr(r,1).toString(),o.match(/[ABEH]/)?l===r:o.match(/[KPQS]/)?l===n:l===r||l===n}),"Please specify a valid CIF number."),t.validator.addMethod("cnhBR",(function(t){if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var e,i,a,r,n,s=0,o=0;if(e=t.charAt(0),new Array(12).join(e)===t)return!1;for(r=0,n=9,0;r<9;++r,--n)s+=+t.charAt(r)*n;for((i=s%11)>=10&&(i=0,o=2),s=0,r=0,n=1,0;r<9;++r,++n)s+=+t.charAt(r)*n;return(a=s%11)>=10?a=0:a-=o,String(i).concat(a)===t.substr(-2)}),"Please specify a valid CNH number"),t.validator.addMethod("cnpjBR",(function(t,e){"use strict";if(this.optional(e))return!0;if(14!==(t=t.replace(/[^\d]+/g,"")).length)return!1;if("00000000000000"===t||"11111111111111"===t||"22222222222222"===t||"33333333333333"===t||"44444444444444"===t||"55555555555555"===t||"66666666666666"===t||"77777777777777"===t||"88888888888888"===t||"99999999999999"===t)return!1;for(var i=t.length-2,a=t.substring(0,i),r=t.substring(i),n=0,s=i-7,o=i;o>=1;o--)n+=a.charAt(i-o)*s--,s<2&&(s=9);var d=n%11<2?0:11-n%11;if(d!==parseInt(r.charAt(0),10))return!1;i+=1,a=t.substring(0,i),n=0,s=i-7;for(var l=i;l>=1;l--)n+=a.charAt(i-l)*s--,s<2&&(s=9);return(d=n%11<2?0:11-n%11)===parseInt(r.charAt(1),10)}),"Please specify a CNPJ value number"),t.validator.addMethod("cpfBR",(function(t,e){"use strict";if(this.optional(e))return!0;if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var i,a,r,n,s=0;if(i=parseInt(t.substring(9,10),10),a=parseInt(t.substring(10,11),10),r=function(t,e){var i=10*t%11;return 10!==i&&11!==i||(i=0),i===e},""===t||"00000000000"===t||"11111111111"===t||"22222222222"===t||"33333333333"===t||"44444444444"===t||"55555555555"===t||"66666666666"===t||"77777777777"===t||"88888888888"===t||"99999999999"===t)return!1;for(n=1;n<=9;n++)s+=parseInt(t.substring(n-1,n),10)*(11-n);if(r(s,i)){for(s=0,n=1;n<=10;n++)s+=parseInt(t.substring(n-1,n),10)*(12-n);return r(s,a)}return!1}),"Please specify a valid CPF number"),t.validator.addMethod("creditcard",(function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i,a,r=0,n=0,s=!1;if((t=t.replace(/\D/g,"")).length<13||t.length>19)return!1;for(i=t.length-1;i>=0;i--)a=t.charAt(i),n=parseInt(a,10),s&&(n*=2)>9&&(n-=9),r+=n,s=!s;return r%10==0}),"Please enter a valid credit card number."),t.validator.addMethod("creditcardtypes",(function(t,e,i){if(/[^0-9\-]+/.test(t))return!1;t=t.replace(/\D/g,"");var a=0;return i.mastercard&&(a|=1),i.visa&&(a|=2),i.amex&&(a|=4),i.dinersclub&&(a|=8),i.enroute&&(a|=16),i.discover&&(a|=32),i.jcb&&(a|=64),i.unknown&&(a|=128),i.all&&(a=255),1&a&&(/^(5[12345])/.test(t)||/^(2[234567])/.test(t))||2&a&&/^(4)/.test(t)?16===t.length:4&a&&/^(3[47])/.test(t)?15===t.length:8&a&&/^(3(0[012345]|[68]))/.test(t)?14===t.length:16&a&&/^(2(014|149))/.test(t)?15===t.length:32&a&&/^(6011)/.test(t)||64&a&&/^(3)/.test(t)?16===t.length:64&a&&/^(2131|1800)/.test(t)?15===t.length:!!(128&a)}),"Please enter a valid credit card number."),t.validator.addMethod("currency",(function(t,e,i){var a,r="string"==typeof i,n=r?i:i[0],s=!!r||i[1];return n=n.replace(/,/g,""),a="^["+(n=s?n+"]":n+"]?")+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",a=new RegExp(a),this.optional(e)||a.test(t)}),"Please specify a valid currency"),t.validator.addMethod("dateFA",(function(t,e){return this.optional(e)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(t)}),t.validator.messages.date),t.validator.addMethod("dateITA",(function(t,e){var i,a,r,n,s,o=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(t)?(i=t.split("/"),a=parseInt(i[0],10),r=parseInt(i[1],10),n=parseInt(i[2],10),o=(s=new Date(Date.UTC(n,r-1,a,12,0,0,0))).getUTCFullYear()===n&&s.getUTCMonth()===r-1&&s.getUTCDate()===a):o=!1,this.optional(e)||o}),t.validator.messages.date),t.validator.addMethod("dateNL",(function(t,e){return this.optional(e)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(t)}),t.validator.messages.date),t.validator.addMethod("extension",(function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(new RegExp("\\.("+i+")$","i"))}),t.validator.format("Please enter a value with a valid extension.")),t.validator.addMethod("giroaccountNL",(function(t,e){return this.optional(e)||/^[0-9]{1,7}$/.test(t)}),"Please specify a valid giro account number"),t.validator.addMethod("greaterThan",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-greaterThan-blur").length&&r.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",(function(){t(i).valid()})),e>r.val()}),"Please enter a greater value."),t.validator.addMethod("greaterThanEqual",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-greaterThanEqual-blur").length&&r.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",(function(){t(i).valid()})),e>=r.val()}),"Please enter a greater value."),t.validator.addMethod("iban",(function(t,e){if(this.optional(e))return!0;var i,a,r,n,s,o=t.replace(/ /g,"").toUpperCase(),d="",l=!0,u="";if(o.length<5)return!1;if(void 0!==(r={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"}[o.substring(0,2)])&&!new RegExp("^[A-Z]{2}\\d{2}"+r+"$","").test(o))return!1;for(i=o.substring(4,o.length)+o.substring(0,4),n=0;n<i.length;n++)"0"!==(a=i.charAt(n))&&(l=!1),l||(d+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a));for(s=0;s<d.length;s++)u=(""+u+d.charAt(s))%97;return 1===u}),"Please specify a valid IBAN"),t.validator.addMethod("integer",(function(t,e){return this.optional(e)||/^-?\d+$/.test(t)}),"A positive or negative non-decimal number please"),t.validator.addMethod("ipv4",(function(t,e){return this.optional(e)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(t)}),"Please enter a valid IP v4 address."),t.validator.addMethod("ipv6",(function(t,e){return this.optional(e)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(t)}),"Please enter a valid IP v6 address."),t.validator.addMethod("lessThan",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-lessThan-blur").length&&r.addClass("validate-lessThan-blur").on("blur.validate-lessThan",(function(){t(i).valid()})),e<r.val()}),"Please enter a lesser value."),t.validator.addMethod("lessThanEqual",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-lessThanEqual-blur").length&&r.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",(function(){t(i).valid()})),e<=r.val()}),"Please enter a lesser value."),t.validator.addMethod("lettersonly",(function(t,e){return this.optional(e)||/^[a-z]+$/i.test(t)}),"Letters only please"),t.validator.addMethod("letterswithbasicpunc",(function(t,e){return this.optional(e)||/^[a-z\-.,()'"\s]+$/i.test(t)}),"Letters or punctuation only please"),t.validator.addMethod("maxfiles",(function(e,i,a){return!!this.optional(i)||!("file"===t(i).attr("type")&&i.files&&i.files.length>a)}),t.validator.format("Please select no more than {0} files.")),t.validator.addMethod("maxsize",(function(e,i,a){if(this.optional(i))return!0;if("file"===t(i).attr("type")&&i.files&&i.files.length)for(var r=0;r<i.files.length;r++)if(i.files[r].size>a)return!1;return!0}),t.validator.format("File size must not exceed {0} bytes each.")),t.validator.addMethod("maxsizetotal",(function(e,i,a){if(this.optional(i))return!0;if("file"===t(i).attr("type")&&i.files&&i.files.length)for(var r=0,n=0;n<i.files.length;n++)if((r+=i.files[n].size)>a)return!1;return!0}),t.validator.format("Total size of all files must not exceed {0} bytes.")),t.validator.addMethod("mobileNL",(function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(t)}),"Please specify a valid mobile number"),t.validator.addMethod("mobileRU",(function(t,e){var i=t.replace(/\(|\)|\s+|-/g,"");return this.optional(e)||i.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(i)}),"Please specify a valid mobile number"),t.validator.addMethod("mobileUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)}),"Please specify a valid mobile number"),t.validator.addMethod("netmask",(function(t,e){return this.optional(e)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(t)}),"Please enter a valid netmask."),t.validator.addMethod("nieES",(function(t,e){"use strict";if(this.optional(e))return!0;var i,a=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),r=t.substr(t.length-1).toUpperCase();return!((t=t.toString().toUpperCase()).length>10||t.length<9||!a.test(t))&&(i=9===(t=t.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2")).length?t.substr(0,8):t.substr(0,9),"TRWAGMYFPDXBNJZSQVHLCKET".charAt(parseInt(i,10)%23)===r)}),"Please specify a valid NIE number."),t.validator.addMethod("nifES",(function(t,e){"use strict";return!!this.optional(e)||!!(t=t.toUpperCase()).match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(t)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,0)%23)===t.charAt(8):!!/^[KLM]{1}/.test(t)&&t[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,1)%23))}),"Please specify a valid NIF number."),t.validator.addMethod("nipPL",(function(t){"use strict";if(10!==(t=t.replace(/[^0-9]/g,"")).length)return!1;for(var e=[6,5,7,2,3,4,5,6,7],i=0,a=0;a<9;a++)i+=e[a]*t[a];var r=i%11;return(10===r?0:r)===parseInt(t[9],10)}),"Please specify a valid NIP number."),t.validator.addMethod("nisBR",(function(t){var e,i,a,r,n,s=0;if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;for(i=parseInt(t.substring(10,11),10),e=parseInt(t.substring(0,10),10),r=2;r<12;r++)n=r,10===r&&(n=2),11===r&&(n=3),s+=e%10*n,e=parseInt(e/10,10);return i===(a=(a=s%11)>1?11-a:0)}),"Please specify a valid NIS/PIS number"),t.validator.addMethod("notEqualTo",(function(e,i,a){return this.optional(i)||!t.validator.methods.equalTo.call(this,e,i,a)}),"Please enter a different value, values must not be the same."),t.validator.addMethod("nowhitespace",(function(t,e){return this.optional(e)||/^\S+$/i.test(t)}),"No white space please"),t.validator.addMethod("pattern",(function(t,e,i){return!!this.optional(e)||("string"==typeof i&&(i=new RegExp("^(?:"+i+")$")),i.test(t))}),"Invalid format."),t.validator.addMethod("phoneNL",(function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(t)}),"Please specify a valid phone number."),t.validator.addMethod("phonePL",(function(t,e){t=t.replace(/\s+/g,"");return this.optional(e)||/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/.test(t)}),"Please specify a valid phone number"),t.validator.addMethod("phonesUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)}),"Please specify a valid uk phone number"),t.validator.addMethod("phoneUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)}),"Please specify a valid phone number"),t.validator.addMethod("phoneUS",(function(t,e){return t=t.replace(/\s+/g,""),this.optional(e)||t.length>9&&t.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)}),"Please specify a valid phone number"),t.validator.addMethod("postalcodeBR",(function(t,e){return this.optional(e)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(t)}),"Informe um CEP válido."),t.validator.addMethod("postalCodeCA",(function(t,e){return this.optional(e)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postalcodeIT",(function(t,e){return this.optional(e)||/^\d{5}$/.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postalcodeNL",(function(t,e){return this.optional(e)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postcodeUK",(function(t,e){return this.optional(e)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(t)}),"Please specify a valid UK postcode"),t.validator.addMethod("require_from_group",(function(e,i,a){var r=t(a[1],i.form),n=r.eq(0),s=n.data("valid_req_grp")?n.data("valid_req_grp"):t.extend({},this),o=r.filter((function(){return s.elementValue(this)})).length>=a[0];return n.data("valid_req_grp",s),t(i).data("being_validated")||(r.data("being_validated",!0),r.each((function(){s.element(this)})),r.data("being_validated",!1)),o}),t.validator.format("Please fill at least {0} of these fields.")),t.validator.addMethod("skip_or_fill_minimum",(function(e,i,a){var r=t(a[1],i.form),n=r.eq(0),s=n.data("valid_skip")?n.data("valid_skip"):t.extend({},this),o=r.filter((function(){return s.elementValue(this)})).length,d=0===o||o>=a[0];return n.data("valid_skip",s),t(i).data("being_validated")||(r.data("being_validated",!0),r.each((function(){s.element(this)})),r.data("being_validated",!1)),d}),t.validator.format("Please either skip these fields or fill at least {0} of them.")),t.validator.addMethod("stateUS",(function(t,e,i){var a,r=void 0===i,n=!r&&void 0!==i.caseSensitive&&i.caseSensitive,s=!r&&void 0!==i.includeTerritories&&i.includeTerritories,o=!r&&void 0!==i.includeMilitary&&i.includeMilitary;return a=s||o?s&&o?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":s?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",a=n?new RegExp(a):new RegExp(a,"i"),this.optional(e)||a.test(t)}),"Please specify a valid state"),t.validator.addMethod("strippedminlength",(function(e,i,a){return t(e).text().length>=a}),t.validator.format("Please enter at least {0} characters")),t.validator.addMethod("time",(function(t,e){return this.optional(e)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(t)}),"Please enter a valid time, between 00:00 and 23:59"),t.validator.addMethod("time12h",(function(t,e){return this.optional(e)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(t)}),"Please enter a valid time in 12-hour am/pm format"),t.validator.addMethod("url2",(function(t,e){return this.optional(e)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)}),t.validator.messages.url),t.validator.addMethod("vinUS",(function(t){if(17!==t.length)return!1;var e,i,a,r,n,s,o=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],d=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],l=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],u=0;for(e=0;e<17;e++){if(r=l[e],a=t.slice(e,e+1),8===e&&(s=a),isNaN(a)){for(i=0;i<o.length;i++)if(a.toUpperCase()===o[i]){a=d[i],a*=r,isNaN(s)&&8===i&&(s=o[i]);break}}else a*=r;u+=a}return 10===(n=u%11)&&(n="X"),n===s}),"The specified vehicle identification number (VIN) is invalid."),t.validator.addMethod("zipcodeUS",(function(t,e){return this.optional(e)||/^\d{5}(-\d{4})?$/.test(t)}),"The specified US ZIP Code is invalid"),t.validator.addMethod("ziprange",(function(t,e){return this.optional(e)||/^90[2-5]\d\{2\}-\d{4}$/.test(t)}),"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx"),t})),function(t,e,i){"use strict";var a=function(){function e(i){_classCallCheck(this,e),this.$form=t(i),this.validationElements=this.$form.find(".rwmb-validation"),this.showAsterisks(),this.getSettings()}return _createClass(e,[{key:"init",value:function(){this.$form.on("submit",(function(){"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave()})).validate(this.settings)}},{key:"showAsterisks",value:function(){this.validationElements.each((function(){var e=t(this).data("validation");t.each(e.rules,(function(e,i){if(i.required){var a=t('[name="'+e+'"]');a.length&&a.closest(".rwmb-input").siblings(".rwmb-label").find("label").append('<span class="rwmb-required">*</span>')}}))}))}},{key:"getSettings",value:function(){this.settings={ignore:':not(.rwmb-media,.rwmb-image_select,.rwmb-wysiwyg,.rwmb-color,.rwmb-map,.rwmb-osm,.rwmb-switch,[class|="rwmb"]:visible)',errorPlacement:function(t,e){t.appendTo(e.closest(".rwmb-input"))},errorClass:"rwmb-error",errorElement:"p",invalidHandler:this.invalidHandler.bind(this)};var e=this;this.validationElements.each((function(){t.extend(!0,e.settings,t(this).data("validation"))}))}},{key:"invalidHandler",value:function(){this.showMessage();var t=this;setTimeout((function(){t.$form.trigger("after_validate")}),200)}},{key:"showMessage",value:function(){t("#publish").removeClass("button-primary-disabled"),t("#ajax-loading").attr("style",""),t("#rwmb-validation-message").remove(),this.$form.before('<div id="rwmb-validation-message" class="notice notice-error is-dismissible"><p>'+i.message+"</p></div>")}}]),e}(),r=function(t){_inherits(a,t);var e=_createSuper(a);function a(){return _classCallCheck(this,a),e.apply(this,arguments)}return _createClass(a,[{key:"init",value:function(){var t=this,e=wp.data.dispatch("core/editor"),i=e.savePost;e.savePost=function(e){"object"===_typeof(e)&&e.isPreview?i(e):(t.$form.validate(t.settings),t.$form.valid()&&i(e))}}},{key:"showMessage",value:function(){wp.data.dispatch("core/notices").createErrorNotice(i.message,{id:"meta-box-validation",isDismissible:!0})}}]),a}(a);t((function(){if(e.isGutenberg){var i=new r(".metabox-location-advanced"),n=new r(".metabox-location-normal");return new r(".metabox-location-side").init(),n.init(),void i.init()}t("#post, #edittag, #your-profile, .rwmb-form").each((function(){new a(this).init()}))}))}(jQuery,rwmb,rwmbValidation);
15
  * Copyright (c) 2019 Jörn Zaefferer
16
  * Released under the MIT license
17
  */
18
+ function(t){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}((function(t){return function(){function e(t){return t.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}t.validator.addMethod("maxWords",(function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length<=a}),t.validator.format("Please enter {0} words or less.")),t.validator.addMethod("minWords",(function(t,i,a){return this.optional(i)||e(t).match(/\b\w+\b/g).length>=a}),t.validator.format("Please enter at least {0} words.")),t.validator.addMethod("rangeWords",(function(t,i,a){var r=e(t),n=/\b\w+\b/g;return this.optional(i)||r.match(n).length>=a[0]&&r.match(n).length<=a[1]}),t.validator.format("Please enter between {0} and {1} words."))}(),t.validator.addMethod("abaRoutingNumber",(function(t){var e=0,i=t.split(""),a=i.length;if(9!==a)return!1;for(var r=0;r<a;r+=3)e+=3*parseInt(i[r],10)+7*parseInt(i[r+1],10)+parseInt(i[r+2],10);return 0!==e&&e%10==0}),"Please enter a valid routing number."),t.validator.addMethod("accept",(function(e,i,a){var r,n,s="string"==typeof a?a.replace(/\s/g,""):"image/*",o=this.optional(i);if(o)return o;if("file"===t(i).attr("type")&&(s=s.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),i.files&&i.files.length))for(n=new RegExp(".?("+s+")$","i"),r=0;r<i.files.length;r++)if(!i.files[r].type.match(n))return!1;return!0}),t.validator.format("Please enter a value with a valid mimetype.")),t.validator.addMethod("alphanumeric",(function(t,e){return this.optional(e)||/^\w+$/i.test(t)}),"Letters, numbers, and underscores only please"),t.validator.addMethod("bankaccountNL",(function(t,e){if(this.optional(e))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(t))return!1;var i,a=t.replace(/ /g,""),r=0,n=a.length;for(i=0;i<n;i++)r+=(n-i)*a.substring(i,i+1);return r%11==0}),"Please specify a valid bank account number"),t.validator.addMethod("bankorgiroaccountNL",(function(e,i){return this.optional(i)||t.validator.methods.bankaccountNL.call(this,e,i)||t.validator.methods.giroaccountNL.call(this,e,i)}),"Please specify a valid bank or giro account number"),t.validator.addMethod("bic",(function(t,e){return this.optional(e)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(t.toUpperCase())}),"Please specify a valid BIC code"),t.validator.addMethod("cifES",(function(t,e){"use strict";if(this.optional(e))return!0;var i,a,r,n,s=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),o=t.substring(0,1),d=t.substring(1,8),l=t.substring(8,9),u=0,h=0;function c(t){return t%2==0}if(9!==t.length||!s.test(t))return!1;for(i=0;i<d.length;i++)a=parseInt(d[i],10),c(i)?h+=(a*=2)<10?a:a-9:u+=a;return r=(10-(u+h).toString().substr(-1)).toString(),r=parseInt(r,10)>9?"0":r,n="JABCDEFGHI".substr(r,1).toString(),o.match(/[ABEH]/)?l===r:o.match(/[KPQS]/)?l===n:l===r||l===n}),"Please specify a valid CIF number."),t.validator.addMethod("cnhBR",(function(t){if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var e,i,a,r,n,s=0,o=0;if(e=t.charAt(0),new Array(12).join(e)===t)return!1;for(r=0,n=9,0;r<9;++r,--n)s+=+t.charAt(r)*n;for((i=s%11)>=10&&(i=0,o=2),s=0,r=0,n=1,0;r<9;++r,++n)s+=+t.charAt(r)*n;return(a=s%11)>=10?a=0:a-=o,String(i).concat(a)===t.substr(-2)}),"Please specify a valid CNH number"),t.validator.addMethod("cnpjBR",(function(t,e){"use strict";if(this.optional(e))return!0;if(14!==(t=t.replace(/[^\d]+/g,"")).length)return!1;if("00000000000000"===t||"11111111111111"===t||"22222222222222"===t||"33333333333333"===t||"44444444444444"===t||"55555555555555"===t||"66666666666666"===t||"77777777777777"===t||"88888888888888"===t||"99999999999999"===t)return!1;for(var i=t.length-2,a=t.substring(0,i),r=t.substring(i),n=0,s=i-7,o=i;o>=1;o--)n+=a.charAt(i-o)*s--,s<2&&(s=9);var d=n%11<2?0:11-n%11;if(d!==parseInt(r.charAt(0),10))return!1;i+=1,a=t.substring(0,i),n=0,s=i-7;for(var l=i;l>=1;l--)n+=a.charAt(i-l)*s--,s<2&&(s=9);return(d=n%11<2?0:11-n%11)===parseInt(r.charAt(1),10)}),"Please specify a CNPJ value number"),t.validator.addMethod("cpfBR",(function(t,e){"use strict";if(this.optional(e))return!0;if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;var i,a,r,n,s=0;if(i=parseInt(t.substring(9,10),10),a=parseInt(t.substring(10,11),10),r=function(t,e){var i=10*t%11;return 10!==i&&11!==i||(i=0),i===e},""===t||"00000000000"===t||"11111111111"===t||"22222222222"===t||"33333333333"===t||"44444444444"===t||"55555555555"===t||"66666666666"===t||"77777777777"===t||"88888888888"===t||"99999999999"===t)return!1;for(n=1;n<=9;n++)s+=parseInt(t.substring(n-1,n),10)*(11-n);if(r(s,i)){for(s=0,n=1;n<=10;n++)s+=parseInt(t.substring(n-1,n),10)*(12-n);return r(s,a)}return!1}),"Please specify a valid CPF number"),t.validator.addMethod("creditcard",(function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i,a,r=0,n=0,s=!1;if((t=t.replace(/\D/g,"")).length<13||t.length>19)return!1;for(i=t.length-1;i>=0;i--)a=t.charAt(i),n=parseInt(a,10),s&&(n*=2)>9&&(n-=9),r+=n,s=!s;return r%10==0}),"Please enter a valid credit card number."),t.validator.addMethod("creditcardtypes",(function(t,e,i){if(/[^0-9\-]+/.test(t))return!1;t=t.replace(/\D/g,"");var a=0;return i.mastercard&&(a|=1),i.visa&&(a|=2),i.amex&&(a|=4),i.dinersclub&&(a|=8),i.enroute&&(a|=16),i.discover&&(a|=32),i.jcb&&(a|=64),i.unknown&&(a|=128),i.all&&(a=255),1&a&&(/^(5[12345])/.test(t)||/^(2[234567])/.test(t))||2&a&&/^(4)/.test(t)?16===t.length:4&a&&/^(3[47])/.test(t)?15===t.length:8&a&&/^(3(0[012345]|[68]))/.test(t)?14===t.length:16&a&&/^(2(014|149))/.test(t)?15===t.length:32&a&&/^(6011)/.test(t)||64&a&&/^(3)/.test(t)?16===t.length:64&a&&/^(2131|1800)/.test(t)?15===t.length:!!(128&a)}),"Please enter a valid credit card number."),t.validator.addMethod("currency",(function(t,e,i){var a,r="string"==typeof i,n=r?i:i[0],s=!!r||i[1];return n=n.replace(/,/g,""),a="^["+(n=s?n+"]":n+"]?")+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",a=new RegExp(a),this.optional(e)||a.test(t)}),"Please specify a valid currency"),t.validator.addMethod("dateFA",(function(t,e){return this.optional(e)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(t)}),t.validator.messages.date),t.validator.addMethod("dateITA",(function(t,e){var i,a,r,n,s,o=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(t)?(i=t.split("/"),a=parseInt(i[0],10),r=parseInt(i[1],10),n=parseInt(i[2],10),o=(s=new Date(Date.UTC(n,r-1,a,12,0,0,0))).getUTCFullYear()===n&&s.getUTCMonth()===r-1&&s.getUTCDate()===a):o=!1,this.optional(e)||o}),t.validator.messages.date),t.validator.addMethod("dateNL",(function(t,e){return this.optional(e)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(t)}),t.validator.messages.date),t.validator.addMethod("extension",(function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(new RegExp("\\.("+i+")$","i"))}),t.validator.format("Please enter a value with a valid extension.")),t.validator.addMethod("giroaccountNL",(function(t,e){return this.optional(e)||/^[0-9]{1,7}$/.test(t)}),"Please specify a valid giro account number"),t.validator.addMethod("greaterThan",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-greaterThan-blur").length&&r.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",(function(){t(i).valid()})),e>r.val()}),"Please enter a greater value."),t.validator.addMethod("greaterThanEqual",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-greaterThanEqual-blur").length&&r.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",(function(){t(i).valid()})),e>=r.val()}),"Please enter a greater value."),t.validator.addMethod("iban",(function(t,e){if(this.optional(e))return!0;var i,a,r,n,s,o=t.replace(/ /g,"").toUpperCase(),d="",l=!0,u="";if(o.length<5)return!1;if(void 0!==(r={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"}[o.substring(0,2)])&&!new RegExp("^[A-Z]{2}\\d{2}"+r+"$","").test(o))return!1;for(i=o.substring(4,o.length)+o.substring(0,4),n=0;n<i.length;n++)"0"!==(a=i.charAt(n))&&(l=!1),l||(d+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a));for(s=0;s<d.length;s++)u=(""+u+d.charAt(s))%97;return 1===u}),"Please specify a valid IBAN"),t.validator.addMethod("integer",(function(t,e){return this.optional(e)||/^-?\d+$/.test(t)}),"A positive or negative non-decimal number please"),t.validator.addMethod("ipv4",(function(t,e){return this.optional(e)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(t)}),"Please enter a valid IP v4 address."),t.validator.addMethod("ipv6",(function(t,e){return this.optional(e)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(t)}),"Please enter a valid IP v6 address."),t.validator.addMethod("lessThan",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-lessThan-blur").length&&r.addClass("validate-lessThan-blur").on("blur.validate-lessThan",(function(){t(i).valid()})),e<r.val()}),"Please enter a lesser value."),t.validator.addMethod("lessThanEqual",(function(e,i,a){var r=t(a);return this.settings.onfocusout&&r.not(".validate-lessThanEqual-blur").length&&r.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",(function(){t(i).valid()})),e<=r.val()}),"Please enter a lesser value."),t.validator.addMethod("lettersonly",(function(t,e){return this.optional(e)||/^[a-z]+$/i.test(t)}),"Letters only please"),t.validator.addMethod("letterswithbasicpunc",(function(t,e){return this.optional(e)||/^[a-z\-.,()'"\s]+$/i.test(t)}),"Letters or punctuation only please"),t.validator.addMethod("maxfiles",(function(e,i,a){return!!this.optional(i)||!("file"===t(i).attr("type")&&i.files&&i.files.length>a)}),t.validator.format("Please select no more than {0} files.")),t.validator.addMethod("maxsize",(function(e,i,a){if(this.optional(i))return!0;if("file"===t(i).attr("type")&&i.files&&i.files.length)for(var r=0;r<i.files.length;r++)if(i.files[r].size>a)return!1;return!0}),t.validator.format("File size must not exceed {0} bytes each.")),t.validator.addMethod("maxsizetotal",(function(e,i,a){if(this.optional(i))return!0;if("file"===t(i).attr("type")&&i.files&&i.files.length)for(var r=0,n=0;n<i.files.length;n++)if((r+=i.files[n].size)>a)return!1;return!0}),t.validator.format("Total size of all files must not exceed {0} bytes.")),t.validator.addMethod("mobileNL",(function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(t)}),"Please specify a valid mobile number"),t.validator.addMethod("mobileRU",(function(t,e){var i=t.replace(/\(|\)|\s+|-/g,"");return this.optional(e)||i.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(i)}),"Please specify a valid mobile number"),t.validator.addMethod("mobileUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)}),"Please specify a valid mobile number"),t.validator.addMethod("netmask",(function(t,e){return this.optional(e)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(t)}),"Please enter a valid netmask."),t.validator.addMethod("nieES",(function(t,e){"use strict";if(this.optional(e))return!0;var i,a=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),r=t.substr(t.length-1).toUpperCase();return!((t=t.toString().toUpperCase()).length>10||t.length<9||!a.test(t))&&(i=9===(t=t.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2")).length?t.substr(0,8):t.substr(0,9),"TRWAGMYFPDXBNJZSQVHLCKET".charAt(parseInt(i,10)%23)===r)}),"Please specify a valid NIE number."),t.validator.addMethod("nifES",(function(t,e){"use strict";return!!this.optional(e)||!!(t=t.toUpperCase()).match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(t)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,0)%23)===t.charAt(8):!!/^[KLM]{1}/.test(t)&&t[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(t.substring(8,1)%23))}),"Please specify a valid NIF number."),t.validator.addMethod("nipPL",(function(t){"use strict";if(10!==(t=t.replace(/[^0-9]/g,"")).length)return!1;for(var e=[6,5,7,2,3,4,5,6,7],i=0,a=0;a<9;a++)i+=e[a]*t[a];var r=i%11;return(10===r?0:r)===parseInt(t[9],10)}),"Please specify a valid NIP number."),t.validator.addMethod("nisBR",(function(t){var e,i,a,r,n,s=0;if(11!==(t=t.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,"")).length)return!1;for(i=parseInt(t.substring(10,11),10),e=parseInt(t.substring(0,10),10),r=2;r<12;r++)n=r,10===r&&(n=2),11===r&&(n=3),s+=e%10*n,e=parseInt(e/10,10);return i===(a=(a=s%11)>1?11-a:0)}),"Please specify a valid NIS/PIS number"),t.validator.addMethod("notEqualTo",(function(e,i,a){return this.optional(i)||!t.validator.methods.equalTo.call(this,e,i,a)}),"Please enter a different value, values must not be the same."),t.validator.addMethod("nowhitespace",(function(t,e){return this.optional(e)||/^\S+$/i.test(t)}),"No white space please"),t.validator.addMethod("pattern",(function(t,e,i){return!!this.optional(e)||("string"==typeof i&&(i=new RegExp("^(?:"+i+")$")),i.test(t))}),"Invalid format."),t.validator.addMethod("phoneNL",(function(t,e){return this.optional(e)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(t)}),"Please specify a valid phone number."),t.validator.addMethod("phonePL",(function(t,e){t=t.replace(/\s+/g,"");return this.optional(e)||/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/.test(t)}),"Please specify a valid phone number"),t.validator.addMethod("phonesUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)}),"Please specify a valid uk phone number"),t.validator.addMethod("phoneUK",(function(t,e){return t=t.replace(/\(|\)|\s+|-/g,""),this.optional(e)||t.length>9&&t.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)}),"Please specify a valid phone number"),t.validator.addMethod("phoneUS",(function(t,e){return t=t.replace(/\s+/g,""),this.optional(e)||t.length>9&&t.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)}),"Please specify a valid phone number"),t.validator.addMethod("postalcodeBR",(function(t,e){return this.optional(e)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(t)}),"Informe um CEP válido."),t.validator.addMethod("postalCodeCA",(function(t,e){return this.optional(e)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postalcodeIT",(function(t,e){return this.optional(e)||/^\d{5}$/.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postalcodeNL",(function(t,e){return this.optional(e)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(t)}),"Please specify a valid postal code"),t.validator.addMethod("postcodeUK",(function(t,e){return this.optional(e)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(t)}),"Please specify a valid UK postcode"),t.validator.addMethod("require_from_group",(function(e,i,a){var r=t(a[1],i.form),n=r.eq(0),s=n.data("valid_req_grp")?n.data("valid_req_grp"):t.extend({},this),o=r.filter((function(){return s.elementValue(this)})).length>=a[0];return n.data("valid_req_grp",s),t(i).data("being_validated")||(r.data("being_validated",!0),r.each((function(){s.element(this)})),r.data("being_validated",!1)),o}),t.validator.format("Please fill at least {0} of these fields.")),t.validator.addMethod("skip_or_fill_minimum",(function(e,i,a){var r=t(a[1],i.form),n=r.eq(0),s=n.data("valid_skip")?n.data("valid_skip"):t.extend({},this),o=r.filter((function(){return s.elementValue(this)})).length,d=0===o||o>=a[0];return n.data("valid_skip",s),t(i).data("being_validated")||(r.data("being_validated",!0),r.each((function(){s.element(this)})),r.data("being_validated",!1)),d}),t.validator.format("Please either skip these fields or fill at least {0} of them.")),t.validator.addMethod("stateUS",(function(t,e,i){var a,r=void 0===i,n=!r&&void 0!==i.caseSensitive&&i.caseSensitive,s=!r&&void 0!==i.includeTerritories&&i.includeTerritories,o=!r&&void 0!==i.includeMilitary&&i.includeMilitary;return a=s||o?s&&o?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":s?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",a=n?new RegExp(a):new RegExp(a,"i"),this.optional(e)||a.test(t)}),"Please specify a valid state"),t.validator.addMethod("strippedminlength",(function(e,i,a){return t(e).text().length>=a}),t.validator.format("Please enter at least {0} characters")),t.validator.addMethod("time",(function(t,e){return this.optional(e)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(t)}),"Please enter a valid time, between 00:00 and 23:59"),t.validator.addMethod("time12h",(function(t,e){return this.optional(e)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(t)}),"Please enter a valid time in 12-hour am/pm format"),t.validator.addMethod("url2",(function(t,e){return this.optional(e)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)}),t.validator.messages.url),t.validator.addMethod("vinUS",(function(t){if(17!==t.length)return!1;var e,i,a,r,n,s,o=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],d=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],l=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],u=0;for(e=0;e<17;e++){if(r=l[e],a=t.slice(e,e+1),8===e&&(s=a),isNaN(a)){for(i=0;i<o.length;i++)if(a.toUpperCase()===o[i]){a=d[i],a*=r,isNaN(s)&&8===i&&(s=o[i]);break}}else a*=r;u+=a}return 10===(n=u%11)&&(n="X"),n===s}),"The specified vehicle identification number (VIN) is invalid."),t.validator.addMethod("zipcodeUS",(function(t,e){return this.optional(e)||/^\d{5}(-\d{4})?$/.test(t)}),"The specified US ZIP Code is invalid"),t.validator.addMethod("ziprange",(function(t,e){return this.optional(e)||/^90[2-5]\d\{2\}-\d{4}$/.test(t)}),"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx"),t})),function(t,e,i){"use strict";var a=function(){function e(i){_classCallCheck(this,e),this.$form=t(i),this.validationElements=this.$form.find(".rwmb-validation"),this.showAsterisks(),this.getSettings()}return _createClass(e,[{key:"init",value:function(){this.$form.on("submit",(function(){"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave()})).validate(this.settings)}},{key:"showAsterisks",value:function(){this.validationElements.each((function(){var e=t(this).data("validation");t.each(e.rules,(function(e,i){if(i.required){var a=t('[name="'+e+'"]');a.length&&a.closest(".rwmb-input").siblings(".rwmb-label").find("label").append('<span class="rwmb-required">*</span>')}}))}))}},{key:"getSettings",value:function(){this.settings={ignore:':not(.rwmb-media,.rwmb-image_select,.rwmb-wysiwyg,.rwmb-color,.rwmb-map,.rwmb-osm,.rwmb-switch,[class|="rwmb"])',errorPlacement:function(t,e){t.appendTo(e.closest(".rwmb-input"))},errorClass:"rwmb-error",errorElement:"p",invalidHandler:this.invalidHandler.bind(this)};var e=this;this.validationElements.each((function(){t.extend(!0,e.settings,t(this).data("validation"))}))}},{key:"invalidHandler",value:function(){this.showMessage();for(var i=0;i<this.$form.data("validator").errorList.length;i++)jQuery("#"+this.$form.data("validator").errorList[i].element.id).closest(".rwmb-group-collapsed").removeClass("rwmb-group-collapsed");var t=this;setTimeout((function(){t.$form.trigger("after_validate")}),200)}},{key:"showMessage",value:function(){t("#publish").removeClass("button-primary-disabled"),t("#ajax-loading").attr("style",""),t("#rwmb-validation-message").remove(),this.$form.before('<div id="rwmb-validation-message" class="notice notice-error is-dismissible"><p>'+i.message+"</p></div>")}}]),e}(),r=function(t){_inherits(a,t);var e=_createSuper(a);function a(){return _classCallCheck(this,a),e.apply(this,arguments)}return _createClass(a,[{key:"init",value:function(){var t=this,e=wp.data.dispatch("core/editor"),i=e.savePost;e.savePost=function(e){"object"===_typeof(e)&&e.isPreview?i(e):(t.$form.validate(t.settings),t.$form.valid()&&i(e))}}},{key:"showMessage",value:function(){wp.data.dispatch("core/notices").createErrorNotice(i.message,{id:"meta-box-validation",isDismissible:!0})}}]),a}(a);t((function(){if(e.isGutenberg){var i=new r(".metabox-location-advanced"),n=new r(".metabox-location-normal");return new r(".metabox-location-side").init(),n.init(),void i.init()}t("#post, #edittag, #your-profile, .rwmb-form").each((function(){new a(this).init()}))}))}(jQuery,rwmb,rwmbValidation);
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
- * Version: 5.6.2
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
+ * Version: 5.6.3
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://metabox.io/pricing/
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.6
7
- Tested up to: 5.9.2
8
- Stable tag: 5.6.2
9
  License: GPLv2 or later
10
 
11
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
@@ -168,6 +168,12 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
168
 
169
  == Changelog ==
170
 
 
 
 
 
 
 
171
  = 5.6.2 - 2022-04-01 =
172
  - Fix map not showing in block preview
173
  - Fix deleting images in cloneable groups
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.6
7
+ Tested up to: 5.9.3
8
+ Stable tag: 5.6.3
9
  License: GPLv2 or later
10
 
11
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
168
 
169
  == Changelog ==
170
 
171
+ = 5.6.3 - 2022-04-18 =
172
+ - Improve Google Maps search, allowing to search by place names
173
+ - Fix incorrect the label ID for subfield in groups
174
+ - Fix validation not working when a cloneable group collapse
175
+ - Improve license key check
176
+
177
  = 5.6.2 - 2022-04-01 =
178
  - Fix map not showing in block preview
179
  - Fix deleting images in cloneable groups