Meta Box - Version 5.3.2

Version Description

  • 2020-07-03 =
  • Fix validation not working for media fields
  • Add "add_to" option for media fields to allow adding new images to the beginning/end of the list
  • Improve style for input & select on the sidebar
  • Improve style for mobiles
Download this release

Release Info

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

Code changes from version 5.3.1 to 5.3.2

Files changed (7) hide show
  1. css/style.css +29 -0
  2. inc/fields/media.php +8 -5
  3. inc/loader.php +1 -1
  4. js/media.js +10 -8
  5. js/validation.min.js +1 -1
  6. meta-box.php +1 -1
  7. readme.txt +8 -2
css/style.css CHANGED
@@ -128,6 +128,35 @@ select.rwmb-error {
128
  #side-sortables .rwmb-label {
129
  margin-bottom: 3px;
130
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  /* Seamless style
133
  --------------------------------------------------------------*/
128
  #side-sortables .rwmb-label {
129
  margin-bottom: 3px;
130
  }
131
+ #side-sortables .rwmb-input input,
132
+ #side-sortables .rwmb-input select {
133
+ width: 100%;
134
+ max-width: 100%;
135
+ }
136
+ #side-sortables .rwmb-input input[type="checkbox"],
137
+ #side-sortables .rwmb-input input[type="radio"] {
138
+ width: auto;
139
+ }
140
+
141
+ /* Mobile style */
142
+ @media (max-width: 1023px) {
143
+ .rwmb-label,
144
+ .rwmb-label ~ .rwmb-input {
145
+ width: 100%;
146
+ }
147
+ .rwmb-label {
148
+ margin-bottom: 3px;
149
+ }
150
+ .rwmb-input input,
151
+ .rwmb-input select {
152
+ width: 100%;
153
+ max-width: 100%;
154
+ }
155
+ .rwmb-input input[type="checkbox"],
156
+ .rwmb-input input[type="radio"] {
157
+ width: auto;
158
+ }
159
+ }
160
 
161
  /* Seamless style
162
  --------------------------------------------------------------*/
inc/fields/media.php CHANGED
@@ -116,6 +116,7 @@ class RWMB_Media_Field extends RWMB_File_Field {
116
  'force_delete' => false,
117
  'max_status' => true,
118
  'js_options' => array(),
 
119
  )
120
  );
121
 
@@ -126,6 +127,7 @@ class RWMB_Media_Field extends RWMB_File_Field {
126
  'maxFiles' => $field['max_file_uploads'],
127
  'forceDelete' => $field['force_delete'] ? true : false,
128
  'maxStatus' => $field['max_status'],
 
129
  )
130
  );
131
 
@@ -145,11 +147,12 @@ class RWMB_Media_Field extends RWMB_File_Field {
145
  public static function get_attributes( $field, $value = null ) {
146
  $value = (array) $value;
147
 
148
- $attributes = parent::get_attributes( $field, $value );
149
- $attributes['type'] = 'hidden';
150
- $attributes['name'] = $field['clone'] ? str_replace( '[]', '', $attributes['name'] ) : $attributes['name'];
151
- $attributes['id'] = false;
152
- $attributes['value'] = implode( ',', $value );
 
153
 
154
  // Add attachment details.
155
  $attachments = array();
116
  'force_delete' => false,
117
  'max_status' => true,
118
  'js_options' => array(),
119
+ 'add_to' => 'end',
120
  )
121
  );
122
 
127
  'maxFiles' => $field['max_file_uploads'],
128
  'forceDelete' => $field['force_delete'] ? true : false,
129
  'maxStatus' => $field['max_status'],
130
+ 'addTo' => $field['add_to'],
131
  )
132
  );
133
 
147
  public static function get_attributes( $field, $value = null ) {
148
  $value = (array) $value;
149
 
150
+ $attributes = parent::get_attributes( $field, $value );
151
+ $attributes['type'] = 'hidden';
152
+ $attributes['name'] = $field['clone'] ? str_replace( '[]', '', $attributes['name'] ) : $attributes['name'];
153
+ $attributes['id'] = false;
154
+ $attributes['value'] = implode( ',', $value );
155
+ $attributes['class'] .= ' rwmb-media';
156
 
157
  // Add attachment details.
158
  $attachments = array();
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.3.1' );
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.3.2' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
js/media.js CHANGED
@@ -130,16 +130,14 @@
130
  that.controller.destroy();
131
  } );
132
 
 
133
  this.$input.on( 'media:reset', function() {
134
- that.controller.get( 'items' ).reset();
135
  } );
136
 
137
- this.controller.get( 'items' ).on( 'add remove reset', _.debounce( function () {
138
- that.$input.trigger( 'change', [that.$( '.rwmb-media-input' )] );
139
- }, 500 ) );
140
-
141
- this.controller.get( 'items' ).on( 'remove', _.debounce( function () {
142
- that.$input.val( '' ).trigger( 'change' );
143
  }, 500 ) );
144
  },
145
 
@@ -375,7 +373,11 @@
375
 
376
  this._frame.on( 'select', function () {
377
  var selection = this._frame.state().get( 'selection' );
378
- this.collection.add( selection.models );
 
 
 
 
379
  }, this );
380
 
381
  this._frame.open();
130
  that.controller.destroy();
131
  } );
132
 
133
+ var collection = this.controller.get( 'items' );
134
  this.$input.on( 'media:reset', function() {
135
+ collection.reset();
136
  } );
137
 
138
+ collection.on( 'add remove reset', _.debounce( function () {
139
+ var ids = collection.pluck( 'id' ).join( ',' );
140
+ that.$input.val( ids ).trigger( 'change', [that.$( '.rwmb-media-input' )] );
 
 
 
141
  }, 500 ) );
142
  },
143
 
373
 
374
  this._frame.on( 'select', function () {
375
  var selection = this._frame.state().get( 'selection' );
376
+ if ( this.controller.get( 'addTo' ) === 'beginning' ) {
377
+ this.collection.add( selection.models, {at: 0} );
378
+ } else {
379
+ this.collection.add( selection.models );
380
+ }
381
  }, this );
382
 
383
  this._frame.open();
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 n=e(t),r=/\b\w+\b/g;return this.optional(i)||n.match(r).length>=a[0]&&n.match(r).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 n=0;n<a;n+=3)e+=3*parseInt(i[n],10)+7*parseInt(i[n+1],10)+parseInt(i[n+2],10);return 0!==e&&e%10==0}),"Please enter a valid routing number."),t.validator.addMethod("accept",(function(e,i,a){var n,r,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(r=new RegExp(".?("+s+")$","i"),n=0;n<i.files.length;n++)if(!i.files[n].type.match(r))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,""),n=0,r=a.length;for(i=0;i<r;i++)n+=(r-i)*a.substring(i,i+1);return n%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,n,r,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 n=(10-(u+h).toString().substr(-1)).toString(),n=parseInt(n,10)>9?"0":n,r="JABCDEFGHI".substr(n,1).toString(),o.match(/[ABEH]/)?l===n:o.match(/[KPQS]/)?l===r:l===n||l===r}),"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,n,r,s=0,o=0;if(e=t.charAt(0),new Array(12).join(e)===t)return!1;for(n=0,r=9,0;n<9;++n,--r)s+=+t.charAt(n)*r;for((i=s%11)>=10&&(i=0,o=2),s=0,n=0,r=1,0;n<9;++n,++r)s+=+t.charAt(n)*r;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),n=t.substring(i),r=0,s=i-7,o=i;o>=1;o--)r+=a.charAt(i-o)*s--,s<2&&(s=9);var d=r%11<2?0:11-r%11;if(d!==parseInt(n.charAt(0),10))return!1;i+=1,a=t.substring(0,i),r=0,s=i-7;for(var l=i;l>=1;l--)r+=a.charAt(i-l)*s--,s<2&&(s=9);return(d=r%11<2?0:11-r%11)===parseInt(n.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,n,r,s=0;if(i=parseInt(t.substring(9,10),10),a=parseInt(t.substring(10,11),10),n=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(r=1;r<=9;r++)s+=parseInt(t.substring(r-1,r),10)*(11-r);if(n(s,i)){for(s=0,r=1;r<=10;r++)s+=parseInt(t.substring(r-1,r),10)*(12-r);return n(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,n=0,r=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),r=parseInt(a,10),s&&(r*=2)>9&&(r-=9),n+=r,s=!s;return n%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,n="string"==typeof i,r=n?i:i[0],s=!!n||i[1];return r=r.replace(/,/g,""),a="^["+(r=s?r+"]":r+"]?")+"([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,n,r,s,o=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(t)?(i=t.split("/"),a=parseInt(i[0],10),n=parseInt(i[1],10),r=parseInt(i[2],10),o=(s=new Date(Date.UTC(r,n-1,a,12,0,0,0))).getUTCFullYear()===r&&s.getUTCMonth()===n-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 n=t(a);return this.settings.onfocusout&&n.not(".validate-greaterThan-blur").length&&n.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",(function(){t(i).valid()})),e>n.val()}),"Please enter a greater value."),t.validator.addMethod("greaterThanEqual",(function(e,i,a){var n=t(a);return this.settings.onfocusout&&n.not(".validate-greaterThanEqual-blur").length&&n.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",(function(){t(i).valid()})),e>=n.val()}),"Please enter a greater value."),t.validator.addMethod("iban",(function(t,e){if(this.optional(e))return!0;var i,a,n,r,s,o=t.replace(/ /g,"").toUpperCase(),d="",l=!0,u="";if(o.length<5)return!1;if(void 0!==(n={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}"+n+"$","").test(o))return!1;for(i=o.substring(4,o.length)+o.substring(0,4),r=0;r<i.length;r++)"0"!==(a=i.charAt(r))&&(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 n=t(a);return this.settings.onfocusout&&n.not(".validate-lessThan-blur").length&&n.addClass("validate-lessThan-blur").on("blur.validate-lessThan",(function(){t(i).valid()})),e<n.val()}),"Please enter a lesser value."),t.validator.addMethod("lessThanEqual",(function(e,i,a){var n=t(a);return this.settings.onfocusout&&n.not(".validate-lessThanEqual-blur").length&&n.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",(function(){t(i).valid()})),e<=n.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 n=0;n<i.files.length;n++)if(i.files[n].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 n=0,r=0;r<i.files.length;r++)if((n+=i.files[r].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),n=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)===n)}),"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 n=i%11;return(10===n?0:n)===parseInt(t[9],10)}),"Please specify a valid NIP number."),t.validator.addMethod("nisBR",(function(t){var e,i,a,n,r,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),n=2;n<12;n++)r=n,10===n&&(r=2),11===n&&(r=3),s+=e%10*r,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 n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_req_grp")?r.data("valid_req_grp"):t.extend({},this),o=n.filter((function(){return s.elementValue(this)})).length>=a[0];return r.data("valid_req_grp",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each((function(){s.element(this)})),n.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 n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_skip")?r.data("valid_skip"):t.extend({},this),o=n.filter((function(){return s.elementValue(this)})).length,d=0===o||o>=a[0];return r.data("valid_skip",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each((function(){s.element(this)})),n.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,n=void 0===i,r=!n&&void 0!==i.caseSensitive&&i.caseSensitive,s=!n&&void 0!==i.includeTerritories&&i.includeTerritories,o=!n&&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=r?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,n,r,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(n=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*=n,isNaN(s)&&8===i&&(s=o[i]);break}}else a*=n;u+=a}return 10===(r=u%11)&&(r="X"),r===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([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}(),n=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(){t.$form.validate(t.settings),t.$form.valid()&&i()}}},{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 n(".metabox-location-advanced"),r=new n(".metabox-location-normal");return new n(".metabox-location-side").init(),r.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 n=e(t),r=/\b\w+\b/g;return this.optional(i)||n.match(r).length>=a[0]&&n.match(r).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 n=0;n<a;n+=3)e+=3*parseInt(i[n],10)+7*parseInt(i[n+1],10)+parseInt(i[n+2],10);return 0!==e&&e%10==0}),"Please enter a valid routing number."),t.validator.addMethod("accept",(function(e,i,a){var n,r,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(r=new RegExp(".?("+s+")$","i"),n=0;n<i.files.length;n++)if(!i.files[n].type.match(r))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,""),n=0,r=a.length;for(i=0;i<r;i++)n+=(r-i)*a.substring(i,i+1);return n%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,n,r,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 n=(10-(u+h).toString().substr(-1)).toString(),n=parseInt(n,10)>9?"0":n,r="JABCDEFGHI".substr(n,1).toString(),o.match(/[ABEH]/)?l===n:o.match(/[KPQS]/)?l===r:l===n||l===r}),"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,n,r,s=0,o=0;if(e=t.charAt(0),new Array(12).join(e)===t)return!1;for(n=0,r=9,0;n<9;++n,--r)s+=+t.charAt(n)*r;for((i=s%11)>=10&&(i=0,o=2),s=0,n=0,r=1,0;n<9;++n,++r)s+=+t.charAt(n)*r;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),n=t.substring(i),r=0,s=i-7,o=i;o>=1;o--)r+=a.charAt(i-o)*s--,s<2&&(s=9);var d=r%11<2?0:11-r%11;if(d!==parseInt(n.charAt(0),10))return!1;i+=1,a=t.substring(0,i),r=0,s=i-7;for(var l=i;l>=1;l--)r+=a.charAt(i-l)*s--,s<2&&(s=9);return(d=r%11<2?0:11-r%11)===parseInt(n.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,n,r,s=0;if(i=parseInt(t.substring(9,10),10),a=parseInt(t.substring(10,11),10),n=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(r=1;r<=9;r++)s+=parseInt(t.substring(r-1,r),10)*(11-r);if(n(s,i)){for(s=0,r=1;r<=10;r++)s+=parseInt(t.substring(r-1,r),10)*(12-r);return n(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,n=0,r=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),r=parseInt(a,10),s&&(r*=2)>9&&(r-=9),n+=r,s=!s;return n%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,n="string"==typeof i,r=n?i:i[0],s=!!n||i[1];return r=r.replace(/,/g,""),a="^["+(r=s?r+"]":r+"]?")+"([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,n,r,s,o=!1;return/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(t)?(i=t.split("/"),a=parseInt(i[0],10),n=parseInt(i[1],10),r=parseInt(i[2],10),o=(s=new Date(Date.UTC(r,n-1,a,12,0,0,0))).getUTCFullYear()===r&&s.getUTCMonth()===n-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 n=t(a);return this.settings.onfocusout&&n.not(".validate-greaterThan-blur").length&&n.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",(function(){t(i).valid()})),e>n.val()}),"Please enter a greater value."),t.validator.addMethod("greaterThanEqual",(function(e,i,a){var n=t(a);return this.settings.onfocusout&&n.not(".validate-greaterThanEqual-blur").length&&n.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",(function(){t(i).valid()})),e>=n.val()}),"Please enter a greater value."),t.validator.addMethod("iban",(function(t,e){if(this.optional(e))return!0;var i,a,n,r,s,o=t.replace(/ /g,"").toUpperCase(),d="",l=!0,u="";if(o.length<5)return!1;if(void 0!==(n={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}"+n+"$","").test(o))return!1;for(i=o.substring(4,o.length)+o.substring(0,4),r=0;r<i.length;r++)"0"!==(a=i.charAt(r))&&(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 n=t(a);return this.settings.onfocusout&&n.not(".validate-lessThan-blur").length&&n.addClass("validate-lessThan-blur").on("blur.validate-lessThan",(function(){t(i).valid()})),e<n.val()}),"Please enter a lesser value."),t.validator.addMethod("lessThanEqual",(function(e,i,a){var n=t(a);return this.settings.onfocusout&&n.not(".validate-lessThanEqual-blur").length&&n.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",(function(){t(i).valid()})),e<=n.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 n=0;n<i.files.length;n++)if(i.files[n].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 n=0,r=0;r<i.files.length;r++)if((n+=i.files[r].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),n=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)===n)}),"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 n=i%11;return(10===n?0:n)===parseInt(t[9],10)}),"Please specify a valid NIP number."),t.validator.addMethod("nisBR",(function(t){var e,i,a,n,r,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),n=2;n<12;n++)r=n,10===n&&(r=2),11===n&&(r=3),s+=e%10*r,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 n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_req_grp")?r.data("valid_req_grp"):t.extend({},this),o=n.filter((function(){return s.elementValue(this)})).length>=a[0];return r.data("valid_req_grp",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each((function(){s.element(this)})),n.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 n=t(a[1],i.form),r=n.eq(0),s=r.data("valid_skip")?r.data("valid_skip"):t.extend({},this),o=n.filter((function(){return s.elementValue(this)})).length,d=0===o||o>=a[0];return r.data("valid_skip",s),t(i).data("being_validated")||(n.data("being_validated",!0),n.each((function(){s.element(this)})),n.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,n=void 0===i,r=!n&&void 0!==i.caseSensitive&&i.caseSensitive,s=!n&&void 0!==i.includeTerritories&&i.includeTerritories,o=!n&&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=r?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,n,r,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(n=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*=n,isNaN(s)&&8===i&&(s=o[i]);break}}else a*=n;u+=a}return 10===(r=u%11)&&(r="X"),r===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,[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}(),n=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(){t.$form.validate(t.settings),t.$form.valid()&&i()}}},{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 n(".metabox-location-advanced"),r=new n(".metabox-location-normal");return new n(".metabox-location-side").init(),r.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.3.1
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.3.2
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 field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.3
7
- Tested up to: 5.4.1
8
- Stable tag: 5.3.1
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 WordPress.
@@ -167,6 +167,12 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
170
  = 5.3.1 - 2020-06-03 =
171
  - Fix validation not working for multiple forms (front end)
172
  - Fix PHP warning: Creating default object from empty value
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Requires PHP: 5.3
7
+ Tested up to: 5.4.2
8
+ Stable tag: 5.3.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 WordPress.
167
 
168
  == Changelog ==
169
 
170
+ = 5.3.2 - 2020-07-03 =
171
+ - Fix validation not working for media fields
172
+ - Add "add_to" option for media fields to allow adding new images to the beginning/end of the list
173
+ - Improve style for input & select on the sidebar
174
+ - Improve style for mobiles
175
+
176
  = 5.3.1 - 2020-06-03 =
177
  - Fix validation not working for multiple forms (front end)
178
  - Fix PHP warning: Creating default object from empty value