Version Description
- 2020-09-23 =
- Add default title
- Update autoloader
- Bypass the validation when previewing in Gutenberg
- Add MB Views to the updater
- Update color picker script to latest version 2.1.4
- Fix missing labels for color field (wp 5.5.1)
- Fix preview is not generated
- Fix seamless style in WordPress 5.5
- Fix style for file_input field (description is inline with input field)
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 5.3.4 |
Comparing to | |
See all releases |
Code changes from version 5.3.3 to 5.3.4
- css/background.css +6 -1
- css/file-input.css +1 -6
- css/style.css +2 -1
- inc/autoloader.php +5 -1
- inc/fields/color.php +12 -0
- inc/helpers/field.php +6 -0
- inc/loader.php +1 -1
- inc/meta-box.php +3 -1
- inc/update/checker.php +1 -0
- js/validation.min.js +1 -1
- js/wp-color-picker-alpha/wp-color-picker-alpha.min.js +3 -5
- meta-box.php +1 -1
- readme.txt +13 -2
css/background.css
CHANGED
@@ -4,6 +4,11 @@
|
|
4 |
flex-wrap: wrap;
|
5 |
align-items: flex-start;
|
6 |
}
|
|
|
|
|
|
|
|
|
|
|
7 |
.rwmb-background-wrapper .wp-picker-container {
|
8 |
position: relative;
|
9 |
display: inline-block;
|
@@ -18,4 +23,4 @@
|
|
18 |
flex: 1;
|
19 |
margin-bottom: 5px;
|
20 |
max-width: 100%;
|
21 |
-
}
|
4 |
flex-wrap: wrap;
|
5 |
align-items: flex-start;
|
6 |
}
|
7 |
+
|
8 |
+
.rwmb-background-row .button {
|
9 |
+
margin-right: 5px;
|
10 |
+
}
|
11 |
+
|
12 |
.rwmb-background-wrapper .wp-picker-container {
|
13 |
position: relative;
|
14 |
display: inline-block;
|
23 |
flex: 1;
|
24 |
margin-bottom: 5px;
|
25 |
max-width: 100%;
|
26 |
+
}
|
css/file-input.css
CHANGED
@@ -1,8 +1,3 @@
|
|
1 |
-
.rwmb-file_input-wrapper > .rwmb-input {
|
2 |
-
display: flex;
|
3 |
-
flex-wrap: wrap;
|
4 |
-
align-items: flex-start;
|
5 |
-
}
|
6 |
.rwmb-file_input.rwmb-file_input {
|
7 |
line-height: 18px;
|
8 |
margin: 0 5px 0 0;
|
@@ -14,4 +9,4 @@
|
|
14 |
.rwmb-file-input-select {
|
15 |
margin-bottom: 5px;
|
16 |
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
1 |
.rwmb-file_input.rwmb-file_input {
|
2 |
line-height: 18px;
|
3 |
margin: 0 5px 0 0;
|
9 |
.rwmb-file-input-select {
|
10 |
margin-bottom: 5px;
|
11 |
}
|
12 |
+
}
|
css/style.css
CHANGED
@@ -170,7 +170,8 @@ select.rwmb-error {
|
|
170 |
padding-right: 0;
|
171 |
}
|
172 |
.postbox.rwmb-seamless .hndle,
|
173 |
-
.postbox.rwmb-seamless .handlediv
|
|
|
174 |
display: none;
|
175 |
}
|
176 |
.rwmb-seamless .rwmb-clone {
|
170 |
padding-right: 0;
|
171 |
}
|
172 |
.postbox.rwmb-seamless .hndle,
|
173 |
+
.postbox.rwmb-seamless .handlediv,
|
174 |
+
.postbox.rwmb-seamless .postbox-header {
|
175 |
display: none;
|
176 |
}
|
177 |
.rwmb-seamless .rwmb-clone {
|
inc/autoloader.php
CHANGED
@@ -55,7 +55,11 @@ class RWMB_Autoloader {
|
|
55 |
if ( $dir['suffix'] && strlen( $file ) > strlen( $dir['suffix'] ) ) {
|
56 |
$file = substr( $file, 0, - strlen( $dir['suffix'] ) );
|
57 |
}
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
$file = $dir['dir'] . $file;
|
60 |
$this->require_file( $file );
|
61 |
}
|
55 |
if ( $dir['suffix'] && strlen( $file ) > strlen( $dir['suffix'] ) ) {
|
56 |
$file = substr( $file, 0, - strlen( $dir['suffix'] ) );
|
57 |
}
|
58 |
+
if ( function_exists( 'mb_strtolower' ) && function_exists( 'mb_detect_encoding' ) ) {
|
59 |
+
$file = mb_strtolower( str_replace( '_', '-', $file ), mb_detect_encoding( $file ) ) . '.php';
|
60 |
+
} else {
|
61 |
+
$file = strtolower( str_replace( '_', '-', $file ) ) . '.php';
|
62 |
+
}
|
63 |
$file = $dir['dir'] . $file;
|
64 |
$this->require_file( $file );
|
65 |
}
|
inc/fields/color.php
CHANGED
@@ -23,6 +23,18 @@ class RWMB_Color_Field extends RWMB_Text_Field {
|
|
23 |
$dependencies = array( 'wp-color-picker-alpha' );
|
24 |
}
|
25 |
wp_enqueue_script( 'rwmb-color', RWMB_JS_URL . 'color.js', $dependencies, RWMB_VER, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/**
|
23 |
$dependencies = array( 'wp-color-picker-alpha' );
|
24 |
}
|
25 |
wp_enqueue_script( 'rwmb-color', RWMB_JS_URL . 'color.js', $dependencies, RWMB_VER, true );
|
26 |
+
RWMB_Helpers_Field::add_inline_script_once( 'rwmb-color', '
|
27 |
+
if ( wpColorPickerL10n !== undefined && wpColorPickerL10n.clear !== undefined ) {
|
28 |
+
wpColorPickerL10n = Object.assign( {
|
29 |
+
clear: "' . esc_html__( 'Clear', 'meta-box' ) . '",
|
30 |
+
clearAriaLabel: "' . esc_html__( 'Clear color', 'meta-box' ) . '",
|
31 |
+
defaultAriaLabel: "' . esc_html__( 'Select default color', 'meta-box' ) . '",
|
32 |
+
defaultLabel: "' . esc_html__( 'Color value', 'meta-box' ) . '",
|
33 |
+
defaultString: "' . esc_html__( 'Default', 'meta-box' ) . '",
|
34 |
+
pick: "' . esc_html__( 'Select Color', 'meta-box' ) . '",
|
35 |
+
}, wpColorPickerL10n );
|
36 |
+
}
|
37 |
+
' );
|
38 |
}
|
39 |
|
40 |
/**
|
inc/helpers/field.php
CHANGED
@@ -26,6 +26,12 @@ class RWMB_Helpers_Field {
|
|
26 |
}
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Get field class name.
|
31 |
*
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
public static function add_inline_script_once( $handle, $text ) {
|
30 |
+
if ( ! wp_scripts()->get_data( $handle, 'after' ) ) {
|
31 |
+
wp_add_inline_script( $handle, $text );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
/**
|
36 |
* Get field class name.
|
37 |
*
|
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.
|
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.4' );
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
inc/meta-box.php
CHANGED
@@ -339,11 +339,13 @@ class RW_Meta_Box {
|
|
339 |
* @return array $meta_box Normalized meta box.
|
340 |
*/
|
341 |
public static function normalize( $meta_box ) {
|
|
|
342 |
// Set default values for meta box.
|
343 |
$meta_box = wp_parse_args(
|
344 |
$meta_box,
|
345 |
array(
|
346 |
-
'
|
|
|
347 |
'context' => 'normal',
|
348 |
'priority' => 'high',
|
349 |
'post_types' => 'post',
|
339 |
* @return array $meta_box Normalized meta box.
|
340 |
*/
|
341 |
public static function normalize( $meta_box ) {
|
342 |
+
$default_title = __( 'Meta Box Title', 'meta-box' );
|
343 |
// Set default values for meta box.
|
344 |
$meta_box = wp_parse_args(
|
345 |
$meta_box,
|
346 |
array(
|
347 |
+
'title' => $default_title,
|
348 |
+
'id' => ! empty( $meta_box['title'] ) ? sanitize_title( $meta_box['title'] ) : sanitize_title( $default_title ),
|
349 |
'context' => 'normal',
|
350 |
'priority' => 'high',
|
351 |
'post_types' => 'post',
|
inc/update/checker.php
CHANGED
@@ -82,6 +82,7 @@ class RWMB_Update_Checker {
|
|
82 |
'mb-term-meta',
|
83 |
'mb-user-meta',
|
84 |
'mb-user-profile',
|
|
|
85 |
'meta-box-aio',
|
86 |
'meta-box-builder',
|
87 |
'meta-box-columns',
|
82 |
'mb-term-meta',
|
83 |
'mb-user-meta',
|
84 |
'mb-user-profile',
|
85 |
+
'mb-views',
|
86 |
'meta-box-aio',
|
87 |
'meta-box-builder',
|
88 |
'meta-box-columns',
|
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(/ | /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);
|
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(/ | /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(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 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);
|
js/wp-color-picker-alpha/wp-color-picker-alpha.min.js
CHANGED
@@ -4,10 +4,8 @@
|
|
4 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
* Only run in input and is defined data alpha in true
|
6 |
*
|
7 |
-
* Version: 2.1.
|
8 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
-
* Licensed under the GPLv2 license.
|
10 |
*/
|
11 |
-
!function(t){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',
|
12 |
-
// Auto call with colo-picker class
|
13 |
-
jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
4 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
* Only run in input and is defined data alpha in true
|
6 |
*
|
7 |
+
* Version: 2.1.4
|
8 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
+
* Licensed under the GPLv2 license or later.
|
10 |
*/
|
11 |
+
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
|
|
|
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.
|
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.4
|
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.
|
8 |
-
Stable tag: 5.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 WordPress.
|
@@ -167,6 +167,17 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
|
|
167 |
|
168 |
== Changelog ==
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
= 5.3.3 - 2020-07-21 =
|
171 |
- Hide Go Pro link for premium users
|
172 |
- Update intro and image for the Online Generator in the welcome page
|
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.5.1
|
8 |
+
Stable tag: 5.3.4
|
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.4 - 2020-09-23 =
|
171 |
+
- Add default title
|
172 |
+
- Update autoloader
|
173 |
+
- Bypass the validation when previewing in Gutenberg
|
174 |
+
- Add MB Views to the updater
|
175 |
+
- Update color picker script to latest version 2.1.4
|
176 |
+
- Fix missing labels for color field (wp 5.5.1)
|
177 |
+
- Fix preview is not generated
|
178 |
+
- Fix seamless style in WordPress 5.5
|
179 |
+
- Fix style for file_input field (description is inline with input field)
|
180 |
+
|
181 |
= 5.3.3 - 2020-07-21 =
|
182 |
- Hide Go Pro link for premium users
|
183 |
- Update intro and image for the Online Generator in the welcome page
|