Version Description
- Added html support to Send Email action.
- Added file attachments support to Send Email action.
- Added reset settings button to debug tools.
- Fixed a bug: radio buttons and checkboxes are now passed correctly as url parameters.
- Fixed a bug: "Changes you made may not be saved" pop-up no longer appears when no changes have been made.
Download this release
Release Info
Developer | yuvalsabar |
Plugin | Contact Form 7 Redirection |
Version | 2.2.8 |
Comparing to | |
See all releases |
Code changes from version 2.2.7 to 2.2.8
- build/js/wpcf7-redirect-backend-script.js +1317 -1248
- class-wpcf7-redirect.php +9 -5
- classes/actions/class-wpcf7r-action-redirect.php +11 -4
- classes/actions/class-wpcf7r-action-sendmail.php +58 -16
- classes/class-qs-api.php +90 -9
- classes/class-wpcf7r-base.php +38 -1
- classes/class-wpcf7r-form-helper.php +13 -70
- classes/class-wpcf7r-html.php +8 -8
- classes/class-wpcf7r-mailchimp-helper.php +13 -2
- classes/class-wpcf7r-settings.php +17 -7
- classes/class-wpcf7r-utils.php +5 -1
- modules/index.php +0 -0
- readme.txt +15 -7
- templates/fields/field-text.php +21 -9
- templates/fields/field-textarea.php +19 -7
- wpcf7-redirect.php +2 -2
- wpcf7r-functions.php +79 -42
build/js/wpcf7-redirect-backend-script.js
CHANGED
@@ -4,1254 +4,1323 @@
|
|
4 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,c){var e=a.port;"abort"===a.mode&&(d[e]&&d[e].abort(),d[e]=c)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(d[f]&&d[f].abort(),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a});
|
5 |
/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
6 |
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),--u;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;--u){if(r=n.slice(0,u).join("/"),h)for(d=h.length;0<d;--d)if(i=(i=f[h.slice(0,d).join("/")])&&i[r]){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function D(e){if(w(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!w(m,e)&&!w(_,e))throw new Error("No "+e);return m[e]}function c(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?c(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},i=Object.prototype.hasOwnProperty,a=[].slice,b=/\.js$/,f=function(e,t){var n,r,i=c(e),o=i[0],s=t[1];return e=i[1],o&&(n=D(o=l(o,s))),o?e=n&&n.normalize?n.normalize(e,(r=s,function(e){return l(e,r)})):l(e,s):(o=(i=c(e=l(e,s)))[0],e=i[1],o&&(n=D(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},o=function(e,t,n,r){var i,o,s,a,l,c,u,d=[],p=typeof n;if(c=S(r=r||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)i=d[l]=g.module(e);else if(w(m,o)||w(v,o)||w(_,o))d[l]=D(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(r,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(i&&i.exports!==h&&i.exports!==m[e]?m[e]=i.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,r,i){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=r,r=i),r?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),w(m,e)||w(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=r),e.define("almond",function(){}),e.define("jquery",[],function(){var e=u||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),e.define("select2/utils",["jquery"],function(o){var i={};function u(e){var t=e.prototype,n=[];for(var r in t){"function"==typeof t[r]&&"constructor"!==r&&n.push(r)}return n}i.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var i in t)n.call(t,i)&&(e[i]=t[i]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},i.Decorate=function(r,i){var e=u(i),t=u(r);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=r.prototype.constructor;0<t&&(e.call(arguments,r.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=r.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=r.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},i.Observable=e,i.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},i.hasScroll=function(e,t){var n=o(t),r=t.style.overflowX,i=t.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},i.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},r.prototype.position=function(e,t){t.find(".select2-results").append(e)},r.prototype.sort=function(e){return this.options.get("sorter")(e)},r.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},r.prototype.setClasses=function(){var t=this;this.data.current(function(e){var r=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,r)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},r.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},r.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},r.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},r=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=e.element&&r.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[i];t.setAttribute(i,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):i<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,r=0<e.deltaY&&t-e.deltaY<=0,i=e.deltaY<0&&n<=l.$results.height();r?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},r.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},r.prototype.destroy=function(){this.$results.remove()},r.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,r=e.offset().top,i=this.$results.scrollTop()+(r-n),o=r-n;i-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=this.selectionContainer(),o=this.display(r,i);i.append(o);var s=r.title||r.text;s&&i.attr("title",s),l.StoreData(i[0],"data",r),t.push(i)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,r,a){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var r=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=r.DELETE&&t.which!=r.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),r=i('<span class="select2-selection__clear" title="'+n()+'">×</span>');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");r.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){r.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?r.$selection.off("input.search input.searchcheck"):r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)r.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&r.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,i)){t=t||{};var n=s.Event("select2:"+e,{params:t});r.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function r(e){this.dict=e||{}}return r.prototype.all=function(){return this.dict},r.prototype.get=function(e){return this.dict[e]},r.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},r._cache={},r.loadPath=function(e){if(!(e in r._cache)){var t=n(e);r._cache[e]=t}return new r(r._cache[e])},r}),e.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(r){function n(e,t){n.__super__.constructor.call(this)}return r.Extend(n,r.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=r.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+r.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],r=this;this.$element.find(":selected").each(function(){var e=l(this),t=r.item(e);n.push(t)}),e(n)},n.prototype.select=function(i){var o=this;if(i.selected=!0,l(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var r=i[n].id;-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")});else{var e=i.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,l(i.element).is("option"))return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n].id;r!==i.id&&-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(r,e){var i=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(r,t);null!==n&&i.push(n)}}),e({results:i})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),r=this._normalizeItem(e);return r.element=t,a.StoreData(t,"data",r),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),r=[],i=0;i<n.length;i++){var o=l(n[i]),s=this.item(o);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return f.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),r=n.map(function(){return t.item(g(this)).id}).get(),i=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,r)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}i.push(p)}}return i},r}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var r=o.ajax(e);return r.then(t),r.fail(n),r}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,r){var i=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=i.processResults(e,n);i.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),r(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||i.trigger("results:message",{message:"errorLoading"})});i._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var r=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(r))for(var s=0;s<r.length;s++){var a=r[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var r=t.results,i=0;i<r.length;i++){var o=r[i],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=r,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(r,a)}t.results=r,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var i=this;t.term=t.term||"";var r=this.tokenizer(t,this.options,function(e){var t,n=i._normalizeItem(e);if(!i.$element.find("option").filter(function(){return d(this).val()===n.id}).length){var r=i.option(n);r.attr("data-select2-tag",!0),i._removeOldTags(),i.addOptions([r])}t=n,i.trigger("select",{data:t})});r.term!==t.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.trigger("focus")),t.term=r.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,r){for(var i=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,i)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(r(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0<r.maximumSelectionLength&&t>=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-s,u=l>i.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=o.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(c,u,d,p,h,f,g,m,v,y,s,t,_,$,b,w,A,x,D,S,E,C,O,T,q,L,I,j,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=b:null!=e.data?e.dataAdapter=$:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,w)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,I))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=E;else{var r=y.Decorate(E,C);e.dropdownAdapter=r}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var i=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,i)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var r=c.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&r.children.splice(i,1);return 0<r.children.length?r:e(t,r)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,i=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],r=0;r<t.length;r++)if(n.push(t[r]),"string"==typeof t[r]&&0<t[r].indexOf("-")){var i=t[r].split("-")[0];n.push(i)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,r=0;r<e.length;r++){var i=new s,o=e[r];if("string"==typeof o)try{i=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=c.isPlainObject(o)?new s(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var r=y._convertData(n);c.extend(!0,this.defaults,r)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(r,d,i,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=i.applyFromElement(this.options,t)),this.options=i.apply(this.options),t&&t.is("input")){var n=r(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function r(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,r)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(o,c,u,r){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var i=this.render();this._placeContainer(i);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,i);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,i);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return i<=0?"auto":i+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){t._syncA(),t._syncS(null,e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,r=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===o.inArray(e,r)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===r.ESC||t===r.TAB||t===r.UP&&e.altKey?(n.close(e),e.preventDefault()):t===r.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===r.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===r.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===r.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===r.ENTER||t===r.SPACE||t===r.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){t.addedNodes[i].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length?n=!0:o.isArray(t)&&o.each(t,function(e,t){if(r._isChangeMutation(e,t))return!(n=!0)});else n=!0;return n}},d.prototype._syncSubtree=function(e,t){var n=this._isChangeMutation(e,t),r=this;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var i=r[e],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];o.isArray(t)&&(t=o.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},d.prototype.render=function(){var e=o('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1<i.inArray(t,a)?this:n}}return null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return u.fn.select2.amd=e,t});;
|
7 |
-
/**
|
8 |
-
* Validation for fields
|
9 |
-
* @constructor
|
10 |
-
*/
|
11 |
-
function Wpcf7_admin_validations($){
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
-
var wpcf7_redirect_admin;
|
55 |
-
|
56 |
-
(function ($) {
|
57 |
-
function Wpcf7_redirect_admin() {
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Initialize the class
|
61 |
-
* @return {[type]} [description]
|
62 |
-
*/
|
63 |
-
this.init = function () {
|
64 |
-
this.setparams();
|
65 |
-
//set hooks for handling the redirect settings tab
|
66 |
-
this.admin_field_handlers();
|
67 |
-
//set hooks
|
68 |
-
this.register_action_hooks();
|
69 |
-
//hide select options
|
70 |
-
this.hide_select_options();
|
71 |
-
//init drag and drop features
|
72 |
-
this.init_draggable();
|
73 |
-
this.renumber_rows();
|
74 |
-
this.admin_validations = new Wpcf7_admin_validations($);
|
75 |
-
this.init_select2();
|
76 |
-
|
77 |
-
this.init_media_field();
|
78 |
-
this.init_colorpickers();
|
79 |
-
this.mark_default_select_fields();
|
80 |
-
};
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Avoid alert while trying to leave page
|
84 |
-
*/
|
85 |
-
this.mark_default_select_fields = function () {
|
86 |
-
$('.action-container select').each(function () {
|
87 |
-
if ($(this).val() === 0 || !$(this).val()) {
|
88 |
-
$(this).find('option:first-child').prop('selected', 'selected')
|
89 |
-
}
|
90 |
-
})
|
91 |
-
}
|
92 |
-
|
93 |
-
this.
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
this.
|
110 |
-
this.
|
111 |
-
this.
|
112 |
-
this.
|
113 |
-
this.
|
114 |
-
this.
|
115 |
-
this.
|
116 |
-
this.
|
117 |
-
this.
|
118 |
-
this.
|
119 |
-
this.
|
120 |
-
this.
|
121 |
-
this.
|
122 |
-
this.
|
123 |
-
this.
|
124 |
-
this.
|
125 |
-
this.
|
126 |
-
this.
|
127 |
-
this.
|
128 |
-
this.
|
129 |
-
this.
|
130 |
-
this.
|
131 |
-
this.
|
132 |
-
this.
|
133 |
-
this.
|
134 |
-
this.
|
135 |
-
this.
|
136 |
-
this.
|
137 |
-
this.
|
138 |
-
this.
|
139 |
-
this.
|
140 |
-
this.
|
141 |
-
this.
|
142 |
-
this.
|
143 |
-
this.
|
144 |
-
this.
|
145 |
-
this.
|
146 |
-
this.
|
147 |
-
this.
|
148 |
-
this.
|
149 |
-
this.
|
150 |
-
this.
|
151 |
-
this.
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
var
|
224 |
-
if (
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
//
|
305 |
-
$(document.body).on('click', this.
|
306 |
-
//
|
307 |
-
$(document.body).on('click', this.
|
308 |
-
//
|
309 |
-
$(document.body).on('click', this.
|
310 |
-
//
|
311 |
-
$(document.body).on('click', this.
|
312 |
-
//
|
313 |
-
$(document.body).on('click', this.
|
314 |
-
//
|
315 |
-
$(document.body).on('click', this.
|
316 |
-
//
|
317 |
-
$(document.body).on('
|
318 |
-
//
|
319 |
-
$(document.body).on('
|
320 |
-
//
|
321 |
-
$(document.body).on('click', this.
|
322 |
-
//
|
323 |
-
$(document.body).on('click', this.
|
324 |
-
//
|
325 |
-
$(document.body).on('
|
326 |
-
//
|
327 |
-
$(document.body).on('
|
328 |
-
//
|
329 |
-
$(document.body).on('
|
330 |
-
//
|
331 |
-
$(document.body).on('click', this.
|
332 |
-
//
|
333 |
-
$(document.body).on('
|
334 |
-
//
|
335 |
-
$(document.body).on('
|
336 |
-
//
|
337 |
-
$(document.body).on('
|
338 |
-
//
|
339 |
-
$(document.body).on('click', this.
|
340 |
-
//
|
341 |
-
$(document.body).on('
|
342 |
-
//
|
343 |
-
$(document.body).on('
|
344 |
-
//
|
345 |
-
$(document.body).on('click', this.
|
346 |
-
//
|
347 |
-
$(document.body).on('click', this.
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
//
|
358 |
-
$(document.body).on('
|
359 |
-
//
|
360 |
-
$(document.body).on('click', this.
|
361 |
-
//
|
362 |
-
$(document.body).on('click', this.
|
363 |
-
//
|
364 |
-
$(document.body).on('
|
365 |
-
//
|
366 |
-
$(document.body).on('click', this.
|
367 |
-
//
|
368 |
-
$(document.body).on('click', this.
|
369 |
-
//
|
370 |
-
$(document.body).on('click', this.
|
371 |
-
//
|
372 |
-
$(document.body).on('click', this.
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
*
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
this.
|
502 |
-
}
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
}
|
513 |
-
|
514 |
-
this.
|
515 |
-
|
516 |
-
var $clicked_button = $(e.currentTarget);
|
517 |
-
var $
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
var
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
$clicked_button
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
$
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
$('.
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
*
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
$
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
}
|
702 |
-
|
703 |
-
/**
|
704 |
-
*
|
705 |
-
* @param {[type]} [action== '
|
706 |
-
* @return {[type]} [description]
|
707 |
-
*/
|
708 |
-
if ('
|
709 |
-
$action_wrap = $('[data-actionid=' + params.action_id + ']');
|
710 |
-
$
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
} else {
|
716 |
-
$
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
$
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
$
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
$
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
*
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
$
|
837 |
-
$
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
*
|
843 |
-
* @
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
var
|
850 |
-
$
|
851 |
-
$
|
852 |
-
$
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
*
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
$clicked_button.
|
866 |
-
$
|
867 |
-
$
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
*
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
$clicked_button
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
*
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
$
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
this.
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
*
|
968 |
-
* @
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
this.
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
if (checked) {
|
1014 |
-
$(this).
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
*
|
1060 |
-
*/
|
1061 |
-
this.
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
}
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1112 |
})(jQuery);
|
1113 |
-
jQuery(document).ready(function () {
|
1114 |
-
set_event_listeneres();
|
1115 |
-
disply_updates_marks();
|
1116 |
-
});
|
1117 |
-
|
1118 |
-
function disply_updates_marks() {
|
1119 |
-
var update_count = jQuery('.extensions-list .has-update').length;
|
1120 |
-
if (update_count) {
|
1121 |
-
jQuery('li#extensions-panel-tab a').append(' <span class="update-plugins wpcf7r-update-extensions"><span class="plugin-count">' + update_count + '</span></span>');
|
1122 |
-
}
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
function set_event_listeneres() {
|
1126 |
-
activate_serial_handler();
|
1127 |
-
close_promo_box();
|
1128 |
-
serial_activation_handler();
|
1129 |
-
extension_deactivate_handler();
|
1130 |
-
extension_update_handler();
|
1131 |
-
}
|
1132 |
-
|
1133 |
-
function extension_update_handler() {
|
1134 |
-
jQuery('.extensions').on('click', '.promo-box .btn-update', function (e) {
|
1135 |
-
e.preventDefault();
|
1136 |
-
$extension = jQuery(this).parents('.promo-box');
|
1137 |
-
show_extension_loader($extension);
|
1138 |
-
update_wpcf7r_extension($extension);
|
1139 |
-
});
|
1140 |
-
}
|
1141 |
-
|
1142 |
-
function activate_serial_handler() {
|
1143 |
-
jQuery('.extensions').on('click', '.promo-box .btn-activate', function (e) {
|
1144 |
-
e.preventDefault();
|
1145 |
-
jQuery(this).parents('.promo-box').find('.serial').addClass('open');
|
1146 |
-
});
|
1147 |
-
}
|
1148 |
-
|
1149 |
-
function close_promo_box() {
|
1150 |
-
jQuery('.extensions').on('click', '.promo-box .btn-close', function (e) {
|
1151 |
-
e.preventDefault();
|
1152 |
-
jQuery(this).parents('.promo-box').find('.serial').removeClass('open');
|
1153 |
-
});
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
function serial_activation_handler() {
|
1157 |
-
jQuery('.extensions').on('click', '.promo-box .btn-activate-serial', function (e) {
|
1158 |
-
e.preventDefault();
|
1159 |
-
$extension = jQuery(this).parents('.promo-box');
|
1160 |
-
var serial = $extension.find('.serial-number').val();
|
1161 |
-
if (!serial) {
|
1162 |
-
$extension.find('.serial-number').addClass('err');
|
1163 |
-
return false;
|
1164 |
-
}
|
1165 |
-
$extension.find('.serial-number').removeClass('err');
|
1166 |
-
show_extension_loader($extension);
|
1167 |
-
activate_extension($extension, serial);
|
1168 |
-
});
|
1169 |
-
}
|
1170 |
-
|
1171 |
-
function extension_deactivate_handler() {
|
1172 |
-
jQuery('.extensions').on('click', '.promo-box .btn-deactivate', function (e) {
|
1173 |
-
e.preventDefault();
|
1174 |
-
$extension = jQuery(this).parents('.promo-box');
|
1175 |
-
show_extension_loader($extension);
|
1176 |
-
deactivate_plugin_license($extension);
|
1177 |
-
});
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
function show_extension_loader($extension) {
|
1181 |
-
$extension.append('<div class="wpcf7r_loader active"></div>');
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
function deactivate_plugin_license($extension) {
|
1185 |
-
var extension_name = $extension.data('extension');
|
1186 |
-
|
1187 |
-
jQuery.ajax({
|
1188 |
-
type: "post",
|
1189 |
-
dataType: "json",
|
1190 |
-
url: ajaxurl,
|
1191 |
-
data: {
|
1192 |
-
action: "deactivate_wpcf7r_extension",
|
1193 |
-
extension_name: extension_name
|
1194 |
-
},
|
1195 |
-
success: function (response) {
|
1196 |
-
console.log(response);
|
1197 |
-
if (typeof response.error != 'undefined') {
|
1198 |
-
jQuery('.actions').after('<div class="err">' + response.error + '</div>');
|
1199 |
-
} else if (typeof response.extension_html != 'undefined') {
|
1200 |
-
$extension.replaceWith(response.extension_html);
|
1201 |
-
}
|
1202 |
-
remove_extension_loader();
|
1203 |
-
}
|
1204 |
-
});
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
function remove_extension_loader() {
|
1208 |
-
jQuery('.wpcf7r_loader').remove();
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
function update_wpcf7r_extension($extension) {
|
1212 |
-
var extension_name = $extension.data('extension');
|
1213 |
-
|
1214 |
-
jQuery.ajax({
|
1215 |
-
type: "post",
|
1216 |
-
dataType: "json",
|
1217 |
-
url: ajaxurl,
|
1218 |
-
data: {
|
1219 |
-
action: "wpcf7r_extension_update",
|
1220 |
-
extension_name: extension_name
|
1221 |
-
},
|
1222 |
-
success: function (response) {
|
1223 |
-
if (response.extension_html != 'undefined' && response.extension_html) {
|
1224 |
-
$extension.replaceWith(response.extension_html);
|
1225 |
-
} else if (typeof response.error != 'undefined' && response.error) {
|
1226 |
-
jQuery('.actions').after('<div class="err">' + response.error + '</div>');
|
1227 |
-
}
|
1228 |
-
remove_extension_loader();
|
1229 |
-
}
|
1230 |
-
});
|
1231 |
-
}
|
1232 |
-
|
1233 |
-
function activate_extension($extension, serial) {
|
1234 |
-
var extension_name = $extension.data('extension');
|
1235 |
-
|
1236 |
-
jQuery.ajax({
|
1237 |
-
type: "post",
|
1238 |
-
dataType: "json",
|
1239 |
-
url: ajaxurl,
|
1240 |
-
data: {
|
1241 |
-
action: "activate_wpcf7r_extension",
|
1242 |
-
extension_name: extension_name,
|
1243 |
-
serial: serial
|
1244 |
-
},
|
1245 |
-
success: function (response) {
|
1246 |
-
if (response.extension_html != 'undefined' && response.extension_html) {
|
1247 |
-
$extension.replaceWith(response.extension_html);
|
1248 |
-
window.location.reload();
|
1249 |
-
} else if (typeof response.error != 'undefined' && response.error) {
|
1250 |
-
$extension.find('.err').remove();
|
1251 |
-
$extension.append('<div class="err">' + response.error + '</div>');
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
remove_extension_loader();
|
1255 |
-
}
|
1256 |
-
});
|
1257 |
}
|
4 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,c){var e=a.port;"abort"===a.mode&&(d[e]&&d[e].abort(),d[e]=c)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(d[f]&&d[f].abort(),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a});
|
5 |
/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
6 |
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),--u;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;--u){if(r=n.slice(0,u).join("/"),h)for(d=h.length;0<d;--d)if(i=(i=f[h.slice(0,d).join("/")])&&i[r]){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function D(e){if(w(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!w(m,e)&&!w(_,e))throw new Error("No "+e);return m[e]}function c(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?c(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},i=Object.prototype.hasOwnProperty,a=[].slice,b=/\.js$/,f=function(e,t){var n,r,i=c(e),o=i[0],s=t[1];return e=i[1],o&&(n=D(o=l(o,s))),o?e=n&&n.normalize?n.normalize(e,(r=s,function(e){return l(e,r)})):l(e,s):(o=(i=c(e=l(e,s)))[0],e=i[1],o&&(n=D(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},o=function(e,t,n,r){var i,o,s,a,l,c,u,d=[],p=typeof n;if(c=S(r=r||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)i=d[l]=g.module(e);else if(w(m,o)||w(v,o)||w(_,o))d[l]=D(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(r,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(i&&i.exports!==h&&i.exports!==m[e]?m[e]=i.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,r,i){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=r,r=i),r?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),w(m,e)||w(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=r),e.define("almond",function(){}),e.define("jquery",[],function(){var e=u||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),e.define("select2/utils",["jquery"],function(o){var i={};function u(e){var t=e.prototype,n=[];for(var r in t){"function"==typeof t[r]&&"constructor"!==r&&n.push(r)}return n}i.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var i in t)n.call(t,i)&&(e[i]=t[i]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},i.Decorate=function(r,i){var e=u(i),t=u(r);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=r.prototype.constructor;0<t&&(e.call(arguments,r.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=r.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=r.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},i.Observable=e,i.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},i.hasScroll=function(e,t){var n=o(t),r=t.style.overflowX,i=t.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},i.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},r.prototype.position=function(e,t){t.find(".select2-results").append(e)},r.prototype.sort=function(e){return this.options.get("sorter")(e)},r.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},r.prototype.setClasses=function(){var t=this;this.data.current(function(e){var r=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,r)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},r.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},r.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},r.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},r=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=e.element&&r.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[i];t.setAttribute(i,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):i<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,r=0<e.deltaY&&t-e.deltaY<=0,i=e.deltaY<0&&n<=l.$results.height();r?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},r.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},r.prototype.destroy=function(){this.$results.remove()},r.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,r=e.offset().top,i=this.$results.scrollTop()+(r-n),o=r-n;i-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=this.selectionContainer(),o=this.display(r,i);i.append(o);var s=r.title||r.text;s&&i.attr("title",s),l.StoreData(i[0],"data",r),t.push(i)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,r,a){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var r=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=r.DELETE&&t.which!=r.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),r=i('<span class="select2-selection__clear" title="'+n()+'">×</span>');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");r.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){r.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?r.$selection.off("input.search input.searchcheck"):r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)r.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&r.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,i)){t=t||{};var n=s.Event("select2:"+e,{params:t});r.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function r(e){this.dict=e||{}}return r.prototype.all=function(){return this.dict},r.prototype.get=function(e){return this.dict[e]},r.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},r._cache={},r.loadPath=function(e){if(!(e in r._cache)){var t=n(e);r._cache[e]=t}return new r(r._cache[e])},r}),e.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(r){function n(e,t){n.__super__.constructor.call(this)}return r.Extend(n,r.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=r.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+r.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],r=this;this.$element.find(":selected").each(function(){var e=l(this),t=r.item(e);n.push(t)}),e(n)},n.prototype.select=function(i){var o=this;if(i.selected=!0,l(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var r=i[n].id;-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")});else{var e=i.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,l(i.element).is("option"))return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n].id;r!==i.id&&-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(r,e){var i=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(r,t);null!==n&&i.push(n)}}),e({results:i})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),r=this._normalizeItem(e);return r.element=t,a.StoreData(t,"data",r),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),r=[],i=0;i<n.length;i++){var o=l(n[i]),s=this.item(o);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return f.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),r=n.map(function(){return t.item(g(this)).id}).get(),i=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,r)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}i.push(p)}}return i},r}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var r=o.ajax(e);return r.then(t),r.fail(n),r}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,r){var i=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=i.processResults(e,n);i.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),r(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||i.trigger("results:message",{message:"errorLoading"})});i._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var r=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(r))for(var s=0;s<r.length;s++){var a=r[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var r=t.results,i=0;i<r.length;i++){var o=r[i],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=r,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(r,a)}t.results=r,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var i=this;t.term=t.term||"";var r=this.tokenizer(t,this.options,function(e){var t,n=i._normalizeItem(e);if(!i.$element.find("option").filter(function(){return d(this).val()===n.id}).length){var r=i.option(n);r.attr("data-select2-tag",!0),i._removeOldTags(),i.addOptions([r])}t=n,i.trigger("select",{data:t})});r.term!==t.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.trigger("focus")),t.term=r.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,r){for(var i=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,i)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(r(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0<r.maximumSelectionLength&&t>=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-s,u=l>i.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=o.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(c,u,d,p,h,f,g,m,v,y,s,t,_,$,b,w,A,x,D,S,E,C,O,T,q,L,I,j,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=b:null!=e.data?e.dataAdapter=$:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,w)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,I))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=E;else{var r=y.Decorate(E,C);e.dropdownAdapter=r}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var i=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,i)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var r=c.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&r.children.splice(i,1);return 0<r.children.length?r:e(t,r)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,i=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],r=0;r<t.length;r++)if(n.push(t[r]),"string"==typeof t[r]&&0<t[r].indexOf("-")){var i=t[r].split("-")[0];n.push(i)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,r=0;r<e.length;r++){var i=new s,o=e[r];if("string"==typeof o)try{i=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=c.isPlainObject(o)?new s(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var r=y._convertData(n);c.extend(!0,this.defaults,r)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(r,d,i,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=i.applyFromElement(this.options,t)),this.options=i.apply(this.options),t&&t.is("input")){var n=r(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function r(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,r)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(o,c,u,r){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var i=this.render();this._placeContainer(i);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,i);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,i);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return i<=0?"auto":i+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){t._syncA(),t._syncS(null,e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,r=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===o.inArray(e,r)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===r.ESC||t===r.TAB||t===r.UP&&e.altKey?(n.close(e),e.preventDefault()):t===r.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===r.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===r.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===r.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===r.ENTER||t===r.SPACE||t===r.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){t.addedNodes[i].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length?n=!0:o.isArray(t)&&o.each(t,function(e,t){if(r._isChangeMutation(e,t))return!(n=!0)});else n=!0;return n}},d.prototype._syncSubtree=function(e,t){var n=this._isChangeMutation(e,t),r=this;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var i=r[e],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];o.isArray(t)&&(t=o.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},d.prototype.render=function(){var e=o('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1<i.inArray(t,a)?this:n}}return null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return u.fn.select2.amd=e,t});;
|
7 |
+
/**
|
8 |
+
* Validation for fields
|
9 |
+
* @constructor
|
10 |
+
*/
|
11 |
+
function Wpcf7_admin_validations($){
|
12 |
+
|
13 |
+
this.rules = {
|
14 |
+
|
15 |
+
rules: {
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
};
|
20 |
+
|
21 |
+
this.init = function(){
|
22 |
+
|
23 |
+
this.addMethods();
|
24 |
+
|
25 |
+
$('#wpcf7-contact-form-editor form').validate({
|
26 |
+
|
27 |
+
rules: this.rules,
|
28 |
+
|
29 |
+
onfocusout: function(element) {
|
30 |
+
|
31 |
+
this.element(element);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
});
|
36 |
+
|
37 |
+
};
|
38 |
+
|
39 |
+
this.addMethods = function(){
|
40 |
+
|
41 |
+
this.nospaces();
|
42 |
+
|
43 |
+
this.englishAndNumbersOnly();
|
44 |
+
|
45 |
+
};
|
46 |
+
|
47 |
+
/**
|
48 |
+
|
49 |
+
* Allow only enlish and numbers
|
50 |
+
|
51 |
+
* @return {[type]} [description]
|
52 |
+
|
53 |
+
*/
|
54 |
+
|
55 |
+
this.englishAndNumbersOnly = function(){
|
56 |
+
|
57 |
+
$.validator.addMethod("validateenglishnumbers", function(value, element) {
|
58 |
+
|
59 |
+
return this.optional(element) || /^[a-z0-9_\-," "]+$/i.test(value);
|
60 |
+
|
61 |
+
}, "English and numbers only");
|
62 |
+
|
63 |
+
$.validator.addClassRules("validateenglishnumbers", {
|
64 |
+
|
65 |
+
validateenglishnumbers: true
|
66 |
+
|
67 |
+
});
|
68 |
+
|
69 |
+
};
|
70 |
+
|
71 |
+
/**
|
72 |
+
|
73 |
+
* Disallow spaces
|
74 |
+
|
75 |
+
*/
|
76 |
+
|
77 |
+
this.nospaces = function(){
|
78 |
+
|
79 |
+
$.validator.addMethod("validatenospace", function(value, element) {
|
80 |
+
|
81 |
+
return value.indexOf(" ") < 0 && value != "";
|
82 |
+
|
83 |
+
}, "No spaces please");
|
84 |
+
|
85 |
+
$.validator.addClassRules("validatenospace", {
|
86 |
+
|
87 |
+
validatenospace: true
|
88 |
+
|
89 |
+
});
|
90 |
+
|
91 |
+
};
|
92 |
+
|
93 |
+
this.init();
|
94 |
+
|
95 |
}
|
96 |
+
var wpcf7_redirect_admin;
|
97 |
+
|
98 |
+
(function ($) {
|
99 |
+
function Wpcf7_redirect_admin() {
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Initialize the class
|
103 |
+
* @return {[type]} [description]
|
104 |
+
*/
|
105 |
+
this.init = function () {
|
106 |
+
this.setparams();
|
107 |
+
//set hooks for handling the redirect settings tab
|
108 |
+
this.admin_field_handlers();
|
109 |
+
//set hooks
|
110 |
+
this.register_action_hooks();
|
111 |
+
//hide select options
|
112 |
+
this.hide_select_options();
|
113 |
+
//init drag and drop features
|
114 |
+
this.init_draggable();
|
115 |
+
this.renumber_rows();
|
116 |
+
this.admin_validations = new Wpcf7_admin_validations($);
|
117 |
+
this.init_select2();
|
118 |
+
|
119 |
+
this.init_media_field();
|
120 |
+
this.init_colorpickers();
|
121 |
+
this.mark_default_select_fields();
|
122 |
+
};
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Avoid alert while trying to leave page
|
126 |
+
*/
|
127 |
+
this.mark_default_select_fields = function () {
|
128 |
+
$('.action-container select').each(function () {
|
129 |
+
if ($(this).val() === 0 || !$(this).val()) {
|
130 |
+
$(this).find('option:first-child').prop('selected', 'selected')
|
131 |
+
}
|
132 |
+
})
|
133 |
+
}
|
134 |
+
|
135 |
+
this.init_editors = function($editor_action_wrap){
|
136 |
+
if( 'undefined' !== typeof tinymce){
|
137 |
+
editor_id = $editor_action_wrap.find('textarea').prop('id');
|
138 |
+
|
139 |
+
tinymce.init(tinyMCEPreInit.mceInit[editor_id]);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
this.init_colorpickers = function () {
|
143 |
+
$('input.colorpicker').addClass('rendered').wpColorPicker();
|
144 |
+
}
|
145 |
+
|
146 |
+
this.setparams = function () {
|
147 |
+
/**
|
148 |
+
* Define jquery selectors
|
149 |
+
* @type {String}
|
150 |
+
*/
|
151 |
+
this.banner_selector = '.wpcfr-banner-holder';
|
152 |
+
this.add_and_selector = '.add-condition';
|
153 |
+
this.row_template_selector = '.row-template';
|
154 |
+
this.remove_and_selector = '.qs-condition-actions .dashicons-minus';
|
155 |
+
this.add_group_button_selector = '.wpcfr-add-group';
|
156 |
+
this.rule_group_selector = '.wpcfr-rule-group';
|
157 |
+
this.edit_block_title_selector = '.conditional-group-titles .dashicons-edit';
|
158 |
+
this.cancel_block_title_selector = '.conditional-group-titles .dashicons-no';
|
159 |
+
this.save_block_title_edit_selector = '.conditional-group-titles .dashicons-yes';
|
160 |
+
this.tab_title_all_selector = '.block-title';
|
161 |
+
this.tab_title_selector = '.block-title:not(.edit)';
|
162 |
+
this.tab_title_active_selector = '.block-title.active';
|
163 |
+
this.active_tab_selector = '.conditional-group-block.active';
|
164 |
+
this.tab_inner_title = '.conditional-group-block-title';
|
165 |
+
this.new_block_counter = 1;
|
166 |
+
this.add_block_button_selector = '.wpcf7r-add-block';
|
167 |
+
this.blocks_container_selector = '.conditional-group-blocks';
|
168 |
+
this.remove_block_button_selector = '.remove-block';
|
169 |
+
this.group_row_value_select_selector = '.group_row_value_select';
|
170 |
+
this.group_select_field_selector = '.wpcf7r-fields';
|
171 |
+
this.open_tab_selector = '#redirect-panel h3[data-tab-target]';
|
172 |
+
this.show_action_selector = '.actions-list .edit a';
|
173 |
+
this.move_action_to_trash_selector = '.actions-list .row-actions .trash a';
|
174 |
+
this.move_lead_to_trash_selector = '.leads-list .trash a';
|
175 |
+
this.add_new_action_selector = '.wpcf7-add-new-action';
|
176 |
+
this.custom_checkbox_selector = '.wpcf7r-checkbox input';
|
177 |
+
this.action_title_field = '.wpcf7-redirect-post-title-fields';
|
178 |
+
this.migrate_from_cf7_api_selector = '.migrate-from-send-to-api';
|
179 |
+
this.migrate_from_cf7_redirect_selector = '.migrate-from-redirection';
|
180 |
+
this.json_textarea_selector = '.json-container';
|
181 |
+
this.butify_button_selector = '.wpcf7-redirect-butify';
|
182 |
+
this.add_repeater_field_selector = '.qs-repeater-action .dashicons-plus';
|
183 |
+
this.remove_repeater_field_selector = '.qs-repeater-action .dashicons-minus';
|
184 |
+
this.api_test_button_selector = '.wpcf7-redirect-test_button-fields';
|
185 |
+
this.toggler_handler_selector = '.actions-list [data-toggle] input';
|
186 |
+
this.mailchimp_get_lists = '.wpcf7-redirect-get_mailchimp_lists-fields';
|
187 |
+
this.mailchimp_create_list = '.wpcf7-redirect-create_list-fields';
|
188 |
+
this.mailchimp_list_selector = '.field-wrap-mailchimp_list_id select';
|
189 |
+
this.tab_actions_selector = '[href="#redirect-panel"]';
|
190 |
+
this.pro_banner_submit_btn_selector = '.btn-rp-submit';
|
191 |
+
this.pro_banner_user_email_selecttor = '[name="rp_user_email"]';
|
192 |
+
this.pro_banner_close_selector = '.rp-close';
|
193 |
+
this.new_group_counter = 0;
|
194 |
+
this.migrate_again_class = '.migrate_again';
|
195 |
+
this.reset_all_button = '.cf7-redirect-reset';
|
196 |
+
this.new_row_counter = 0;
|
197 |
+
this.notice_dismiss_selector = '.wpcf7r-notice .notice-dismiss';
|
198 |
+
this.mail_tags_toggle = '.mail-tags-title';
|
199 |
+
this.validate_salesforce_app_details = '.wpcf7-redirect-validate_connection-fields';
|
200 |
+
this.debug_import_button_selector = '.reacreate-from-debug';
|
201 |
+
this.debug_send_button_selector = '.send-debug-info'
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Initialize Select 2 fields
|
206 |
+
*/
|
207 |
+
this.init_select2 = function (e) {
|
208 |
+
$('.select2-field select:not(.rendered)').each(function () {
|
209 |
+
var options = {
|
210 |
+
width: 'resolve'
|
211 |
+
};
|
212 |
+
$('.select2-field select:not(.rendered)').select2(options).addClass('rendered');
|
213 |
+
});
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Init wp media uploader
|
218 |
+
*/
|
219 |
+
this.init_media_field = function () {
|
220 |
+
var $imgContainer, imgIdInput = '';
|
221 |
+
|
222 |
+
if (typeof wp.media == 'undefined') {
|
223 |
+
console.log('no media support');
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
|
227 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
228 |
+
frame: 'post',
|
229 |
+
state: 'insert',
|
230 |
+
multiple: false
|
231 |
+
});
|
232 |
+
|
233 |
+
file_frame.on('insert', function (e) {
|
234 |
+
// Get media attachment details from the frame state
|
235 |
+
var attachment = file_frame.state().get('selection').first().toJSON();
|
236 |
+
$imgContainer.find('.popup-image').remove();
|
237 |
+
// Send the attachment URL to our custom image input field.
|
238 |
+
$imgContainer.prepend('<img src="' + attachment.url + '" alt="" style="max-width:100px;" class="popup-image"/>');
|
239 |
+
// Send the attachment id to our hidden input
|
240 |
+
imgIdInput.val(attachment.url).change();
|
241 |
+
});
|
242 |
+
|
243 |
+
$(document.body).on('click', '.image-uploader-btn', function () {
|
244 |
+
imgIdInput = $(this).parent().find('input[type=hidden]');
|
245 |
+
$imgContainer = $(this).parent();
|
246 |
+
file_frame.open();
|
247 |
+
});
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Beutify the user input (XML/JSON)
|
252 |
+
* @param {[type]} e [description]
|
253 |
+
* @return {[type]} [description]
|
254 |
+
*/
|
255 |
+
this.beutify_json_and_css = function (e) {
|
256 |
+
e.preventDefault();
|
257 |
+
$clicked_button = $(e.currentTarget);
|
258 |
+
var $parent = $clicked_button.parents('.hidden-action');
|
259 |
+
var record_type = $parent.find('.field-wrap-record_type select').val();
|
260 |
+
this.remove_errors();
|
261 |
+
var $textarea = $('textarea', $parent);
|
262 |
+
var string = $textarea.val();
|
263 |
+
try {
|
264 |
+
if (record_type == 'json') {
|
265 |
+
var json_object = jQuery.parseJSON(string);
|
266 |
+
if (json_object) {
|
267 |
+
string = JSON.stringify(json_object, null, "\t");
|
268 |
+
if (string) {
|
269 |
+
$textarea.val(string);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
} else if (record_type == 'xml') {
|
273 |
+
var xml_object = jQuery.parseXML(string);
|
274 |
+
if (xml_object) {
|
275 |
+
var xmlString = (new XMLSerializer()).serializeToString(xml_object);
|
276 |
+
$textarea.val(xmlString);
|
277 |
+
}
|
278 |
+
}
|
279 |
+
} catch (err) {
|
280 |
+
this.add_error($textarea, err);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Init sortable elements
|
286 |
+
*/
|
287 |
+
this.init_draggable = function () {
|
288 |
+
var _this = this;
|
289 |
+
|
290 |
+
$('#the_list').sortable({
|
291 |
+
'items': '.drag',
|
292 |
+
'axis': 'y',
|
293 |
+
'helper': fixHelper,
|
294 |
+
'update': function (e, ui) {
|
295 |
+
params = {
|
296 |
+
'order': $('#the_list').sortable('serialize')
|
297 |
+
};
|
298 |
+
_this.make_ajax_call('wpcf7r_set_action_menu_order', params, 'after_ajax_call');
|
299 |
+
|
300 |
+
var actionid = $(ui.item).data('actionid');
|
301 |
+
|
302 |
+
$(ui.item).after($('.action-container[data-actionid=' + actionid + ']'));
|
303 |
+
_this.renumber_rows();
|
304 |
+
}
|
305 |
+
});
|
306 |
+
|
307 |
+
var fixHelper = function (e, ui) {
|
308 |
+
ui.children().children().each(function () {
|
309 |
+
$(this).width($(this).width());
|
310 |
+
});
|
311 |
+
return ui;
|
312 |
+
};
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Replace or add query parameter to url
|
317 |
+
*/
|
318 |
+
this.replace_query_var = function (uri, key, value) {
|
319 |
+
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
320 |
+
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
321 |
+
if (uri.match(re)) {
|
322 |
+
return uri.replace(re, '$1' + key + "=" + value + '$2');
|
323 |
+
}
|
324 |
+
else {
|
325 |
+
return uri + separator + key + "=" + value;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* A callback used to rearange numbering after sort
|
331 |
+
* @return {[type]} [description]
|
332 |
+
*/
|
333 |
+
this.renumber_rows = function () {
|
334 |
+
numbering = 1;
|
335 |
+
$('#the_list tr .num').each(function () {
|
336 |
+
$(this).html(numbering);
|
337 |
+
numbering++;
|
338 |
+
});
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Register all the event handlers
|
343 |
+
* @return {[type]} [description]
|
344 |
+
*/
|
345 |
+
this.register_action_hooks = function () {
|
346 |
+
//connect event handler for close banner button click
|
347 |
+
$(document.body).on('click', this.banner_selector + ' .close-banner', this.close_banner.bind(this));
|
348 |
+
//add and rule
|
349 |
+
$(document.body).on('click', this.add_and_selector, this.add_and_row.bind(this));
|
350 |
+
//remove rule
|
351 |
+
$(document.body).on('click', this.remove_and_selector, this.remove_and_row.bind(this));
|
352 |
+
//add group
|
353 |
+
$(document.body).on('click', this.add_group_button_selector, this.add_new_group.bind(this));
|
354 |
+
//edit group block title
|
355 |
+
$(document.body).on('click', this.edit_block_title_selector, this.edit_block_title.bind(this));
|
356 |
+
//cancel group block title change
|
357 |
+
$(document.body).on('click', this.cancel_block_title_selector, this.cancel_block_title_edit.bind(this));
|
358 |
+
//save group block title change
|
359 |
+
$(document.body).on('click', this.save_block_title_edit_selector, this.save_block_title_edit.bind(this));
|
360 |
+
//change tab
|
361 |
+
$(document.body).on('click', this.tab_title_selector, this.switch_tab.bind(this));
|
362 |
+
//add a new rule block
|
363 |
+
$(document.body).on('click', this.add_block_button_selector, this.add_new_block.bind(this));
|
364 |
+
//remove block button
|
365 |
+
$(document.body).on('click', this.remove_block_button_selector, this.remove_block.bind(this));
|
366 |
+
//set select value
|
367 |
+
$(document.body).on('change', this.group_row_value_select_selector, this.set_select_value.bind(this));
|
368 |
+
//set select value
|
369 |
+
$(document.body).on('change', this.group_select_field_selector, this.show_field_options.bind(this));
|
370 |
+
//show/hide tabs
|
371 |
+
$(document.body).on('click', this.open_tab_selector, this.show_hide_tab.bind(this));
|
372 |
+
//show action
|
373 |
+
$(document.body).on('click', this.show_action_selector, this.show_hide_action.bind(this));
|
374 |
+
//move action to trash
|
375 |
+
$(document.body).on('click', this.move_action_to_trash_selector, this.move_post_to_trash.bind(this));
|
376 |
+
//move lead to trash
|
377 |
+
$(document.body).on('click', this.move_lead_to_trash_selector, this.move_post_to_trash.bind(this));
|
378 |
+
//after ajax call handler
|
379 |
+
$(document.body).on('wpcf7r_after_ajax_call', this.after_ajax_call.bind(this));
|
380 |
+
//add new action
|
381 |
+
$(document.body).on('click', this.add_new_action_selector, this.add_new_action.bind(this));
|
382 |
+
//checkbox change event
|
383 |
+
$(document.body).on('change', this.custom_checkbox_selector, this.checkbox_changed.bind(this));
|
384 |
+
//title change
|
385 |
+
$(document.body).on('keyup', this.action_title_field, this.action_title_field_changed.bind(this));
|
386 |
+
//migrate from wp7 api
|
387 |
+
$(document.body).on('click', this.migrate_from_cf7_api_selector, this.migrate_from_cf7_api.bind(this));
|
388 |
+
//migrate from wp7 redirect
|
389 |
+
$(document.body).on('click', this.migrate_from_cf7_redirect_selector, this.migrate_from_cf7_api.bind(this));
|
390 |
+
//butify json and xml
|
391 |
+
$(document.body).on('click', this.butify_button_selector, this.beutify_json_and_css.bind(this));
|
392 |
+
//add repeater field
|
393 |
+
$(document.body).on('click', this.add_repeater_field_selector, this.add_repeating_field.bind(this));
|
394 |
+
//remove repeater field
|
395 |
+
$(document.body).on('click', this.remove_repeater_field_selector, this.remove_repeating_field.bind(this));
|
396 |
+
//make API test
|
397 |
+
$(document.body).on('click', this.api_test_button_selector, this.make_api_test_call.bind(this));
|
398 |
+
|
399 |
+
//data toggler function
|
400 |
+
$(document.body).on('change', this.toggler_handler_selector, this.data_toggler.bind(this));
|
401 |
+
//get mailchimp lists
|
402 |
+
$(document.body).on('click', this.mailchimp_get_lists, this.mailchimp_get_lists_handler.bind(this));
|
403 |
+
//create mailchimp list
|
404 |
+
$(document.body).on('click', this.mailchimp_create_list, this.mailchimp_create_list_handler.bind(this));
|
405 |
+
//change the selected list calback
|
406 |
+
$(document.body).on('change', this.mailchimp_list_selector, this.mailchimp_list_select_handler.bind(this));
|
407 |
+
//migrate again from old plugin
|
408 |
+
$(document.body).on('click', this.migrate_again_class, this.migrate_all_forms.bind(this));
|
409 |
+
//reset all plugin settings
|
410 |
+
$(document.body).on('click', this.reset_all_button, this.reset_all_settings.bind(this));
|
411 |
+
//show pro banner
|
412 |
+
$(document.body).on('click', this.tab_actions_selector, this.show_pro_banner.bind(this));
|
413 |
+
//submit pro banner ajax request
|
414 |
+
$(document.body).on('click', this.pro_banner_submit_btn_selector, this.ajax_get_coupon.bind(this));
|
415 |
+
//submit pro banner get a coupon request when clicking enter key
|
416 |
+
$(document.body).on('keyup', this.pro_banner_user_email_selector, this.pro_banner_user_email_keyup.bind(this));
|
417 |
+
//pro banner close
|
418 |
+
$(document.body).on('click', this.pro_banner_close_selector, this.pro_banner_close.bind(this));
|
419 |
+
//toggle mail tags
|
420 |
+
$(document.body).on('click', this.mail_tags_toggle, this.toggle_mail_tags.bind(this));
|
421 |
+
//create an enviorment based on debug
|
422 |
+
$(document.body).on('click', this.debug_import_button_selector, this.import_debug.bind(this));
|
423 |
+
//send debug info
|
424 |
+
$(document.body).on('click', this.debug_send_button_selector, this.send_debug_info.bind(this));
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* show or hide mail tags section
|
429 |
+
* @param {event} e
|
430 |
+
*/
|
431 |
+
this.toggle_mail_tags = function (e) {
|
432 |
+
var $clicked_button = $(e.currentTarget);
|
433 |
+
$clicked_button.next().slideToggle('fast');
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Send debug info via api
|
438 |
+
* @param {event} e
|
439 |
+
*/
|
440 |
+
this.send_debug_info = function (e) {
|
441 |
+
e.preventDefault();
|
442 |
+
|
443 |
+
var params = {
|
444 |
+
form_id: $('#post_ID').val()
|
445 |
+
}
|
446 |
+
|
447 |
+
if ($('.approve-debug').is(':checked')) {
|
448 |
+
this.show_loader($('#debug-panel'));
|
449 |
+
|
450 |
+
this.make_ajax_call('send_debug_info', params, 'after_ajax_call');
|
451 |
+
} else {
|
452 |
+
$('.approve-debug').parent().addClass('error');
|
453 |
+
}
|
454 |
+
}
|
455 |
+
/**
|
456 |
+
* import and create forms and actions based on debug info
|
457 |
+
* @param {EVENT} e
|
458 |
+
*/
|
459 |
+
this.import_debug = function (e) {
|
460 |
+
e.preventDefault();
|
461 |
+
|
462 |
+
var $clicked_button = $(e.currentTarget);
|
463 |
+
|
464 |
+
params = {
|
465 |
+
'debug_info': $('#debug-info').val()
|
466 |
+
};
|
467 |
+
|
468 |
+
this.make_ajax_call('import_from_debug', params, 'after_ajax_call');
|
469 |
+
|
470 |
+
this.show_action_loader($clicked_button);
|
471 |
+
|
472 |
+
}
|
473 |
+
/**
|
474 |
+
* Gets the available mailchimp lists
|
475 |
+
* @param {[type]} e [description]
|
476 |
+
* @return {[type]} [description]
|
477 |
+
*/
|
478 |
+
this.mailchimp_create_list_handler = function (e) {
|
479 |
+
var $clicked_button = $(e.currentTarget);
|
480 |
+
var $parent_action = $clicked_button.parents('.action-container').first();
|
481 |
+
var list_name = prompt("Please enter list name");
|
482 |
+
if (list_name != null) {
|
483 |
+
this.mailchimp_get_lists_handler(e, list_name);
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Set the available mailchimp tags on the merge table
|
489 |
+
* @return {[type]} [description]
|
490 |
+
*/
|
491 |
+
this.mailchimp_list_select_handler = function (e) {
|
492 |
+
var $changed_element = $(e.currentTarget);
|
493 |
+
var $parent_action = $changed_element.parents('.action-container').first();
|
494 |
+
var lists = $parent_action.find('.field-wrap-mailchimp_settings').data('lists');
|
495 |
+
var selected_list = $parent_action.find(this.mailchimp_list_selector).val();
|
496 |
+
lists = this.maybe_parse_json(lists);
|
497 |
+
list_fields = lists[selected_list].list_fields;
|
498 |
+
merge_tags_selects = $parent_action.find('.field-wrap-mailchimp_key select');
|
499 |
+
$.each(merge_tags_selects, function (key, select) {
|
500 |
+
$(select).html('');
|
501 |
+
var o = '<option value="">Select field</option>';
|
502 |
+
$(select).append(o);
|
503 |
+
$.each(list_fields, function (k, v) {
|
504 |
+
var o = '<option value="' + k + '">' + v + '</option>';
|
505 |
+
$(select).append(o);
|
506 |
+
});
|
507 |
+
});
|
508 |
+
}
|
509 |
+
|
510 |
+
/**
|
511 |
+
* Try to parse the string
|
512 |
+
* OR return already json
|
513 |
+
* @param {[type]} string [description]
|
514 |
+
* @return {[type]} [description]
|
515 |
+
*/
|
516 |
+
this.maybe_parse_json = function (string) {
|
517 |
+
try {
|
518 |
+
a = JSON.parse(string);
|
519 |
+
} catch (e) {
|
520 |
+
a = string;
|
521 |
+
}
|
522 |
+
return a;
|
523 |
+
}
|
524 |
+
|
525 |
+
this.mailchimp_get_lists_handler = function (e, list_name) {
|
526 |
+
var $clicked_button = $(e.currentTarget);
|
527 |
+
var $parent_action = $clicked_button.parents('.action-container').first();
|
528 |
+
this.remove_errors();
|
529 |
+
|
530 |
+
if (!$('.wpcf7-redirect-mailchimp_api_key-fields').val()) {
|
531 |
+
this.add_error('.wpcf7-redirect-mailchimp_api_key-fields', 'Add your key and save the form');
|
532 |
+
return false;
|
533 |
+
}
|
534 |
+
|
535 |
+
this.show_action_loader($clicked_button);
|
536 |
+
|
537 |
+
params = {
|
538 |
+
'action_id': this.get_block_action_id($clicked_button),
|
539 |
+
'mailchimp_api_key': $parent_action.find('.wpcf7-redirect-mailchimp_api_key-fields').val(),
|
540 |
+
'list_name': list_name
|
541 |
+
};
|
542 |
+
|
543 |
+
this.make_ajax_call('wpcf7r_get_mailchimp_lists', params, 'after_ajax_call');
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Show ajax loader on the open action tab
|
548 |
+
* @param {[type]} $inner_element [description]
|
549 |
+
* @return {[type]} [description]
|
550 |
+
*/
|
551 |
+
this.show_action_loader = function ($inner_element) {
|
552 |
+
var $action_wrap = $inner_element.parents('.field-wrap-test_section').first();
|
553 |
+
this.show_loader($inner_element.parents('.hidden-action').first());
|
554 |
+
}
|
555 |
+
|
556 |
+
this.data_toggler = function (e) {
|
557 |
+
//prevent checkbox input from firing duplicated event but keep its original functionality
|
558 |
+
var $clicked_button = $(e.currentTarget);
|
559 |
+
var $parent_action = $clicked_button.parents('.action-container').first();
|
560 |
+
var toggle_element = $clicked_button.parents('[data-toggle]').data('toggle');
|
561 |
+
if (toggle_element) {
|
562 |
+
$parent_action.find(toggle_element).slideToggle('fast');
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
this.make_api_test_call = function (e) {
|
567 |
+
e.preventDefault();
|
568 |
+
var $clicked_button = $(e.currentTarget);
|
569 |
+
var $action_wrap = $clicked_button.parents('.field-wrap-test_section').first();
|
570 |
+
this.show_loader($clicked_button.parents('.hidden-action').first());
|
571 |
+
|
572 |
+
params = {
|
573 |
+
'action_id': $clicked_button.data('action_id'),
|
574 |
+
'cf7_id': $clicked_button.data('cf7_id'),
|
575 |
+
'rule_id': $clicked_button.data('ruleid'),
|
576 |
+
'data': $action_wrap.find('input').serialize()
|
577 |
+
};
|
578 |
+
|
579 |
+
this.make_ajax_call('wpcf7r_make_api_test', params, 'after_ajax_call');
|
580 |
+
}
|
581 |
+
|
582 |
+
this.remove_repeating_field = function (e) {
|
583 |
+
e.preventDefault();
|
584 |
+
var $clicked_button = $(e.currentTarget);
|
585 |
+
$clicked_button.parents('.qs-repeater-row').remove();
|
586 |
+
}
|
587 |
+
|
588 |
+
this.add_repeating_field = function (e) {
|
589 |
+
e.preventDefault();
|
590 |
+
var $clicked_button = $(e.currentTarget);
|
591 |
+
var $parent_element = $clicked_button.parents('[data-repeater-template]');
|
592 |
+
var next_row_count = $parent_element.find('[data-repeater-row-count]').length - 1;
|
593 |
+
next_row_count++;
|
594 |
+
var template = $parent_element.data('repeater-template');
|
595 |
+
template_html = this.replaceAll(template.template, 'new_row', next_row_count);
|
596 |
+
$parent_element.append(template_html);
|
597 |
+
$(document.body).trigger('added-repeating-row', [$parent_element]);
|
598 |
+
}
|
599 |
+
|
600 |
+
this.migrate_from_cf7_api = function (e) {
|
601 |
+
e.preventDefault();
|
602 |
+
$clicked_button = $(e.currentTarget);
|
603 |
+
this.show_loader($clicked_button.parents('.actions-list'));
|
604 |
+
params = {
|
605 |
+
'post_id': $clicked_button.data('id'),
|
606 |
+
'rule_id': $clicked_button.data('ruleid'),
|
607 |
+
'action_type': $clicked_button.data('migration-type'),
|
608 |
+
};
|
609 |
+
|
610 |
+
this.make_ajax_call('wpcf7r_add_action', params, 'after_ajax_call');
|
611 |
+
|
612 |
+
$clicked_button.fadeOut(function () {
|
613 |
+
$(this).remove();
|
614 |
+
});
|
615 |
+
}
|
616 |
+
|
617 |
+
this.action_title_field_changed = function (e) {
|
618 |
+
e.preventDefault();
|
619 |
+
$changed_title = $(e.currentTarget);
|
620 |
+
action_id = this.get_block_action_id($changed_title);
|
621 |
+
$('.primary[data-actionid="' + action_id + '"] .column-post-title').html($changed_title.val());
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* Catch checkbox change event
|
626 |
+
* @param {[type]} e [description]
|
627 |
+
* @return {[type]} [description]
|
628 |
+
*/
|
629 |
+
this.checkbox_changed = function (e) {
|
630 |
+
e.preventDefault();
|
631 |
+
$clicked_button = $(e.currentTarget);
|
632 |
+
checkbox_on = $clicked_button.is(':checked');
|
633 |
+
$parent_element = $clicked_button.parents('.hidden-action');
|
634 |
+
$field_wrap = $clicked_button.parents('.field-wrap').first();
|
635 |
+
if ($clicked_button.data('toggle-label')) {
|
636 |
+
toggle_data = $clicked_button.data('toggle-label');
|
637 |
+
jQuery.each(toggle_data, function (css_class, toggle) {
|
638 |
+
if (checkbox_on) {
|
639 |
+
string = toggle[0];
|
640 |
+
} else {
|
641 |
+
string = toggle[1];
|
642 |
+
}
|
643 |
+
$parent_element.find(css_class).html(string);
|
644 |
+
});
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Add a new action handler
|
650 |
+
* @param {[type]} e [description]
|
651 |
+
* @return {[type]} [description]
|
652 |
+
*/
|
653 |
+
this.add_new_action = function (e) {
|
654 |
+
e.preventDefault();
|
655 |
+
$clicked_button = $(e.currentTarget);
|
656 |
+
var $action_selector = $clicked_button.siblings('.new-action-selector');
|
657 |
+
var action_type = $action_selector.val();
|
658 |
+
this.remove_errors();
|
659 |
+
if (!action_type) {
|
660 |
+
this.add_error('.new-action-selector', 'Please choose an action');
|
661 |
+
return false;
|
662 |
+
}
|
663 |
+
if ('purchase' === $action_selector.find(':selected').data('action')) {
|
664 |
+
window.open(action_type);
|
665 |
+
} else {
|
666 |
+
this.show_loader($clicked_button.parents('.actions-list'));
|
667 |
+
params = {
|
668 |
+
'post_id': $clicked_button.data('id'),
|
669 |
+
'rule_id': $clicked_button.data('ruleid'),
|
670 |
+
'action_type': action_type,
|
671 |
+
};
|
672 |
+
$('.hidden-action').slideUp('fast');
|
673 |
+
this.make_ajax_call('wpcf7r_add_action', params, 'after_ajax_call');
|
674 |
+
}
|
675 |
+
}
|
676 |
+
|
677 |
+
this.remove_errors = function () {
|
678 |
+
$('.error-message').removeClass('error-message');
|
679 |
+
$('.error-label').remove();
|
680 |
+
}
|
681 |
+
|
682 |
+
this.add_error = function (selector, message) {
|
683 |
+
$(selector).addClass('error-message').after('<span class="error-label">' + message + '</span>');
|
684 |
+
}
|
685 |
+
|
686 |
+
this.show_loader = function (selector) {
|
687 |
+
$(selector).append('<div class="wpcf7r_loader"></div>');
|
688 |
+
$('.wpcf7r_loader').addClass('active');
|
689 |
+
}
|
690 |
+
|
691 |
+
this.hide_loader = function () {
|
692 |
+
$('.wpcf7r_loader').fadeOut(function () {
|
693 |
+
$(this).remove();
|
694 |
+
});
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* A callback after ajax actions
|
699 |
+
* @param {[type]} e [description]
|
700 |
+
* @param {[type]} params [description]
|
701 |
+
* @param {[type]} response [description]
|
702 |
+
* @param {[type]} action [description]
|
703 |
+
* @return {[type]} [description]
|
704 |
+
*/
|
705 |
+
this.after_ajax_call = function (e, params, response, action) {
|
706 |
+
var _this = this;
|
707 |
+
var $action_wrap;
|
708 |
+
|
709 |
+
/**
|
710 |
+
* Handle action delete request
|
711 |
+
* @param {[type]} [action== 'wpcf7r_delete_action'] [description]
|
712 |
+
* @return {[type]} [description]
|
713 |
+
*/
|
714 |
+
if ('wpcf7r_delete_action' === action) {
|
715 |
+
$(params).each(function (k, v) {
|
716 |
+
$('[data-actionid="' + v.post_id + '"]').fadeOut(function () {
|
717 |
+
$(this).remove();
|
718 |
+
_this.renumber_rows();
|
719 |
+
});
|
720 |
+
$('[data-postid="' + v.post_id + '"]').fadeOut(function () {
|
721 |
+
$(this).remove();
|
722 |
+
});
|
723 |
+
});
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Handle action add request
|
728 |
+
* @param {[type]} [action== 'wpcf7r_add_action'] [description]
|
729 |
+
* @return {[type]} [description]
|
730 |
+
*/
|
731 |
+
if ('wpcf7r_add_action' === action) {
|
732 |
+
$('[data-wrapid=' + params.rule_id + '] #the_list').append(response.action_row);
|
733 |
+
|
734 |
+
$new_action_wrap = $('[data-wrapid=' + params.rule_id + '] #the_list tr:last-child').prev();
|
735 |
+
|
736 |
+
_this.init_select2();
|
737 |
+
_this.renumber_rows();
|
738 |
+
_this.init_colorpickers();
|
739 |
+
_this.init_editors($new_action_wrap);
|
740 |
+
}
|
741 |
+
if ('wpcf7r_reset_settings' === action) {
|
742 |
+
window.location.reload();
|
743 |
+
}
|
744 |
+
|
745 |
+
/**
|
746 |
+
* Make an API test
|
747 |
+
* @param {[type]} [action== 'wpcf7r_make_api_test'] [description]
|
748 |
+
* @return {[type]} [description]
|
749 |
+
*/
|
750 |
+
if ('wpcf7r_make_api_test' === action) {
|
751 |
+
$action_wrap = $('[data-actionid=' + params.action_id + '] .field-wrap-test_section');
|
752 |
+
$('span.err').remove();
|
753 |
+
if (typeof response.status != 'undefined' && response.status === 'failed') {
|
754 |
+
$.each(response.invalid_fields, function (field_key, error) {
|
755 |
+
$action_wrap.find('.' + field_key).append('<span class="err">' + error.reason + '</span>');
|
756 |
+
});
|
757 |
+
} else {
|
758 |
+
$('body').append(response.html);
|
759 |
+
}
|
760 |
+
}
|
761 |
+
|
762 |
+
/**
|
763 |
+
* After getting mailchimp lists
|
764 |
+
* @param {[type]} [action== 'wpcf7r_get_mailchimp_lists'] [description]
|
765 |
+
* @return {[type]} [description]
|
766 |
+
*/
|
767 |
+
if ('wpcf7r_get_mailchimp_lists' === action) {
|
768 |
+
$action_wrap = $('[data-actionid=' + params.action_id + ']');
|
769 |
+
$lists_select = $action_wrap.find('.field-wrap-mailchimp_list_id select');
|
770 |
+
$api_key_input = $action_wrap.find('.field-wrap-mailchimp_api_key');
|
771 |
+
$lists_select.html('');
|
772 |
+
if (typeof response.error != 'undefined' && response.error) {
|
773 |
+
this.add_error($api_key_input, response.error);
|
774 |
+
} else {
|
775 |
+
$action_wrap.find('.field-wrap-mailchimp_settings')
|
776 |
+
.attr('data-lists', JSON.stringify(response.lists))
|
777 |
+
.data('lists', JSON.stringify(response.lists));
|
778 |
+
|
779 |
+
$.each(response.lists, function (k, v) {
|
780 |
+
var o = '<option value="' + v.list_id + '">' + v.list_name + '</option>';
|
781 |
+
$lists_select.append(o);
|
782 |
+
});
|
783 |
+
|
784 |
+
$lists_select.change();
|
785 |
+
}
|
786 |
+
}
|
787 |
+
this.hide_loader();
|
788 |
+
}
|
789 |
+
|
790 |
+
this.move_post_to_trash = function (e) {
|
791 |
+
e.preventDefault();
|
792 |
+
$clicked_button = $(e.currentTarget);
|
793 |
+
this.show_loader($clicked_button.parents('td'));
|
794 |
+
params = [{
|
795 |
+
'post_id': $clicked_button.data('id')
|
796 |
+
}];
|
797 |
+
this.make_ajax_call('wpcf7r_delete_action', params, 'ater_ajax_delete');
|
798 |
+
}
|
799 |
+
|
800 |
+
this.show_hide_action = function (e) {
|
801 |
+
e.preventDefault();
|
802 |
+
$clicked_button = $(e.currentTarget);
|
803 |
+
$hidden_action_to_show = $clicked_button.parents('tr').next().find('.hidden-action');
|
804 |
+
$('.hidden-action').not($hidden_action_to_show).slideUp('fast');
|
805 |
+
$hidden_action_to_show.slideToggle('fast');
|
806 |
+
}
|
807 |
+
|
808 |
+
this.show_hide_tab = function (e) {
|
809 |
+
$clicked_tab = $(e.currentTarget);
|
810 |
+
var target = $clicked_tab.data('tab-target');
|
811 |
+
$clicked_tab.toggleClass('active');
|
812 |
+
$('[data-tab=' + target + ']').slideToggle('fast');
|
813 |
+
}
|
814 |
+
|
815 |
+
this.hide_select_options = function (e) {
|
816 |
+
$('.row-template .wpcf7r-fields').each(function () {
|
817 |
+
$(this).trigger('change');
|
818 |
+
});
|
819 |
+
}
|
820 |
+
|
821 |
+
this.show_field_options = function (e) {
|
822 |
+
$changed_select = $(e.currentTarget);
|
823 |
+
$row = $changed_select.parents('.row-template');
|
824 |
+
|
825 |
+
if ($changed_select.val()) {
|
826 |
+
$elem_to_show = $row.find('.group_row_value[data-rel=' + $changed_select.val() + ']');
|
827 |
+
} else {
|
828 |
+
$elem_to_show = "";
|
829 |
+
}
|
830 |
+
|
831 |
+
$row.find('.group_row_value').hide();
|
832 |
+
|
833 |
+
if ($elem_to_show.length) {
|
834 |
+
$elem_to_show.show();
|
835 |
+
$row.find('.compare-options option').hide();
|
836 |
+
$row.find('.compare-options option[data-comparetype=select]').show();
|
837 |
+
} else {
|
838 |
+
$row.find('.compare-options option').show();
|
839 |
+
$row.find('.wpcf7-redirect-value').show();
|
840 |
+
}
|
841 |
+
}
|
842 |
+
|
843 |
+
this.set_select_value = function (e) {
|
844 |
+
$changed_select = $(e.currentTarget);
|
845 |
+
$changed_select.siblings('.wpcf7-redirect-value').val($changed_select.val());
|
846 |
+
}
|
847 |
+
|
848 |
+
/**
|
849 |
+
* Removes a block of rules from the DOM
|
850 |
+
* @param {[type]} e [description]
|
851 |
+
* @return {[type]} [description]
|
852 |
+
*/
|
853 |
+
this.remove_block = function (e) {
|
854 |
+
e.preventDefault();
|
855 |
+
$clicked_button = $(e.currentTarget);
|
856 |
+
$clicked_button_parent = $clicked_button.parents('.block-title').first();
|
857 |
+
var tab_to_remove = $clicked_button_parent.data('rel');
|
858 |
+
$clicked_button_parent.prev().click();
|
859 |
+
$('.conditional-group-block[data-block-id=' + tab_to_remove + ']').remove();
|
860 |
+
$('.block-title[data-rel=' + tab_to_remove + ']').remove();
|
861 |
+
}
|
862 |
+
|
863 |
+
/**
|
864 |
+
* Adds a new block to the DOM
|
865 |
+
* @param {[type]} e [description]
|
866 |
+
* @return {[type]} [description]
|
867 |
+
*/
|
868 |
+
this.add_new_block = function (e) {
|
869 |
+
this.new_block_counter++;
|
870 |
+
$clicked_button = $(e.currentTarget);
|
871 |
+
action_id = this.get_block_action_id($clicked_button);
|
872 |
+
html_block_template = wpcfr_template.block_html;
|
873 |
+
block_title_html = wpcfr_template.block_title_html;
|
874 |
+
html_block_template = this.replaceAll(html_block_template, 'new_block', 'block_' + this.new_block_counter);
|
875 |
+
html_block_template = this.replaceAll(html_block_template, 'action_id', action_id);
|
876 |
+
block_title_html = this.replaceAll(block_title_html, 'new_block', 'block_' + this.new_block_counter);
|
877 |
+
block_title_html = this.replaceAll(block_title_html, 'action_id', action_id);
|
878 |
+
$(this.tab_title_all_selector).last().after(block_title_html);
|
879 |
+
$(this.blocks_container_selector).append(html_block_template);
|
880 |
+
$(this.tab_title_all_selector).last().click();
|
881 |
+
}
|
882 |
+
|
883 |
+
/**
|
884 |
+
* Switch between tabs
|
885 |
+
* @param {[type]} e [description]
|
886 |
+
* @return {[type]} [description]
|
887 |
+
*/
|
888 |
+
this.switch_tab = function (e) {
|
889 |
+
e.preventDefault();
|
890 |
+
$clicked_button = $(e.currentTarget);
|
891 |
+
var tab_to_show = $clicked_button.data('rel');
|
892 |
+
var $tab_to_show = $('[data-block-id=' + tab_to_show + ']');
|
893 |
+
$(this.active_tab_selector).removeClass('active');
|
894 |
+
$(this.tab_title_active_selector).removeClass('active');
|
895 |
+
$clicked_button.addClass('active');
|
896 |
+
$tab_to_show.addClass('active');
|
897 |
+
}
|
898 |
+
|
899 |
+
/**
|
900 |
+
* Update block title upon save
|
901 |
+
* @param {[type]} e [description]
|
902 |
+
* @return {[type]} [description]
|
903 |
+
*/
|
904 |
+
this.save_block_title_edit = function (e) {
|
905 |
+
e.preventDefault();
|
906 |
+
$clicked_button = $(e.currentTarget);
|
907 |
+
var tab_to_show = $clicked_button.data('rel');
|
908 |
+
var $tab_to_show = $('[data-block-id=' + tab_to_show + ']');
|
909 |
+
$clicked_button.siblings('input').attr('readonly', 'readonly');
|
910 |
+
$clicked_button.parent().removeClass('edit');
|
911 |
+
$tab_to_show.find(this.tab_inner_title).html($clicked_button.siblings('input').val());
|
912 |
+
}
|
913 |
+
|
914 |
+
/**
|
915 |
+
* Close the text field for editing
|
916 |
+
* @param {[type]} e [description]
|
917 |
+
* @return {[type]} [description]
|
918 |
+
*/
|
919 |
+
this.cancel_block_title_edit = function (e) {
|
920 |
+
e.preventDefault();
|
921 |
+
$clicked_button = $(e.currentTarget);
|
922 |
+
var tab_to_show = $clicked_button.data('rel');
|
923 |
+
var $tab_to_show = $('[data-block-id=' + tab_to_show + ']');
|
924 |
+
$clicked_button.siblings('input').val($clicked_button.siblings('input').data('original')).attr('readonly', 'readonly');
|
925 |
+
$clicked_button.parent().removeClass('edit');
|
926 |
+
$tab_to_show.find(this.tab_inner_title).html($clicked_button.siblings('input').val());
|
927 |
+
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* Open block title for editing
|
931 |
+
* @param {[type]} e [description]
|
932 |
+
* @return {[type]} [description]
|
933 |
+
*/
|
934 |
+
this.edit_block_title = function (e) {
|
935 |
+
e.preventDefault();
|
936 |
+
$clicked_button = $(e.currentTarget);
|
937 |
+
$clicked_button.parent().addClass('edit');
|
938 |
+
$clicked_button.siblings('input').removeAttr('readonly');
|
939 |
+
}
|
940 |
+
|
941 |
+
/**
|
942 |
+
* Add a new group of fields (OR)
|
943 |
+
* @param {[type]} e [description]
|
944 |
+
* @return {[type]} [description]
|
945 |
+
*/
|
946 |
+
this.add_new_group = function (e) {
|
947 |
+
e.preventDefault();
|
948 |
+
|
949 |
+
$clicked_button = $(e.currentTarget);
|
950 |
+
var block_id = 'block_1';
|
951 |
+
var action_id = this.get_block_action_id($clicked_button);
|
952 |
+
var $rule_group = $clicked_button.parents('.conditional-group-blocks').find('.wpcfr-rule-groups');
|
953 |
+
this.new_group_counter = $rule_group.find('.wpcfr-rule-group').length;
|
954 |
+
this.new_group_counter++;
|
955 |
+
group_html = wpcfr_template.group_html;
|
956 |
+
group_html = this.replaceAll(group_html, 'group-new_group', 'group-' + this.new_group_counter);
|
957 |
+
group_html = this.replaceAll(group_html, 'new_group', 'group-' + this.new_group_counter);
|
958 |
+
group_html = this.replaceAll(group_html, 'new_block', block_id);
|
959 |
+
group_html = this.replaceAll(group_html, 'action_id', action_id);
|
960 |
+
|
961 |
+
$rule_group.append(group_html);
|
962 |
+
}
|
963 |
+
|
964 |
+
/**
|
965 |
+
* Remove an and row from the dom
|
966 |
+
* @param {[type]} e [description]
|
967 |
+
* @return {[type]} [description]
|
968 |
+
*/
|
969 |
+
this.remove_and_row = function (e) {
|
970 |
+
e.preventDefault();
|
971 |
+
$clicked_button = $(e.currentTarget);
|
972 |
+
if ($clicked_button.parents(this.rule_group_selector).find('.row-template').length == 1) {
|
973 |
+
$clicked_button.parents(this.rule_group_selector).remove();
|
974 |
+
} else {
|
975 |
+
$clicked_button.parents(this.row_template_selector).remove();
|
976 |
+
}
|
977 |
+
}
|
978 |
+
|
979 |
+
this.get_block_action_id = function ($inner_item) {
|
980 |
+
return $inner_item.parents('[data-actionid]').data('actionid');
|
981 |
+
}
|
982 |
+
|
983 |
+
/**
|
984 |
+
* Add an and row to the dom
|
985 |
+
* @param {[type]} e [description]
|
986 |
+
* @return {[type]} [description]
|
987 |
+
*/
|
988 |
+
this.add_and_row = function (e) {
|
989 |
+
e.preventDefault();
|
990 |
+
this.new_row_counter++;
|
991 |
+
|
992 |
+
$clicked_button = $(e.currentTarget);
|
993 |
+
action_id = this.get_block_action_id($clicked_button);
|
994 |
+
block_id = 'block_1';
|
995 |
+
group_id = $clicked_button.parents('[data-group-id]').first().data('group-id');
|
996 |
+
|
997 |
+
$(wpcfr_template.row_html).find(this.add_and_selector).remove();
|
998 |
+
|
999 |
+
row_html = wpcfr_template.row_html;
|
1000 |
+
row_html = this.replaceAll(row_html, 'new_block', block_id);
|
1001 |
+
row_html = this.replaceAll(row_html, 'new_group', group_id);
|
1002 |
+
row_html = this.replaceAll(row_html, 'new_row', 'row-' + this.new_row_counter);
|
1003 |
+
row_html = this.replaceAll(row_html, 'action_id', action_id);
|
1004 |
+
|
1005 |
+
$clicked_button.parents('table').first().find('tbody').append(row_html);
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
/**
|
1009 |
+
* Close displayed banner
|
1010 |
+
* @return {[type]} [description]
|
1011 |
+
*/
|
1012 |
+
this.close_banner = function () {
|
1013 |
+
$(this.banner_selector).slideUp('fast');
|
1014 |
+
this.make_ajax_call('dismiss-cf7r-notices', ['dismiss-cf7r-notices'], '');
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/**
|
1018 |
+
* Dismiss admin notices
|
1019 |
+
*/
|
1020 |
+
this.dismiss_notices = function () {
|
1021 |
+
this.make_ajax_call('close_ad_banner', [], '');
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
/**
|
1025 |
+
* Replace all instances of a string
|
1026 |
+
* @param {[type]} str [description]
|
1027 |
+
* @param {[type]} find [description]
|
1028 |
+
* @param {[type]} replace [description]
|
1029 |
+
* @return {[type]} [description]
|
1030 |
+
*/
|
1031 |
+
this.replaceAll = function (str, find, replace) {
|
1032 |
+
return str.replace(new RegExp(find, 'g'), replace);
|
1033 |
+
}
|
1034 |
+
this.admin_fields_init = function () {
|
1035 |
+
$('.field-wrap input[type=checkbox],.field-wrap select').each(function () {
|
1036 |
+
if ($(this).is(":checked")) {
|
1037 |
+
$(this).siblings('.field-notice-hidden').removeClass('field-notice-hidden').addClass('field-notice-show');
|
1038 |
+
}
|
1039 |
+
});
|
1040 |
+
$('.wpcf7-redirect-after-sent-script').each(function () {
|
1041 |
+
if ($(this).val()) {
|
1042 |
+
$(this).siblings('.field-warning-alert').removeClass('field-notice-hidden');
|
1043 |
+
}
|
1044 |
+
});
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
/**
|
1048 |
+
* Show/hide fields according to user selections
|
1049 |
+
* @return {[type]} [description]
|
1050 |
+
*/
|
1051 |
+
this.admin_field_handlers = function () {
|
1052 |
+
this.admin_fields_init();
|
1053 |
+
// field - open in a new tab
|
1054 |
+
$(document.body).on('change', '.field-wrap input[type=checkbox],.field-wrap select', function () {
|
1055 |
+
if ($(this).is(":checked")) {
|
1056 |
+
$(this).siblings('.field-notice-hidden').removeClass('field-notice-hidden').addClass('field-notice-show');
|
1057 |
+
} else {
|
1058 |
+
$(this).siblings('.field-notice-show').addClass('field-notice-hidden').removeClass('field-notice-show');
|
1059 |
+
}
|
1060 |
+
});
|
1061 |
+
// field - after sent script
|
1062 |
+
$(document.body).on('keyup', '.wpcf7-redirect-after-sent-script', function (event) {
|
1063 |
+
if ($(this).val().length != 0) {
|
1064 |
+
$(this).siblings('.field-warning-alert').removeClass('field-notice-hidden');
|
1065 |
+
} else {
|
1066 |
+
$(this).siblings('.field-warning-alert').addClass('field-notice-hidden');
|
1067 |
+
}
|
1068 |
+
});
|
1069 |
+
$(document.body).on('change', '.checkbox-radio-1', function () {
|
1070 |
+
var checked = $(this).is(':checked');
|
1071 |
+
$('.checkbox-radio-1').prop('checked', false);
|
1072 |
+
if (checked) {
|
1073 |
+
$(this).prop('checked', true);
|
1074 |
+
}
|
1075 |
+
});
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
this.reset_all_settings = function(e){
|
1079 |
+
e.preventDefault();
|
1080 |
+
var action = 'wpcf7r_reset_settings';
|
1081 |
+
var params = [];
|
1082 |
+
// TODO: Translation
|
1083 |
+
if (confirm('Are you sure? this process will delete all of your plugin settings. There is no way back from this process!')) {
|
1084 |
+
this.make_ajax_call(action, params);
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
this.migrate_all_forms = function (e) {
|
1089 |
+
e.preventDefault();
|
1090 |
+
var action = 'wpcf7r_migrate_all_forms';
|
1091 |
+
var params = [];
|
1092 |
+
// TODO: Translation
|
1093 |
+
if (confirm('Are you sure? this process will delete all current actions and create new actions according to the old plugin settings. There is no way back from this process!')) {
|
1094 |
+
this.make_ajax_call(action, params);
|
1095 |
+
}
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
/**
|
1099 |
+
* Basic function to make admin ajax calls
|
1100 |
+
* @param {[type]} params [description]
|
1101 |
+
* @return {[type]} [description]
|
1102 |
+
*/
|
1103 |
+
this.make_ajax_call = function (action, params) {
|
1104 |
+
jQuery.ajax({
|
1105 |
+
type: "post",
|
1106 |
+
dataType: "json",
|
1107 |
+
url: ajaxurl,
|
1108 |
+
data: {
|
1109 |
+
action: action,
|
1110 |
+
data: params
|
1111 |
+
},
|
1112 |
+
success: function (response) {
|
1113 |
+
$(document.body).trigger('wpcf7r_after_ajax_call', [params, response, action]);
|
1114 |
+
}
|
1115 |
+
});
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
/**
|
1119 |
+
* Show PRO Banner
|
1120 |
+
*/
|
1121 |
+
this.show_pro_banner = function (e) {
|
1122 |
+
window.setTimeout(function () {
|
1123 |
+
$('.rp-overlay').addClass('active');
|
1124 |
+
}, 500);
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
/**
|
1128 |
+
* Send pro banner ajax request when clicking 'enter' key
|
1129 |
+
*/
|
1130 |
+
this.pro_banner_user_email_keyup = function (e) {
|
1131 |
+
e.stopPropagation();
|
1132 |
+
if (e.key === 'Enter' || e.keyCode === 13) {
|
1133 |
+
e.preventDefault();
|
1134 |
+
this.ajax_get_coupon();
|
1135 |
+
}
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
/**
|
1139 |
+
* PRO Banner ajax request - get a coupon request
|
1140 |
+
*/
|
1141 |
+
this.ajax_get_coupon = function (e) {
|
1142 |
+
$('.rp-form-message').html('<span class="rp-loader-wrap"><span class="rp-loader"></span></span>');
|
1143 |
+
var get_offers = $('[name="rp_get_offers"]').prop("checked") == true ? '1' : '0';
|
1144 |
+
$.ajax({
|
1145 |
+
type: 'POST',
|
1146 |
+
dataType: 'json',
|
1147 |
+
url: ajaxurl,
|
1148 |
+
data: {
|
1149 |
+
action: 'get_coupon',
|
1150 |
+
data: {
|
1151 |
+
email: $('[name="rp_user_email"]').val(),
|
1152 |
+
get_offers: get_offers
|
1153 |
+
}
|
1154 |
+
},
|
1155 |
+
success: function (results) {
|
1156 |
+
if (!results.url) {
|
1157 |
+
$('.rp-form-message').html('<span class="rp-form-message-text ' + results.status + '">' + results.message + '</span>');
|
1158 |
+
} else {
|
1159 |
+
location.href = results.url;
|
1160 |
+
}
|
1161 |
+
}
|
1162 |
+
});
|
1163 |
+
}
|
1164 |
+
/**
|
1165 |
+
* Close pro banner
|
1166 |
+
*/
|
1167 |
+
this.pro_banner_close = function (e) {
|
1168 |
+
e.preventDefault();
|
1169 |
+
sign = window.location.href.indexOf("?") > -1 ? '&' : '?';
|
1170 |
+
location.href = window.location.href + sign + 'wpcf7_redirect_dismiss_banner=1';
|
1171 |
+
}
|
1172 |
+
this.init();
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
$(document).ready(function ($) {
|
1176 |
+
//init the class functionality
|
1177 |
+
wpcf7_redirect_admin = new Wpcf7_redirect_admin();
|
1178 |
+
|
1179 |
+
$(document.body).trigger('wpcf7r-loaded', wpcf7_redirect_admin);
|
1180 |
+
});
|
1181 |
})(jQuery);
|
1182 |
+
jQuery(document).ready(function () {
|
1183 |
+
set_event_listeneres();
|
1184 |
+
disply_updates_marks();
|
1185 |
+
});
|
1186 |
+
|
1187 |
+
function disply_updates_marks() {
|
1188 |
+
var update_count = jQuery('.extensions-list .has-update').length;
|
1189 |
+
if (update_count) {
|
1190 |
+
jQuery('li#extensions-panel-tab a').append(' <span class="update-plugins wpcf7r-update-extensions"><span class="plugin-count">' + update_count + '</span></span>');
|
1191 |
+
}
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
function set_event_listeneres() {
|
1195 |
+
activate_serial_handler();
|
1196 |
+
close_promo_box();
|
1197 |
+
serial_activation_handler();
|
1198 |
+
extension_deactivate_handler();
|
1199 |
+
extension_update_handler();
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
function extension_update_handler() {
|
1203 |
+
jQuery('.extensions').on('click', '.promo-box .btn-update', function (e) {
|
1204 |
+
e.preventDefault();
|
1205 |
+
$extension = jQuery(this).parents('.promo-box');
|
1206 |
+
show_extension_loader($extension);
|
1207 |
+
update_wpcf7r_extension($extension);
|
1208 |
+
});
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
function activate_serial_handler() {
|
1212 |
+
jQuery('.extensions').on('click', '.promo-box .btn-activate', function (e) {
|
1213 |
+
e.preventDefault();
|
1214 |
+
jQuery(this).parents('.promo-box').find('.serial').addClass('open');
|
1215 |
+
});
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
function close_promo_box() {
|
1219 |
+
jQuery('.extensions').on('click', '.promo-box .btn-close', function (e) {
|
1220 |
+
e.preventDefault();
|
1221 |
+
jQuery(this).parents('.promo-box').find('.serial').removeClass('open');
|
1222 |
+
});
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
function serial_activation_handler() {
|
1226 |
+
jQuery('.extensions').on('click', '.promo-box .btn-activate-serial', function (e) {
|
1227 |
+
e.preventDefault();
|
1228 |
+
$extension = jQuery(this).parents('.promo-box');
|
1229 |
+
var serial = $extension.find('.serial-number').val();
|
1230 |
+
if (!serial) {
|
1231 |
+
$extension.find('.serial-number').addClass('err');
|
1232 |
+
return false;
|
1233 |
+
}
|
1234 |
+
$extension.find('.serial-number').removeClass('err');
|
1235 |
+
show_extension_loader($extension);
|
1236 |
+
activate_extension($extension, serial);
|
1237 |
+
});
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
function extension_deactivate_handler() {
|
1241 |
+
jQuery('.extensions').on('click', '.promo-box .btn-deactivate', function (e) {
|
1242 |
+
e.preventDefault();
|
1243 |
+
$extension = jQuery(this).parents('.promo-box');
|
1244 |
+
show_extension_loader($extension);
|
1245 |
+
deactivate_plugin_license($extension);
|
1246 |
+
});
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
function show_extension_loader($extension) {
|
1250 |
+
$extension.append('<div class="wpcf7r_loader active"></div>');
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
function deactivate_plugin_license($extension) {
|
1254 |
+
var extension_name = $extension.data('extension');
|
1255 |
+
|
1256 |
+
jQuery.ajax({
|
1257 |
+
type: "post",
|
1258 |
+
dataType: "json",
|
1259 |
+
url: ajaxurl,
|
1260 |
+
data: {
|
1261 |
+
action: "deactivate_wpcf7r_extension",
|
1262 |
+
extension_name: extension_name
|
1263 |
+
},
|
1264 |
+
success: function (response) {
|
1265 |
+
console.log(response);
|
1266 |
+
if (typeof response.error != 'undefined') {
|
1267 |
+
jQuery('.actions').after('<div class="err">' + response.error + '</div>');
|
1268 |
+
} else if (typeof response.extension_html != 'undefined') {
|
1269 |
+
$extension.replaceWith(response.extension_html);
|
1270 |
+
}
|
1271 |
+
remove_extension_loader();
|
1272 |
+
}
|
1273 |
+
});
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
function remove_extension_loader() {
|
1277 |
+
jQuery('.wpcf7r_loader').remove();
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
function update_wpcf7r_extension($extension) {
|
1281 |
+
var extension_name = $extension.data('extension');
|
1282 |
+
|
1283 |
+
jQuery.ajax({
|
1284 |
+
type: "post",
|
1285 |
+
dataType: "json",
|
1286 |
+
url: ajaxurl,
|
1287 |
+
data: {
|
1288 |
+
action: "wpcf7r_extension_update",
|
1289 |
+
extension_name: extension_name
|
1290 |
+
},
|
1291 |
+
success: function (response) {
|
1292 |
+
if (response.extension_html != 'undefined' && response.extension_html) {
|
1293 |
+
$extension.replaceWith(response.extension_html);
|
1294 |
+
} else if (typeof response.error != 'undefined' && response.error) {
|
1295 |
+
jQuery('.actions').after('<div class="err">' + response.error + '</div>');
|
1296 |
+
}
|
1297 |
+
remove_extension_loader();
|
1298 |
+
}
|
1299 |
+
});
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
function activate_extension($extension, serial) {
|
1303 |
+
var extension_name = $extension.data('extension');
|
1304 |
+
|
1305 |
+
jQuery.ajax({
|
1306 |
+
type: "post",
|
1307 |
+
dataType: "json",
|
1308 |
+
url: ajaxurl,
|
1309 |
+
data: {
|
1310 |
+
action: "activate_wpcf7r_extension",
|
1311 |
+
extension_name: extension_name,
|
1312 |
+
serial: serial
|
1313 |
+
},
|
1314 |
+
success: function (response) {
|
1315 |
+
if (response.extension_html != 'undefined' && response.extension_html) {
|
1316 |
+
$extension.replaceWith(response.extension_html);
|
1317 |
+
window.location.reload();
|
1318 |
+
} else if (typeof response.error != 'undefined' && response.error) {
|
1319 |
+
$extension.find('.err').remove();
|
1320 |
+
$extension.append('<div class="err">' + response.error + '</div>');
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
remove_extension_loader();
|
1324 |
+
}
|
1325 |
+
});
|
1326 |
}
|
class-wpcf7-redirect.php
CHANGED
@@ -38,11 +38,15 @@ class Wpcf7_Redirect {
|
|
38 |
* Defines
|
39 |
*/
|
40 |
public function define() {
|
41 |
-
|
42 |
-
|
43 |
-
define( '
|
44 |
-
define( '
|
45 |
-
define( '
|
|
|
|
|
|
|
|
|
46 |
|
47 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ID', '6XpU046EOVs7v6O' );
|
48 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_SKU', 'wpcfr-pro' );
|
38 |
* Defines
|
39 |
*/
|
40 |
public function define() {
|
41 |
+
$base_url = 'https://redirection-for-contact-form7.com/';
|
42 |
+
|
43 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL', $base_url );
|
44 |
+
define( 'WPCF7_PRO_REDIRECT_DEBUG_URL', $base_url . 'wp-json/api-v1/debug' );
|
45 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL', $base_url . 'wp-admin/admin-ajax.php' );
|
46 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_UPDATES', $base_url . 'wp-json/api-v1/check-for-updates/' );
|
47 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_EXTENSIONS_LIST_URL', $base_url . 'wp-json/api-v1/extensions_list/' );
|
48 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_PROMOTIONS_URL', $base_url . 'wp-json/api-v1/promotions/' );
|
49 |
+
define( 'ACCESSIBE_API_URI', $base_url . 'wp-json/accesibe-api/activate' );
|
50 |
|
51 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_ID', '6XpU046EOVs7v6O' );
|
52 |
define( 'WPCF7_PRO_REDIRECT_PLUGIN_SKU', 'wpcfr-pro' );
|
classes/actions/class-wpcf7r-action-redirect.php
CHANGED
@@ -15,9 +15,9 @@ register_wpcf7r_actions(
|
|
15 |
);
|
16 |
|
17 |
/**
|
18 |
-
* Class WPCF7R_Action_Redirect
|
19 |
-
* A Class that handles redirect actions
|
20 |
-
*/
|
21 |
class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
22 |
|
23 |
/**
|
@@ -186,6 +186,12 @@ class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
|
186 |
|
187 |
$this->posted_data = $submission->get_posted_data();
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
if ( $this->get( 'use_external_url' ) === 'on' && $this->get( 'external_url' ) ) {
|
190 |
$response = array(
|
191 |
'type' => 'redirect',
|
@@ -235,7 +241,8 @@ class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
|
235 |
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
236 |
|
237 |
$response['http_build_query'] = true;
|
238 |
-
|
|
|
239 |
|
240 |
} elseif ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
241 |
|
15 |
);
|
16 |
|
17 |
/**
|
18 |
+
* Class WPCF7R_Action_Redirect
|
19 |
+
* A Class that handles redirect actions
|
20 |
+
*/
|
21 |
class WPCF7R_Action_Redirect extends WPCF7R_Action {
|
22 |
|
23 |
/**
|
186 |
|
187 |
$this->posted_data = $submission->get_posted_data();
|
188 |
|
189 |
+
foreach ( $this->posted_data as $posted_data_key => $posted_data_value ) {
|
190 |
+
if ( is_array( $posted_data_value ) ) {
|
191 |
+
$this->posted_data[ $posted_data_key ] = implode( ',', $posted_data_value );
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
if ( $this->get( 'use_external_url' ) === 'on' && $this->get( 'external_url' ) ) {
|
196 |
$response = array(
|
197 |
'type' => 'redirect',
|
241 |
} elseif ( $this->get( 'http_build_query' ) === 'on' ) {
|
242 |
|
243 |
$response['http_build_query'] = true;
|
244 |
+
|
245 |
+
$response['redirect_url'] = add_query_arg( $this->posted_data, $response['redirect_url'] );
|
246 |
|
247 |
} elseif ( $this->get( 'http_build_query_selectively' ) === 'on' ) {
|
248 |
|
classes/actions/class-wpcf7r-action-sendmail.php
CHANGED
@@ -41,20 +41,39 @@ class WPCF7R_Action_SendMail extends WPCF7R_Action {
|
|
41 |
'value' => $this->get( 'email_sender' ),
|
42 |
),
|
43 |
'email_subject' => array(
|
44 |
-
'name'
|
45 |
-
'type'
|
46 |
-
'label'
|
47 |
-
'
|
48 |
-
'value' => $this->get( 'email_subject' ),
|
49 |
),
|
50 |
'email_format' => array(
|
51 |
-
'name'
|
52 |
-
'type'
|
53 |
-
'label'
|
54 |
-
'footer'
|
55 |
-
'
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
'action_status' => array(
|
59 |
'name' => 'action_status',
|
60 |
'type' => 'checkbox',
|
@@ -101,31 +120,54 @@ class WPCF7R_Action_SendMail extends WPCF7R_Action {
|
|
101 |
* @param $response
|
102 |
*/
|
103 |
public function process( $submission ) {
|
104 |
-
$response
|
105 |
-
$email_to
|
106 |
-
$email_sender
|
107 |
-
$email_format
|
108 |
-
$email_subject
|
|
|
|
|
109 |
|
110 |
// set the email address to recipient
|
111 |
$mail_settings = $this->cf7r_form->cf7_post->get_properties( 'mail' );
|
|
|
112 |
if ( $email_to ) {
|
113 |
$mail_settings['mail']['recipient'] = $email_to;
|
114 |
}
|
|
|
115 |
if ( $email_sender ) {
|
116 |
$mail_settings['mail']['sender'] = $email_sender;
|
117 |
}
|
|
|
118 |
if ( $email_format ) {
|
119 |
$mail_settings['mail']['body'] = $email_format;
|
120 |
}
|
|
|
121 |
if ( $email_subject ) {
|
122 |
$mail_settings['mail']['subject'] = $email_subject;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$result = $this->send_mail( $mail_settings['mail'] );
|
125 |
|
126 |
return $result;
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
/**
|
130 |
* Use contact form 7 function to send the email
|
131 |
*
|
41 |
'value' => $this->get( 'email_sender' ),
|
42 |
),
|
43 |
'email_subject' => array(
|
44 |
+
'name' => 'email_subject',
|
45 |
+
'type' => 'text',
|
46 |
+
'label' => __( 'Subject:', 'wpcf7-redirect' ),
|
47 |
+
'value' => $this->get( 'email_subject' ),
|
|
|
48 |
),
|
49 |
'email_format' => array(
|
50 |
+
'name' => 'email_format',
|
51 |
+
'type' => 'editor',
|
52 |
+
'label' => __( 'Email Format (use the same structure used on Contact Form 7)', 'wpcf7-redirect' ),
|
53 |
+
'footer' => $this->get_formatted_mail_tags(),
|
54 |
+
'value' => $this->get( 'email_format' ),
|
55 |
+
),
|
56 |
+
'email_attachments' => array(
|
57 |
+
'name' => 'email_attachments',
|
58 |
+
'type' => 'text',
|
59 |
+
'label' => __( 'Add your form attachments shortcodes here', 'wpcf7-redirect' ),
|
60 |
+
'value' => $this->get( 'email_attachments' ),
|
61 |
+
),
|
62 |
+
'plain_text' => array(
|
63 |
+
'name' => 'plain_text',
|
64 |
+
'type' => 'checkbox',
|
65 |
+
'label' => __( 'Use plain text email', 'wpcf7-redirect' ),
|
66 |
+
'placeholder' => '',
|
67 |
+
'show_selector' => '.field-wrap-plain_text',
|
68 |
+
'value' => $this->get( 'plain_text' ),
|
69 |
),
|
70 |
+
// 'disable_cf7_mail' => array(
|
71 |
+
// 'name' => 'disable_cf7_mail',
|
72 |
+
// 'type' => 'checkbox',
|
73 |
+
// 'label' => __( 'Disable contact form 7 default email', 'wpcf7-redirect' ),
|
74 |
+
// 'placeholder' => '',
|
75 |
+
// 'value' => $this->get( 'disable_cf7_mail' ),
|
76 |
+
// ),
|
77 |
'action_status' => array(
|
78 |
'name' => 'action_status',
|
79 |
'type' => 'checkbox',
|
120 |
* @param $response
|
121 |
*/
|
122 |
public function process( $submission ) {
|
123 |
+
$response = array();
|
124 |
+
$email_to = $this->get( 'send_to_emails_values' );
|
125 |
+
$email_sender = $this->get( 'email_sender' );
|
126 |
+
$email_format = $this->get( 'email_format' );
|
127 |
+
$email_subject = $this->get( 'email_subject' );
|
128 |
+
$email_attachments = $this->get( 'email_attachments' );
|
129 |
+
$plain_text = $this->get( 'plain_text' );
|
130 |
|
131 |
// set the email address to recipient
|
132 |
$mail_settings = $this->cf7r_form->cf7_post->get_properties( 'mail' );
|
133 |
+
|
134 |
if ( $email_to ) {
|
135 |
$mail_settings['mail']['recipient'] = $email_to;
|
136 |
}
|
137 |
+
|
138 |
if ( $email_sender ) {
|
139 |
$mail_settings['mail']['sender'] = $email_sender;
|
140 |
}
|
141 |
+
|
142 |
if ( $email_format ) {
|
143 |
$mail_settings['mail']['body'] = $email_format;
|
144 |
}
|
145 |
+
|
146 |
if ( $email_subject ) {
|
147 |
$mail_settings['mail']['subject'] = $email_subject;
|
148 |
}
|
149 |
+
|
150 |
+
if ( $email_attachments ) {
|
151 |
+
$mail_settings['mail']['attachments'] = $email_attachments;
|
152 |
+
}
|
153 |
+
|
154 |
+
$mail_settings['mail']['use_html'] = ! $plain_text;
|
155 |
+
|
156 |
$result = $this->send_mail( $mail_settings['mail'] );
|
157 |
|
158 |
return $result;
|
159 |
}
|
160 |
|
161 |
+
/**
|
162 |
+
* Maybe perform actions before sending results to the user
|
163 |
+
*/
|
164 |
+
public function maybe_perform_pre_result_action() {
|
165 |
+
if ( $this->get( 'disable_cf7_mail' ) ) {
|
166 |
+
add_filter( 'wpcf7_skip_mail', '__return_false' );
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
/**
|
172 |
* Use contact form 7 function to send the email
|
173 |
*
|
classes/class-qs-api.php
CHANGED
@@ -9,10 +9,12 @@ defined( 'ABSPATH' ) || exit;
|
|
9 |
class Qs_Api {
|
10 |
|
11 |
public function __construct() {
|
12 |
-
$this->activation_url
|
13 |
-
$this->api_url
|
14 |
-
$this->store_id
|
15 |
-
$this->sku
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function extension_has_update( $extension ) {
|
@@ -31,6 +33,79 @@ class Qs_Api {
|
|
31 |
}
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Make the API call
|
36 |
*/
|
@@ -45,7 +120,7 @@ class Qs_Api {
|
|
45 |
'body' => $params,
|
46 |
'compress' => false,
|
47 |
'decompress' => true,
|
48 |
-
'sslverify' =>
|
49 |
'stream' => false,
|
50 |
'filename' => null,
|
51 |
);
|
@@ -55,14 +130,19 @@ class Qs_Api {
|
|
55 |
$results = wp_remote_post( $url, $args );
|
56 |
|
57 |
if ( ! is_wp_error( $results ) ) {
|
58 |
-
$body
|
|
|
59 |
$results = json_decode( $body );
|
60 |
|
61 |
-
if (
|
62 |
-
return
|
63 |
}
|
64 |
|
65 |
-
if ( $results->error ) {
|
|
|
|
|
|
|
|
|
66 |
return new WP_Error( $params['action'], $results->errors );
|
67 |
}
|
68 |
|
@@ -161,6 +241,7 @@ class Qs_Api {
|
|
161 |
|
162 |
if ( ! is_wp_error( $results ) ) {
|
163 |
$results = json_decode( $results );
|
|
|
164 |
$results = download_url( $results->download_link, 1000 );
|
165 |
}
|
166 |
} elseif ( ! $results ) {
|
9 |
class Qs_Api {
|
10 |
|
11 |
public function __construct() {
|
12 |
+
$this->activation_url = WPCF7_PRO_REDIRECT_PLUGIN_ACTIVATION_URL;
|
13 |
+
$this->api_url = WPCF7_PRO_REDIRECT_PLUGIN_UPDATES;
|
14 |
+
$this->store_id = WPCF7_PRO_REDIRECT_PLUGIN_ID;
|
15 |
+
$this->sku = WPCF7_PRO_REDIRECT_PLUGIN_SKU;
|
16 |
+
$this->extensions_list_url = WPCF7_PRO_REDIRECT_PLUGIN_EXTENSIONS_LIST_URL;
|
17 |
+
$this->promotions_url = WPCF7_PRO_REDIRECT_PLUGIN_PROMOTIONS_URL;
|
18 |
}
|
19 |
|
20 |
public function extension_has_update( $extension ) {
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Get a list of all extensions available on the server.
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function get_extensions_definitions() {
|
42 |
+
$params = array(
|
43 |
+
'ignore_unknown' => true,
|
44 |
+
);
|
45 |
+
|
46 |
+
if ( ! $this->update_extentions_list() ) {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
$results = $this->api_call( $this->extensions_list_url, $params );
|
51 |
+
|
52 |
+
if ( ! is_wp_error( $results ) ) {
|
53 |
+
$extensions_list = (array) $results->response;
|
54 |
+
|
55 |
+
$extensions_list = array_map(
|
56 |
+
function( $extension_definition ) {
|
57 |
+
return (array) $extension_definition;
|
58 |
+
},
|
59 |
+
$extensions_list
|
60 |
+
);
|
61 |
+
|
62 |
+
update_option( 'wpcf7r-extensions-list', $extensions_list );
|
63 |
+
update_option( 'wpcf7r-extensions-list-updated', current_time( 'timestamp' ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
return $extensions_list;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Check id extensions list update is required.
|
71 |
+
* Get a list of extensions once a week.
|
72 |
+
*
|
73 |
+
* @return boolean - true - get the list.
|
74 |
+
*/
|
75 |
+
private function update_extentions_list() {
|
76 |
+
return isset( $_POST['extensions-updates-check'] ) && $_POST['extensions-updates-check'];
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Check if banner update is required.
|
81 |
+
*
|
82 |
+
* @return boolean - true - get the banner.
|
83 |
+
*/
|
84 |
+
private function update_promotions() {
|
85 |
+
return isset( $_POST['update-banner'] ) && $_POST['update-banner'];
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Get an updated promotion banner.
|
90 |
+
*
|
91 |
+
* @return array - the banner html anb version.
|
92 |
+
*/
|
93 |
+
public function get_promotion_banner() {
|
94 |
+
$params = array(
|
95 |
+
'ignore_unknown' => true,
|
96 |
+
);
|
97 |
+
|
98 |
+
if ( $this->update_promotions() ) {
|
99 |
+
$results = $this->api_call( $this->promotions_url, $params );
|
100 |
+
|
101 |
+
if ( ! is_wp_error( $results ) ) {
|
102 |
+
return $results;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
/**
|
110 |
* Make the API call
|
111 |
*/
|
120 |
'body' => $params,
|
121 |
'compress' => false,
|
122 |
'decompress' => true,
|
123 |
+
'sslverify' => false,
|
124 |
'stream' => false,
|
125 |
'filename' => null,
|
126 |
);
|
130 |
$results = wp_remote_post( $url, $args );
|
131 |
|
132 |
if ( ! is_wp_error( $results ) ) {
|
133 |
+
$body = wp_remote_retrieve_body( $results );
|
134 |
+
|
135 |
$results = json_decode( $body );
|
136 |
|
137 |
+
if ( is_wp_error( $results ) ) {
|
138 |
+
return $results;
|
139 |
}
|
140 |
|
141 |
+
if ( ! isset( $results->error ) && ! isset( $params['ignore_unknown'] ) ) {
|
142 |
+
return new WP_Error( $params['action'], 'Unknown error' );
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( isset( $results->error ) && $results->error ) {
|
146 |
return new WP_Error( $params['action'], $results->errors );
|
147 |
}
|
148 |
|
241 |
|
242 |
if ( ! is_wp_error( $results ) ) {
|
243 |
$results = json_decode( $results );
|
244 |
+
|
245 |
$results = download_url( $results->download_link, 1000 );
|
246 |
}
|
247 |
} elseif ( ! $results ) {
|
classes/class-wpcf7r-base.php
CHANGED
@@ -165,7 +165,7 @@ class WPCF7R_Base {
|
|
165 |
?>
|
166 |
|
167 |
<div class="notice is-dismissible <?php echo esc_html( $notice_type ); ?>">
|
168 |
-
<p><?php echo
|
169 |
</div>
|
170 |
|
171 |
<?php
|
@@ -179,6 +179,41 @@ class WPCF7R_Base {
|
|
179 |
WPCF7r_Utils::auto_migrate( 'migrate_from_cf7_redirect', true );
|
180 |
}
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
/**
|
183 |
* Register plugins ajax hooks
|
184 |
*/
|
@@ -206,6 +241,8 @@ class WPCF7R_Base {
|
|
206 |
add_action( 'admin_init', array( $this, 'alert_conflicts' ) );
|
207 |
// run the migration process.
|
208 |
add_action( 'wp_ajax_wpcf7r_migrate_all_forms', array( $this, 'migrate_all_forms' ) );
|
|
|
|
|
209 |
|
210 |
add_action( 'wp_ajax_nopriv_wpcf7r_get_nonce', array( $this, 'wpcf7r_get_nonce' ) );
|
211 |
add_action( 'wp_ajax_wpcf7r_get_nonce', array( $this, 'wpcf7r_get_nonce' ) );
|
165 |
?>
|
166 |
|
167 |
<div class="notice is-dismissible <?php echo esc_html( $notice_type ); ?>">
|
168 |
+
<p><?php echo $notice; ?></p>
|
169 |
</div>
|
170 |
|
171 |
<?php
|
179 |
WPCF7r_Utils::auto_migrate( 'migrate_from_cf7_redirect', true );
|
180 |
}
|
181 |
|
182 |
+
/**
|
183 |
+
* Reset redirection for contact form 7 settings
|
184 |
+
*
|
185 |
+
* @return void
|
186 |
+
*/
|
187 |
+
public function wpcf7r_reset_settings() {
|
188 |
+
$options_list = array(
|
189 |
+
'wpcf7r-extensions-list-updated',
|
190 |
+
'wpcf7r-extensions-list',
|
191 |
+
'wpcf7r_activation_wpcf7r-send-mail-sku',
|
192 |
+
'wpcf7r_activation_wpcf7r-register-sku',
|
193 |
+
'wpcf7r_activation_wpcf7r-popup-sku',
|
194 |
+
'wpcf7r_activation_wpcf7r-paypal-sku',
|
195 |
+
'wpcf7r_activation_wpcf7r-mailchimp-sku',
|
196 |
+
'wpcf7r_activation_wpcf7r-login-sku',
|
197 |
+
'wpcf7r_activation_wpcf7r-custom-errors-sku',
|
198 |
+
'wpcf7r_activation_wpcf7r-create-post-sku',
|
199 |
+
'wpcf7r_activation_wpcf7r-conditional-logic-sku',
|
200 |
+
'wpcf7r_activation_wpcf7r-api-sku',
|
201 |
+
'wpcf7r_activation_wpcf7r-actions-bundle-sku',
|
202 |
+
'wpcf7_redirect_version',
|
203 |
+
'wpcf7_redirect_pro_version',
|
204 |
+
'wpcf7_redirect_pro_verion',
|
205 |
+
'wpcf7_redirect_dismiss_banner',
|
206 |
+
'wpcf7_redirect_admin_notice_ver_dismiss',
|
207 |
+
'wpcf7_migration_completed',
|
208 |
+
'wpcf_debug',
|
209 |
+
'wpcf7_redirect_admin_notice_dismiss',
|
210 |
+
'wpcf7r-extensions-banner-updated',
|
211 |
+
);
|
212 |
+
|
213 |
+
foreach ( $options_list as $option ) {
|
214 |
+
delete_option( $option );
|
215 |
+
}
|
216 |
+
}
|
217 |
/**
|
218 |
* Register plugins ajax hooks
|
219 |
*/
|
241 |
add_action( 'admin_init', array( $this, 'alert_conflicts' ) );
|
242 |
// run the migration process.
|
243 |
add_action( 'wp_ajax_wpcf7r_migrate_all_forms', array( $this, 'migrate_all_forms' ) );
|
244 |
+
// reset plugin settings
|
245 |
+
add_action( 'wp_ajax_wpcf7r_reset_settings', array( $this, 'wpcf7r_reset_settings' ) );
|
246 |
|
247 |
add_action( 'wp_ajax_nopriv_wpcf7r_get_nonce', array( $this, 'wpcf7r_get_nonce' ) );
|
248 |
add_action( 'wp_ajax_wpcf7r_get_nonce', array( $this, 'wpcf7r_get_nonce' ) );
|
classes/class-wpcf7r-form-helper.php
CHANGED
@@ -202,7 +202,9 @@ class WPCF7r_Form_Helper {
|
|
202 |
public function dismiss_ads() {
|
203 |
|
204 |
if ( isset( $_GET['wpcf7_redirect_dismiss_banner'] ) && '1' === $_GET['wpcf7_redirect_dismiss_banner'] ) {
|
205 |
-
|
|
|
|
|
206 |
}
|
207 |
|
208 |
}
|
@@ -474,75 +476,16 @@ class WPCF7r_Form_Helper {
|
|
474 |
public function render_discount_banner( $page, $action, $object ) {
|
475 |
|
476 |
if ( 'edit' === $action ) {
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
</span>
|
488 |
-
<ul class="rp-features-list">
|
489 |
-
<li>
|
490 |
-
<?php _e( 'Get 20% OffUpgrade your Contact Form 7 experience', 'wpcf7-redirect' ); ?>
|
491 |
-
</li>
|
492 |
-
<li>
|
493 |
-
<?php _e( 'With conditional actions management', 'wpcf7-redirect' ); ?>
|
494 |
-
</li>
|
495 |
-
</ul>
|
496 |
-
<div class="rp-contact-form">
|
497 |
-
<span class="rp-contact-form-title">
|
498 |
-
<?php _e( 'With conditional actions managementGet it now -', 'wpcf7-redirect' ); ?>
|
499 |
-
</span>
|
500 |
-
<div class="rp-cols">
|
501 |
-
<div class="rp-col-form">
|
502 |
-
<div class="rp-contact-form-form">
|
503 |
-
<div class="input-wrap">
|
504 |
-
<input type="email" name="rp_user_email" id="rp_user_email" aria-label="Enter your e-mail here" value="<?php echo get_option( 'admin_email' ); ?>" placeholder="Enter your e-mail here" />
|
505 |
-
<button class="btn-rp-submit" aria-label="Contact Form 7 Redirection Pro - submit application for a discount">
|
506 |
-
<span class="rp-icon-plane"></span>
|
507 |
-
</button>
|
508 |
-
</div>
|
509 |
-
<div class="checkbox-wrap">
|
510 |
-
<input type="checkbox" name="rp_get_offers" id="rp_get_offers" value="0">
|
511 |
-
<label for="rp_get_offers">
|
512 |
-
<?php _e( 'Keep me up to date on updates and exclusive offers', 'wpcf7-redirect' ); ?>
|
513 |
-
</label>
|
514 |
-
</div>
|
515 |
-
<div class="rp-form-message">
|
516 |
-
<span class="rp-loader"></span>
|
517 |
-
</div>
|
518 |
-
</div>
|
519 |
-
</div>
|
520 |
-
<div class="rp-col-featured">
|
521 |
-
<a href="<?php echo WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL; ?>" rel="noopener" target="_blank">
|
522 |
-
<span class="rp-text">
|
523 |
-
<?php _e( 'Featured in:', 'wpcf7-redirect' ); ?>
|
524 |
-
</span>
|
525 |
-
<span class="logo-querysol"></span>
|
526 |
-
</a>
|
527 |
-
</div>
|
528 |
-
</div>
|
529 |
-
</div>
|
530 |
-
<footer class="rp-footer">
|
531 |
-
<div class="rp-footer-top">
|
532 |
-
<strong><?php _e( 'WHY IT’S THE MIGHTIEST', 'wpcf7-redirect' ); ?></strong><?php _e( ' - Powerful conditional logic - Manage custom error messages - Manage direction rules -', 'wpcf7-redirect' ); ?>
|
533 |
-
<?php _e( 'Mailchimp integration - Paypal integration - Manage Google/Facebook Pixels', 'wpcf7-redirect' ); ?>
|
534 |
-
<a href="<?php echo WPCF7_PRO_REDIRECT_PLUGIN_PAGE_URL; ?>" target="_blank" rel="noopener">
|
535 |
-
<?php _e( 'Learn More', 'wpcf7-redirect' ); ?>
|
536 |
-
</a>
|
537 |
-
</div>
|
538 |
-
<div class="rp-footer-bottom">
|
539 |
-
<?php _e( 'Query Solutions Ltd. 2010 Ⓒ', 'wpcf7-redirect' ); ?>
|
540 |
-
</div>
|
541 |
-
</footer>
|
542 |
-
</div>
|
543 |
-
</div>
|
544 |
-
<?php
|
545 |
-
endif;
|
546 |
}
|
547 |
}
|
548 |
|
202 |
public function dismiss_ads() {
|
203 |
|
204 |
if ( isset( $_GET['wpcf7_redirect_dismiss_banner'] ) && '1' === $_GET['wpcf7_redirect_dismiss_banner'] ) {
|
205 |
+
$banner_version = wpcf7r_get_banner_version() ? wpcf7r_get_banner_version() : 1;
|
206 |
+
|
207 |
+
update_option( 'wpcf7_redirect_dismiss_banner', $banner_version );
|
208 |
}
|
209 |
|
210 |
}
|
476 |
public function render_discount_banner( $page, $action, $object ) {
|
477 |
|
478 |
if ( 'edit' === $action ) {
|
479 |
+
$banner_version_dismissed = get_option( 'wpcf7_redirect_dismiss_banner' );
|
480 |
+
$banner = wpcf7r_get_discount_banner();
|
481 |
+
|
482 |
+
if ( $banner ) {
|
483 |
+
update_option( 'wpcf7r_banner_version', $banner->version );
|
484 |
+
}
|
485 |
+
|
486 |
+
if ( ! $banner_version_dismissed && $banner_version_dismissed !== wpcf7r_get_banner_version() ) {
|
487 |
+
echo $banner->banner;
|
488 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
490 |
}
|
491 |
|
classes/class-wpcf7r-html.php
CHANGED
@@ -108,7 +108,7 @@ class WPCF7R_Html {
|
|
108 |
<tr class="row-template">
|
109 |
<td>
|
110 |
<select class="wpcf7r-fields" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][if]" required>
|
111 |
-
<option value=""
|
112 |
<?php foreach ( WPCF7R_Form::get_mail_tags() as $mail_tag ) : ?>
|
113 |
<option value="<?php echo $mail_tag['name']; ?>" <?php selected( $mail_tag['name'], $row_fields['if'] ); ?>><?php echo $mail_tag['name']; ?></option>
|
114 |
<?php endforeach; ?>
|
@@ -116,7 +116,7 @@ class WPCF7R_Html {
|
|
116 |
</td>
|
117 |
<td>
|
118 |
<select class="compare-options" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][condition]" required>
|
119 |
-
<option value=""
|
120 |
<option value="equal" <?php selected( $condition, 'equal' ); ?> data-comparetype="select"><?php _e( 'Equal', 'wpcf7-redirect' ); ?></option>
|
121 |
<option value="not-equal" <?php selected( $condition, 'not-equal' ); ?> data-comparetype="select"><?php _e( 'Non Equal', 'wpcf7-redirect' ); ?></option>
|
122 |
<option value="contain" <?php selected( $condition, 'contain' ); ?> data-comparetype=""><?php _e( 'Contains', 'wpcf7-redirect' ); ?></option>
|
@@ -140,7 +140,7 @@ class WPCF7R_Html {
|
|
140 |
<?php if ( in_array( $mail_tag->type, $select_fields, true ) ) : ?>
|
141 |
<?php $select_visible = $row_fields['if'] === $mail_tag['name'] ? true : $select_visible; ?>
|
142 |
<select class="group_row_value group_row_value_select" style="<?php echo $row_fields['if'] !== $mail_tag['name'] ? 'display:none;' : ''; ?>" data-rel="<?php echo $mail_tag['name']; ?>">
|
143 |
-
<option value=""
|
144 |
<?php
|
145 |
foreach ( $mail_tag->raw_values as $orig_value ) :
|
146 |
$orig_value = explode( '|', $orig_value );
|
@@ -148,11 +148,11 @@ class WPCF7R_Html {
|
|
148 |
$value = isset( $orig_value[1] ) && $orig_value[1] ? $orig_value[1] : $orig_value[0];
|
149 |
?>
|
150 |
<option value="<?php echo $value; ?>"
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
>
|
157 |
<?php echo $label; ?>
|
158 |
</option>
|
108 |
<tr class="row-template">
|
109 |
<td>
|
110 |
<select class="wpcf7r-fields" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][if]" required>
|
111 |
+
<option value="" <?php selected( $row_fields['if'], '' ); ?>><?php _e( 'Select' ); ?></option>
|
112 |
<?php foreach ( WPCF7R_Form::get_mail_tags() as $mail_tag ) : ?>
|
113 |
<option value="<?php echo $mail_tag['name']; ?>" <?php selected( $mail_tag['name'], $row_fields['if'] ); ?>><?php echo $mail_tag['name']; ?></option>
|
114 |
<?php endforeach; ?>
|
116 |
</td>
|
117 |
<td>
|
118 |
<select class="compare-options" name="wpcf7-redirect<?php echo $prefix; ?>[blocks][<?php echo $block_key; ?>][groups][<?php echo $group_key; ?>][<?php echo $group_row; ?>][condition]" required>
|
119 |
+
<option value="" <?php selected( $condition , '' ); ?>><?php _e( 'Select', 'wpcf7-redirect' ); ?></option>
|
120 |
<option value="equal" <?php selected( $condition, 'equal' ); ?> data-comparetype="select"><?php _e( 'Equal', 'wpcf7-redirect' ); ?></option>
|
121 |
<option value="not-equal" <?php selected( $condition, 'not-equal' ); ?> data-comparetype="select"><?php _e( 'Non Equal', 'wpcf7-redirect' ); ?></option>
|
122 |
<option value="contain" <?php selected( $condition, 'contain' ); ?> data-comparetype=""><?php _e( 'Contains', 'wpcf7-redirect' ); ?></option>
|
140 |
<?php if ( in_array( $mail_tag->type, $select_fields, true ) ) : ?>
|
141 |
<?php $select_visible = $row_fields['if'] === $mail_tag['name'] ? true : $select_visible; ?>
|
142 |
<select class="group_row_value group_row_value_select" style="<?php echo $row_fields['if'] !== $mail_tag['name'] ? 'display:none;' : ''; ?>" data-rel="<?php echo $mail_tag['name']; ?>">
|
143 |
+
<option value="" <?php selected( $row_fields['value'] , '' ); ?>><?php _e( 'Select', 'wpcf7-redirect' ); ?></option>
|
144 |
<?php
|
145 |
foreach ( $mail_tag->raw_values as $orig_value ) :
|
146 |
$orig_value = explode( '|', $orig_value );
|
148 |
$value = isset( $orig_value[1] ) && $orig_value[1] ? $orig_value[1] : $orig_value[0];
|
149 |
?>
|
150 |
<option value="<?php echo $value; ?>"
|
151 |
+
<?php
|
152 |
+
if ( isset( $row_fields['value'] ) ) :
|
153 |
+
selected( $row_fields['value'], $value );
|
154 |
+
endif;
|
155 |
+
?>
|
156 |
>
|
157 |
<?php echo $label; ?>
|
158 |
</option>
|
classes/class-wpcf7r-mailchimp-helper.php
CHANGED
@@ -79,6 +79,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
79 |
* @param $post_params
|
80 |
*/
|
81 |
public static function create_mailchimp_user( $list_id, $api_key, $post_params ) {
|
|
|
82 |
$instance = self::get_instance( $api_key );
|
83 |
|
84 |
try {
|
@@ -91,6 +92,12 @@ class WPCF7R_Mailchimp_Helper {
|
|
91 |
->members()
|
92 |
->post( $post_params );
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
} catch ( Exception $ex ) {
|
95 |
$response = new WP_Error( 'create_mailchimp_user', $ex->message . " List:{$list_id}" );
|
96 |
return $response;
|
@@ -116,6 +123,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
116 |
|
117 |
/**
|
118 |
* Create a new list
|
|
|
119 |
* @param $api_key
|
120 |
* @param $list_name
|
121 |
*/
|
@@ -125,7 +133,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
125 |
$response = '';
|
126 |
|
127 |
try {
|
128 |
-
$contact = new stdclass;
|
129 |
|
130 |
$contact->company = 'test';
|
131 |
$contact->address1 = 'address1';
|
@@ -135,7 +143,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
135 |
$contact->country = 'country';
|
136 |
$contact->phone = 'phone';
|
137 |
|
138 |
-
$campaign_defaults = new stdclass;
|
139 |
$campaign_defaults->from_name = 'name';
|
140 |
$campaign_defaults->from_email = 'test@gmail.com';
|
141 |
$campaign_defaults->subject = 'test';
|
@@ -173,6 +181,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
173 |
}
|
174 |
/**
|
175 |
* Get the lists from the API
|
|
|
176 |
* @param [type] $api_key [description]
|
177 |
* @return [type] [description]
|
178 |
*/
|
@@ -215,6 +224,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
215 |
|
216 |
/**
|
217 |
* Get merge tags from the relevant list
|
|
|
218 |
* @param [type] $list_id [description]
|
219 |
* @return [type] [description]
|
220 |
*/
|
@@ -233,6 +243,7 @@ class WPCF7R_Mailchimp_Helper {
|
|
233 |
|
234 |
/**
|
235 |
* Create an array from the raw list
|
|
|
236 |
* @param [type] $lists_raw [description]
|
237 |
* @return [type] [description]
|
238 |
*/
|
79 |
* @param $post_params
|
80 |
*/
|
81 |
public static function create_mailchimp_user( $list_id, $api_key, $post_params ) {
|
82 |
+
|
83 |
$instance = self::get_instance( $api_key );
|
84 |
|
85 |
try {
|
92 |
->members()
|
93 |
->post( $post_params );
|
94 |
|
95 |
+
if ( $results->wasFailure() ) {
|
96 |
+
$res_object = json_decode( $results->getBody() );
|
97 |
+
$response = new WP_Error( 'create_mailchimp_user', $res_object->detail . " List:{$list_id}" );
|
98 |
+
|
99 |
+
return $response;
|
100 |
+
}
|
101 |
} catch ( Exception $ex ) {
|
102 |
$response = new WP_Error( 'create_mailchimp_user', $ex->message . " List:{$list_id}" );
|
103 |
return $response;
|
123 |
|
124 |
/**
|
125 |
* Create a new list
|
126 |
+
*
|
127 |
* @param $api_key
|
128 |
* @param $list_name
|
129 |
*/
|
133 |
$response = '';
|
134 |
|
135 |
try {
|
136 |
+
$contact = new stdclass();
|
137 |
|
138 |
$contact->company = 'test';
|
139 |
$contact->address1 = 'address1';
|
143 |
$contact->country = 'country';
|
144 |
$contact->phone = 'phone';
|
145 |
|
146 |
+
$campaign_defaults = new stdclass();
|
147 |
$campaign_defaults->from_name = 'name';
|
148 |
$campaign_defaults->from_email = 'test@gmail.com';
|
149 |
$campaign_defaults->subject = 'test';
|
181 |
}
|
182 |
/**
|
183 |
* Get the lists from the API
|
184 |
+
*
|
185 |
* @param [type] $api_key [description]
|
186 |
* @return [type] [description]
|
187 |
*/
|
224 |
|
225 |
/**
|
226 |
* Get merge tags from the relevant list
|
227 |
+
*
|
228 |
* @param [type] $list_id [description]
|
229 |
* @return [type] [description]
|
230 |
*/
|
243 |
|
244 |
/**
|
245 |
* Create an array from the raw list
|
246 |
+
*
|
247 |
* @param [type] $lists_raw [description]
|
248 |
* @return [type] [description]
|
249 |
*/
|
classes/class-wpcf7r-settings.php
CHANGED
@@ -39,13 +39,13 @@ class WPCF7r_Settings {
|
|
39 |
*/
|
40 |
public function wpcf7r_register_options() {
|
41 |
$this->fields = array();
|
42 |
-
|
43 |
$this->add_settings_section();
|
44 |
|
45 |
foreach ( $this->fields as $field ) {
|
46 |
$args = array();
|
47 |
add_settings_field( $field['uid'], $field['label'], array( $this, 'field_callback' ), $this->page_slug, $field['section'], $field );
|
48 |
-
|
49 |
register_setting( $this->page_slug, $field['uid'], $args );
|
50 |
}
|
51 |
}
|
@@ -116,7 +116,7 @@ class WPCF7r_Settings {
|
|
116 |
$is_valid = $this->api->validate_serial( $activation_id, $serial );
|
117 |
}
|
118 |
|
119 |
-
//serial was not valid
|
120 |
if ( is_wp_error( $is_valid ) ) {
|
121 |
$message = $is_valid->get_error_message();
|
122 |
if ( is_object( $message ) && isset( $message->license_key ) ) {
|
@@ -131,7 +131,7 @@ class WPCF7r_Settings {
|
|
131 |
$this->reset_activation();
|
132 |
return false;
|
133 |
} elseif ( ! $activation_id ) {
|
134 |
-
//serial was valid, update the activation key for future validation
|
135 |
$this->set_activation( $is_valid->data );
|
136 |
}
|
137 |
|
@@ -222,7 +222,7 @@ class WPCF7r_Settings {
|
|
222 |
|
223 |
/**
|
224 |
* The setting page template HTML
|
225 |
-
|
226 |
public function plugin_settings_page_content() {
|
227 |
$wpcf7_extensions = new WPCF7R_Extensions();
|
228 |
?>
|
@@ -240,6 +240,15 @@ class WPCF7r_Settings {
|
|
240 |
<li>You can add multiple actions to a single form or a single action can be added to any form.</li>
|
241 |
<li>Create custom login/registration forms, manage your conversion pixels, set conditional rules and much more.</li>
|
242 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
</div>
|
244 |
<div class="postbox extensions-list-wrap">
|
245 |
<div class="padbox">
|
@@ -257,11 +266,12 @@ class WPCF7r_Settings {
|
|
257 |
?>
|
258 |
</form>
|
259 |
<?php if ( is_wpcf7r_debug() ) : ?>
|
260 |
-
<input type="button" name="migrate_again" value="<?php _e( 'Migrate
|
|
|
261 |
|
262 |
<h3><?php _e( 'Recreate from Debug', 'wpcf7-redirect' ); ?></h3>
|
263 |
<textarea id="debug-info" style="width:100%;"></textarea>
|
264 |
-
<button class="reacreate-from-debug button button-primary"><?php _e( 'Recreate From
|
265 |
<?php endif; ?>
|
266 |
</div>
|
267 |
</div>
|
39 |
*/
|
40 |
public function wpcf7r_register_options() {
|
41 |
$this->fields = array();
|
42 |
+
// $this->add_license_section();
|
43 |
$this->add_settings_section();
|
44 |
|
45 |
foreach ( $this->fields as $field ) {
|
46 |
$args = array();
|
47 |
add_settings_field( $field['uid'], $field['label'], array( $this, 'field_callback' ), $this->page_slug, $field['section'], $field );
|
48 |
+
// $args['sanitize_callback'] = array($this, 'validate_serial_key');
|
49 |
register_setting( $this->page_slug, $field['uid'], $args );
|
50 |
}
|
51 |
}
|
116 |
$is_valid = $this->api->validate_serial( $activation_id, $serial );
|
117 |
}
|
118 |
|
119 |
+
// serial was not valid
|
120 |
if ( is_wp_error( $is_valid ) ) {
|
121 |
$message = $is_valid->get_error_message();
|
122 |
if ( is_object( $message ) && isset( $message->license_key ) ) {
|
131 |
$this->reset_activation();
|
132 |
return false;
|
133 |
} elseif ( ! $activation_id ) {
|
134 |
+
// serial was valid, update the activation key for future validation
|
135 |
$this->set_activation( $is_valid->data );
|
136 |
}
|
137 |
|
222 |
|
223 |
/**
|
224 |
* The setting page template HTML
|
225 |
+
*/
|
226 |
public function plugin_settings_page_content() {
|
227 |
$wpcf7_extensions = new WPCF7R_Extensions();
|
228 |
?>
|
240 |
<li>You can add multiple actions to a single form or a single action can be added to any form.</li>
|
241 |
<li>Create custom login/registration forms, manage your conversion pixels, set conditional rules and much more.</li>
|
242 |
</ul>
|
243 |
+
<form method="post">
|
244 |
+
<br/>
|
245 |
+
<input type="submit" value="Check For Updates" class="button-primary" name="extensions-updates-check"/>
|
246 |
+
<br/><br/>
|
247 |
+
<lable>
|
248 |
+
<input type="checkbox" checked="checked" name="update-banner" value="1">
|
249 |
+
<?php _e( 'Get available deals and sales (no spam of any kind).' ); ?>
|
250 |
+
</label>
|
251 |
+
</form>
|
252 |
</div>
|
253 |
<div class="postbox extensions-list-wrap">
|
254 |
<div class="padbox">
|
266 |
?>
|
267 |
</form>
|
268 |
<?php if ( is_wpcf7r_debug() ) : ?>
|
269 |
+
<input type="button" name="migrate_again" value="<?php _e( 'Migrate Again from Old Settings', 'wpcf7-redirect' ); ?>" class="migrate_again button button-secondary" />
|
270 |
+
<input type="button" name="reset_all" value="<?php _e( 'Reset all Settings - BE CAREFUL! this will delete all Redirection for Contact Form 7 data.', 'wpcf7-redirect' ); ?>" class="cf7-redirect-reset button button-secondary" />
|
271 |
|
272 |
<h3><?php _e( 'Recreate from Debug', 'wpcf7-redirect' ); ?></h3>
|
273 |
<textarea id="debug-info" style="width:100%;"></textarea>
|
274 |
+
<button class="reacreate-from-debug button button-primary"><?php _e( 'Recreate From Debug', 'wpcf7-redirect' ); ?></button>
|
275 |
<?php endif; ?>
|
276 |
</div>
|
277 |
</div>
|
classes/class-wpcf7r-utils.php
CHANGED
@@ -505,7 +505,11 @@ class WPCF7r_Utils {
|
|
505 |
|
506 |
if ( $actions ) {
|
507 |
foreach ( $actions as $action ) {
|
508 |
-
|
|
|
|
|
|
|
|
|
509 |
}
|
510 |
} else {
|
511 |
$results['action_row'] = '';
|
505 |
|
506 |
if ( $actions ) {
|
507 |
foreach ( $actions as $action ) {
|
508 |
+
if( ! is_wp_error($action )){
|
509 |
+
$results['action_row'] .= $action->get_action_row();
|
510 |
+
}else{
|
511 |
+
wp_send_json( $results );
|
512 |
+
}
|
513 |
}
|
514 |
} else {
|
515 |
$results['action_row'] = '';
|
modules/index.php
DELETED
File without changes
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Tags: contact form 7 redirect, contact form 7 thank you page, redirect cf7, redirect contact form 7, contact form 7 success page, cf7 redirect, registration form, mailchimp, login form, conditional redirect, cms integration, conversions, save leads, paypal
|
3 |
Contributors: yuvalsabar, regevlio
|
4 |
Requires at least: 4.7.0
|
5 |
-
Tested up to: 5.5.
|
6 |
-
Stable tag: 2.2.
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -38,15 +38,15 @@ Cooperation with a world leading web accessibility solution - you can try it for
|
|
38 |
* **[Extension]** Frontend Registration - Use contact form 7 as a registration form
|
39 |
* **[Extension]** Frontend Login - Use contact form 7 to login users to your website
|
40 |
* **[Extension]** Automatically add form submissions to your predefined list
|
41 |
-
* **[Extension]** Conditional error
|
42 |
* **[Extension]** Manage email notifications by conditional logic
|
43 |
* **[Extension]** Fire custom JavaScript events by conditional logic
|
44 |
* **[Extension]** Send data to remote servers (3rd-party integration)
|
45 |
-
* **[Extension]** Send
|
46 |
-
* **[Extension]** Send
|
47 |
* **[Extension]** PayPal Integration
|
48 |
|
49 |
-
> Note: some features are availible only
|
50 |
|
51 |
== Installation ==
|
52 |
|
@@ -77,11 +77,19 @@ No. One of the reasons we developed this plugin, is because on_send_ok is now de
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= 2.2.7 =
|
81 |
-
*
|
82 |
|
83 |
= 2.2.6 =
|
84 |
* Fixed support for non-ajax redirection action.
|
|
|
85 |
|
86 |
= 2.2.5 =
|
87 |
* Fixed compatibility issues with "Contact Form 7 - Conditional Fields" Plugin.
|
2 |
Tags: contact form 7 redirect, contact form 7 thank you page, redirect cf7, redirect contact form 7, contact form 7 success page, cf7 redirect, registration form, mailchimp, login form, conditional redirect, cms integration, conversions, save leads, paypal
|
3 |
Contributors: yuvalsabar, regevlio
|
4 |
Requires at least: 4.7.0
|
5 |
+
Tested up to: 5.5.3
|
6 |
+
Stable tag: 2.2.8
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
38 |
* **[Extension]** Frontend Registration - Use contact form 7 as a registration form
|
39 |
* **[Extension]** Frontend Login - Use contact form 7 to login users to your website
|
40 |
* **[Extension]** Automatically add form submissions to your predefined list
|
41 |
+
* **[Extension]** Conditional form validations (custom error messages)
|
42 |
* **[Extension]** Manage email notifications by conditional logic
|
43 |
* **[Extension]** Fire custom JavaScript events by conditional logic
|
44 |
* **[Extension]** Send data to remote servers (3rd-party integration)
|
45 |
+
* **[Extension]** Send submissions to API Json/XML to remote servers
|
46 |
+
* **[Extension]** Send submissions to API POST/GET to remote servers
|
47 |
* **[Extension]** PayPal Integration
|
48 |
|
49 |
+
> Note: some features are availible only as an extension. Which means you need Redirection for Contact Form 7 Pro to unlock those features. You can [get Redirection for Contact Form 7 Pro here](http://querysol.com/product/contact-form-7-redirection/)!
|
50 |
|
51 |
== Installation ==
|
52 |
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 2.2.8 =
|
81 |
+
* Added html support to Send Email action.
|
82 |
+
* Added file attachments support to Send Email action.
|
83 |
+
* Added reset settings button to debug tools.
|
84 |
+
* Fixed a bug: radio buttons and checkboxes are now passed correctly as url parameters.
|
85 |
+
* Fixed a bug: "Changes you made may not be saved" pop-up no longer appears when no changes have been made.
|
86 |
+
|
87 |
= 2.2.7 =
|
88 |
+
* Fixed extensions update check interval.
|
89 |
|
90 |
= 2.2.6 =
|
91 |
* Fixed support for non-ajax redirection action.
|
92 |
+
* Minor styling changes.
|
93 |
|
94 |
= 2.2.5 =
|
95 |
* Fixed compatibility issues with "Contact Form 7 - Conditional Fields" Plugin.
|
templates/fields/field-text.php
CHANGED
@@ -4,26 +4,38 @@
|
|
4 |
*/
|
5 |
|
6 |
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
?>
|
8 |
-
<div class="field-wrap field-wrap-<?php echo $
|
9 |
-
<?php if (
|
10 |
-
<label for="wpcf7-redirect-<?php echo $
|
11 |
-
<strong><?php echo esc_html( $
|
12 |
-
<?php echo
|
13 |
</label>
|
14 |
<?php endif; ?>
|
15 |
|
16 |
-
<?php if (
|
17 |
|
18 |
<div class="wpcf7-subtitle">
|
19 |
-
<?php echo $
|
20 |
</div>
|
21 |
|
22 |
<?php endif; ?>
|
23 |
|
24 |
-
<input type="text" class="wpcf7-redirect-<?php echo $
|
25 |
|
26 |
<div class="field-footer">
|
27 |
-
<?php echo
|
28 |
</div>
|
29 |
</div>
|
4 |
*/
|
5 |
|
6 |
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
+
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
+
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
+
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
+
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
+
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
+
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
+
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
+
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
+
|
19 |
?>
|
20 |
+
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo $class; ?>">
|
21 |
+
<?php if ( $label ) : ?>
|
22 |
+
<label for="wpcf7-redirect-<?php echo $name; ?>">
|
23 |
+
<strong><?php echo esc_html( $label ); ?></strong>
|
24 |
+
<?php echo $tooltip;?>
|
25 |
</label>
|
26 |
<?php endif; ?>
|
27 |
|
28 |
+
<?php if ( $sub_title ) : ?>
|
29 |
|
30 |
<div class="wpcf7-subtitle">
|
31 |
+
<?php echo esc_html( $sub_title ); ?>
|
32 |
</div>
|
33 |
|
34 |
<?php endif; ?>
|
35 |
|
36 |
+
<input type="text" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields <?php echo esc_html( $input_class ); ?>" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]" value="<?php echo esc_html( $value ); ?>" <?php echo esc_html( $input_attr ); ?>>
|
37 |
|
38 |
<div class="field-footer">
|
39 |
+
<?php echo $footer; ?>
|
40 |
</div>
|
41 |
</div>
|
templates/fields/field-textarea.php
CHANGED
@@ -4,18 +4,30 @@
|
|
4 |
*/
|
5 |
|
6 |
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
?>
|
8 |
-
<div class="field-wrap field-wrap-<?php echo $
|
9 |
-
<label for="wpcf7-redirect-<?php echo $
|
10 |
-
<strong><?php echo esc_html( $
|
11 |
</label>
|
12 |
-
<?php if (
|
13 |
<div class="wpcf7-subtitle">
|
14 |
-
<?php echo $
|
15 |
</div>
|
16 |
<?php endif; ?>
|
17 |
-
<textarea rows="10" class="wpcf7-redirect-<?php echo $
|
18 |
<div class="field-footer">
|
19 |
-
<?php echo
|
20 |
</div>
|
21 |
</div>
|
4 |
*/
|
5 |
|
6 |
defined( 'ABSPATH' ) || exit;
|
7 |
+
|
8 |
+
$name = isset( $field['name'] ) ? $field['name'] : '';
|
9 |
+
$class = isset( $field['class'] ) ? $field['class'] : '';
|
10 |
+
$label = isset( $field['label'] ) ? $field['label'] : '';
|
11 |
+
$tooltip = isset( $field['tooltip'] ) ? cf7r_tooltip( $field['tooltip'] ) : '';
|
12 |
+
$sub_title = isset( $field['sub_title'] ) ? $field['sub_title'] : '';
|
13 |
+
$input_class = isset( $field['input_class'] ) ? $field['input_class'] : '';
|
14 |
+
$input_attr = isset( $field['input_attr'] ) ? $field['input_attr'] : '';
|
15 |
+
$footer = isset( $field['footer'] ) ? $field['footer'] : '';
|
16 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
|
17 |
+
$value = isset( $field['value'] ) ? $field['value'] : '';
|
18 |
+
|
19 |
?>
|
20 |
+
<div class="field-wrap field-wrap-<?php echo esc_html( $name ); ?> <?php echo esc_html( $class ); ?>">
|
21 |
+
<label for="wpcf7-redirect-<?php echo esc_html( $name ); ?>">
|
22 |
+
<strong><?php echo esc_html( $label ); ?></strong>
|
23 |
</label>
|
24 |
+
<?php if ( $sub_title ) : ?>
|
25 |
<div class="wpcf7-subtitle">
|
26 |
+
<?php echo esc_html( $sub_title ); ?>
|
27 |
</div>
|
28 |
<?php endif; ?>
|
29 |
+
<textarea rows="10" class="wpcf7-redirect-<?php echo esc_html( $name ); ?>-fields" placeholder="<?php echo esc_html( $placeholder ); ?>" name="wpcf7-redirect<?php echo esc_html( $prefix ); ?>[<?php echo esc_html( $name ); ?>]"><?php echo esc_html( $value ); ?></textarea>
|
30 |
<div class="field-footer">
|
31 |
+
<?php echo $footer ; ?>
|
32 |
</div>
|
33 |
</div>
|
wpcf7-redirect.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: https://redirection-for-contact-form7.com/
|
5 |
* Description: The ultimate add-on for Contact Form 7 - redirect to any page after submission, fire scripts, save submissions in database, and much more options to make Contact Form 7 poweful than ever.
|
6 |
-
* Version: 2.2.
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: https://redirection-for-contact-form7.com/
|
9 |
* Contributors: querysolutions, yuvalsabar, regevlio
|
@@ -23,7 +23,7 @@ if ( ! defined( 'CF7_REDIRECT_DEBUG' ) ) {
|
|
23 |
define( 'CF7_REDIRECT_DEBUG', get_option( 'wpcf_debug' ) ? true : false );
|
24 |
}
|
25 |
|
26 |
-
define( 'WPCF7_PRO_REDIRECT_PLUGIN_VERSION', '2.2' );
|
27 |
define( 'WPCF7_PRO_MIGRATION_VERSION', '1' );
|
28 |
define( 'WPCF7_PRO_REDIRECT_CLASSES_PATH', plugin_dir_path( __FILE__ ) . 'classes/' );
|
29 |
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: https://redirection-for-contact-form7.com/
|
5 |
* Description: The ultimate add-on for Contact Form 7 - redirect to any page after submission, fire scripts, save submissions in database, and much more options to make Contact Form 7 poweful than ever.
|
6 |
+
* Version: 2.2.8
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: https://redirection-for-contact-form7.com/
|
9 |
* Contributors: querysolutions, yuvalsabar, regevlio
|
23 |
define( 'CF7_REDIRECT_DEBUG', get_option( 'wpcf_debug' ) ? true : false );
|
24 |
}
|
25 |
|
26 |
+
define( 'WPCF7_PRO_REDIRECT_PLUGIN_VERSION', '2.2.8' );
|
27 |
define( 'WPCF7_PRO_MIGRATION_VERSION', '1' );
|
28 |
define( 'WPCF7_PRO_REDIRECT_CLASSES_PATH', plugin_dir_path( __FILE__ ) . 'classes/' );
|
29 |
|
wpcf7r-functions.php
CHANGED
@@ -16,7 +16,28 @@ defined( 'ABSPATH' ) || exit;
|
|
16 |
* @return array - $extensions - extensions array.
|
17 |
*/
|
18 |
function wpcf7_get_extensions() {
|
19 |
-
$extensions =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
'special-offer' => array(
|
21 |
'name' => 'accessibie-plugin',
|
22 |
'title' => __( 'Website Accessibility', 'wpcf7-redirect' ),
|
@@ -127,17 +148,33 @@ function wpcf7_get_extensions() {
|
|
127 |
),
|
128 |
);
|
129 |
|
130 |
-
$
|
131 |
|
132 |
-
|
133 |
-
foreach ( $installed_extensions as $installed_extension ) {
|
134 |
-
if ( class_exists( $extension['classname'] ) || $installed_extension['handler'] === $extension['classname'] || ( isset( $extension['type'] ) && 'affiliate' === $extension['type'] ) ) {
|
135 |
-
$extensions[ $key ]['active'] = true;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
|
140 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
/**
|
@@ -322,14 +359,14 @@ function block_field_value( $key, $block_key, $fields ) {
|
|
322 |
function wpcf7_remove_old_plugin_notice() {
|
323 |
?>
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
|
334 |
<?php
|
335 |
}
|
@@ -340,14 +377,14 @@ function wpcf7_remove_old_plugin_notice() {
|
|
340 |
function wpcf7_remove_contact_form_7_to_api() {
|
341 |
?>
|
342 |
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
|
352 |
<?php
|
353 |
}
|
@@ -375,27 +412,27 @@ function wpcf7r_admin_notice() {
|
|
375 |
if ( $ver < 4.8 ) {
|
376 |
?>
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
|
387 |
<?php
|
388 |
} else {
|
389 |
// If CF7 isn't installed and activated, throw an error.
|
390 |
?>
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
|
400 |
<?php
|
401 |
}
|
16 |
* @return array - $extensions - extensions array.
|
17 |
*/
|
18 |
function wpcf7_get_extensions() {
|
19 |
+
$extensions = wpcf7_redirect_get_all_extensions_list();
|
20 |
+
|
21 |
+
$installed_extensions = wpcf7r_get_available_actions();
|
22 |
+
|
23 |
+
foreach ( $extensions as $key => $extension ) {
|
24 |
+
foreach ( $installed_extensions as $installed_extension ) {
|
25 |
+
if ( class_exists( $extension['classname'] ) || $installed_extension['handler'] === $extension['classname'] || ( isset( $extension['type'] ) && 'affiliate' === $extension['type'] ) ) {
|
26 |
+
$extensions[ $key ]['active'] = true;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return apply_filters( 'wpcf7_get_extensions', $extensions );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get all available extensions definitions.
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
function wpcf7_redirect_get_all_extensions_list() {
|
40 |
+
$defaults = array(
|
41 |
'special-offer' => array(
|
42 |
'name' => 'accessibie-plugin',
|
43 |
'title' => __( 'Website Accessibility', 'wpcf7-redirect' ),
|
148 |
),
|
149 |
);
|
150 |
|
151 |
+
$api = new Qs_Api();
|
152 |
|
153 |
+
$extensions_from_api = $api->get_extensions_definitions();
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
return $extensions_from_api ? $extensions_from_api : $defaults;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get promotion banner
|
160 |
+
*
|
161 |
+
* @return void
|
162 |
+
*/
|
163 |
+
function wpcf7r_get_discount_banner() {
|
164 |
+
$api = new Qs_Api();
|
165 |
+
|
166 |
+
$promotion_banner = $api->get_promotion_banner();
|
167 |
+
|
168 |
+
return $promotion_banner;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get the promotion banner version.
|
173 |
+
*
|
174 |
+
* @return int - banner version.
|
175 |
+
*/
|
176 |
+
function wpcf7r_get_banner_version() {
|
177 |
+
return get_option( 'wpcf7r_banner_version' );
|
178 |
}
|
179 |
|
180 |
/**
|
359 |
function wpcf7_remove_old_plugin_notice() {
|
360 |
?>
|
361 |
|
362 |
+
<div class="wpcf7-redirect-error error notice">
|
363 |
+
<h3>
|
364 |
+
<?php esc_html_e( 'Redirection for Contact Form 7', 'wpcf7-redirect' ); ?>
|
365 |
+
</h3>
|
366 |
+
<p>
|
367 |
+
<?php esc_html_e( 'Error: It is recommended to deactivate and remove Redirection for Contact Form 7 plugin for the PRO version to work.', 'wpcf7-redirect' ); ?>
|
368 |
+
</p>
|
369 |
+
</div>
|
370 |
|
371 |
<?php
|
372 |
}
|
377 |
function wpcf7_remove_contact_form_7_to_api() {
|
378 |
?>
|
379 |
|
380 |
+
<div class="wpcf7-redirect-error error notice">
|
381 |
+
<h3>
|
382 |
+
<?php esc_html_e( 'Redirection for Contact Form 7', 'wpcf7-redirect' ); ?>
|
383 |
+
</h3>
|
384 |
+
<p>
|
385 |
+
<?php esc_html_e( 'Error: It is recommended to deactivate and remove Contact Form 7 to API plugin.', 'wpcf7-redirect' ); ?>
|
386 |
+
</p>
|
387 |
+
</div>
|
388 |
|
389 |
<?php
|
390 |
}
|
412 |
if ( $ver < 4.8 ) {
|
413 |
?>
|
414 |
|
415 |
+
<div class="wpcf7-redirect-error error notice">
|
416 |
+
<h3>
|
417 |
+
<?php esc_html_e( 'Redirection for Contact Form 7', 'wpcf7-redirect' ); ?>
|
418 |
+
</h3>
|
419 |
+
<p>
|
420 |
+
<?php esc_html_e( 'Error: Contact Form 7 version is too old. Redirection for Contact Form 7 is compatible from version 4.8 and above. Please update Contact Form 7.', 'wpcf7-redirect' ); ?>
|
421 |
+
</p>
|
422 |
+
</div>
|
423 |
|
424 |
<?php
|
425 |
} else {
|
426 |
// If CF7 isn't installed and activated, throw an error.
|
427 |
?>
|
428 |
+
<div class="wpcf7-redirect-error error notice">
|
429 |
+
<h3>
|
430 |
+
<?php esc_html_e( 'Contact Form Redirection', 'wpcf7-redirect' ); ?>
|
431 |
+
</h3>
|
432 |
+
<p>
|
433 |
+
<?php esc_html_e( 'Error: Please install and activate Contact Form 7.', 'wpcf7-redirect' ); ?>
|
434 |
+
</p>
|
435 |
+
</div>
|
436 |
|
437 |
<?php
|
438 |
}
|