Version Description
https://contactform7.com/contact-form-7-562/
Download this release
Release Info
Developer | takayukister |
Plugin | Contact Form 7 |
Version | 5.6.2 |
Comparing to | |
See all releases |
Code changes from version 5.6.1 to 5.6.2
- includes/js/index.js +1 -1
- includes/submission.php +155 -4
- includes/validation-functions.php +17 -4
- modules/akismet.php +41 -3
- readme.txt +5 -1
- wp-contact-form-7.php +2 -2
includes/js/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var e={d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{date:function(){return m},email:function(){return p},file:function(){return h},maxdate:function(){return x},maxfilesize:function(){return A},maxlength:function(){return v},maxnumber:function(){return b},mindate:function(){return y},minlength:function(){return w},minnumber:function(){return g},number:function(){return u},required:function(){return c},requiredfile:function(){return l},tel:function(){return f},url:function(){return d}});const n=e=>Math.abs(parseInt(e,10)),a=(e,t)=>{const n=new Map([["init","init"],["validation_failed","invalid"],["acceptance_missing","unaccepted"],["spam","spam"],["aborted","aborted"],["mail_sent","sent"],["mail_failed","failed"],["submitting","submitting"],["resetting","resetting"],["validating","validating"],["payment_required","payment-required"]]);n.has(t)&&(t=n.get(t)),Array.from(n.values()).includes(t)||(t=`custom-${t=(t=t.replace(/[^0-9a-z]+/i," ").trim()).replace(/\s+/,"-")}`);const a=e.getAttribute("data-status");return e.wpcf7.status=t,e.setAttribute("data-status",t),e.classList.add(t),a&&a!==t&&e.classList.remove(a),t},o=(e,t,n)=>{const a=new CustomEvent(`wpcf7${t}`,{bubbles:!0,detail:n});"string"==typeof e&&(e=document.querySelector(e)),e.dispatchEvent(a)},i=e=>{const{root:t,namespace:n="contact-form-7/v1"}=wpcf7.api,a=s.reduceRight(((e,t)=>n=>t(n,e)),(e=>{let a,o,{url:i,path:s,endpoint:r,headers:c,body:l,data:p,...d}=e;"string"==typeof r&&(a=n.replace(/^\/|\/$/g,""),o=r.replace(/^\//,""),s=o?a+"/"+o:a),"string"==typeof s&&(-1!==t.indexOf("?")&&(s=s.replace("?","&")),s=s.replace(/^\//,""),i=t+s),c={Accept:"application/json, */*;q=0.1",...c},delete c["X-WP-Nonce"],p&&(l=JSON.stringify(p),c["Content-Type"]="application/json");const f={code:"fetch_error",message:"You are probably offline."},u={code:"invalid_json",message:"The response is not a valid JSON response."};return window.fetch(i||s||window.location.href,{...d,headers:c,body:l}).then((e=>Promise.resolve(e).then((e=>{if(e.status>=200&&e.status<300)return e;throw e})).then((e=>{if(204===e.status)return null;if(e&&e.json)return e.json().catch((()=>{throw u}));throw u}))),(()=>{throw f}))}));return a(e)},s=[];function r(e){let{rule:t,field:n,error:a,...o}=e;this.rule=t,this.field=n,this.error=a,this.properties=o}i.use=e=>{s.unshift(e)};const c=function(e){if(0===e.getAll(this.field).length)throw new r(this)},l=function(e){if(0===e.getAll(this.field).length)throw new r(this)},p=function(e){if(!e.getAll(this.field).every((e=>{if((e=e.trim()).length<6)return!1;if(-1===e.indexOf("@",1))return!1;if(e.indexOf("@")!==e.lastIndexOf("@"))return!1;const[t,n]=e.split("@",2);if(!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/.test(t))return!1;if(/\.{2,}/.test(n))return!1;if(/(?:^[ \t\n\r\0\x0B.]|[ \t\n\r\0\x0B.]$)/.test(n))return!1;const a=n.split(".");if(a.length<2)return!1;for(const e of a){if(/(?:^[ \t\n\r\0\x0B-]|[ \t\n\r\0\x0B-]$)/.test(e))return!1;if(!/^[a-z0-9-]+$/i.test(e))return!1}return!0})))throw new r(this)},d=function(e){const t=e.getAll(this.field);if(!t.every((e=>{if(""===(e=e.trim()))return!1;try{return(e=>-1!==["http","https","ftp","ftps","mailto","news","irc","irc6","ircs","gopher","nntp","feed","telnet","mms","rtsp","sms","svn","tel","fax","xmpp","webcal","urn"].indexOf(e))(new URL(e).protocol.replace(/:$/,""))}catch{return!1}})))throw new r(this)},f=function(e){if(!e.getAll(this.field).every((e=>(e=(e=e.trim()).replaceAll(/[()/.*#\s-]+/g,""),/^[+]?[0-9]+$/.test(e)))))throw new r(this)},u=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!!/^[-]?[0-9]+(?:[eE][+-]?[0-9]+)?$/.test(e)||!!/^[-]?(?:[0-9]+)?[.][0-9]+(?:[eE][+-]?[0-9]+)?$/.test(e)))))throw new r(this)},m=function(e){if(!e.getAll(this.field).every((e=>/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e.trim()))))throw new r(this)},h=function(e){if(!e.getAll(this.field).every((e=>{var t;return e instanceof File&&(null===(t=this.accept)||void 0===t?void 0:t.some((t=>/^\.[a-z0-9]+$/i.test(t)?e.name.toLowerCase().endsWith(t.toLowerCase()):(e=>{const t=[],n=e.match(/^(?<toplevel>[a-z]+)\/(?<sub>[*]|[a-z0-9.+-]+)$/i);if(n){const e=n.groups.toplevel.toLowerCase(),a=n.groups.sub.toLowerCase();for(const[o,i]of(()=>{const e=new Map;return e.set("jpg|jpeg|jpe","image/jpeg"),e.set("gif","image/gif"),e.set("png","image/png"),e.set("bmp","image/bmp"),e.set("tiff|tif","image/tiff"),e.set("webp","image/webp"),e.set("ico","image/x-icon"),e.set("heic","image/heic"),e.set("asf|asx","video/x-ms-asf"),e.set("wmv","video/x-ms-wmv"),e.set("wmx","video/x-ms-wmx"),e.set("wm","video/x-ms-wm"),e.set("avi","video/avi"),e.set("divx","video/divx"),e.set("flv","video/x-flv"),e.set("mov|qt","video/quicktime"),e.set("mpeg|mpg|mpe","video/mpeg"),e.set("mp4|m4v","video/mp4"),e.set("ogv","video/ogg"),e.set("webm","video/webm"),e.set("mkv","video/x-matroska"),e.set("3gp|3gpp","video/3gpp"),e.set("3g2|3gp2","video/3gpp2"),e.set("txt|asc|c|cc|h|srt","text/plain"),e.set("csv","text/csv"),e.set("tsv","text/tab-separated-values"),e.set("ics","text/calendar"),e.set("rtx","text/richtext"),e.set("css","text/css"),e.set("htm|html","text/html"),e.set("vtt","text/vtt"),e.set("dfxp","application/ttaf+xml"),e.set("mp3|m4a|m4b","audio/mpeg"),e.set("aac","audio/aac"),e.set("ra|ram","audio/x-realaudio"),e.set("wav","audio/wav"),e.set("ogg|oga","audio/ogg"),e.set("flac","audio/flac"),e.set("mid|midi","audio/midi"),e.set("wma","audio/x-ms-wma"),e.set("wax","audio/x-ms-wax"),e.set("mka","audio/x-matroska"),e.set("rtf","application/rtf"),e.set("js","application/javascript"),e.set("pdf","application/pdf"),e.set("swf","application/x-shockwave-flash"),e.set("class","application/java"),e.set("tar","application/x-tar"),e.set("zip","application/zip"),e.set("gz|gzip","application/x-gzip"),e.set("rar","application/rar"),e.set("7z","application/x-7z-compressed"),e.set("exe","application/x-msdownload"),e.set("psd","application/octet-stream"),e.set("xcf","application/octet-stream"),e.set("doc","application/msword"),e.set("pot|pps|ppt","application/vnd.ms-powerpoint"),e.set("wri","application/vnd.ms-write"),e.set("xla|xls|xlt|xlw","application/vnd.ms-excel"),e.set("mdb","application/vnd.ms-access"),e.set("mpp","application/vnd.ms-project"),e.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),e.set("docm","application/vnd.ms-word.document.macroEnabled.12"),e.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),e.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),e.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),e.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),e.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),e.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),e.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),e.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),e.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),e.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),e.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),e.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),e.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),e.set("potm","application/vnd.ms-powerpoint.template.macroEnabled.12"),e.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),e.set("sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"),e.set("sldm","application/vnd.ms-powerpoint.slide.macroEnabled.12"),e.set("onetoc|onetoc2|onetmp|onepkg","application/onenote"),e.set("oxps","application/oxps"),e.set("xps","application/vnd.ms-xpsdocument"),e.set("odt","application/vnd.oasis.opendocument.text"),e.set("odp","application/vnd.oasis.opendocument.presentation"),e.set("ods","application/vnd.oasis.opendocument.spreadsheet"),e.set("odg","application/vnd.oasis.opendocument.graphics"),e.set("odc","application/vnd.oasis.opendocument.chart"),e.set("odb","application/vnd.oasis.opendocument.database"),e.set("odf","application/vnd.oasis.opendocument.formula"),e.set("wp|wpd","application/wordperfect"),e.set("key","application/vnd.apple.keynote"),e.set("numbers","application/vnd.apple.numbers"),e.set("pages","application/vnd.apple.pages"),e})())("*"===a&&i.startsWith(e+"/")||i===n[0])&&t.push(...o.split("|"))}return t})(t).some((t=>(t="."+t.trim(),e.name.toLowerCase().endsWith(t.toLowerCase())))))))})))throw new r(this)},w=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{"string"==typeof e&&(n+=e.length)})),n<parseInt(this.threshold))throw new r(this)},v=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{"string"==typeof e&&(n+=e.length)})),parseInt(this.threshold)<n)throw new r(this)},g=function(e){if(!e.getAll(this.field).every((e=>!(parseFloat(e)<parseFloat(this.threshold)))))throw new r(this)},b=function(e){if(!e.getAll(this.field).every((e=>!(parseFloat(this.threshold)<parseFloat(e)))))throw new r(this)},y=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!(/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e)&&/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(this.threshold)&&e<this.threshold)))))throw new r(this)},x=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!(/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e)&&/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(this.threshold)&&this.threshold<e)))))throw new r(this)},A=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{e instanceof File&&(n+=e.size)})),parseInt(this.threshold)<n)throw new r(this)};function E(e){if(this.formData={},this.tree={},!(e instanceof FormData))return this;this.formData=e;const t=()=>{const e=new Map;return e.largestIndex=0,e.set=function(t,n){""===t?t=e.largestIndex++:/^[0-9]+$/.test(t)&&(t=parseInt(t),e.largestIndex<=t&&(e.largestIndex=t+1)),Map.prototype.set.call(e,t,n)},e};this.tree=t();const n=/^(?<name>[a-z][-a-z0-9_:]*)(?<array>(?:\[(?:[a-z][-a-z0-9_:]*|[0-9]*)\])*)/i;for(const[e,a]of this.formData){const o=e.match(n);if(o)if(""===o.groups.array)this.tree.set(o.groups.name,a);else{const e=[...o.groups.array.matchAll(/\[([a-z][-a-z0-9_:]*|[0-9]*)\]/gi)].map((e=>{let[t,n]=e;return n}));e.unshift(o.groups.name);const n=e.pop();e.reduce(((e,n)=>{if(/^[0-9]+$/.test(n)&&(n=parseInt(n)),e.get(n)instanceof Map)return e.get(n);const a=t();return e.set(n,a),a}),this.tree).set(n,a)}}}function q(e){var t,n,o,i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const c=e;if(null===(t=s.target)||void 0===t||!t.closest(".wpcf7-form-control-wrap[data-name]"))return;if(null!==(n=s.target)&&void 0!==n&&n.closest(".novalidate"))return;const l=new FormData,p=[];for(const e of c.querySelectorAll(".wpcf7-form-control-wrap"))if(!e.closest(".novalidate")&&(e.querySelectorAll(":where( input, textarea, select ):enabled").forEach((e=>{if(e.name)switch(e.type){case"button":case"image":case"reset":case"submit":break;case"checkbox":case"radio":e.checked&&l.append(e.name,e.value);break;case"select-multiple":for(const t of e.selectedOptions)l.append(e.name,t.value);break;case"file":for(const t of e.files)l.append(e.name,t);break;default:l.append(e.name,e.value)}})),e.dataset.name&&(p.push(e.dataset.name),e.setAttribute("data-under-validation","1"),e.dataset.name===s.target.name.replace(/\[.*\]$/,""))))break;const d=null!==(o=q.validators)&&void 0!==o?o:{},f=(null!==(i=e.wpcf7.schema.rules)&&void 0!==i?i:[]).filter((e=>{let{rule:t,...n}=e;return"function"==typeof d[t]&&("function"==typeof d[t].matches?d[t].matches(n,s):p.includes(n.field))}));if(!f.length)return;const u=e.getAttribute("data-status");Promise.resolve(a(e,"validating")).then((t=>{const n=[],a=new E(l);for(const{rule:t,...o}of f)if(!n.includes(o.field))try{_(e,o.field),d[t].call({rule:t,...o},a)}catch(t){t instanceof r&&(S(e,o.field,t.error),n.push(o.field))}})).finally((()=>{a(e,u),e.querySelectorAll(".wpcf7-form-control-wrap[data-under-validation]").forEach((e=>{e.removeAttribute("data-under-validation")}))}))}E.prototype.entries=function(){return this.tree.entries()},E.prototype.get=function(e){return this.tree.get(e)},E.prototype.getAll=function(e){if(!this.has(e))return[];const t=e=>{const n=[];if(e instanceof Map)for(const[a,o]of e)n.push(...t(o));else""!==e&&n.push(e);return n};return t(this.get(e))},E.prototype.has=function(e){return this.tree.has(e)},E.prototype.keys=function(){return this.tree.keys()},E.prototype.values=function(){return this.tree.values()},q.validators=t;const S=(e,t,n)=>{var a;const o=`${null===(a=e.wpcf7)||void 0===a?void 0:a.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,""),i=e.querySelector(`.wpcf7-form-control-wrap[data-name="${t}"] .wpcf7-form-control`);(()=>{const t=document.createElement("li");t.setAttribute("id",o),i&&i.id?t.insertAdjacentHTML("beforeend",`<a href="#${i.id}">${n}</a>`):t.insertAdjacentText("beforeend",n),e.wpcf7.parent.querySelector(".screen-reader-response ul").appendChild(t)})(),e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((t=>{if("validating"===e.getAttribute("data-status")&&!t.dataset.underValidation)return;const a=document.createElement("span");a.classList.add("wpcf7-not-valid-tip"),a.setAttribute("aria-hidden","true"),a.insertAdjacentText("beforeend",n),t.appendChild(a),t.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","true")})),t.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.classList.add("wpcf7-not-valid"),e.setAttribute("aria-describedby",o),"function"==typeof e.setCustomValidity&&e.setCustomValidity(n),e.closest(".use-floating-validation-tip")&&(e.addEventListener("focus",(e=>{a.setAttribute("style","display: none")})),a.addEventListener("click",(e=>{a.setAttribute("style","display: none")})))}))}))},_=(e,t)=>{var n,a;const o=`${null===(n=e.wpcf7)||void 0===n?void 0:n.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,"");null===(a=e.wpcf7.parent.querySelector(`.screen-reader-response ul li#${o}`))||void 0===a||a.remove(),e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((e=>{var t;null===(t=e.querySelector(".wpcf7-not-valid-tip"))||void 0===t||t.remove(),e.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","false")})),e.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.removeAttribute("aria-describedby"),e.classList.remove("wpcf7-not-valid"),"function"==typeof e.setCustomValidity&&e.setCustomValidity("")}))}))};function $(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(wpcf7.blocked)return L(e),void a(e,"submitting");const n=new FormData(e);t.submitter&&t.submitter.name&&n.append(t.submitter.name,t.submitter.value);const s={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(n,(e=>{const t=e[0],n=e[1];return!t.match(/^_/)&&{name:t,value:n}})).filter((e=>!1!==e)),formData:n};i({endpoint:`contact-forms/${e.wpcf7.id}/feedback`,method:"POST",body:n,wpcf7:{endpoint:"feedback",form:e,detail:s}}).then((t=>{const n=a(e,t.status);return s.status=t.status,s.apiResponse=t,["invalid","unaccepted","spam","aborted"].includes(n)?o(e,n,s):["sent","failed"].includes(n)&&o(e,`mail${n}`,s),o(e,"submit",s),t})).then((t=>{t.posted_data_hash&&(e.querySelector('input[name="_wpcf7_posted_data_hash"]').value=t.posted_data_hash),"mail_sent"===t.status&&(e.reset(),e.wpcf7.resetOnMailSent=!0),t.invalid_fields&&t.invalid_fields.forEach((t=>{S(e,t.field,t.message)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').insertAdjacentText("beforeend",t.message),e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=t.message}))})).catch((e=>console.error(e)))}i.use(((e,t)=>{if(e.wpcf7&&"feedback"===e.wpcf7.endpoint){const{form:t,detail:n}=e.wpcf7;L(t),o(t,"beforesubmit",n),a(t,"submitting")}return t(e)}));const L=e=>{e.querySelectorAll(".wpcf7-form-control-wrap").forEach((t=>{t.dataset.name&&_(e,t.dataset.name)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').innerText="",e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=""}))};function k(e){const t=new FormData(e),n={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(t,(e=>{const t=e[0],n=e[1];return!t.match(/^_/)&&{name:t,value:n}})).filter((e=>!1!==e)),formData:t};i({endpoint:`contact-forms/${e.wpcf7.id}/refill`,method:"GET",wpcf7:{endpoint:"refill",form:e,detail:n}}).then((t=>{e.wpcf7.resetOnMailSent?(delete e.wpcf7.resetOnMailSent,a(e,"mail_sent")):a(e,"init"),n.apiResponse=t,o(e,"reset",n)})).catch((e=>console.error(e)))}i.use(((e,t)=>{if(e.wpcf7&&"refill"===e.wpcf7.endpoint){const{form:t,detail:n}=e.wpcf7;L(t),a(t,"resetting")}return t(e)}));const z=(e,t)=>{for(const n in t){const a=t[n];e.querySelectorAll(`input[name="${n}"]`).forEach((e=>{e.value=""})),e.querySelectorAll(`img.wpcf7-captcha-${n.replaceAll(":","")}`).forEach((e=>{e.setAttribute("src",a)}));const o=/([0-9]+)\.(png|gif|jpeg)$/.exec(a);o&&e.querySelectorAll(`input[name="_wpcf7_captcha_challenge_${n}"]`).forEach((e=>{e.value=o[1]}))}},j=(e,t)=>{for(const n in t){const a=t[n][0],o=t[n][1];e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${n}"]`).forEach((e=>{e.querySelector(`input[name="${n}"]`).value="",e.querySelector(".wpcf7-quiz-label").textContent=a,e.querySelector(`input[name="_wpcf7_quiz_answer_${n}"]`).value=o}))}};function T(e){const t=new FormData(e);e.wpcf7={id:n(t.get("_wpcf7")),status:e.getAttribute("data-status"),pluginVersion:t.get("_wpcf7_version"),locale:t.get("_wpcf7_locale"),unitTag:t.get("_wpcf7_unit_tag"),containerPost:n(t.get("_wpcf7_container_post")),parent:e.closest(".wpcf7"),schema:{}},e.querySelectorAll(".has-spinner").forEach((e=>{e.insertAdjacentHTML("afterend",'<span class="wpcf7-spinner"></span>')})),(e=>{e.querySelectorAll(".wpcf7-exclusive-checkbox").forEach((t=>{t.addEventListener("change",(t=>{const n=t.target.getAttribute("name");e.querySelectorAll(`input[type="checkbox"][name="${n}"]`).forEach((e=>{e!==t.target&&(e.checked=!1)}))}))}))})(e),(e=>{e.querySelectorAll(".has-free-text").forEach((t=>{const n=t.querySelector("input.wpcf7-free-text"),a=t.querySelector('input[type="checkbox"], input[type="radio"]');n.disabled=!a.checked,e.addEventListener("change",(e=>{n.disabled=!a.checked,e.target===a&&a.checked&&n.focus()}))}))})(e),(e=>{e.querySelectorAll(".wpcf7-validates-as-url").forEach((e=>{e.addEventListener("change",(t=>{let n=e.value.trim();n&&!n.match(/^[a-z][a-z0-9.+-]*:/i)&&-1!==n.indexOf(".")&&(n=n.replace(/^\/+/,""),n="http://"+n),e.value=n}))}))})(e),(e=>{if(!e.querySelector(".wpcf7-acceptance")||e.classList.contains("wpcf7-acceptance-as-validation"))return;const t=()=>{let t=!0;e.querySelectorAll(".wpcf7-acceptance").forEach((e=>{if(!t||e.classList.contains("optional"))return;const n=e.querySelector('input[type="checkbox"]');(e.classList.contains("invert")&&n.checked||!e.classList.contains("invert")&&!n.checked)&&(t=!1)})),e.querySelectorAll(".wpcf7-submit").forEach((e=>{e.disabled=!t}))};t(),e.addEventListener("change",(e=>{t()})),e.addEventListener("wpcf7reset",(e=>{t()}))})(e),(e=>{const t=(e,t)=>{const a=n(e.getAttribute("data-starting-value")),o=n(e.getAttribute("data-maximum-value")),i=n(e.getAttribute("data-minimum-value")),s=e.classList.contains("down")?a-t.value.length:t.value.length;e.setAttribute("data-current-value",s),e.innerText=s,o&&o<t.value.length?e.classList.add("too-long"):e.classList.remove("too-long"),i&&t.value.length<i?e.classList.add("too-short"):e.classList.remove("too-short")},a=n=>{n={init:!1,...n},e.querySelectorAll(".wpcf7-character-count").forEach((a=>{const o=a.getAttribute("data-target-name"),i=e.querySelector(`[name="${o}"]`);i&&(i.value=i.defaultValue,t(a,i),n.init&&i.addEventListener("keyup",(e=>{t(a,i)})))}))};a({init:!0}),e.addEventListener("wpcf7reset",(e=>{a()}))})(e),window.addEventListener("load",(t=>{wpcf7.cached&&e.reset()})),e.addEventListener("reset",(t=>{wpcf7.reset(e)})),e.addEventListener("submit",(t=>{wpcf7.submit(e,{submitter:t.submitter}),t.preventDefault()})),e.addEventListener("wpcf7submit",(t=>{t.detail.apiResponse.captcha&&z(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&j(e,t.detail.apiResponse.quiz)})),e.addEventListener("wpcf7reset",(t=>{t.detail.apiResponse.captcha&&z(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&j(e,t.detail.apiResponse.quiz)})),i({endpoint:`contact-forms/${e.wpcf7.id}/feedback/schema`,method:"GET"}).then((t=>{e.wpcf7.schema=t})),e.addEventListener("change",(t=>{t.target.closest(".wpcf7-form-control")&&wpcf7.validate(e,{target:t.target})}))}document.addEventListener("DOMContentLoaded",(e=>{var t;if("undefined"==typeof wpcf7)return void console.error("wpcf7 is not defined.");if(void 0===wpcf7.api)return void console.error("wpcf7.api is not defined.");if("function"!=typeof window.fetch)return void console.error("Your browser does not support window.fetch().");if("function"!=typeof window.FormData)return void console.error("Your browser does not support window.FormData().");const n=document.querySelectorAll(".wpcf7 > form");"function"==typeof n.forEach?(wpcf7={init:T,submit:$,reset:k,validate:q,...null!==(t=wpcf7)&&void 0!==t?t:{}},n.forEach((e=>wpcf7.init(e)))):console.error("Your browser does not support NodeList.forEach().")}))}();
|
1 |
+
!function(){"use strict";var e={d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{date:function(){return m},email:function(){return p},file:function(){return h},maxdate:function(){return x},maxfilesize:function(){return A},maxlength:function(){return v},maxnumber:function(){return b},mindate:function(){return y},minlength:function(){return w},minnumber:function(){return g},number:function(){return u},required:function(){return c},requiredfile:function(){return l},tel:function(){return f},url:function(){return d}});const n=e=>Math.abs(parseInt(e,10)),a=(e,t)=>{const n=new Map([["init","init"],["validation_failed","invalid"],["acceptance_missing","unaccepted"],["spam","spam"],["aborted","aborted"],["mail_sent","sent"],["mail_failed","failed"],["submitting","submitting"],["resetting","resetting"],["validating","validating"],["payment_required","payment-required"]]);n.has(t)&&(t=n.get(t)),Array.from(n.values()).includes(t)||(t=`custom-${t=(t=t.replace(/[^0-9a-z]+/i," ").trim()).replace(/\s+/,"-")}`);const a=e.getAttribute("data-status");return e.wpcf7.status=t,e.setAttribute("data-status",t),e.classList.add(t),a&&a!==t&&e.classList.remove(a),t},o=(e,t,n)=>{const a=new CustomEvent(`wpcf7${t}`,{bubbles:!0,detail:n});"string"==typeof e&&(e=document.querySelector(e)),e.dispatchEvent(a)},i=e=>{const{root:t,namespace:n="contact-form-7/v1"}=wpcf7.api,a=s.reduceRight(((e,t)=>n=>t(n,e)),(e=>{let a,o,{url:i,path:s,endpoint:r,headers:c,body:l,data:p,...d}=e;"string"==typeof r&&(a=n.replace(/^\/|\/$/g,""),o=r.replace(/^\//,""),s=o?a+"/"+o:a),"string"==typeof s&&(-1!==t.indexOf("?")&&(s=s.replace("?","&")),s=s.replace(/^\//,""),i=t+s),c={Accept:"application/json, */*;q=0.1",...c},delete c["X-WP-Nonce"],p&&(l=JSON.stringify(p),c["Content-Type"]="application/json");const f={code:"fetch_error",message:"You are probably offline."},u={code:"invalid_json",message:"The response is not a valid JSON response."};return window.fetch(i||s||window.location.href,{...d,headers:c,body:l}).then((e=>Promise.resolve(e).then((e=>{if(e.status>=200&&e.status<300)return e;throw e})).then((e=>{if(204===e.status)return null;if(e&&e.json)return e.json().catch((()=>{throw u}));throw u}))),(()=>{throw f}))}));return a(e)},s=[];function r(e){let{rule:t,field:n,error:a,...o}=e;this.rule=t,this.field=n,this.error=a,this.properties=o}i.use=e=>{s.unshift(e)};const c=function(e){if(0===e.getAll(this.field).length)throw new r(this)},l=function(e){if(0===e.getAll(this.field).length)throw new r(this)},p=function(e){if(!e.getAll(this.field).every((e=>{if((e=e.trim()).length<6)return!1;if(-1===e.indexOf("@",1))return!1;if(e.indexOf("@")!==e.lastIndexOf("@"))return!1;const[t,n]=e.split("@",2);if(!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/.test(t))return!1;if(/\.{2,}/.test(n))return!1;if(/(?:^[ \t\n\r\0\x0B.]|[ \t\n\r\0\x0B.]$)/.test(n))return!1;const a=n.split(".");if(a.length<2)return!1;for(const e of a){if(/(?:^[ \t\n\r\0\x0B-]|[ \t\n\r\0\x0B-]$)/.test(e))return!1;if(!/^[a-z0-9-]+$/i.test(e))return!1}return!0})))throw new r(this)},d=function(e){const t=e.getAll(this.field);if(!t.every((e=>{if(""===(e=e.trim()))return!1;try{return(e=>-1!==["http","https","ftp","ftps","mailto","news","irc","irc6","ircs","gopher","nntp","feed","telnet","mms","rtsp","sms","svn","tel","fax","xmpp","webcal","urn"].indexOf(e))(new URL(e).protocol.replace(/:$/,""))}catch{return!1}})))throw new r(this)},f=function(e){if(!e.getAll(this.field).every((e=>(e=(e=e.trim()).replaceAll(/[()/.*#\s-]+/g,""),/^[+]?[0-9]+$/.test(e)))))throw new r(this)},u=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!!/^[-]?[0-9]+(?:[eE][+-]?[0-9]+)?$/.test(e)||!!/^[-]?(?:[0-9]+)?[.][0-9]+(?:[eE][+-]?[0-9]+)?$/.test(e)))))throw new r(this)},m=function(e){if(!e.getAll(this.field).every((e=>/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e.trim()))))throw new r(this)},h=function(e){if(!e.getAll(this.field).every((e=>{var t;return e instanceof File&&(null===(t=this.accept)||void 0===t?void 0:t.some((t=>/^\.[a-z0-9]+$/i.test(t)?e.name.toLowerCase().endsWith(t.toLowerCase()):(e=>{const t=[],n=e.match(/^(?<toplevel>[a-z]+)\/(?<sub>[*]|[a-z0-9.+-]+)$/i);if(n){const e=n.groups.toplevel.toLowerCase(),a=n.groups.sub.toLowerCase();for(const[o,i]of(()=>{const e=new Map;return e.set("jpg|jpeg|jpe","image/jpeg"),e.set("gif","image/gif"),e.set("png","image/png"),e.set("bmp","image/bmp"),e.set("tiff|tif","image/tiff"),e.set("webp","image/webp"),e.set("ico","image/x-icon"),e.set("heic","image/heic"),e.set("asf|asx","video/x-ms-asf"),e.set("wmv","video/x-ms-wmv"),e.set("wmx","video/x-ms-wmx"),e.set("wm","video/x-ms-wm"),e.set("avi","video/avi"),e.set("divx","video/divx"),e.set("flv","video/x-flv"),e.set("mov|qt","video/quicktime"),e.set("mpeg|mpg|mpe","video/mpeg"),e.set("mp4|m4v","video/mp4"),e.set("ogv","video/ogg"),e.set("webm","video/webm"),e.set("mkv","video/x-matroska"),e.set("3gp|3gpp","video/3gpp"),e.set("3g2|3gp2","video/3gpp2"),e.set("txt|asc|c|cc|h|srt","text/plain"),e.set("csv","text/csv"),e.set("tsv","text/tab-separated-values"),e.set("ics","text/calendar"),e.set("rtx","text/richtext"),e.set("css","text/css"),e.set("htm|html","text/html"),e.set("vtt","text/vtt"),e.set("dfxp","application/ttaf+xml"),e.set("mp3|m4a|m4b","audio/mpeg"),e.set("aac","audio/aac"),e.set("ra|ram","audio/x-realaudio"),e.set("wav","audio/wav"),e.set("ogg|oga","audio/ogg"),e.set("flac","audio/flac"),e.set("mid|midi","audio/midi"),e.set("wma","audio/x-ms-wma"),e.set("wax","audio/x-ms-wax"),e.set("mka","audio/x-matroska"),e.set("rtf","application/rtf"),e.set("js","application/javascript"),e.set("pdf","application/pdf"),e.set("swf","application/x-shockwave-flash"),e.set("class","application/java"),e.set("tar","application/x-tar"),e.set("zip","application/zip"),e.set("gz|gzip","application/x-gzip"),e.set("rar","application/rar"),e.set("7z","application/x-7z-compressed"),e.set("exe","application/x-msdownload"),e.set("psd","application/octet-stream"),e.set("xcf","application/octet-stream"),e.set("doc","application/msword"),e.set("pot|pps|ppt","application/vnd.ms-powerpoint"),e.set("wri","application/vnd.ms-write"),e.set("xla|xls|xlt|xlw","application/vnd.ms-excel"),e.set("mdb","application/vnd.ms-access"),e.set("mpp","application/vnd.ms-project"),e.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),e.set("docm","application/vnd.ms-word.document.macroEnabled.12"),e.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),e.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),e.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),e.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),e.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),e.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),e.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),e.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),e.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),e.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),e.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),e.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),e.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),e.set("potm","application/vnd.ms-powerpoint.template.macroEnabled.12"),e.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),e.set("sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"),e.set("sldm","application/vnd.ms-powerpoint.slide.macroEnabled.12"),e.set("onetoc|onetoc2|onetmp|onepkg","application/onenote"),e.set("oxps","application/oxps"),e.set("xps","application/vnd.ms-xpsdocument"),e.set("odt","application/vnd.oasis.opendocument.text"),e.set("odp","application/vnd.oasis.opendocument.presentation"),e.set("ods","application/vnd.oasis.opendocument.spreadsheet"),e.set("odg","application/vnd.oasis.opendocument.graphics"),e.set("odc","application/vnd.oasis.opendocument.chart"),e.set("odb","application/vnd.oasis.opendocument.database"),e.set("odf","application/vnd.oasis.opendocument.formula"),e.set("wp|wpd","application/wordperfect"),e.set("key","application/vnd.apple.keynote"),e.set("numbers","application/vnd.apple.numbers"),e.set("pages","application/vnd.apple.pages"),e})())("*"===a&&i.startsWith(e+"/")||i===n[0])&&t.push(...o.split("|"))}return t})(t).some((t=>(t="."+t.trim(),e.name.toLowerCase().endsWith(t.toLowerCase())))))))})))throw new r(this)},w=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{"string"==typeof e&&(n+=e.length)})),0!==n&&n<parseInt(this.threshold))throw new r(this)},v=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{"string"==typeof e&&(n+=e.length)})),parseInt(this.threshold)<n)throw new r(this)},g=function(e){if(!e.getAll(this.field).every((e=>!(parseFloat(e)<parseFloat(this.threshold)))))throw new r(this)},b=function(e){if(!e.getAll(this.field).every((e=>!(parseFloat(this.threshold)<parseFloat(e)))))throw new r(this)},y=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!(/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e)&&/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(this.threshold)&&e<this.threshold)))))throw new r(this)},x=function(e){if(!e.getAll(this.field).every((e=>(e=e.trim(),!(/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(e)&&/^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/.test(this.threshold)&&this.threshold<e)))))throw new r(this)},A=function(e){const t=e.getAll(this.field);let n=0;if(t.forEach((e=>{e instanceof File&&(n+=e.size)})),parseInt(this.threshold)<n)throw new r(this)};function E(e){if(this.formData={},this.tree={},!(e instanceof FormData))return this;this.formData=e;const t=()=>{const e=new Map;return e.largestIndex=0,e.set=function(t,n){""===t?t=e.largestIndex++:/^[0-9]+$/.test(t)&&(t=parseInt(t),e.largestIndex<=t&&(e.largestIndex=t+1)),Map.prototype.set.call(e,t,n)},e};this.tree=t();const n=/^(?<name>[a-z][-a-z0-9_:]*)(?<array>(?:\[(?:[a-z][-a-z0-9_:]*|[0-9]*)\])*)/i;for(const[e,a]of this.formData){const o=e.match(n);if(o)if(""===o.groups.array)this.tree.set(o.groups.name,a);else{const e=[...o.groups.array.matchAll(/\[([a-z][-a-z0-9_:]*|[0-9]*)\]/gi)].map((([e,t])=>t));e.unshift(o.groups.name);const n=e.pop();e.reduce(((e,n)=>{if(/^[0-9]+$/.test(n)&&(n=parseInt(n)),e.get(n)instanceof Map)return e.get(n);const a=t();return e.set(n,a),a}),this.tree).set(n,a)}}}E.prototype.entries=function(){return this.tree.entries()},E.prototype.get=function(e){return this.tree.get(e)},E.prototype.getAll=function(e){if(!this.has(e))return[];const t=e=>{const n=[];if(e instanceof Map)for(const[a,o]of e)n.push(...t(o));else""!==e&&n.push(e);return n};return t(this.get(e))},E.prototype.has=function(e){return this.tree.has(e)},E.prototype.keys=function(){return this.tree.keys()},E.prototype.values=function(){return this.tree.values()};var q=E;function S(e){var t,n,o,i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const c=e;if(null===(t=s.target)||void 0===t||!t.closest(".wpcf7-form-control-wrap[data-name]"))return;if(null!==(n=s.target)&&void 0!==n&&n.closest(".novalidate"))return;const l=new FormData,p=[];for(const e of c.querySelectorAll(".wpcf7-form-control-wrap"))if(!e.closest(".novalidate")&&(e.querySelectorAll(":where( input, textarea, select ):enabled").forEach((e=>{if(e.name)switch(e.type){case"button":case"image":case"reset":case"submit":break;case"checkbox":case"radio":e.checked&&l.append(e.name,e.value);break;case"select-multiple":for(const t of e.selectedOptions)l.append(e.name,t.value);break;case"file":for(const t of e.files)l.append(e.name,t);break;default:l.append(e.name,e.value)}})),e.dataset.name&&(p.push(e.dataset.name),e.setAttribute("data-under-validation","1"),e.dataset.name===s.target.name.replace(/\[.*\]$/,""))))break;const d=null!==(o=S.validators)&&void 0!==o?o:{},f=(null!==(i=e.wpcf7.schema.rules)&&void 0!==i?i:[]).filter((e=>{let{rule:t,...n}=e;return"function"==typeof d[t]&&("function"==typeof d[t].matches?d[t].matches(n,s):p.includes(n.field))}));if(!f.length)return;const u=e.getAttribute("data-status");Promise.resolve(a(e,"validating")).then((t=>{const n=[],a=new q(l);for(const{rule:t,...o}of f)if(!n.includes(o.field))try{$(e,o.field),d[t].call({rule:t,...o},a)}catch(t){t instanceof r&&(_(e,o.field,t.error),n.push(o.field))}})).finally((()=>{a(e,u),e.querySelectorAll(".wpcf7-form-control-wrap[data-under-validation]").forEach((e=>{e.removeAttribute("data-under-validation")}))}))}S.validators=t;const _=(e,t,n)=>{var a;const o=`${null===(a=e.wpcf7)||void 0===a?void 0:a.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,""),i=e.querySelector(`.wpcf7-form-control-wrap[data-name="${t}"] .wpcf7-form-control`);(()=>{const t=document.createElement("li");t.setAttribute("id",o),i&&i.id?t.insertAdjacentHTML("beforeend",`<a href="#${i.id}">${n}</a>`):t.insertAdjacentText("beforeend",n),e.wpcf7.parent.querySelector(".screen-reader-response ul").appendChild(t)})(),e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((t=>{if("validating"===e.getAttribute("data-status")&&!t.dataset.underValidation)return;const a=document.createElement("span");a.classList.add("wpcf7-not-valid-tip"),a.setAttribute("aria-hidden","true"),a.insertAdjacentText("beforeend",n),t.appendChild(a),t.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","true")})),t.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.classList.add("wpcf7-not-valid"),e.setAttribute("aria-describedby",o),"function"==typeof e.setCustomValidity&&e.setCustomValidity(n),e.closest(".use-floating-validation-tip")&&(e.addEventListener("focus",(e=>{a.setAttribute("style","display: none")})),a.addEventListener("click",(e=>{a.setAttribute("style","display: none")})))}))}))},$=(e,t)=>{var n,a;const o=`${null===(n=e.wpcf7)||void 0===n?void 0:n.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,"");null===(a=e.wpcf7.parent.querySelector(`.screen-reader-response ul li#${o}`))||void 0===a||a.remove(),e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((e=>{var t;null===(t=e.querySelector(".wpcf7-not-valid-tip"))||void 0===t||t.remove(),e.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","false")})),e.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.removeAttribute("aria-describedby"),e.classList.remove("wpcf7-not-valid"),"function"==typeof e.setCustomValidity&&e.setCustomValidity("")}))}))};function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(wpcf7.blocked)return k(e),void a(e,"submitting");const n=new FormData(e);t.submitter&&t.submitter.name&&n.append(t.submitter.name,t.submitter.value);const s={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(n,(e=>{const t=e[0],n=e[1];return!t.match(/^_/)&&{name:t,value:n}})).filter((e=>!1!==e)),formData:n};i({endpoint:`contact-forms/${e.wpcf7.id}/feedback`,method:"POST",body:n,wpcf7:{endpoint:"feedback",form:e,detail:s}}).then((t=>{const n=a(e,t.status);return s.status=t.status,s.apiResponse=t,["invalid","unaccepted","spam","aborted"].includes(n)?o(e,n,s):["sent","failed"].includes(n)&&o(e,`mail${n}`,s),o(e,"submit",s),t})).then((t=>{t.posted_data_hash&&(e.querySelector('input[name="_wpcf7_posted_data_hash"]').value=t.posted_data_hash),"mail_sent"===t.status&&(e.reset(),e.wpcf7.resetOnMailSent=!0),t.invalid_fields&&t.invalid_fields.forEach((t=>{_(e,t.field,t.message)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').insertAdjacentText("beforeend",t.message),e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=t.message}))})).catch((e=>console.error(e)))}i.use(((e,t)=>{if(e.wpcf7&&"feedback"===e.wpcf7.endpoint){const{form:t,detail:n}=e.wpcf7;k(t),o(t,"beforesubmit",n),a(t,"submitting")}return t(e)}));const k=e=>{e.querySelectorAll(".wpcf7-form-control-wrap").forEach((t=>{t.dataset.name&&$(e,t.dataset.name)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').innerText="",e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=""}))};function z(e){const t=new FormData(e),n={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(t,(e=>{const t=e[0],n=e[1];return!t.match(/^_/)&&{name:t,value:n}})).filter((e=>!1!==e)),formData:t};i({endpoint:`contact-forms/${e.wpcf7.id}/refill`,method:"GET",wpcf7:{endpoint:"refill",form:e,detail:n}}).then((t=>{e.wpcf7.resetOnMailSent?(delete e.wpcf7.resetOnMailSent,a(e,"mail_sent")):a(e,"init"),n.apiResponse=t,o(e,"reset",n)})).catch((e=>console.error(e)))}i.use(((e,t)=>{if(e.wpcf7&&"refill"===e.wpcf7.endpoint){const{form:t,detail:n}=e.wpcf7;k(t),a(t,"resetting")}return t(e)}));const j=(e,t)=>{for(const n in t){const a=t[n];e.querySelectorAll(`input[name="${n}"]`).forEach((e=>{e.value=""})),e.querySelectorAll(`img.wpcf7-captcha-${n.replaceAll(":","")}`).forEach((e=>{e.setAttribute("src",a)}));const o=/([0-9]+)\.(png|gif|jpeg)$/.exec(a);o&&e.querySelectorAll(`input[name="_wpcf7_captcha_challenge_${n}"]`).forEach((e=>{e.value=o[1]}))}},T=(e,t)=>{for(const n in t){const a=t[n][0],o=t[n][1];e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${n}"]`).forEach((e=>{e.querySelector(`input[name="${n}"]`).value="",e.querySelector(".wpcf7-quiz-label").textContent=a,e.querySelector(`input[name="_wpcf7_quiz_answer_${n}"]`).value=o}))}};function O(e){const t=new FormData(e);e.wpcf7={id:n(t.get("_wpcf7")),status:e.getAttribute("data-status"),pluginVersion:t.get("_wpcf7_version"),locale:t.get("_wpcf7_locale"),unitTag:t.get("_wpcf7_unit_tag"),containerPost:n(t.get("_wpcf7_container_post")),parent:e.closest(".wpcf7"),schema:{}},e.querySelectorAll(".has-spinner").forEach((e=>{e.insertAdjacentHTML("afterend",'<span class="wpcf7-spinner"></span>')})),(e=>{e.querySelectorAll(".wpcf7-exclusive-checkbox").forEach((t=>{t.addEventListener("change",(t=>{const n=t.target.getAttribute("name");e.querySelectorAll(`input[type="checkbox"][name="${n}"]`).forEach((e=>{e!==t.target&&(e.checked=!1)}))}))}))})(e),(e=>{e.querySelectorAll(".has-free-text").forEach((t=>{const n=t.querySelector("input.wpcf7-free-text"),a=t.querySelector('input[type="checkbox"], input[type="radio"]');n.disabled=!a.checked,e.addEventListener("change",(e=>{n.disabled=!a.checked,e.target===a&&a.checked&&n.focus()}))}))})(e),(e=>{e.querySelectorAll(".wpcf7-validates-as-url").forEach((e=>{e.addEventListener("change",(t=>{let n=e.value.trim();n&&!n.match(/^[a-z][a-z0-9.+-]*:/i)&&-1!==n.indexOf(".")&&(n=n.replace(/^\/+/,""),n="http://"+n),e.value=n}))}))})(e),(e=>{if(!e.querySelector(".wpcf7-acceptance")||e.classList.contains("wpcf7-acceptance-as-validation"))return;const t=()=>{let t=!0;e.querySelectorAll(".wpcf7-acceptance").forEach((e=>{if(!t||e.classList.contains("optional"))return;const n=e.querySelector('input[type="checkbox"]');(e.classList.contains("invert")&&n.checked||!e.classList.contains("invert")&&!n.checked)&&(t=!1)})),e.querySelectorAll(".wpcf7-submit").forEach((e=>{e.disabled=!t}))};t(),e.addEventListener("change",(e=>{t()})),e.addEventListener("wpcf7reset",(e=>{t()}))})(e),(e=>{const t=(e,t)=>{const a=n(e.getAttribute("data-starting-value")),o=n(e.getAttribute("data-maximum-value")),i=n(e.getAttribute("data-minimum-value")),s=e.classList.contains("down")?a-t.value.length:t.value.length;e.setAttribute("data-current-value",s),e.innerText=s,o&&o<t.value.length?e.classList.add("too-long"):e.classList.remove("too-long"),i&&t.value.length<i?e.classList.add("too-short"):e.classList.remove("too-short")},a=n=>{n={init:!1,...n},e.querySelectorAll(".wpcf7-character-count").forEach((a=>{const o=a.getAttribute("data-target-name"),i=e.querySelector(`[name="${o}"]`);i&&(i.value=i.defaultValue,t(a,i),n.init&&i.addEventListener("keyup",(e=>{t(a,i)})))}))};a({init:!0}),e.addEventListener("wpcf7reset",(e=>{a()}))})(e),window.addEventListener("load",(t=>{wpcf7.cached&&e.reset()})),e.addEventListener("reset",(t=>{wpcf7.reset(e)})),e.addEventListener("submit",(t=>{wpcf7.submit(e,{submitter:t.submitter}),t.preventDefault()})),e.addEventListener("wpcf7submit",(t=>{t.detail.apiResponse.captcha&&j(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&T(e,t.detail.apiResponse.quiz)})),e.addEventListener("wpcf7reset",(t=>{t.detail.apiResponse.captcha&&j(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&T(e,t.detail.apiResponse.quiz)})),i({endpoint:`contact-forms/${e.wpcf7.id}/feedback/schema`,method:"GET"}).then((t=>{e.wpcf7.schema=t})),e.addEventListener("change",(t=>{t.target.closest(".wpcf7-form-control")&&wpcf7.validate(e,{target:t.target})}))}document.addEventListener("DOMContentLoaded",(e=>{var t;if("undefined"==typeof wpcf7)return void console.error("wpcf7 is not defined.");if(void 0===wpcf7.api)return void console.error("wpcf7.api is not defined.");if("function"!=typeof window.fetch)return void console.error("Your browser does not support window.fetch().");if("function"!=typeof window.FormData)return void console.error("Your browser does not support window.FormData().");const n=document.querySelectorAll(".wpcf7 > form");"function"==typeof n.forEach?(wpcf7={init:O,submit:L,reset:z,validate:S,...null!==(t=wpcf7)&&void 0!==t?t:{}},n.forEach((e=>wpcf7.init(e)))):console.error("Your browser does not support NodeList.forEach().")}))}();
|
includes/submission.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
class WPCF7_Submission {
|
4 |
|
5 |
private static $instance;
|
@@ -20,6 +23,9 @@ class WPCF7_Submission {
|
|
20 |
private $result_props = array();
|
21 |
|
22 |
|
|
|
|
|
|
|
23 |
public static function get_instance( $contact_form = null, $args = '' ) {
|
24 |
if ( $contact_form instanceof WPCF7_ContactForm ) {
|
25 |
if ( empty( self::$instance ) ) {
|
@@ -39,11 +45,17 @@ class WPCF7_Submission {
|
|
39 |
}
|
40 |
|
41 |
|
|
|
|
|
|
|
42 |
public static function is_restful() {
|
43 |
return defined( 'REST_REQUEST' ) && REST_REQUEST;
|
44 |
}
|
45 |
|
46 |
|
|
|
|
|
|
|
47 |
private function __construct( WPCF7_ContactForm $contact_form, $args = '' ) {
|
48 |
$args = wp_parse_args( $args, array(
|
49 |
'skip_mail' => false,
|
@@ -54,6 +66,9 @@ class WPCF7_Submission {
|
|
54 |
}
|
55 |
|
56 |
|
|
|
|
|
|
|
57 |
private function proceed() {
|
58 |
$contact_form = $this->contact_form;
|
59 |
|
@@ -114,11 +129,19 @@ class WPCF7_Submission {
|
|
114 |
}
|
115 |
|
116 |
|
|
|
|
|
|
|
117 |
public function get_status() {
|
118 |
return $this->status;
|
119 |
}
|
120 |
|
121 |
|
|
|
|
|
|
|
|
|
|
|
122 |
public function set_status( $status ) {
|
123 |
if ( preg_match( '/^[a-z][0-9a-z_]+$/', $status ) ) {
|
124 |
$this->status = $status;
|
@@ -129,8 +152,14 @@ class WPCF7_Submission {
|
|
129 |
}
|
130 |
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
public function is( $status ) {
|
133 |
-
return $this->status
|
134 |
}
|
135 |
|
136 |
|
@@ -182,22 +211,44 @@ class WPCF7_Submission {
|
|
182 |
}
|
183 |
|
184 |
|
|
|
|
|
|
|
|
|
|
|
185 |
public function get_response() {
|
186 |
return $this->response;
|
187 |
}
|
188 |
|
189 |
|
|
|
|
|
|
|
|
|
|
|
190 |
public function set_response( $response ) {
|
191 |
$this->response = $response;
|
192 |
return true;
|
193 |
}
|
194 |
|
195 |
|
|
|
|
|
|
|
|
|
|
|
196 |
public function get_contact_form() {
|
197 |
return $this->contact_form;
|
198 |
}
|
199 |
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
public function get_invalid_field( $name ) {
|
202 |
if ( isset( $this->invalid_fields[$name] ) ) {
|
203 |
return $this->invalid_fields[$name];
|
@@ -207,11 +258,23 @@ class WPCF7_Submission {
|
|
207 |
}
|
208 |
|
209 |
|
|
|
|
|
|
|
|
|
|
|
210 |
public function get_invalid_fields() {
|
211 |
return $this->invalid_fields;
|
212 |
}
|
213 |
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
public function get_meta( $name ) {
|
216 |
if ( isset( $this->meta[$name] ) ) {
|
217 |
return $this->meta[$name];
|
@@ -219,6 +282,9 @@ class WPCF7_Submission {
|
|
219 |
}
|
220 |
|
221 |
|
|
|
|
|
|
|
222 |
private function setup_meta_data() {
|
223 |
$timestamp = time();
|
224 |
|
@@ -258,6 +324,13 @@ class WPCF7_Submission {
|
|
258 |
}
|
259 |
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
public function get_posted_data( $name = '' ) {
|
262 |
if ( ! empty( $name ) ) {
|
263 |
if ( isset( $this->posted_data[$name] ) ) {
|
@@ -271,6 +344,13 @@ class WPCF7_Submission {
|
|
271 |
}
|
272 |
|
273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
public function get_posted_string( $name ) {
|
275 |
$data = $this->get_posted_data( $name );
|
276 |
$data = wpcf7_array_flatten( $data );
|
@@ -284,6 +364,9 @@ class WPCF7_Submission {
|
|
284 |
}
|
285 |
|
286 |
|
|
|
|
|
|
|
287 |
private function setup_posted_data() {
|
288 |
$posted_data = array_filter( (array) $_POST, function( $key ) {
|
289 |
return '_' !== substr( $key, 0, 1 );
|
@@ -363,7 +446,8 @@ class WPCF7_Submission {
|
|
363 |
}
|
364 |
|
365 |
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
|
366 |
-
$value_orig, $tag
|
|
|
367 |
|
368 |
$posted_data[$name] = $value;
|
369 |
|
@@ -381,6 +465,9 @@ class WPCF7_Submission {
|
|
381 |
}
|
382 |
|
383 |
|
|
|
|
|
|
|
384 |
private function sanitize_posted_data( $value ) {
|
385 |
if ( is_array( $value ) ) {
|
386 |
$value = array_map( array( $this, 'sanitize_posted_data' ), $value );
|
@@ -482,6 +569,9 @@ class WPCF7_Submission {
|
|
482 |
}
|
483 |
|
484 |
|
|
|
|
|
|
|
485 |
private function get_remote_ip_addr() {
|
486 |
$ip_addr = '';
|
487 |
|
@@ -494,6 +584,9 @@ class WPCF7_Submission {
|
|
494 |
}
|
495 |
|
496 |
|
|
|
|
|
|
|
497 |
private function get_request_url() {
|
498 |
$home_url = untrailingslashit( home_url() );
|
499 |
|
@@ -514,6 +607,11 @@ class WPCF7_Submission {
|
|
514 |
}
|
515 |
|
516 |
|
|
|
|
|
|
|
|
|
|
|
517 |
private function validate() {
|
518 |
if ( $this->invalid_fields ) {
|
519 |
return false;
|
@@ -547,22 +645,41 @@ class WPCF7_Submission {
|
|
547 |
}
|
548 |
|
549 |
|
|
|
|
|
|
|
550 |
private function accepted() {
|
551 |
return apply_filters( 'wpcf7_acceptance', true, $this );
|
552 |
}
|
553 |
|
554 |
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
public function add_consent( $name, $conditions ) {
|
556 |
$this->consent[$name] = $conditions;
|
557 |
return true;
|
558 |
}
|
559 |
|
560 |
|
|
|
|
|
|
|
|
|
|
|
561 |
public function collect_consent() {
|
562 |
return (array) $this->consent;
|
563 |
}
|
564 |
|
565 |
|
|
|
|
|
|
|
|
|
|
|
566 |
private function spam() {
|
567 |
$spam = false;
|
568 |
|
@@ -604,6 +721,11 @@ class WPCF7_Submission {
|
|
604 |
}
|
605 |
|
606 |
|
|
|
|
|
|
|
|
|
|
|
607 |
public function add_spam_log( $args = '' ) {
|
608 |
$args = wp_parse_args( $args, array(
|
609 |
'agent' => '',
|
@@ -614,11 +736,19 @@ class WPCF7_Submission {
|
|
614 |
}
|
615 |
|
616 |
|
|
|
|
|
|
|
|
|
|
|
617 |
public function get_spam_log() {
|
618 |
return $this->spam_log;
|
619 |
}
|
620 |
|
621 |
|
|
|
|
|
|
|
622 |
private function verify_nonce() {
|
623 |
if ( ! $this->contact_form->nonce_is_active() or ! is_user_logged_in() ) {
|
624 |
return true;
|
@@ -630,8 +760,9 @@ class WPCF7_Submission {
|
|
630 |
}
|
631 |
|
632 |
|
633 |
-
|
634 |
-
|
|
|
635 |
private function before_send_mail() {
|
636 |
$abort = false;
|
637 |
|
@@ -645,6 +776,9 @@ class WPCF7_Submission {
|
|
645 |
}
|
646 |
|
647 |
|
|
|
|
|
|
|
648 |
private function mail() {
|
649 |
$contact_form = $this->contact_form;
|
650 |
|
@@ -681,11 +815,20 @@ class WPCF7_Submission {
|
|
681 |
}
|
682 |
|
683 |
|
|
|
|
|
|
|
684 |
public function uploaded_files() {
|
685 |
return $this->uploaded_files;
|
686 |
}
|
687 |
|
688 |
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
private function add_uploaded_file( $name, $file_path ) {
|
690 |
if ( ! wpcf7_is_name( $name ) ) {
|
691 |
return false;
|
@@ -710,6 +853,9 @@ class WPCF7_Submission {
|
|
710 |
}
|
711 |
|
712 |
|
|
|
|
|
|
|
713 |
private function remove_uploaded_files() {
|
714 |
foreach ( (array) $this->uploaded_files as $file_path ) {
|
715 |
$paths = (array) $file_path;
|
@@ -728,6 +874,11 @@ class WPCF7_Submission {
|
|
728 |
}
|
729 |
|
730 |
|
|
|
|
|
|
|
|
|
|
|
731 |
private function unship_uploaded_files() {
|
732 |
$result = new WPCF7_Validation();
|
733 |
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class representing contact form submission.
|
5 |
+
*/
|
6 |
class WPCF7_Submission {
|
7 |
|
8 |
private static $instance;
|
23 |
private $result_props = array();
|
24 |
|
25 |
|
26 |
+
/**
|
27 |
+
* Returns the singleton instance of this class.
|
28 |
+
*/
|
29 |
public static function get_instance( $contact_form = null, $args = '' ) {
|
30 |
if ( $contact_form instanceof WPCF7_ContactForm ) {
|
31 |
if ( empty( self::$instance ) ) {
|
45 |
}
|
46 |
|
47 |
|
48 |
+
/**
|
49 |
+
* Returns true if this submission is created via WP REST API.
|
50 |
+
*/
|
51 |
public static function is_restful() {
|
52 |
return defined( 'REST_REQUEST' ) && REST_REQUEST;
|
53 |
}
|
54 |
|
55 |
|
56 |
+
/**
|
57 |
+
* Constructor.
|
58 |
+
*/
|
59 |
private function __construct( WPCF7_ContactForm $contact_form, $args = '' ) {
|
60 |
$args = wp_parse_args( $args, array(
|
61 |
'skip_mail' => false,
|
66 |
}
|
67 |
|
68 |
|
69 |
+
/**
|
70 |
+
* The main logic of submission.
|
71 |
+
*/
|
72 |
private function proceed() {
|
73 |
$contact_form = $this->contact_form;
|
74 |
|
129 |
}
|
130 |
|
131 |
|
132 |
+
/**
|
133 |
+
* Returns the current status property.
|
134 |
+
*/
|
135 |
public function get_status() {
|
136 |
return $this->status;
|
137 |
}
|
138 |
|
139 |
|
140 |
+
/**
|
141 |
+
* Sets the status property.
|
142 |
+
*
|
143 |
+
* @param string $status The status.
|
144 |
+
*/
|
145 |
public function set_status( $status ) {
|
146 |
if ( preg_match( '/^[a-z][0-9a-z_]+$/', $status ) ) {
|
147 |
$this->status = $status;
|
152 |
}
|
153 |
|
154 |
|
155 |
+
/**
|
156 |
+
* Returns true if the specified status is identical to the current
|
157 |
+
* status property.
|
158 |
+
*
|
159 |
+
* @param string $status The status to compare.
|
160 |
+
*/
|
161 |
public function is( $status ) {
|
162 |
+
return $this->status === $status;
|
163 |
}
|
164 |
|
165 |
|
211 |
}
|
212 |
|
213 |
|
214 |
+
/**
|
215 |
+
* Retrieves the response property.
|
216 |
+
*
|
217 |
+
* @return string The current response property value.
|
218 |
+
*/
|
219 |
public function get_response() {
|
220 |
return $this->response;
|
221 |
}
|
222 |
|
223 |
|
224 |
+
/**
|
225 |
+
* Sets the response property.
|
226 |
+
*
|
227 |
+
* @param string $response New response property value.
|
228 |
+
*/
|
229 |
public function set_response( $response ) {
|
230 |
$this->response = $response;
|
231 |
return true;
|
232 |
}
|
233 |
|
234 |
|
235 |
+
/**
|
236 |
+
* Retrieves the contact form property.
|
237 |
+
*
|
238 |
+
* @return WPCF7_ContactForm A contact form object.
|
239 |
+
*/
|
240 |
public function get_contact_form() {
|
241 |
return $this->contact_form;
|
242 |
}
|
243 |
|
244 |
|
245 |
+
/**
|
246 |
+
* Search an invalid field by field name.
|
247 |
+
*
|
248 |
+
* @param string $name The field name.
|
249 |
+
* @return array|bool An associative array of validation error
|
250 |
+
* or false when no invalid field.
|
251 |
+
*/
|
252 |
public function get_invalid_field( $name ) {
|
253 |
if ( isset( $this->invalid_fields[$name] ) ) {
|
254 |
return $this->invalid_fields[$name];
|
258 |
}
|
259 |
|
260 |
|
261 |
+
/**
|
262 |
+
* Retrieves all invalid fields.
|
263 |
+
*
|
264 |
+
* @return array Invalid fields.
|
265 |
+
*/
|
266 |
public function get_invalid_fields() {
|
267 |
return $this->invalid_fields;
|
268 |
}
|
269 |
|
270 |
|
271 |
+
/**
|
272 |
+
* Retrieves meta information.
|
273 |
+
*
|
274 |
+
* @param string $name Name of the meta information.
|
275 |
+
* @return string|null The meta information of the given name if it exists,
|
276 |
+
* null otherwise.
|
277 |
+
*/
|
278 |
public function get_meta( $name ) {
|
279 |
if ( isset( $this->meta[$name] ) ) {
|
280 |
return $this->meta[$name];
|
282 |
}
|
283 |
|
284 |
|
285 |
+
/**
|
286 |
+
* Collects meta information about this submission.
|
287 |
+
*/
|
288 |
private function setup_meta_data() {
|
289 |
$timestamp = time();
|
290 |
|
324 |
}
|
325 |
|
326 |
|
327 |
+
/**
|
328 |
+
* Retrieves user input data through this submission.
|
329 |
+
*
|
330 |
+
* @param string $name Optional field name.
|
331 |
+
* @return string|array|null The user input of the field, or array of all
|
332 |
+
* fields values if no field name specified.
|
333 |
+
*/
|
334 |
public function get_posted_data( $name = '' ) {
|
335 |
if ( ! empty( $name ) ) {
|
336 |
if ( isset( $this->posted_data[$name] ) ) {
|
344 |
}
|
345 |
|
346 |
|
347 |
+
/**
|
348 |
+
* Retrieves a user input string value through the specified field.
|
349 |
+
*
|
350 |
+
* @param string $name Field name.
|
351 |
+
* @return string The user input. If the input is an array,
|
352 |
+
* the first item in the array.
|
353 |
+
*/
|
354 |
public function get_posted_string( $name ) {
|
355 |
$data = $this->get_posted_data( $name );
|
356 |
$data = wpcf7_array_flatten( $data );
|
364 |
}
|
365 |
|
366 |
|
367 |
+
/**
|
368 |
+
* Constructs posted data property based on user input values.
|
369 |
+
*/
|
370 |
private function setup_posted_data() {
|
371 |
$posted_data = array_filter( (array) $_POST, function( $key ) {
|
372 |
return '_' !== substr( $key, 0, 1 );
|
446 |
}
|
447 |
|
448 |
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
|
449 |
+
$value_orig, $tag
|
450 |
+
);
|
451 |
|
452 |
$posted_data[$name] = $value;
|
453 |
|
465 |
}
|
466 |
|
467 |
|
468 |
+
/**
|
469 |
+
* Sanitizes user input data.
|
470 |
+
*/
|
471 |
private function sanitize_posted_data( $value ) {
|
472 |
if ( is_array( $value ) ) {
|
473 |
$value = array_map( array( $this, 'sanitize_posted_data' ), $value );
|
569 |
}
|
570 |
|
571 |
|
572 |
+
/**
|
573 |
+
* Retrieves the remote IP address of this submission.
|
574 |
+
*/
|
575 |
private function get_remote_ip_addr() {
|
576 |
$ip_addr = '';
|
577 |
|
584 |
}
|
585 |
|
586 |
|
587 |
+
/**
|
588 |
+
* Retrieves the request URL of this submission.
|
589 |
+
*/
|
590 |
private function get_request_url() {
|
591 |
$home_url = untrailingslashit( home_url() );
|
592 |
|
607 |
}
|
608 |
|
609 |
|
610 |
+
/**
|
611 |
+
* Runs user input validation.
|
612 |
+
*
|
613 |
+
* @return bool True if no invalid field is found.
|
614 |
+
*/
|
615 |
private function validate() {
|
616 |
if ( $this->invalid_fields ) {
|
617 |
return false;
|
645 |
}
|
646 |
|
647 |
|
648 |
+
/**
|
649 |
+
* Returns true if user consent is obtained.
|
650 |
+
*/
|
651 |
private function accepted() {
|
652 |
return apply_filters( 'wpcf7_acceptance', true, $this );
|
653 |
}
|
654 |
|
655 |
|
656 |
+
/**
|
657 |
+
* Adds user consent data to this submission.
|
658 |
+
*
|
659 |
+
* @param string $name Field name.
|
660 |
+
* @param string $conditions Conditions of consent.
|
661 |
+
*/
|
662 |
public function add_consent( $name, $conditions ) {
|
663 |
$this->consent[$name] = $conditions;
|
664 |
return true;
|
665 |
}
|
666 |
|
667 |
|
668 |
+
/**
|
669 |
+
* Collects user consent data.
|
670 |
+
*
|
671 |
+
* @return array User consent data.
|
672 |
+
*/
|
673 |
public function collect_consent() {
|
674 |
return (array) $this->consent;
|
675 |
}
|
676 |
|
677 |
|
678 |
+
/**
|
679 |
+
* Executes spam protections.
|
680 |
+
*
|
681 |
+
* @return bool True if spam captured.
|
682 |
+
*/
|
683 |
private function spam() {
|
684 |
$spam = false;
|
685 |
|
721 |
}
|
722 |
|
723 |
|
724 |
+
/**
|
725 |
+
* Adds a spam log.
|
726 |
+
*
|
727 |
+
* @link https://contactform7.com/2019/05/31/why-is-this-message-marked-spam/
|
728 |
+
*/
|
729 |
public function add_spam_log( $args = '' ) {
|
730 |
$args = wp_parse_args( $args, array(
|
731 |
'agent' => '',
|
736 |
}
|
737 |
|
738 |
|
739 |
+
/**
|
740 |
+
* Retrieves the spam logging data.
|
741 |
+
*
|
742 |
+
* @return array Spam logging data.
|
743 |
+
*/
|
744 |
public function get_spam_log() {
|
745 |
return $this->spam_log;
|
746 |
}
|
747 |
|
748 |
|
749 |
+
/**
|
750 |
+
* Verifies that a correct security nonce was used.
|
751 |
+
*/
|
752 |
private function verify_nonce() {
|
753 |
if ( ! $this->contact_form->nonce_is_active() or ! is_user_logged_in() ) {
|
754 |
return true;
|
760 |
}
|
761 |
|
762 |
|
763 |
+
/**
|
764 |
+
* Function called just before sending email.
|
765 |
+
*/
|
766 |
private function before_send_mail() {
|
767 |
$abort = false;
|
768 |
|
776 |
}
|
777 |
|
778 |
|
779 |
+
/**
|
780 |
+
* Sends emails based on user input values and contact form email templates.
|
781 |
+
*/
|
782 |
private function mail() {
|
783 |
$contact_form = $this->contact_form;
|
784 |
|
815 |
}
|
816 |
|
817 |
|
818 |
+
/**
|
819 |
+
* Retrieves files uploaded through this submission.
|
820 |
+
*/
|
821 |
public function uploaded_files() {
|
822 |
return $this->uploaded_files;
|
823 |
}
|
824 |
|
825 |
|
826 |
+
/**
|
827 |
+
* Adds a file to the uploaded files array.
|
828 |
+
*
|
829 |
+
* @param string $name Field name.
|
830 |
+
* @param string|array $file_path File path or array of file paths.
|
831 |
+
*/
|
832 |
private function add_uploaded_file( $name, $file_path ) {
|
833 |
if ( ! wpcf7_is_name( $name ) ) {
|
834 |
return false;
|
853 |
}
|
854 |
|
855 |
|
856 |
+
/**
|
857 |
+
* Removes uploaded files.
|
858 |
+
*/
|
859 |
private function remove_uploaded_files() {
|
860 |
foreach ( (array) $this->uploaded_files as $file_path ) {
|
861 |
$paths = (array) $file_path;
|
874 |
}
|
875 |
|
876 |
|
877 |
+
/**
|
878 |
+
* Moves uploaded files to the tmp directory and validates them.
|
879 |
+
*
|
880 |
+
* @return bool True if no invalid file is found.
|
881 |
+
*/
|
882 |
private function unship_uploaded_files() {
|
883 |
$result = new WPCF7_Validation();
|
884 |
|
includes/validation-functions.php
CHANGED
@@ -189,13 +189,26 @@ function wpcf7_is_email_in_site_domain( $email ) {
|
|
189 |
return true;
|
190 |
}
|
191 |
|
192 |
-
$
|
|
|
|
|
|
|
193 |
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
|
198 |
-
return
|
199 |
}
|
200 |
|
201 |
|
189 |
return true;
|
190 |
}
|
191 |
|
192 |
+
$homes = array(
|
193 |
+
home_url(),
|
194 |
+
network_home_url(),
|
195 |
+
);
|
196 |
|
197 |
+
$homes = array_unique( $homes );
|
198 |
+
|
199 |
+
foreach ( $homes as $home ) {
|
200 |
+
$sitename = wp_parse_url( $home, PHP_URL_HOST );
|
201 |
+
|
202 |
+
if ( WP_Http::is_ip_address( $sitename ) ) {
|
203 |
+
return true;
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( wpcf7_is_email_in_domain( $email, $sitename ) ) {
|
207 |
+
return true;
|
208 |
+
}
|
209 |
}
|
210 |
|
211 |
+
return false;
|
212 |
}
|
213 |
|
214 |
|
modules/akismet.php
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
add_filter( 'wpcf7_spam', 'wpcf7_akismet', 10, 2 );
|
8 |
|
@@ -208,3 +210,39 @@ function wpcf7_akismet_comment_check( $comment ) {
|
|
208 |
|
209 |
return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment );
|
210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* The Akismet integration module
|
4 |
+
*
|
5 |
+
* @link https://akismet.com/development/api/
|
6 |
+
*/
|
7 |
+
|
8 |
|
9 |
add_filter( 'wpcf7_spam', 'wpcf7_akismet', 10, 2 );
|
10 |
|
210 |
|
211 |
return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment );
|
212 |
}
|
213 |
+
|
214 |
+
|
215 |
+
add_filter( 'wpcf7_posted_data', 'wpcf7_akismet_posted_data', 10, 1 );
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Removes Akismet-related properties from the posted data.
|
219 |
+
*
|
220 |
+
* This does not affect the $_POST variable itself.
|
221 |
+
*
|
222 |
+
* @link https://plugins.trac.wordpress.org/browser/akismet/tags/5.0/_inc/akismet-frontend.js
|
223 |
+
*/
|
224 |
+
function wpcf7_akismet_posted_data( $posted_data ) {
|
225 |
+
if ( wpcf7_akismet_is_available() ) {
|
226 |
+
$posted_data = array_diff_key(
|
227 |
+
$posted_data,
|
228 |
+
array(
|
229 |
+
'ak_bib' => '',
|
230 |
+
'ak_bfs' => '',
|
231 |
+
'ak_bkpc' => '',
|
232 |
+
'ak_bkp' => '',
|
233 |
+
'ak_bmc' => '',
|
234 |
+
'ak_bmcc' => '',
|
235 |
+
'ak_bmk' => '',
|
236 |
+
'ak_bck' => '',
|
237 |
+
'ak_bmmc' => '',
|
238 |
+
'ak_btmc' => '',
|
239 |
+
'ak_bsc' => '',
|
240 |
+
'ak_bte' => '',
|
241 |
+
'ak_btec' => '',
|
242 |
+
'ak_bmm' => '',
|
243 |
+
)
|
244 |
+
);
|
245 |
+
}
|
246 |
+
|
247 |
+
return $posted_data;
|
248 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://contactform7.com/donate/
|
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 5.9
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 5.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -77,6 +77,10 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
|
77 |
|
78 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
79 |
|
|
|
|
|
|
|
|
|
80 |
= 5.6.1 =
|
81 |
|
82 |
[https://contactform7.com/contact-form-7-561/](https://contactform7.com/contact-form-7-561/)
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 5.9
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 5.6.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
77 |
|
78 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
79 |
|
80 |
+
= 5.6.2 =
|
81 |
+
|
82 |
+
[https://contactform7.com/contact-form-7-562/](https://contactform7.com/contact-form-7-562/)
|
83 |
+
|
84 |
= 5.6.1 =
|
85 |
|
86 |
[https://contactform7.com/contact-form-7-561/](https://contactform7.com/contact-form-7-561/)
|
wp-contact-form-7.php
CHANGED
@@ -7,10 +7,10 @@ Author: Takayuki Miyoshi
|
|
7 |
Author URI: https://ideasilo.wordpress.com/
|
8 |
Text Domain: contact-form-7
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 5.6.
|
11 |
*/
|
12 |
|
13 |
-
define( 'WPCF7_VERSION', '5.6.
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '5.9' );
|
16 |
|
7 |
Author URI: https://ideasilo.wordpress.com/
|
8 |
Text Domain: contact-form-7
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 5.6.2
|
11 |
*/
|
12 |
|
13 |
+
define( 'WPCF7_VERSION', '5.6.2' );
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '5.9' );
|
16 |
|