Changeset 3143189
- Timestamp:
- 08/28/2024 08:12:33 PM (19 months ago)
- Location:
- hcaptcha-for-forms-and-more
- Files:
-
- 11 added
- 3 deleted
- 73 edited
- 1 copied
-
assets/banner-1544x500.jpg (added)
-
assets/banner-1544x500.png (deleted)
-
assets/banner-772x250.jpg (modified) (previous)
-
tags/4.5.0 (copied) (copied from hcaptcha-for-forms-and-more/trunk)
-
tags/4.5.0/assets/css/settings-base.css (modified) (2 diffs)
-
tags/4.5.0/assets/css/settings-base.min.css (modified) (1 diff)
-
tags/4.5.0/assets/js/hcaptcha-mailpoet.js (modified) (1 diff)
-
tags/4.5.0/assets/js/hcaptcha-mailpoet.min.js (modified) (1 diff)
-
tags/4.5.0/assets/js/integrations.js (modified) (4 diffs)
-
tags/4.5.0/assets/js/integrations.min.js (modified) (1 diff)
-
tags/4.5.0/assets/js/settings-base.js (modified) (2 diffs)
-
tags/4.5.0/assets/js/settings-base.min.js (modified) (1 diff)
-
tags/4.5.0/changelog.txt (modified) (1 diff)
-
tags/4.5.0/codeception.yml (deleted)
-
tags/4.5.0/hcaptcha.php (modified) (2 diffs)
-
tags/4.5.0/readme.txt (modified) (8 diffs)
-
tags/4.5.0/src/php/BBPress/Login.php (added)
-
tags/4.5.0/src/php/BBPress/LostPassword.php (added)
-
tags/4.5.0/src/php/BBPress/Register.php (added)
-
tags/4.5.0/src/php/CF7/Admin.php (modified) (3 diffs)
-
tags/4.5.0/src/php/Divi/Login.php (modified) (3 diffs)
-
tags/4.5.0/src/php/GravityForms/Field.php (modified) (1 diff)
-
tags/4.5.0/src/php/Helpers/HCaptcha.php (modified) (1 diff)
-
tags/4.5.0/src/php/Helpers/Pages.php (added)
-
tags/4.5.0/src/php/Helpers/Request.php (modified) (2 diffs)
-
tags/4.5.0/src/php/Jetpack/JetpackBase.php (modified) (6 diffs)
-
tags/4.5.0/src/php/Jetpack/JetpackForm.php (modified) (4 diffs)
-
tags/4.5.0/src/php/MailPoet/Form.php (modified) (4 diffs)
-
tags/4.5.0/src/php/Main.php (modified) (10 diffs)
-
tags/4.5.0/src/php/Migrations/Migrations.php (modified) (5 diffs)
-
tags/4.5.0/src/php/NF/Base.php (added)
-
tags/4.5.0/src/php/NF/Field.php (modified) (1 diff)
-
tags/4.5.0/src/php/NF/NF.php (modified) (12 diffs)
-
tags/4.5.0/src/php/Settings/Abstracts/SettingsBase.php (modified) (6 diffs)
-
tags/4.5.0/src/php/Settings/Integrations.php (modified) (1 diff)
-
tags/4.5.0/src/php/Settings/PluginSettingsBase.php (modified) (1 diff)
-
tags/4.5.0/src/php/Settings/Settings.php (modified) (1 diff)
-
tags/4.5.0/src/php/Spectra/Form.php (modified) (4 diffs)
-
tags/4.5.0/src/php/WPDiscuz/Base.php (modified) (1 diff)
-
tags/4.5.0/src/php/includes/functions.php (modified) (2 diffs)
-
tags/4.5.0/src/php/includes/request.php (modified) (1 diff)
-
tags/4.5.0/vendor/autoload.php (modified) (1 diff)
-
tags/4.5.0/vendor/composer/autoload_classmap.php (modified) (3 diffs)
-
tags/4.5.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/4.5.0/vendor/composer/autoload_static.php (modified) (5 diffs)
-
tags/4.5.0/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/assets/css/settings-base.css (modified) (2 diffs)
-
trunk/assets/css/settings-base.min.css (modified) (1 diff)
-
trunk/assets/js/hcaptcha-mailpoet.js (modified) (1 diff)
-
trunk/assets/js/hcaptcha-mailpoet.min.js (modified) (1 diff)
-
trunk/assets/js/integrations.js (modified) (4 diffs)
-
trunk/assets/js/integrations.min.js (modified) (1 diff)
-
trunk/assets/js/settings-base.js (modified) (2 diffs)
-
trunk/assets/js/settings-base.min.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/codeception.yml (deleted)
-
trunk/hcaptcha.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (8 diffs)
-
trunk/src/php/BBPress/Login.php (added)
-
trunk/src/php/BBPress/LostPassword.php (added)
-
trunk/src/php/BBPress/Register.php (added)
-
trunk/src/php/CF7/Admin.php (modified) (3 diffs)
-
trunk/src/php/Divi/Login.php (modified) (3 diffs)
-
trunk/src/php/GravityForms/Field.php (modified) (1 diff)
-
trunk/src/php/Helpers/HCaptcha.php (modified) (1 diff)
-
trunk/src/php/Helpers/Pages.php (added)
-
trunk/src/php/Helpers/Request.php (modified) (2 diffs)
-
trunk/src/php/Jetpack/JetpackBase.php (modified) (6 diffs)
-
trunk/src/php/Jetpack/JetpackForm.php (modified) (4 diffs)
-
trunk/src/php/MailPoet/Form.php (modified) (4 diffs)
-
trunk/src/php/Main.php (modified) (10 diffs)
-
trunk/src/php/Migrations/Migrations.php (modified) (5 diffs)
-
trunk/src/php/NF/Base.php (added)
-
trunk/src/php/NF/Field.php (modified) (1 diff)
-
trunk/src/php/NF/NF.php (modified) (12 diffs)
-
trunk/src/php/Settings/Abstracts/SettingsBase.php (modified) (6 diffs)
-
trunk/src/php/Settings/Integrations.php (modified) (1 diff)
-
trunk/src/php/Settings/PluginSettingsBase.php (modified) (1 diff)
-
trunk/src/php/Settings/Settings.php (modified) (1 diff)
-
trunk/src/php/Spectra/Form.php (modified) (4 diffs)
-
trunk/src/php/WPDiscuz/Base.php (modified) (1 diff)
-
trunk/src/php/includes/functions.php (modified) (2 diffs)
-
trunk/src/php/includes/request.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (5 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hcaptcha-for-forms-and-more/tags/4.5.0/assets/css/settings-base.css
r3114572 r3143189 17 17 18 18 .hcaptcha-settings-tabs { 19 position: sticky; 20 top: 0; 21 z-index: 2; /* +1 to .hcaptcha-header bar z-index, to overlap a bit */ 19 22 display: flex; 20 23 flex-wrap: wrap; … … 46 49 47 50 .hcaptcha-header-bar { 51 position: sticky; 52 top: 60px; 53 z-index: 1; 54 background: #f0f2f5; 48 55 display: flex; 49 56 justify-content: space-between; 50 57 align-items: center; 51 margin: 0; 58 margin: 0 -20px; 59 padding: 0 20px; 52 60 } 53 61 -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/css/settings-base.min.css
r3114572 r3143189 1 body.settings_page_hcaptcha{background:#f0f2f5;color:#5c6f8a}.wrap h1.hcaptcha-settings-header{align-items:center;display:flex;font-size:34px;font-weight:700}.hcaptcha-logo{height:64px;margin:10px 5px 10px 0}.hcaptcha-settings-tabs{background:#fff;display:flex;flex-wrap:wrap;justify-content:space-between;line-height:4.5em;margin:10px -20px 0;padding:0 20px }.hcaptcha-settings-tab{border-bottom:2px solid transparent;color:#646970;display:inline-block;font-size:1.1em;margin-right:30px;text-decoration:none}.hcaptcha-settings-tab:hover{border-bottom-color:#025176!important;border-bottom:2px solid;color:#666}.hcaptcha-settings-tab.active{border-bottom:2px solid #0075ab}.hcaptcha-header-bar{align-items:center;display:flex;justify-content:space-between;margin:0}#hcaptcha-options h2{color:#5c6f8a;font-size:1.5em}#hcaptcha-options h2~*{display:none}#hcaptcha-options h3{color:#5c6f8a;margin:1.5em 0 1em}#hcaptcha-options .notice-dismiss:before{color:#5c6f8a}#hcaptcha-options table tbody tr td{margin:0;padding:0;position:relative}#hcaptcha-options table tr td input[type=checkbox]{border:none;box-shadow:none;display:inline;height:1.25rem;margin:-.125rem .5rem 0 0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:before{background:url(../images/checkbox-off.svg);background-size:cover;content:"";display:inline-block;height:1.25rem;margin:0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:checked:before{background:no-repeat url(../images/checkbox-on.svg);background-size:cover}#hcaptcha-options fieldset:disabled{color:#dadada}#hcaptcha-options .button-primary{background-color:#026593;border-color:#026593;color:#fff}#hcaptcha-options .button-primary:hover{background-color:#025176}#hcaptcha-options .button-secondary{background-color:#fff;border-color:#026593;color:#026593}#hcaptcha-options .button-secondary:hover{background-color:#ccc}#hcaptcha-options a{color:#0075ab}#hcaptcha-navigation a{border-color:#0075ab}#hcaptcha-options a.hcaptcha-settings-tab{color:#5c6f8a}#hcaptcha-options .helper:before{background:#5c6f8a;border-radius:1.2em;color:#fff;content:"?";height:1.2em;position:absolute;right:0;text-align:center;top:0;transform:translateY(-26px);width:1.2em}#hcaptcha-options fieldset+.helper:before{top:50%;transform:translate(25px,-.8em)}#hcaptcha-options .helper .helper-content{background:#5c6f8a;box-sizing:border-box;color:#f0f2f5;display:none;padding:.5em 1em;position:absolute;right:0;top:0;transform:translate(1px,10px);width:100%}#hcaptcha-options fieldset+.helper .helper-content{top:50%;transform:translate(25px,25px);width:calc(100% + 25px)}#hcaptcha-options .helper:hover{cursor:help}#hcaptcha-options .helper:hover .helper-content{display:block;z-index:1}#hcaptcha-options .helper .helper-content:after{border:10px solid transparent;border-bottom-color:#5c6f8a;content:"";position:absolute;right:0;top:0;transform:translateY(-100%)}#hcaptcha-options .helper .helper-content a{color:#fff}#hcaptcha-message{box-sizing:border-box}#hcaptcha-message>p{font-size:13px;font-weight:600;line-height:1.5;margin:.5em 0}@keyframes blink{0%{opacity:1}16.7%{opacity:0}33.3%{opacity:1}50%{opacity:0}66.7%{opacity:1}83.3%{opacity:0}to{opacity:1}}.blink{animation:blink 3s linear}.hcaptcha-hide{display:none}.hcaptcha-excerpt{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hcaptcha-excerpt:hover .hcaptcha-hide{background:#5c6f8a;border:1px solid #c3c4c7;border-radius:6px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);color:#f0f2f5;display:block;left:0;max-width:300px;padding:8px 10px;position:absolute;text-align:center;top:0;white-space:normal;width:max-content;z-index:1}@media (max-width:782px){.hcaptcha-settings-tabs{margin:10px -12px 0 -10px;padding:0 12px 0 10px}}@media (max-width:600px){#hcaptcha-options table tbody{grid-template-columns:1fr}#hcaptcha-options table tbody tr{position:relative}#hcaptcha-options fieldset+.helper:before{transform:translateY(-.7em)}#hcaptcha-options fieldset+.helper .helper-content{transform:translateY(25px);width:100%}#hcaptcha-options .helper{z-index:1}.hcaptcha-settings-tab{margin-right:15px}}1 body.settings_page_hcaptcha{background:#f0f2f5;color:#5c6f8a}.wrap h1.hcaptcha-settings-header{align-items:center;display:flex;font-size:34px;font-weight:700}.hcaptcha-logo{height:64px;margin:10px 5px 10px 0}.hcaptcha-settings-tabs{background:#fff;display:flex;flex-wrap:wrap;justify-content:space-between;line-height:4.5em;margin:10px -20px 0;padding:0 20px;position:sticky;top:0;z-index:2}.hcaptcha-settings-tab{border-bottom:2px solid transparent;color:#646970;display:inline-block;font-size:1.1em;margin-right:30px;text-decoration:none}.hcaptcha-settings-tab:hover{border-bottom-color:#025176!important;border-bottom:2px solid;color:#666}.hcaptcha-settings-tab.active{border-bottom:2px solid #0075ab}.hcaptcha-header-bar{align-items:center;background:#f0f2f5;display:flex;justify-content:space-between;margin:0 -20px;padding:0 20px;position:sticky;top:60px;z-index:1}#hcaptcha-options h2{color:#5c6f8a;font-size:1.5em}#hcaptcha-options h2~*{display:none}#hcaptcha-options h3{color:#5c6f8a;margin:1.5em 0 1em}#hcaptcha-options .notice-dismiss:before{color:#5c6f8a}#hcaptcha-options table tbody tr td{margin:0;padding:0;position:relative}#hcaptcha-options table tr td input[type=checkbox]{border:none;box-shadow:none;display:inline;height:1.25rem;margin:-.125rem .5rem 0 0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:before{background:url(../images/checkbox-off.svg);background-size:cover;content:"";display:inline-block;height:1.25rem;margin:0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:checked:before{background:no-repeat url(../images/checkbox-on.svg);background-size:cover}#hcaptcha-options fieldset:disabled{color:#dadada}#hcaptcha-options .button-primary{background-color:#026593;border-color:#026593;color:#fff}#hcaptcha-options .button-primary:hover{background-color:#025176}#hcaptcha-options .button-secondary{background-color:#fff;border-color:#026593;color:#026593}#hcaptcha-options .button-secondary:hover{background-color:#ccc}#hcaptcha-options a{color:#0075ab}#hcaptcha-navigation a{border-color:#0075ab}#hcaptcha-options a.hcaptcha-settings-tab{color:#5c6f8a}#hcaptcha-options .helper:before{background:#5c6f8a;border-radius:1.2em;color:#fff;content:"?";height:1.2em;position:absolute;right:0;text-align:center;top:0;transform:translateY(-26px);width:1.2em}#hcaptcha-options fieldset+.helper:before{top:50%;transform:translate(25px,-.8em)}#hcaptcha-options .helper .helper-content{background:#5c6f8a;box-sizing:border-box;color:#f0f2f5;display:none;padding:.5em 1em;position:absolute;right:0;top:0;transform:translate(1px,10px);width:100%}#hcaptcha-options fieldset+.helper .helper-content{top:50%;transform:translate(25px,25px);width:calc(100% + 25px)}#hcaptcha-options .helper:hover{cursor:help}#hcaptcha-options .helper:hover .helper-content{display:block;z-index:1}#hcaptcha-options .helper .helper-content:after{border:10px solid transparent;border-bottom-color:#5c6f8a;content:"";position:absolute;right:0;top:0;transform:translateY(-100%)}#hcaptcha-options .helper .helper-content a{color:#fff}#hcaptcha-message{box-sizing:border-box}#hcaptcha-message>p{font-size:13px;font-weight:600;line-height:1.5;margin:.5em 0}@keyframes blink{0%{opacity:1}16.7%{opacity:0}33.3%{opacity:1}50%{opacity:0}66.7%{opacity:1}83.3%{opacity:0}to{opacity:1}}.blink{animation:blink 3s linear}.hcaptcha-hide{display:none}.hcaptcha-excerpt{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hcaptcha-excerpt:hover .hcaptcha-hide{background:#5c6f8a;border:1px solid #c3c4c7;border-radius:6px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);color:#f0f2f5;display:block;left:0;max-width:300px;padding:8px 10px;position:absolute;text-align:center;top:0;white-space:normal;width:max-content;z-index:1}@media (max-width:782px){.hcaptcha-settings-tabs{margin:10px -12px 0 -10px;padding:0 12px 0 10px}}@media (max-width:600px){#hcaptcha-options table tbody{grid-template-columns:1fr}#hcaptcha-options table tbody tr{position:relative}#hcaptcha-options fieldset+.helper:before{transform:translateY(-.7em)}#hcaptcha-options fieldset+.helper .helper-content{transform:translateY(25px);width:100%}#hcaptcha-options .helper{z-index:1}.hcaptcha-settings-tab{margin-right:15px}} -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/hcaptcha-mailpoet.js
r3026321 r3143189 15 15 } 16 16 17 const urlParams = new URLSearchParams( data ); 18 const formId = urlParams.get( 'data[form_id]' ); 19 const $form = $( 'input[name="data[form_id]"][value=' + formId + ']' ).parent( 'form' ); 17 // eslint-disable-next-line @wordpress/no-global-active-element 18 const eventTarget = options.context || document.activeElement; 19 const $form = $( eventTarget.closest( 'form' ) ); 20 20 21 let response = $form.find( '[name="h-captcha-response"]' ).val(); 21 22 response = response ? response : ''; -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/hcaptcha-mailpoet.min.js
r3026321 r3143189 1 (()=>{var a;(a=jQuery).ajaxPrefilter((function(t){var e, i=null!==(e=t.data)&&void 0!==e?e:"",n="";if(i.startsWith("action=mailpoet")&&(n="hcaptcha_mailpoet_nonce"),n){var r=new URLSearchParams(i).get("data[form_id]"),c=a('input[name="data[form_id]"][value='+r+"]").parent("form"),d=c.find('[name="h-captcha-response"]').val();d=d||"";var h=c.find('[name="hcaptcha-widget-id"]').val();h=h||"";var o=c.find('[name="'+n+'"]').val();o=o||"",t.data+="&h-captcha-response="+d+"&hcaptcha-widget-id="+h+"&"+n+"="+o}}))})();1 (()=>{var a;(a=jQuery).ajaxPrefilter((function(t){var e,c="";if((null!==(e=t.data)&&void 0!==e?e:"").startsWith("action=mailpoet")&&(c="hcaptcha_mailpoet_nonce"),c){var n=t.context||document.activeElement,i=a(n.closest("form")),o=i.find('[name="h-captcha-response"]').val();o=o||"";var r=i.find('[name="hcaptcha-widget-id"]').val();r=r||"";var d=i.find('[name="'+c+'"]').val();d=d||"",t.data+="&h-captcha-response="+o+"&hcaptcha-widget-id="+r+"&"+c+"="+d}}))})(); -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/integrations.js
r3114572 r3143189 25 25 */ 26 26 const integrations = function( $ ) { 27 const adminBar = document.querySelector( '#wpadminbar' ); 28 const tabs = document.querySelector( '.hcaptcha-settings-tabs' ); 29 const headerBar = document.querySelector( '.hcaptcha-header-bar' ); 27 30 const msgSelector = '#hcaptcha-message'; 28 31 let $message = $( msgSelector ); … … 30 33 const $adminmenuwrap = $( '#adminmenuwrap' ); 31 34 const $search = $( '#hcaptcha-integrations-search' ); 35 36 function getStickyHeight() { 37 const isAbsolute = adminBar ? window.getComputedStyle( adminBar ).position === 'absolute' : true; 38 const adminBarHeight = ( adminBar && ! isAbsolute ) ? adminBar.offsetHeight : 0; 39 const tabsHeight = tabs ? tabs.offsetHeight : 0; 40 const headerBarHeight = headerBar ? headerBar.offsetHeight : 0; 41 42 return adminBarHeight + tabsHeight + headerBarHeight; 43 } 32 44 33 45 function clearMessage() { … … 223 235 224 236 const $table = $( '.form-table' ).eq( activate ? 0 : 1 ); 225 const top = $wpWrap.position().top;226 237 227 238 swapThemes( activate, entity, newTheme ); … … 232 243 $( 'html, body' ).animate( 233 244 { 234 scrollTop: $tr.offset().top - top - $message.outerHeight(),245 scrollTop: $tr.offset().top - getStickyHeight(), 235 246 }, 236 247 1000 -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/integrations.min.js
r3114572 r3143189 1 (()=>{function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,o,r,c=[],s=!0,l=!1;try{if(o=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;s=!1}else for(;!(s=(n=o.call(a)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{if(!s&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(l)throw i}}return c}}(t,a)||function(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=Array(e);a<e;a++)n[a]=t[a];return n}var a=function(e){var a= "#hcaptcha-message",n=e(a),i=e("#wpwrap"),o=e("#adminmenuwrap"),r=e("#hcaptcha-integrations-search");function c(t,a){n.removeClass(),n.addClass(a+" notice settings-error is-dismissible"),n.html("<p>".concat(t,"</p>")),e(document).trigger("wp-updates-notice-added");var r=n.clone();n.css("visibility","hidden"),r.css("margin","0px"),r.css("top",i.position().top),r.css("z-index","999999");var c="block"===o.css("display")?o.width():0;r.css("left",c),r.width(e(window).width()-c),r.css("position","fixed"),e("body").append(r),setTimeout((function(){n.css("visibility","unset"),r.remove()}),3e3)}function s(t){c(t,"notice-error")}function l(t){return t.is(jQuery(".form-table").eq(0))}function d(t,a,n){var i=!1,o=a.toLowerCase(),r=!l(t),c=n.find("fieldset");c.attr("disabled",r),c.find("input").attr("disabled",r),t.find("tbody").children().each((function(t,a){var r=e(a).find(".hcaptcha-integrations-logo img").attr("alt");if((r=(r=r||"").replace(" Logo","")).toLowerCase()>o)return n.insertBefore(e(a)),i=!0,!1})),i||t.find("tbody").append(n)}e(".form-table img").on("click",(function(o){function r(){var a,o,r=v?"on":"off",h=(o=document.querySelector(".kagg-dialog select"))&&null!==(a=o.value)&&void 0!==a?a:"",m={action:HCaptchaIntegrationsObject.action,nonce:HCaptchaIntegrationsObject.nonce,activate:v,entity:u,status:g,newTheme:h};p.addClass(r),e.post({url:HCaptchaIntegrationsObject.ajaxUrl,data:m}).done((function(a){if(void 0!==a.success)if(void 0!==a.data.themes&&(window.HCaptchaIntegrationsObject.themes=a.data.themes,window.HCaptchaIntegrationsObject.defaultTheme=a.data.defaultTheme),a.success){var o=e(".form-table").eq(v?0:1),r=i.position().top;!function(t,a,n){if("theme"===a){var i=e(".form-table"),o=t?"":'[data-label="'+n+'"]',r=i.eq(t?0:1).find('.hcaptcha-integrations-logo img[data-entity="theme"]'+o);if(r.length){var c=i.eq(t?1:0),s=r.closest("tr");d(c,r.attr("data-label"),s)}}}(v,u,h),d(o,f,p),function(t){c(t,"notice-success")}(a.data.message),function(a){for(var n=e(".form-table"),i=0,o=Object.entries(a);i<o.length;i++){var r=t(o[i],2),c=r[0],s=r[1],h="hcaptcha-integrations-"+c.replace(/_/g,"-"),u=e("tr.".concat(h));l(u.closest(".form-table"))!==s&&d(n.eq(s?0:1),u.find(".hcaptcha-integrations-logo img").attr("alt"),u)}}(a.data.stati),e("html, body").animate({scrollTop:p.offset().top-r-n.outerHeight()},1e3)}else{var g,m;s(null!==(g=null===(m=a.data)||void 0===m?void 0:m.message)&&void 0!==g?g:a.data)}else c(HCaptchaIntegrationsObject.unexpectedErrorMsg,"notice-error")})).fail((function(t){s(t.statusText)})).always((function(){p.removeClass("on off")}))}o.preventDefault(),n.remove(),e('<div id="hcaptcha-message"></div>').insertAfter(".hcaptcha-header-bar"),n=e(a);var h=e(o.target),u=h.data("entity");if(u=u||"",-1!==e.inArray(u,["core","theme","plugin"])&&-1===e.inArray(u,["core"])){var f=h.attr("alt");f=(f=f||"").replace(" Logo","");var p=h.closest("tr"),g=p.attr("class");g=g.replace("hcaptcha-integrations-","");var m,v,b="";if(p.find("fieldset").attr("disabled"))m="plugin"===u?HCaptchaIntegrationsObject.activateMsg:HCaptchaIntegrationsObject.activateThemeMsg,v=!0;else{if("plugin"===u)m=HCaptchaIntegrationsObject.deactivateMsg;else{for(var y in m=HCaptchaIntegrationsObject.deactivateThemeMsg,b="<p>"+HCaptchaIntegrationsObject.selectThemeMsg+"</p>",b+="<select>",HCaptchaIntegrationsObject.themes){var C=y===HCaptchaIntegrationsObject.defaultTheme?' selected="selected"':"";b+='<option value="'.concat(y,'"').concat(C,">").concat(HCaptchaIntegrationsObject.themes[y],"</option>")}b+="</select>"}v=!1}if(-1===e.inArray(u,["theme"])||v||0!==Object.keys(HCaptchaIntegrationsObject.themes).length){if(!p.find(".hcaptcha-integrations-logo").data("installed"))return m=(m=HCaptchaIntegrationsObject.installMsg).replace("%s",f),void kaggDialog.confirm({title:m,content:b,type:"install",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}});o.ctrlKey?r():(m=m.replace("%s",f),kaggDialog.confirm({title:m,content:b,type:v?"activate":"deactivate",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText},cancel:{text:HCaptchaIntegrationsObject.CancelBtnText}},onAction:function(t){t&&r()}}))}else kaggDialog.confirm({title:HCaptchaIntegrationsObject.onlyOneThemeMsg,content:"",type:"info",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}})}}));var h,u,f;r.on("input",(h=function(){var t=r.val().trim().toLowerCase(),a=e(".hcaptcha-integrations-logo img"),n=null;if(a.each((function(a,i){var o=e(i);if("core"!==o.data("entity")){var r,c=o.closest("tr");o.data("label").toLowerCase().includes(t)?(c.show(),n=null!==(r=n)&&void 0!==r?r:c):c.hide()}})),n){var i=n.offset().top+n.outerHeight()-e(window).height()+5;e("html").stop().animate({scrollTop:i},1e3)}},u=100,function(){var t=this,e=arguments;clearTimeout(f),f=setTimeout((function(){return h.apply(t,e)}),u)})),e("#hcaptcha-options").keydown((function(t){e(t.target).is(r)&&13===t.which&&t.preventDefault()}))};window.hCaptchaIntegrations=a,jQuery(document).ready(a)})();1 (()=>{function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,o,r,c=[],s=!0,l=!1;try{if(o=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;s=!1}else for(;!(s=(n=o.call(a)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{if(!s&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(l)throw i}}return c}}(t,a)||function(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=Array(e);a<e;a++)n[a]=t[a];return n}var a=function(e){var a=document.querySelector("#wpadminbar"),n=document.querySelector(".hcaptcha-settings-tabs"),i=document.querySelector(".hcaptcha-header-bar"),o="#hcaptcha-message",r=e(o),c=e("#wpwrap"),s=e("#adminmenuwrap"),l=e("#hcaptcha-integrations-search");function d(t,a){r.removeClass(),r.addClass(a+" notice settings-error is-dismissible"),r.html("<p>".concat(t,"</p>")),e(document).trigger("wp-updates-notice-added");var n=r.clone();r.css("visibility","hidden"),n.css("margin","0px"),n.css("top",c.position().top),n.css("z-index","999999");var i="block"===s.css("display")?s.width():0;n.css("left",i),n.width(e(window).width()-i),n.css("position","fixed"),e("body").append(n),setTimeout((function(){r.css("visibility","unset"),n.remove()}),3e3)}function h(t){d(t,"notice-error")}function u(t){return t.is(jQuery(".form-table").eq(0))}function f(t,a,n){var i=!1,o=a.toLowerCase(),r=!u(t),c=n.find("fieldset");c.attr("disabled",r),c.find("input").attr("disabled",r),t.find("tbody").children().each((function(t,a){var r=e(a).find(".hcaptcha-integrations-logo img").attr("alt");if((r=(r=r||"").replace(" Logo","")).toLowerCase()>o)return n.insertBefore(e(a)),i=!0,!1})),i||t.find("tbody").append(n)}e(".form-table img").on("click",(function(c){function s(){var o,r,c=y?"on":"off",s=(r=document.querySelector(".kagg-dialog select"))&&null!==(o=r.value)&&void 0!==o?o:"",l={action:HCaptchaIntegrationsObject.action,nonce:HCaptchaIntegrationsObject.nonce,activate:y,entity:p,status:b,newTheme:s};m.addClass(c),e.post({url:HCaptchaIntegrationsObject.ajaxUrl,data:l}).done((function(o){if(void 0!==o.success)if(void 0!==o.data.themes&&(window.HCaptchaIntegrationsObject.themes=o.data.themes,window.HCaptchaIntegrationsObject.defaultTheme=o.data.defaultTheme),o.success){var r,c=e(".form-table").eq(y?0:1);!function(t,a,n){if("theme"===a){var i=e(".form-table"),o=t?"":'[data-label="'+n+'"]',r=i.eq(t?0:1).find('.hcaptcha-integrations-logo img[data-entity="theme"]'+o);if(r.length){var c=i.eq(t?1:0),s=r.closest("tr");f(c,r.attr("data-label"),s)}}}(y,p,s),f(c,g,m),function(t){d(t,"notice-success")}(o.data.message),function(a){for(var n=e(".form-table"),i=0,o=Object.entries(a);i<o.length;i++){var r=t(o[i],2),c=r[0],s=r[1],l="hcaptcha-integrations-"+c.replace(/_/g,"-"),d=e("tr.".concat(l));u(d.closest(".form-table"))!==s&&f(n.eq(s?0:1),d.find(".hcaptcha-integrations-logo img").attr("alt"),d)}}(o.data.stati),e("html, body").animate({scrollTop:m.offset().top-(r=!a||"absolute"===window.getComputedStyle(a).position,(a&&!r?a.offsetHeight:0)+(n?n.offsetHeight:0)+(i?i.offsetHeight:0))},1e3)}else{var l,b;h(null!==(l=null===(b=o.data)||void 0===b?void 0:b.message)&&void 0!==l?l:o.data)}else d(HCaptchaIntegrationsObject.unexpectedErrorMsg,"notice-error")})).fail((function(t){h(t.statusText)})).always((function(){m.removeClass("on off")}))}c.preventDefault(),r.remove(),e('<div id="hcaptcha-message"></div>').insertAfter(".hcaptcha-header-bar"),r=e(o);var l=e(c.target),p=l.data("entity");if(p=p||"",-1!==e.inArray(p,["core","theme","plugin"])&&-1===e.inArray(p,["core"])){var g=l.attr("alt");g=(g=g||"").replace(" Logo","");var m=l.closest("tr"),b=m.attr("class");b=b.replace("hcaptcha-integrations-","");var v,y,C="";if(m.find("fieldset").attr("disabled"))v="plugin"===p?HCaptchaIntegrationsObject.activateMsg:HCaptchaIntegrationsObject.activateThemeMsg,y=!0;else{if("plugin"===p)v=HCaptchaIntegrationsObject.deactivateMsg;else{for(var w in v=HCaptchaIntegrationsObject.deactivateThemeMsg,C="<p>"+HCaptchaIntegrationsObject.selectThemeMsg+"</p>",C+="<select>",HCaptchaIntegrationsObject.themes){var j=w===HCaptchaIntegrationsObject.defaultTheme?' selected="selected"':"";C+='<option value="'.concat(w,'"').concat(j,">").concat(HCaptchaIntegrationsObject.themes[w],"</option>")}C+="</select>"}y=!1}if(-1===e.inArray(p,["theme"])||y||0!==Object.keys(HCaptchaIntegrationsObject.themes).length){if(!m.find(".hcaptcha-integrations-logo").data("installed"))return v=(v=HCaptchaIntegrationsObject.installMsg).replace("%s",g),void kaggDialog.confirm({title:v,content:C,type:"install",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}});c.ctrlKey?s():(v=v.replace("%s",g),kaggDialog.confirm({title:v,content:C,type:y?"activate":"deactivate",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText},cancel:{text:HCaptchaIntegrationsObject.CancelBtnText}},onAction:function(t){t&&s()}}))}else kaggDialog.confirm({title:HCaptchaIntegrationsObject.onlyOneThemeMsg,content:"",type:"info",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}})}}));var p,g,m;l.on("input",(p=function(){var t=l.val().trim().toLowerCase(),a=e(".hcaptcha-integrations-logo img"),n=null;if(a.each((function(a,i){var o=e(i);if("core"!==o.data("entity")){var r,c=o.closest("tr");o.data("label").toLowerCase().includes(t)?(c.show(),n=null!==(r=n)&&void 0!==r?r:c):c.hide()}})),n){var i=n.offset().top+n.outerHeight()-e(window).height()+5;e("html").stop().animate({scrollTop:i},1e3)}},g=100,function(){var t=this,e=arguments;clearTimeout(m),m=setTimeout((function(){return p.apply(t,e)}),g)})),e("#hcaptcha-options").keydown((function(t){e(t.target).is(l)&&13===t.which&&t.preventDefault()}))};window.hCaptchaIntegrations=a,jQuery(document).ready(a)})(); -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/settings-base.js
r3114572 r3143189 10 10 const msgSelector = '#hcaptcha-message'; 11 11 12 // Move WP notices to the message area. 13 $( h2Selector ).siblings().appendTo( msgSelector ); 12 function setHeaderBarTop() { 13 const adminBar = document.querySelector( '#wpadminbar' ); 14 const tabs = document.querySelector( '.hcaptcha-settings-tabs' ); 15 const headerBar = document.querySelector( '.hcaptcha-header-bar' ); 16 17 const isAbsolute = adminBar ? window.getComputedStyle( adminBar ).position === 'absolute' : true; 18 const adminBarHeight = ( adminBar && ! isAbsolute ) ? adminBar.offsetHeight : 0; 19 const tabsHeight = tabs ? tabs.offsetHeight : 0; 20 // The -1 to put header bar a bit under tabs. It is a precaution when heights are in fractional pixels. 21 const totalHeight = adminBarHeight + tabsHeight - 1; 22 23 if ( tabs ) { 24 tabs.style.top = `${ adminBarHeight }px`; 25 } 26 27 if ( headerBar ) { 28 headerBar.style.top = `${ totalHeight }px`; 29 } 30 } 14 31 15 32 /** … … 43 60 } 44 61 62 // Move WP notices to the message area. 63 $( h2Selector ).siblings().appendTo( msgSelector ); 64 65 window.addEventListener( 'resize', function() { 66 setHeaderBarTop(); 67 } ); 68 69 setHeaderBarTop(); 70 45 71 highLight(); 46 72 }; -
hcaptcha-for-forms-and-more/tags/4.5.0/assets/js/settings-base.min.js
r3114572 r3143189 1 (()=>{var a=function(a){a(".hcaptcha-header h2").siblings().appendTo("#hcaptcha-message"),function(){var e=window.location.href,i=document.referrer;if(i&&i!==e){var n=window.location.hash;if(n){var s=a(n);s&&(s.is(":checkbox")?s.closest("fieldset").addClass("blink"):s.addClass("blink"))}}}()};window.hCaptchaSettingsBase=a,jQuery(document).ready(a)})();1 (()=>{var e=function(e){function t(){var e=document.querySelector("#wpadminbar"),t=document.querySelector(".hcaptcha-settings-tabs"),a=document.querySelector(".hcaptcha-header-bar"),o=!e||"absolute"===window.getComputedStyle(e).position,n=e&&!o?e.offsetHeight:0,c=n+(t?t.offsetHeight:0)-1;t&&(t.style.top="".concat(n,"px")),a&&(a.style.top="".concat(c,"px"))}e(".hcaptcha-header h2").siblings().appendTo("#hcaptcha-message"),window.addEventListener("resize",(function(){t()})),t(),function(){var t=window.location.href,a=document.referrer;if(a&&a!==t){var o=window.location.hash;if(o){var n=e(o);n&&(n.is(":checkbox")?n.closest("fieldset").addClass("blink"):n.addClass("blink"))}}}()};window.hCaptchaSettingsBase=e,jQuery(document).ready(e)})(); -
hcaptcha-for-forms-and-more/tags/4.5.0/changelog.txt
r3129246 r3143189 1 = 4.5.0 = 2 * Added support for Jetpack forms in block theme templates. 3 * Added support for bbPress Login, Register and Lost Password forms. 4 * Added the second argument $atts to the 'hcap_hcaptcha_content' filter. 5 * Added support for MailPoet forms at any placement. 6 * Added the ability to have multiple MailPoet forms on the same page. 7 * Improved UX of the Integrations page. 8 * Fixed error messaging when there are several Jetpack forms on the same page. 9 * Fixed unconditional forcing hCaptcha in Jetpack forms. 10 * Fixed appearance of Beaver Builder editor with "Turn Off When Logged In" setting. 11 * Fixed appearance of Contact Form 7 editor with "Turn Off When Logged In" setting. 12 * Fixed appearance of Essential Addons editor with "Turn Off When Logged In" setting. 13 * Fixed appearance of Gravity Forms editor with "Turn Off When Logged In" setting. 14 * Fixed appearance of Fluent Forms editor with "Turn Off When Logged In" setting. 15 * Fixed appearance of Forminator editor with "Turn Off When Logged In" setting. 16 * Fixed appearance of Formidable Forms with "Turn Off When Logged In" setting. 17 * Fixed appearance of Ninja Forms editor with "Turn Off When Logged In" setting. 18 * Fixed appearance of WPForms editor with "Turn Off When Logged In" setting. 19 * Fixed fatal error on Gravity Forms Entries page. 20 * Fixed Elementor preview. 21 * Fixed Ninja Forms preview. 22 * Fixed hCaptcha nonce error on MailPoet admin pages. 23 * Fixed frontend error when recaptcha was activated in wpDiscuz. 24 1 25 = 4.4.0 = 2 26 * Added compatibility with Contact Form 7 Stripe integration. -
hcaptcha-for-forms-and-more/tags/4.5.0/hcaptcha.php
r3129246 r3143189 11 11 * Plugin URI: https://www.hcaptcha.com/ 12 12 * Description: hCaptcha keeps out bots and spam while putting privacy first. It is a drop-in replacement for reCAPTCHA. 13 * Version: 4. 4.013 * Version: 4.5.0 14 14 * Requires at least: 5.3 15 15 * Requires PHP: 7.2 … … 40 40 * Plugin version. 41 41 */ 42 const HCAPTCHA_VERSION = '4. 4.0';42 const HCAPTCHA_VERSION = '4.5.0'; 43 43 44 44 /** -
hcaptcha-for-forms-and-more/tags/4.5.0/readme.txt
r3129246 r3143189 5 5 Tested up to: 6.6 6 6 Requires PHP: 7.2 7 Stable tag: 4. 4.07 Stable tag: 4.5.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 17 17 Need to keep out bots? hCaptcha protects privacy while offering better protection against spam and abuse. Help build a better web. 18 18 19 [The hCaptcha for WP many advantages over similar captcha plugins](https://kagg.eu/why-choose-hcaptcha-for-wp/).19 hCaptcha for WP [makes security easy](https://www.hcaptcha.com/integration-hcaptcha-for-wp) with broad integration support, detailed analytics, and strong protection. Start protecting logins, forms, and more in minutes. 20 20 21 21 == How hCaptcha Works == … … 37 37 5. Contact Form 7 live form in the admin editor. 38 38 6. Elementor Pro Form. 39 7. Elementor Pro F rom in admin editor.39 7. Elementor Pro Form in admin editor. 40 40 8. General settings page. 41 41 9. Integrations settings page. … … 197 197 BBPress 198 198 `$source: 'bbpress/bbpress.php'` 199 `$form_id: 'new_topic' or 'reply'`199 `$form_id: 'new_topic', 'reply', 'login', 'register' or 'lost_password'` 200 200 201 201 Beaver Builder … … 233 233 Jetpack 234 234 `$source: 'jetpack/jetpack.php'` 235 `$form_id: 'contact '`235 `$form_id: 'contact_$form_hash'` 236 236 237 237 Kadence Form … … 395 395 = How to whitelist certain IPs = 396 396 397 You can use the following filter :397 You can use the following filter. It should be added to your plugin's (or mu-plugin's) main file. This filter won't work being added to a theme's functions.php file. 398 398 399 399 ` … … 495 495 * Avada Form 496 496 * Back In Stock Notifier Form 497 * bbPress New Topic and ReplyForms497 * bbPress New Topic, Reply, Login, Register and Lost Password Forms 498 498 * Beaver Builder Contact and Login Forms 499 499 * BuddyPress — Create Group and Registration Forms … … 566 566 == Changelog == 567 567 568 = 4.5.0 = 569 * Added support for Jetpack forms in block theme templates. 570 * Added support for bbPress Login, Register and Lost Password forms. 571 * Added the second argument $atts to the 'hcap_hcaptcha_content' filter. 572 * Added support for MailPoet forms at any placement. 573 * Added the ability to have multiple MailPoet forms on the same page. 574 * Improved UX of the Integrations page. 575 * Fixed error messaging when there are several Jetpack forms on the same page. 576 * Fixed unconditional forcing hCaptcha in Jetpack forms. 577 * Fixed appearance of Beaver Builder editor with "Turn Off When Logged In" setting. 578 * Fixed appearance of Contact Form 7 editor with "Turn Off When Logged In" setting. 579 * Fixed appearance of Essential Addons editor with "Turn Off When Logged In" setting. 580 * Fixed appearance of Gravity Forms editor with "Turn Off When Logged In" setting. 581 * Fixed appearance of Fluent Forms editor with "Turn Off When Logged In" setting. 582 * Fixed appearance of Forminator editor with "Turn Off When Logged In" setting. 583 * Fixed appearance of Formidable Forms with "Turn Off When Logged In" setting. 584 * Fixed appearance of Ninja Forms editor with "Turn Off When Logged In" setting. 585 * Fixed appearance of WPForms editor with "Turn Off When Logged In" setting. 586 * Fixed fatal error on Gravity Forms Entries page. 587 * Fixed Elementor preview. 588 * Fixed Ninja Forms preview. 589 * Fixed hCaptcha nonce error on MailPoet admin pages. 590 * Fixed frontend error when recaptcha was activated in wpDiscuz. 591 568 592 = 4.4.0 = 569 593 * Added compatibility with Contact Form 7 Stripe integration. -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/CF7/Admin.php
r3129246 r3143189 11 11 namespace HCaptcha\CF7; 12 12 13 use HCaptcha\Helpers\Pages; 13 14 use WPCF7_TagGenerator; 14 15 … … 36 37 } 37 38 38 if ( ! $this->is_cf7_form_admin_page() ) {39 if ( ! Pages::is_cf7_edit_page() ) { 39 40 return; 40 41 } … … 294 295 } 295 296 } 296 297 /**298 * Check if the current page is a CF7 form create, edit or view page.299 *300 * @return bool301 */302 protected function is_cf7_form_admin_page(): bool {303 304 // phpcs:ignore WordPress.Security.NonceVerification.Recommended305 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';306 307 if ( ! in_array( $page, [ 'wpcf7-new', 'wpcf7' ], true ) ) {308 return false;309 }310 311 // phpcs:ignore WordPress.Security.NonceVerification.Recommended312 if ( ( 'wpcf7' === $page ) && ! isset( $_GET['post'] ) ) {313 return false;314 }315 316 return true;317 }318 297 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Divi/Login.php
r3114572 r3143189 9 9 10 10 use HCaptcha\Abstracts\LoginBase; 11 use Patchwork\Exceptions\NonNullToVoid; 11 12 12 13 /** … … 34 35 * Add hCaptcha to the login form. 35 36 * 36 * @param string| string[]$output Module output.37 * @param string $module_slug Module slug.37 * @param string|mixed $output Module output. 38 * @param string $module_slug Module slug. 38 39 * 39 * @return string| string[]40 * @return string|mixed 40 41 * @noinspection PhpUnusedParameterInspection 41 42 * @noinspection PhpUndefinedFunctionInspection … … 75 76 76 77 // Insert hCaptcha. 77 return preg_replace( $pattern, $replacement, $output );78 return (string) preg_replace( $pattern, $replacement, $output ); 78 79 } 79 80 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/GravityForms/Field.php
r3115148 r3143189 53 53 * @param array $data Data. 54 54 */ 55 public function __construct( array$data = [] ) {55 public function __construct( $data = [] ) { 56 56 parent::__construct( $data ); 57 57 -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Helpers/HCaptcha.php
r3129246 r3143189 873 873 public static function add_type_module( string $tag ): string { 874 874 $search = [ 875 '/type=".+?" /',875 '/type=".+?" /', 876 876 '/<script /', 877 877 ]; 878 878 $replace = [ 879 879 '', 880 '<script type="module" ',880 '<script type="module" ', 881 881 ]; 882 882 -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Helpers/Request.php
r3129246 r3143189 1 1 <?php 2 2 /** 3 * Request class file.3 * Request class' file. 4 4 * 5 5 * @package hcaptcha-wp … … 115 115 return 'POST' === $request_method; 116 116 } 117 118 /** 119 * Filter input in WP style. 120 * Nonce must be checked in the calling function. 121 * 122 * @param int $type Input type. 123 * @param string $var_name Variable name. 124 * 125 * @return string 126 */ 127 public static function filter_input( int $type, string $var_name ): string { 128 switch ( $type ) { 129 case INPUT_GET: 130 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 131 return isset( $_GET[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_GET[ $var_name ] ) ) : ''; 132 case INPUT_POST: 133 // phpcs:ignore WordPress.Security.NonceVerification.Missing 134 return isset( $_POST[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_POST[ $var_name ] ) ) : ''; 135 case INPUT_SERVER: 136 return isset( $_SERVER[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_SERVER[ $var_name ] ) ) : ''; 137 default: 138 return ''; 139 } 140 } 117 141 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Jetpack/JetpackBase.php
r3114572 r3143189 34 34 35 35 /** 36 * Errored form hash. 37 * 38 * @var string|null 39 */ 40 protected $error_form_hash; 41 42 /** 36 43 * Constructor. 37 44 */ … … 46 53 */ 47 54 private function init_hooks(): void { 48 add_filter( 'the_content', [ $this, 'add_captcha' ] ); 55 // This filter works for a Jetpack classic and block form on a page or in a template. 56 add_filter( 'jetpack_contact_form_html', [ $this, 'add_captcha' ] ); 57 58 // This filter works for a Jetpack form in a classic widget. 49 59 add_filter( 'widget_text', [ $this, 'add_captcha' ], 0 ); 50 60 … … 83 93 } 84 94 95 $this->error_form_hash = $this->get_submitted_form_hash(); 96 85 97 $error = new WP_Error(); 98 86 99 $error->add( 'invalid_hcaptcha', $this->error_message ); 87 100 add_filter( 'hcap_hcaptcha_content', [ $this, 'error_message' ] ); … … 93 106 * Print error message. 94 107 * 95 * @param string|mixed $hcaptcha_content Content of hCaptcha. 108 * @param string|mixed $hcaptcha The hCaptcha form. 109 * @param array $atts The hCaptcha shortcode attributes. 96 110 * 97 111 * @return string|mixed 98 112 */ 99 public function error_message( $hcaptcha _content = '') {113 public function error_message( $hcaptcha = '', array $atts = [] ) { 100 114 if ( null === $this->error_message ) { 101 return $hcaptcha_content; 115 return $hcaptcha; 116 } 117 118 $hash = $atts['id']['form_id'] ?? ''; 119 $hash = str_replace( 'contact_', '', $hash ); 120 121 if ( $hash !== $this->error_form_hash ) { 122 return $hcaptcha; 102 123 } 103 124 … … 112 133 HTML; 113 134 114 return $hcaptcha _content. $message;135 return $hcaptcha . $message; 115 136 } 116 137 … … 131 152 HCaptcha::css_display( $css ); 132 153 } 154 155 /** 156 * Get form hash. 157 * 158 * @param string $form Jetpack form. 159 * 160 * @return string 161 */ 162 protected function get_form_hash( string $form ): string { 163 return preg_match( "/name='contact-form-hash' value='(.+)'/", $form, $m ) 164 ? '_' . $m[1] 165 : ''; 166 } 167 168 /** 169 * Get form hash. 170 * 171 * @return string|null 172 */ 173 private function get_submitted_form_hash(): ?string { 174 // phpcs:disable WordPress.Security.NonceVerification.Missing 175 return isset( $_POST['contact-form-hash'] ) 176 ? sanitize_text_field( wp_unslash( $_POST['contact-form-hash'] ) ) 177 : null; 178 // phpcs:enable WordPress.Security.NonceVerification.Missing 179 } 133 180 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Jetpack/JetpackForm.php
r3051014 r3143189 27 27 // Jetpack classic form. 28 28 $content = (string) preg_replace_callback( 29 '~(\[contact-form[\s\S]*?][\s\S]*?)(\[/contact-form])~',30 [ $this, ' classic_callback' ],29 "~<form [\s\S]*?class='contact-form[\s\S]*?(<button type='submit')[\s\S]*?</form>~", 30 [ $this, 'replace_callback' ], 31 31 $content 32 32 ); … … 35 35 return (string) preg_replace_callback( 36 36 '~<form [\s\S]*?wp-block-jetpack-contact-form[\s\S]*?(<div class="wp-block-jetpack-button wp-block-button"[\s\S]*?<button [\s\S]*?type="submit"[\s\S]*?</button>)[\s\S]*?</form>~', 37 [ $this, ' block_callback' ],37 [ $this, 'replace_callback' ], 38 38 $content 39 39 ); 40 }41 42 /**43 * Add hCaptcha shortcode to the provided shortcode for a Jetpack classic contact form.44 *45 * @param array $matches Matches.46 *47 * @return string48 */49 public function classic_callback( array $matches ): string {50 if ( has_shortcode( $matches[0], 'hcaptcha' ) ) {51 return $matches[0];52 }53 54 $args = [55 'action' => self::ACTION,56 'name' => self::NAME,57 'force' => true,58 'id' => [59 'source' => HCaptcha::get_class_source( __CLASS__ ),60 'form_id' => 'contact',61 ],62 ];63 64 $hcaptcha = '<div class="grunion-field-wrap">' . HCaptcha::form( $args ) . '</div>';65 66 return $matches[1] . $this->error_message( $hcaptcha ) . $matches[2];67 40 } 68 41 … … 74 47 * @return string 75 48 */ 76 public function block_callback( array $matches ): string {49 public function replace_callback( array $matches ): string { 77 50 if ( has_shortcode( $matches[0], 'hcaptcha' ) ) { 78 51 return $matches[0]; 79 52 } 80 53 54 $hash = $this->get_form_hash( $matches[0] ); 55 81 56 $args = [ 82 57 'action' => self::ACTION, 83 58 'name' => self::NAME, 84 'force' => true,85 59 'id' => [ 86 60 'source' => HCaptcha::get_class_source( __CLASS__ ), 87 'form_id' => 'contact' ,61 'form_id' => 'contact' . $hash, 88 62 ], 89 63 ]; … … 91 65 $hcaptcha = '<div class="grunion-field-wrap">' . HCaptcha::form( $args ) . '</div>'; 92 66 67 if ( false !== strpos( $matches[0], $hcaptcha ) ) { 68 return $matches[0]; 69 } 70 71 $hcaptcha = $this->error_message( $hcaptcha, $args ); 72 93 73 return str_replace( 94 74 $matches[1], 95 $ this->error_message( $hcaptcha ). $matches[1],75 $hcaptcha . $matches[1], 96 76 $matches[0] 97 77 ); -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/MailPoet/Form.php
r3129246 r3143189 14 14 15 15 use HCaptcha\Helpers\HCaptcha; 16 use HCaptcha\Helpers\Request; 16 17 use MailPoet\API\JSON\API; 17 18 use MailPoet\API\JSON\Response; 18 use WP_Block;19 19 20 20 /** … … 51 51 */ 52 52 private function init_hooks(): void { 53 add_filter( ' render_block', [ $this, 'add_captcha' ], 10, 3);53 add_filter( 'the_content', [ $this, 'the_content_filter' ], 20 ); 54 54 add_action( 'mailpoet_api_setup', [ $this, 'verify' ] ); 55 55 add_action( 'wp_print_footer_scripts', [ $this, 'enqueue_scripts' ], 9 ); … … 57 57 58 58 /** 59 * Add hcaptcha to MailPoet form.59 * The content filter. 60 60 * 61 * @param string|mixed $block_content The block content. 62 * @param array $block The full block, including name and attributes. 63 * @param WP_Block $instance The block instance. 61 * @param string|mixed $content Content. 64 62 * 65 63 * @return string 66 * @noinspection PhpUnusedParameterInspection67 64 */ 68 public function add_captcha( $block_content, array $block, WP_Block $instance ): string { 69 if ( 'mailpoet/subscription-form-block' !== $block['blockName'] ) { 70 return (string) $block_content; 65 public function the_content_filter( $content ): string { 66 $content = (string) $content; 67 68 if ( ! preg_match_all( 69 '~<form[\s\S]+?"data\[form_id]" value="(\d+?)"[\s\S]+?(<input type="submit")[\s\S]+?</form>~', 70 $content, 71 $matches 72 ) ) { 73 return $content; 71 74 } 72 75 73 $form_id = $block['attrs']['formId'] ?? 0; 74 $search = '<input type="submit" class="mailpoet_submit"'; 75 $args = [ 76 'action' => self::ACTION, 77 'name' => self::NONCE, 78 'id' => [ 79 'source' => HCaptcha::get_class_source( __CLASS__ ), 80 'form_id' => $form_id, 81 ], 82 ]; 76 foreach ( $matches[0] as $key => $form ) { 77 if ( false !== strpos( $form, 'h-captcha' ) ) { 78 continue; 79 } 83 80 84 return str_replace( 85 $search, 86 HCaptcha::form( $args ) . $search, 87 (string) $block_content 88 ); 81 $form_id = (int) $matches[1][ $key ]; 82 83 $args = [ 84 'action' => self::ACTION, 85 'name' => self::NONCE, 86 'id' => [ 87 'source' => HCaptcha::get_class_source( __CLASS__ ), 88 'form_id' => $form_id, 89 ], 90 ]; 91 $hcaptcha = HCaptcha::form( $args ); 92 93 $submit = $matches[2][ $key ]; 94 $replace = str_replace( $submit, $hcaptcha . $submit, $form ); 95 $content = str_replace( $form, $replace, $content ); 96 } 97 98 return $content; 89 99 } 90 100 … … 93 103 * 94 104 * @param API $api MailPoet API instance. 105 * 106 * @return void 95 107 */ 96 108 public function verify( API $api ): void { 97 if ( ! wp_doing_ajax() ) { 109 if ( 110 Request::filter_input( INPUT_POST, 'action' ) !== 'mailpoet' || 111 Request::filter_input( INPUT_POST, 'endpoint' ) !== 'subscribers' || 112 Request::filter_input( INPUT_POST, 'method' ) !== 'subscribe' 113 ) { 114 // Process frontend subscription ajax request only. 98 115 return; 99 116 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Main.php
r3129246 r3143189 24 24 use HCaptcha\ElementorPro\HCaptchaHandler; 25 25 use HCaptcha\Helpers\HCaptcha; 26 use HCaptcha\Helpers\Pages; 26 27 use HCaptcha\Helpers\Request; 27 28 use HCaptcha\Jetpack\JetpackForm; … … 69 70 70 71 /** 72 * Priority of the plugins_loaded action to load Main. 73 */ 74 public const LOAD_PRIORITY = Migrations::LOAD_PRIORITY + 1; 75 76 /** 71 77 * Form shown somewhere, use this flag to run the script. 72 78 * … … 98 104 99 105 /** 106 * Migrations class instance. 107 * 108 * @var Migrations 109 */ 110 protected $migrations; 111 112 /** 100 113 * Settings class instance. 101 114 * … … 125 138 public function init(): void { 126 139 if ( Request::is_xml_rpc() ) { 140 // @codeCoverageIgnoreStart 127 141 return; 128 } 129 130 new Migrations(); 142 // @codeCoverageIgnoreEnd 143 } 144 145 $this->migrations = new Migrations(); 131 146 132 147 if ( wp_doing_cron() ) { … … 136 151 ( new Fix() )->init(); 137 152 138 add_action( 'plugins_loaded', [ $this, 'init_hooks' ], -PHP_INT_MAX);153 add_action( 'plugins_loaded', [ $this, 'init_hooks' ], self::LOAD_PRIORITY ); 139 154 } 140 155 … … 172 187 $this->load( Events::class ); 173 188 174 add_action( 'plugins_loaded', [ $this, 'load_modules' ], -PHP_INT_MAX+ 1 );189 add_action( 'plugins_loaded', [ $this, 'load_modules' ], self::LOAD_PRIORITY + 1 ); 175 190 add_filter( 'hcap_whitelist_ip', [ $this, 'whitelist_ip' ], -PHP_INT_MAX, 2 ); 176 191 add_action( 'before_woocommerce_init', [ $this, 'declare_wc_compatibility' ] ); … … 250 265 ); 251 266 252 $activate = ( ! $deactivate ) || $this->is_e lementor_pro_edit_page();267 $activate = ( ! $deactivate ) || $this->is_edit_page(); 253 268 254 269 /** … … 261 276 262 277 /** 263 * Whether we are on the Elementor Pro edit post/page and hCaptcha for Elementor Prois active.278 * Whether we are on the admin edit page for a component and component is active. 264 279 * 265 280 * @return bool 266 281 */ 267 private function is_elementor_pro_edit_page(): bool { 268 if ( ! $this->settings()->is_on( 'elementor_pro_status' ) ) { 269 return false; 270 } 271 272 // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing 273 $request1 = ( 274 isset( $_SERVER['REQUEST_URI'], $_GET['post'], $_GET['action'] ) && 275 0 === strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/wp-admin/post.php' ) && 276 'elementor' === $_GET['action'] 282 private function is_edit_page(): bool { 283 $settings = $this->settings(); 284 $components = [ 285 'beaver_builder', 286 'cf7', 287 'elementor_pro', 288 'gravity', 289 'fluent', 290 'forminator', 291 'formidable_forms', 292 'ninja', 293 'wpforms', 294 ]; 295 296 return array_reduce( 297 $components, 298 static function ( $carry, $component ) use ( $settings ) { 299 $method = 'is_' . $component . '_edit_page'; 300 301 if ( 302 ! method_exists( Pages::class, $method ) || 303 ! $settings->is_on( $component . '_status' ) 304 ) { 305 return $carry; 306 } 307 308 return $carry || Pages::$method(); 309 }, 310 false 277 311 ); 278 $request2 = (279 isset( $_SERVER['REQUEST_URI'], $_GET['elementor-preview'] ) &&280 0 === strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/elementor' )281 );282 $request3 = (283 isset( $_POST['action'] ) && 'elementor_ajax' === $_POST['action']284 );285 286 // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing287 288 return $request1 || $request2 || $request3;289 312 } 290 313 … … 323 346 * 324 347 * @param bool $add_csp_headers Add Content Security Policy (CSP) headers. 325 * @param array $headers Current headers.348 * @param array $headers Current headers. 326 349 */ 327 350 if ( ! apply_filters( 'hcap_add_csp_headers', false, $headers ) ) { … … 863 886 BackInStockNotifier\Form::class, 864 887 ], 888 'bbPress Login Form' => [ 889 [ 'bbp_status', null ], 890 'bbpress/bbpress.php', 891 BBPress\Login::class, 892 ], 893 'bbPress Lost Password Form' => [ 894 [ 'bbp_status', null ], 895 'bbpress/bbpress.php', 896 BBPress\LostPassword::class, 897 ], 865 898 'bbPress New Topic' => [ 866 899 [ 'bbp_status', 'new_topic' ], 867 900 'bbpress/bbpress.php', 868 901 BBPress\NewTopic::class, 902 ], 903 'bbPress Register Form' => [ 904 [ 'bbp_status', null ], 905 'bbpress/bbpress.php', 906 BBPress\Register::class, 869 907 ], 870 908 'bbPress Reply' => [ -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Migrations/Migrations.php
r3114572 r3143189 37 37 38 38 /** 39 * Priority of the plugins_loaded action to load Migrations. 40 */ 41 public const LOAD_PRIORITY = -PHP_INT_MAX; 42 43 /** 39 44 * Plugin name. 40 45 */ … … 67 72 */ 68 73 private function init_hooks(): void { 69 add_action( 'plugins_loaded', [ $this, 'migrate' ], - PHP_INT_MAX);74 add_action( 'plugins_loaded', [ $this, 'migrate' ], self::LOAD_PRIORITY ); 70 75 } 71 76 … … 142 147 } 143 148 144 return wp_doing_cron() || is_admin() || ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ); 149 return ( 150 ( is_admin() && ! wp_doing_ajax() ) || 151 wp_doing_cron() || 152 ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ) 153 ); 154 } 155 156 /** 157 * Send plugin statistics. 158 * 159 * @return void 160 */ 161 public function send_plugin_stats(): void { 162 /** 163 * Send plugin statistics. 164 */ 165 do_action( 'hcap_send_plugin_stats' ); 145 166 } 146 167 … … 158 179 159 180 // Send statistics on plugin update. 160 add_action( 161 'init', 162 static function () { 163 /** 164 * Send plugin statistics. 165 */ 166 do_action( 'hcap_send_plugin_stats' ); 167 } 168 ); 181 add_action( 'init', [ $this, 'send_plugin_stats' ] ); 169 182 } 170 183 … … 199 212 200 213 /** 201 * Output message into log file.214 * Output message into the log file. 202 215 * 203 216 * @param string $message Message to log. -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/NF/Field.php
r3114572 r3143189 18 18 * Class Field 19 19 */ 20 class Field extends NF_Abstracts_Field {20 class Field extends NF_Abstracts_Field implements Base { 21 21 22 22 // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore 23 23 24 24 /** 25 * Name.25 * Field name. 26 26 * 27 27 * @var string 28 28 */ 29 protected $_name = 'hcaptcha-for-ninja-forms';29 protected $_name = self::NAME; 30 30 31 31 /** 32 * Type.32 * Filed type. 33 33 * 34 34 * @var string 35 35 */ 36 protected $_type = 'hcaptcha';36 protected $_type = self::TYPE; 37 37 38 38 /** -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/NF/NF.php
r3114572 r3143189 15 15 * Support Ninja Forms. 16 16 */ 17 class NF {17 class NF implements Base { 18 18 19 19 /** … … 42 42 * @var int 43 43 */ 44 pr ivate$form_id = 0;44 protected $form_id = 0; 45 45 46 46 /** … … 49 49 * @var string 50 50 */ 51 pr ivate$templates_dir;51 protected $templates_dir; 52 52 53 53 /** … … 66 66 */ 67 67 public function init_hooks(): void { 68 $name = Base::NAME; 69 68 70 add_action( 'toplevel_page_ninja-forms', [ $this, 'admin_template' ], 11 ); 69 71 add_action( 'nf_admin_enqueue_scripts', [ $this, 'nf_admin_enqueue_scripts' ] ); … … 72 74 add_filter( 'ninja_forms_field_template_file_paths', [ $this, 'template_file_paths' ] ); 73 75 add_action( 'nf_get_form_id', [ $this, 'set_form_id' ] ); 74 add_filter( 'ninja_forms_localize_field_hcaptcha-for-ninja-forms', [ $this, 'localize_field' ] ); 76 add_filter( "ninja_forms_localize_field_$name", [ $this, 'localize_field' ] ); 77 add_filter( "ninja_forms_localize_field_{$name}_preview", [ $this, 'localize_field' ] ); 75 78 add_action( 'wp_print_footer_scripts', [ $this, 'nf_captcha_script' ], 9 ); 76 79 } … … 96 99 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 97 100 echo str_replace( 98 'tmpl-nf-field- hcaptcha',99 'tmpl-nf-field- hcaptcha-for-ninja-forms',101 'tmpl-nf-field-' . Base::TYPE, 102 'tmpl-nf-field-' . Base::NAME, 100 103 $template 101 104 ); … … 111 114 112 115 // Add hCaptcha to the preloaded form data. 113 $data = $wp_scripts->registered['nf-builder']->extra['data'] ;116 $data = $wp_scripts->registered['nf-builder']->extra['data'] ?? ''; 114 117 115 118 if ( ! preg_match( '/var nfDashInlineVars = (.+);/', $data, $m ) ) { … … 121 124 122 125 foreach ( $vars['preloadedFormData']['fields'] as & $field ) { 123 if ( 'hcaptcha-for-ninja-forms' === $field['type'] ) { 126 // See comment in admin_template(). 127 if ( Base::NAME === $field['type'] ) { 124 128 $found = true; 125 129 $search = 'class="h-captcha"'; … … 129 133 $this->get_hcaptcha( (int) $field['id'] ) 130 134 ); 135 131 136 break; 132 137 } … … 187 192 $fields = (array) $fields; 188 193 189 $fields[ 'hcaptcha-for-ninja-forms'] = new Field();194 $fields[ Base::NAME ] = new Field(); 190 195 191 196 return $fields; … … 203 208 204 209 if ( false === $index ) { 210 // @codeCoverageIgnoreStart 205 211 return; 206 } 207 208 $hcaptcha_key = 'hcaptcha-for-ninja-forms'; 212 // @codeCoverageIgnoreEnd 213 } 214 215 $hcaptcha_key = Base::NAME; 209 216 $hcaptcha_value = $fields[ $hcaptcha_key ]; 210 217 … … 255 262 256 263 $field['settings']['hcaptcha'] = $field['settings']['hcaptcha'] ?? $this->get_hcaptcha( (int) $field['id'] ); 264 265 // Mark hCaptcha as shown in any case. Needed on the preview page. 266 hcaptcha()->form_shown = true; 257 267 258 268 return $field; -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Settings/Abstracts/SettingsBase.php
r3114572 r3143189 233 233 'select' => [ $this, 'print_select_field' ], 234 234 'multiple' => [ $this, 'print_multiple_select_field' ], 235 'file' => [ $this, 'print_file_field' ], 235 236 'table' => [ $this, 'print_table_field' ], 236 237 'button' => [ $this, 'print_button_field' ], … … 260 261 $this->init_settings(); 261 262 262 if ( $this->is_main_menu_page() || $this->is_tab_active( $this) ) {263 if ( is_admin() && ( $this->is_main_menu_page() || $this->is_tab_active( $this ) ) ) { 263 264 $this->init_hooks(); 264 265 } … … 708 709 */ 709 710 public function tabs_callback(): void { 711 if ( ! count( $this->tabs ?? [] ) ) { 712 return; 713 } 714 710 715 ?> 711 716 <div class="<?php echo esc_attr( static::PREFIX . '-settings-tabs' ); ?>"> … … 1236 1241 1237 1242 /** 1243 * Print file field. 1244 * 1245 * @param array $arguments Field arguments. 1246 * 1247 * @return void 1248 * @noinspection HtmlUnknownAttribute 1249 */ 1250 protected function print_file_field( array $arguments ): void { 1251 $multiple = (bool) ( $arguments['multiple'] ?? '' ); 1252 $accept = $arguments['accept'] ?? ''; 1253 1254 printf( 1255 '<input %1$s name="%2$s[%3$s]%4$s" id="%3$s" type="file" %5$s %6$s/>', 1256 disabled( $arguments['disabled'], true, false ), 1257 esc_html( $this->option_name() ), 1258 esc_attr( $arguments['field_id'] ), 1259 esc_attr( $multiple ? '[]' : '' ), 1260 esc_attr( $multiple ? 'multiple' : '' ), 1261 $accept ? 'accept="' . esc_attr( $accept ) . '"' : '' 1262 ); 1263 } 1264 1265 /** 1238 1266 * Print table field. 1239 1267 * … … 1461 1489 1462 1490 foreach ( $this->form_fields() as $key => $form_field ) { 1491 if ( 'file' === $form_field['type'] ) { 1492 unset( $value[ $key ], $old_value[ $key ] ); 1493 continue; 1494 } 1495 1463 1496 if ( 'checkbox' !== $form_field['type'] || isset( $value[ $key ] ) ) { 1464 1497 continue; … … 1620 1653 <?php 1621 1654 } 1655 1656 /** 1657 * Get savable for fields. 1658 * 1659 * @return array 1660 */ 1661 protected function get_savable_form_fields(): array { 1662 $not_savable_form_fields = [ 'button', 'file' ]; 1663 1664 return array_filter( 1665 $this->form_fields, 1666 static function ( $field ) use ( $not_savable_form_fields ) { 1667 return ! in_array( $field['type'] ?? '', $not_savable_form_fields, true ); 1668 } 1669 ); 1670 } 1622 1671 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Settings/Integrations.php
r3129246 r3143189 213 213 'type' => 'checkbox', 214 214 'options' => [ 215 'login' => __( 'Login Form', 'hcaptcha-for-forms-and-more' ), 216 'lost_pass' => __( 'Lost Password Form', 'hcaptcha-for-forms-and-more' ), 215 217 'new_topic' => __( 'New Topic Form', 'hcaptcha-for-forms-and-more' ), 218 'register' => __( 'Register Form', 'hcaptcha-for-forms-and-more' ), 216 219 'reply' => __( 'Reply Form', 'hcaptcha-for-forms-and-more' ), 217 220 ], -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Settings/PluginSettingsBase.php
r3114572 r3143189 197 197 settings_fields( $this->option_group() ); // Hidden protection fields. 198 198 199 if ( ! empty( $this-> form_fields) ) {199 if ( ! empty( $this->get_savable_form_fields() ) ) { 200 200 $this->submit_button(); 201 201 } -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Settings/Settings.php
r3114572 r3143189 106 106 */ 107 107 public function get_tab( string $classname ): ?PluginSettingsBase { 108 $tabs = hcaptcha()->settings()->get_tabs(); 109 110 foreach ( $tabs as $tab ) { 108 foreach ( $this->tabs as $tab ) { 111 109 if ( is_a( $tab, $classname ) ) { 112 110 return $tab; -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/Spectra/Form.php
r3114572 r3143189 37 37 * @var bool 38 38 */ 39 pr ivate$has_recaptcha_field;39 protected $has_recaptcha_field; 40 40 41 41 /** … … 79 79 return $block_content; 80 80 } 81 82 $block_content = (string) $block_content; 81 83 82 84 $args = [ … … 89 91 ]; 90 92 91 $block_content = (string) $block_content;92 93 93 $this->has_recaptcha_field = false; 94 94 … … 198 198 * @return bool 199 199 */ 200 pr ivatefunction has_recaptcha(): bool {200 protected function has_recaptcha(): bool { 201 201 // Spectra checks nonce. 202 202 // phpcs:disable WordPress.Security.NonceVerification.Missing -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/WPDiscuz/Base.php
r3114572 r3143189 24 24 * 25 25 * @return void 26 * @noinspection PhpUndefinedFunctionInspection 26 27 */ 27 28 protected function init_hooks(): void { 28 add_filter( 29 'wpdiscuz_recaptcha_site_key', 30 static function () { 31 // Block output of reCaptcha by wpDiscuz. 32 return ''; 33 } 29 if ( ! function_exists( 'wpDiscuz' ) ) { 30 return; 31 } 32 33 $wpd_recaptcha = wpDiscuz()->options->recaptcha; 34 $wpd_recaptcha = array_merge( 35 $wpd_recaptcha, 36 [ 37 'siteKey' => '', 38 'showForGuests' => 0, 39 'showForUsers' => 0, 40 ] 34 41 ); 42 43 // Block output of reCaptcha by wpDiscuz. 44 wpDiscuz()->options->recaptcha = $wpd_recaptcha; 35 45 36 46 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ], 11 ); -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/includes/functions.php
r3064004 r3143189 11 11 * Display hCaptcha shortcode. 12 12 * 13 * @param array|string $atts hcaptcha shortcode attributes.13 * @param array|string $atts The hCaptcha shortcode attributes. 14 14 * 15 15 * @return string … … 38 38 39 39 /** 40 * Filters the content of the h captcha form.40 * Filters the content of the hCaptcha form. 41 41 * 42 * @param string $form The hcaptcha form. 42 * @param string $form The hCaptcha form. 43 * @param array $atts The hCaptcha shortcode attributes. 43 44 */ 44 return (string) apply_filters( 'hcap_hcaptcha_content', HCaptcha::form( $atts ) );45 return (string) apply_filters( 'hcap_hcaptcha_content', HCaptcha::form( $atts ), $atts ); 45 46 } 46 47 -
hcaptcha-for-forms-and-more/tags/4.5.0/src/php/includes/request.php
r3114572 r3143189 314 314 function hcaptcha_get_verify_output( string $empty_message, string $fail_message, string $nonce_field_name, string $nonce_action_name ): ?string { 315 315 if ( ! empty( $empty_message ) || ! empty( $fail_message ) ) { 316 // @codeCoverageIgnoreStart 316 317 _deprecated_argument( __FUNCTION__, '2.1.0' ); 318 // @codeCoverageIgnoreEnd 317 319 } 318 320 -
hcaptcha-for-forms-and-more/tags/4.5.0/vendor/autoload.php
r3114572 r3143189 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470::getLoader();25 return ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f::getLoader(); -
hcaptcha-for-forms-and-more/tags/4.5.0/vendor/composer/autoload_classmap.php
r3129246 r3143189 23 23 'HCaptcha\\Avada\\Form' => $baseDir . '/src/php/Avada/Form.php', 24 24 'HCaptcha\\BBPress\\Base' => $baseDir . '/src/php/BBPress/Base.php', 25 'HCaptcha\\BBPress\\Login' => $baseDir . '/src/php/BBPress/Login.php', 26 'HCaptcha\\BBPress\\LostPassword' => $baseDir . '/src/php/BBPress/LostPassword.php', 25 27 'HCaptcha\\BBPress\\NewTopic' => $baseDir . '/src/php/BBPress/NewTopic.php', 28 'HCaptcha\\BBPress\\Register' => $baseDir . '/src/php/BBPress/Register.php', 26 29 'HCaptcha\\BBPress\\Reply' => $baseDir . '/src/php/BBPress/Reply.php', 27 30 'HCaptcha\\BackInStockNotifier\\Form' => $baseDir . '/src/php/BackInStockNotifier/Form.php', … … 71 74 'HCaptcha\\HTMLForms\\Form' => $baseDir . '/src/php/HTMLForms/Form.php', 72 75 'HCaptcha\\Helpers\\HCaptcha' => $baseDir . '/src/php/Helpers/HCaptcha.php', 76 'HCaptcha\\Helpers\\Pages' => $baseDir . '/src/php/Helpers/Pages.php', 73 77 'HCaptcha\\Helpers\\Request' => $baseDir . '/src/php/Helpers/Request.php', 74 78 'HCaptcha\\Jetpack\\JetpackBase' => $baseDir . '/src/php/Jetpack/JetpackBase.php', … … 88 92 'HCaptcha\\MemberPress\\Register' => $baseDir . '/src/php/MemberPress/Register.php', 89 93 'HCaptcha\\Migrations\\Migrations' => $baseDir . '/src/php/Migrations/Migrations.php', 94 'HCaptcha\\NF\\Base' => $baseDir . '/src/php/NF/Base.php', 90 95 'HCaptcha\\NF\\Field' => $baseDir . '/src/php/NF/Field.php', 91 96 'HCaptcha\\NF\\NF' => $baseDir . '/src/php/NF/NF.php', -
hcaptcha-for-forms-and-more/tags/4.5.0/vendor/composer/autoload_real.php
r3129246 r3143189 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit a6c3d020c47c988d11030e9a250364705 class ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit a6c3d020c47c988d11030e9a25036470::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::getInitializer($loader)); 31 31 32 32 $loader->setClassMapAuthoritative(true); -
hcaptcha-for-forms-and-more/tags/4.5.0/vendor/composer/autoload_static.php
r3129246 r3143189 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit a6c3d020c47c988d11030e9a250364707 class ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 51 51 'HCaptcha\\Avada\\Form' => __DIR__ . '/../..' . '/src/php/Avada/Form.php', 52 52 'HCaptcha\\BBPress\\Base' => __DIR__ . '/../..' . '/src/php/BBPress/Base.php', 53 'HCaptcha\\BBPress\\Login' => __DIR__ . '/../..' . '/src/php/BBPress/Login.php', 54 'HCaptcha\\BBPress\\LostPassword' => __DIR__ . '/../..' . '/src/php/BBPress/LostPassword.php', 53 55 'HCaptcha\\BBPress\\NewTopic' => __DIR__ . '/../..' . '/src/php/BBPress/NewTopic.php', 56 'HCaptcha\\BBPress\\Register' => __DIR__ . '/../..' . '/src/php/BBPress/Register.php', 54 57 'HCaptcha\\BBPress\\Reply' => __DIR__ . '/../..' . '/src/php/BBPress/Reply.php', 55 58 'HCaptcha\\BackInStockNotifier\\Form' => __DIR__ . '/../..' . '/src/php/BackInStockNotifier/Form.php', … … 99 102 'HCaptcha\\HTMLForms\\Form' => __DIR__ . '/../..' . '/src/php/HTMLForms/Form.php', 100 103 'HCaptcha\\Helpers\\HCaptcha' => __DIR__ . '/../..' . '/src/php/Helpers/HCaptcha.php', 104 'HCaptcha\\Helpers\\Pages' => __DIR__ . '/../..' . '/src/php/Helpers/Pages.php', 101 105 'HCaptcha\\Helpers\\Request' => __DIR__ . '/../..' . '/src/php/Helpers/Request.php', 102 106 'HCaptcha\\Jetpack\\JetpackBase' => __DIR__ . '/../..' . '/src/php/Jetpack/JetpackBase.php', … … 116 120 'HCaptcha\\MemberPress\\Register' => __DIR__ . '/../..' . '/src/php/MemberPress/Register.php', 117 121 'HCaptcha\\Migrations\\Migrations' => __DIR__ . '/../..' . '/src/php/Migrations/Migrations.php', 122 'HCaptcha\\NF\\Base' => __DIR__ . '/../..' . '/src/php/NF/Base.php', 118 123 'HCaptcha\\NF\\Field' => __DIR__ . '/../..' . '/src/php/NF/Field.php', 119 124 'HCaptcha\\NF\\NF' => __DIR__ . '/../..' . '/src/php/NF/NF.php', … … 191 196 { 192 197 return \Closure::bind(function () use ($loader) { 193 $loader->prefixLengthsPsr4 = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$prefixLengthsPsr4;194 $loader->prefixDirsPsr4 = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$prefixDirsPsr4;195 $loader->classMap = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$classMap;198 $loader->prefixLengthsPsr4 = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$prefixLengthsPsr4; 199 $loader->prefixDirsPsr4 = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$prefixDirsPsr4; 200 $loader->classMap = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$classMap; 196 201 197 202 }, null, ClassLoader::class); -
hcaptcha-for-forms-and-more/tags/4.5.0/vendor/composer/installed.php
r3129246 r3143189 2 2 'root' => array( 3 3 'name' => 'hcaptcha/hcaptcha-wordpress-plugin', 4 'pretty_version' => '4. 4.0',5 'version' => '4. 4.0.0',6 'reference' => ' 25bdd39c5629233960c20655da571516f475acb3',4 'pretty_version' => '4.5.0', 5 'version' => '4.5.0.0', 6 'reference' => '0ba34f4533d55163e1ba8af8e119a49ec192be45', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'hcaptcha/hcaptcha-wordpress-plugin' => array( 14 'pretty_version' => '4. 4.0',15 'version' => '4. 4.0.0',16 'reference' => ' 25bdd39c5629233960c20655da571516f475acb3',14 'pretty_version' => '4.5.0', 15 'version' => '4.5.0.0', 16 'reference' => '0ba34f4533d55163e1ba8af8e119a49ec192be45', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
hcaptcha-for-forms-and-more/trunk/assets/css/settings-base.css
r3114572 r3143189 17 17 18 18 .hcaptcha-settings-tabs { 19 position: sticky; 20 top: 0; 21 z-index: 2; /* +1 to .hcaptcha-header bar z-index, to overlap a bit */ 19 22 display: flex; 20 23 flex-wrap: wrap; … … 46 49 47 50 .hcaptcha-header-bar { 51 position: sticky; 52 top: 60px; 53 z-index: 1; 54 background: #f0f2f5; 48 55 display: flex; 49 56 justify-content: space-between; 50 57 align-items: center; 51 margin: 0; 58 margin: 0 -20px; 59 padding: 0 20px; 52 60 } 53 61 -
hcaptcha-for-forms-and-more/trunk/assets/css/settings-base.min.css
r3114572 r3143189 1 body.settings_page_hcaptcha{background:#f0f2f5;color:#5c6f8a}.wrap h1.hcaptcha-settings-header{align-items:center;display:flex;font-size:34px;font-weight:700}.hcaptcha-logo{height:64px;margin:10px 5px 10px 0}.hcaptcha-settings-tabs{background:#fff;display:flex;flex-wrap:wrap;justify-content:space-between;line-height:4.5em;margin:10px -20px 0;padding:0 20px }.hcaptcha-settings-tab{border-bottom:2px solid transparent;color:#646970;display:inline-block;font-size:1.1em;margin-right:30px;text-decoration:none}.hcaptcha-settings-tab:hover{border-bottom-color:#025176!important;border-bottom:2px solid;color:#666}.hcaptcha-settings-tab.active{border-bottom:2px solid #0075ab}.hcaptcha-header-bar{align-items:center;display:flex;justify-content:space-between;margin:0}#hcaptcha-options h2{color:#5c6f8a;font-size:1.5em}#hcaptcha-options h2~*{display:none}#hcaptcha-options h3{color:#5c6f8a;margin:1.5em 0 1em}#hcaptcha-options .notice-dismiss:before{color:#5c6f8a}#hcaptcha-options table tbody tr td{margin:0;padding:0;position:relative}#hcaptcha-options table tr td input[type=checkbox]{border:none;box-shadow:none;display:inline;height:1.25rem;margin:-.125rem .5rem 0 0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:before{background:url(../images/checkbox-off.svg);background-size:cover;content:"";display:inline-block;height:1.25rem;margin:0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:checked:before{background:no-repeat url(../images/checkbox-on.svg);background-size:cover}#hcaptcha-options fieldset:disabled{color:#dadada}#hcaptcha-options .button-primary{background-color:#026593;border-color:#026593;color:#fff}#hcaptcha-options .button-primary:hover{background-color:#025176}#hcaptcha-options .button-secondary{background-color:#fff;border-color:#026593;color:#026593}#hcaptcha-options .button-secondary:hover{background-color:#ccc}#hcaptcha-options a{color:#0075ab}#hcaptcha-navigation a{border-color:#0075ab}#hcaptcha-options a.hcaptcha-settings-tab{color:#5c6f8a}#hcaptcha-options .helper:before{background:#5c6f8a;border-radius:1.2em;color:#fff;content:"?";height:1.2em;position:absolute;right:0;text-align:center;top:0;transform:translateY(-26px);width:1.2em}#hcaptcha-options fieldset+.helper:before{top:50%;transform:translate(25px,-.8em)}#hcaptcha-options .helper .helper-content{background:#5c6f8a;box-sizing:border-box;color:#f0f2f5;display:none;padding:.5em 1em;position:absolute;right:0;top:0;transform:translate(1px,10px);width:100%}#hcaptcha-options fieldset+.helper .helper-content{top:50%;transform:translate(25px,25px);width:calc(100% + 25px)}#hcaptcha-options .helper:hover{cursor:help}#hcaptcha-options .helper:hover .helper-content{display:block;z-index:1}#hcaptcha-options .helper .helper-content:after{border:10px solid transparent;border-bottom-color:#5c6f8a;content:"";position:absolute;right:0;top:0;transform:translateY(-100%)}#hcaptcha-options .helper .helper-content a{color:#fff}#hcaptcha-message{box-sizing:border-box}#hcaptcha-message>p{font-size:13px;font-weight:600;line-height:1.5;margin:.5em 0}@keyframes blink{0%{opacity:1}16.7%{opacity:0}33.3%{opacity:1}50%{opacity:0}66.7%{opacity:1}83.3%{opacity:0}to{opacity:1}}.blink{animation:blink 3s linear}.hcaptcha-hide{display:none}.hcaptcha-excerpt{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hcaptcha-excerpt:hover .hcaptcha-hide{background:#5c6f8a;border:1px solid #c3c4c7;border-radius:6px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);color:#f0f2f5;display:block;left:0;max-width:300px;padding:8px 10px;position:absolute;text-align:center;top:0;white-space:normal;width:max-content;z-index:1}@media (max-width:782px){.hcaptcha-settings-tabs{margin:10px -12px 0 -10px;padding:0 12px 0 10px}}@media (max-width:600px){#hcaptcha-options table tbody{grid-template-columns:1fr}#hcaptcha-options table tbody tr{position:relative}#hcaptcha-options fieldset+.helper:before{transform:translateY(-.7em)}#hcaptcha-options fieldset+.helper .helper-content{transform:translateY(25px);width:100%}#hcaptcha-options .helper{z-index:1}.hcaptcha-settings-tab{margin-right:15px}}1 body.settings_page_hcaptcha{background:#f0f2f5;color:#5c6f8a}.wrap h1.hcaptcha-settings-header{align-items:center;display:flex;font-size:34px;font-weight:700}.hcaptcha-logo{height:64px;margin:10px 5px 10px 0}.hcaptcha-settings-tabs{background:#fff;display:flex;flex-wrap:wrap;justify-content:space-between;line-height:4.5em;margin:10px -20px 0;padding:0 20px;position:sticky;top:0;z-index:2}.hcaptcha-settings-tab{border-bottom:2px solid transparent;color:#646970;display:inline-block;font-size:1.1em;margin-right:30px;text-decoration:none}.hcaptcha-settings-tab:hover{border-bottom-color:#025176!important;border-bottom:2px solid;color:#666}.hcaptcha-settings-tab.active{border-bottom:2px solid #0075ab}.hcaptcha-header-bar{align-items:center;background:#f0f2f5;display:flex;justify-content:space-between;margin:0 -20px;padding:0 20px;position:sticky;top:60px;z-index:1}#hcaptcha-options h2{color:#5c6f8a;font-size:1.5em}#hcaptcha-options h2~*{display:none}#hcaptcha-options h3{color:#5c6f8a;margin:1.5em 0 1em}#hcaptcha-options .notice-dismiss:before{color:#5c6f8a}#hcaptcha-options table tbody tr td{margin:0;padding:0;position:relative}#hcaptcha-options table tr td input[type=checkbox]{border:none;box-shadow:none;display:inline;height:1.25rem;margin:-.125rem .5rem 0 0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:before{background:url(../images/checkbox-off.svg);background-size:cover;content:"";display:inline-block;height:1.25rem;margin:0;width:2.3611rem}#hcaptcha-options table tr td input[type=checkbox]:checked:before{background:no-repeat url(../images/checkbox-on.svg);background-size:cover}#hcaptcha-options fieldset:disabled{color:#dadada}#hcaptcha-options .button-primary{background-color:#026593;border-color:#026593;color:#fff}#hcaptcha-options .button-primary:hover{background-color:#025176}#hcaptcha-options .button-secondary{background-color:#fff;border-color:#026593;color:#026593}#hcaptcha-options .button-secondary:hover{background-color:#ccc}#hcaptcha-options a{color:#0075ab}#hcaptcha-navigation a{border-color:#0075ab}#hcaptcha-options a.hcaptcha-settings-tab{color:#5c6f8a}#hcaptcha-options .helper:before{background:#5c6f8a;border-radius:1.2em;color:#fff;content:"?";height:1.2em;position:absolute;right:0;text-align:center;top:0;transform:translateY(-26px);width:1.2em}#hcaptcha-options fieldset+.helper:before{top:50%;transform:translate(25px,-.8em)}#hcaptcha-options .helper .helper-content{background:#5c6f8a;box-sizing:border-box;color:#f0f2f5;display:none;padding:.5em 1em;position:absolute;right:0;top:0;transform:translate(1px,10px);width:100%}#hcaptcha-options fieldset+.helper .helper-content{top:50%;transform:translate(25px,25px);width:calc(100% + 25px)}#hcaptcha-options .helper:hover{cursor:help}#hcaptcha-options .helper:hover .helper-content{display:block;z-index:1}#hcaptcha-options .helper .helper-content:after{border:10px solid transparent;border-bottom-color:#5c6f8a;content:"";position:absolute;right:0;top:0;transform:translateY(-100%)}#hcaptcha-options .helper .helper-content a{color:#fff}#hcaptcha-message{box-sizing:border-box}#hcaptcha-message>p{font-size:13px;font-weight:600;line-height:1.5;margin:.5em 0}@keyframes blink{0%{opacity:1}16.7%{opacity:0}33.3%{opacity:1}50%{opacity:0}66.7%{opacity:1}83.3%{opacity:0}to{opacity:1}}.blink{animation:blink 3s linear}.hcaptcha-hide{display:none}.hcaptcha-excerpt{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hcaptcha-excerpt:hover .hcaptcha-hide{background:#5c6f8a;border:1px solid #c3c4c7;border-radius:6px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);color:#f0f2f5;display:block;left:0;max-width:300px;padding:8px 10px;position:absolute;text-align:center;top:0;white-space:normal;width:max-content;z-index:1}@media (max-width:782px){.hcaptcha-settings-tabs{margin:10px -12px 0 -10px;padding:0 12px 0 10px}}@media (max-width:600px){#hcaptcha-options table tbody{grid-template-columns:1fr}#hcaptcha-options table tbody tr{position:relative}#hcaptcha-options fieldset+.helper:before{transform:translateY(-.7em)}#hcaptcha-options fieldset+.helper .helper-content{transform:translateY(25px);width:100%}#hcaptcha-options .helper{z-index:1}.hcaptcha-settings-tab{margin-right:15px}} -
hcaptcha-for-forms-and-more/trunk/assets/js/hcaptcha-mailpoet.js
r3026321 r3143189 15 15 } 16 16 17 const urlParams = new URLSearchParams( data ); 18 const formId = urlParams.get( 'data[form_id]' ); 19 const $form = $( 'input[name="data[form_id]"][value=' + formId + ']' ).parent( 'form' ); 17 // eslint-disable-next-line @wordpress/no-global-active-element 18 const eventTarget = options.context || document.activeElement; 19 const $form = $( eventTarget.closest( 'form' ) ); 20 20 21 let response = $form.find( '[name="h-captcha-response"]' ).val(); 21 22 response = response ? response : ''; -
hcaptcha-for-forms-and-more/trunk/assets/js/hcaptcha-mailpoet.min.js
r3026321 r3143189 1 (()=>{var a;(a=jQuery).ajaxPrefilter((function(t){var e, i=null!==(e=t.data)&&void 0!==e?e:"",n="";if(i.startsWith("action=mailpoet")&&(n="hcaptcha_mailpoet_nonce"),n){var r=new URLSearchParams(i).get("data[form_id]"),c=a('input[name="data[form_id]"][value='+r+"]").parent("form"),d=c.find('[name="h-captcha-response"]').val();d=d||"";var h=c.find('[name="hcaptcha-widget-id"]').val();h=h||"";var o=c.find('[name="'+n+'"]').val();o=o||"",t.data+="&h-captcha-response="+d+"&hcaptcha-widget-id="+h+"&"+n+"="+o}}))})();1 (()=>{var a;(a=jQuery).ajaxPrefilter((function(t){var e,c="";if((null!==(e=t.data)&&void 0!==e?e:"").startsWith("action=mailpoet")&&(c="hcaptcha_mailpoet_nonce"),c){var n=t.context||document.activeElement,i=a(n.closest("form")),o=i.find('[name="h-captcha-response"]').val();o=o||"";var r=i.find('[name="hcaptcha-widget-id"]').val();r=r||"";var d=i.find('[name="'+c+'"]').val();d=d||"",t.data+="&h-captcha-response="+o+"&hcaptcha-widget-id="+r+"&"+c+"="+d}}))})(); -
hcaptcha-for-forms-and-more/trunk/assets/js/integrations.js
r3114572 r3143189 25 25 */ 26 26 const integrations = function( $ ) { 27 const adminBar = document.querySelector( '#wpadminbar' ); 28 const tabs = document.querySelector( '.hcaptcha-settings-tabs' ); 29 const headerBar = document.querySelector( '.hcaptcha-header-bar' ); 27 30 const msgSelector = '#hcaptcha-message'; 28 31 let $message = $( msgSelector ); … … 30 33 const $adminmenuwrap = $( '#adminmenuwrap' ); 31 34 const $search = $( '#hcaptcha-integrations-search' ); 35 36 function getStickyHeight() { 37 const isAbsolute = adminBar ? window.getComputedStyle( adminBar ).position === 'absolute' : true; 38 const adminBarHeight = ( adminBar && ! isAbsolute ) ? adminBar.offsetHeight : 0; 39 const tabsHeight = tabs ? tabs.offsetHeight : 0; 40 const headerBarHeight = headerBar ? headerBar.offsetHeight : 0; 41 42 return adminBarHeight + tabsHeight + headerBarHeight; 43 } 32 44 33 45 function clearMessage() { … … 223 235 224 236 const $table = $( '.form-table' ).eq( activate ? 0 : 1 ); 225 const top = $wpWrap.position().top;226 237 227 238 swapThemes( activate, entity, newTheme ); … … 232 243 $( 'html, body' ).animate( 233 244 { 234 scrollTop: $tr.offset().top - top - $message.outerHeight(),245 scrollTop: $tr.offset().top - getStickyHeight(), 235 246 }, 236 247 1000 -
hcaptcha-for-forms-and-more/trunk/assets/js/integrations.min.js
r3114572 r3143189 1 (()=>{function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,o,r,c=[],s=!0,l=!1;try{if(o=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;s=!1}else for(;!(s=(n=o.call(a)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{if(!s&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(l)throw i}}return c}}(t,a)||function(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=Array(e);a<e;a++)n[a]=t[a];return n}var a=function(e){var a= "#hcaptcha-message",n=e(a),i=e("#wpwrap"),o=e("#adminmenuwrap"),r=e("#hcaptcha-integrations-search");function c(t,a){n.removeClass(),n.addClass(a+" notice settings-error is-dismissible"),n.html("<p>".concat(t,"</p>")),e(document).trigger("wp-updates-notice-added");var r=n.clone();n.css("visibility","hidden"),r.css("margin","0px"),r.css("top",i.position().top),r.css("z-index","999999");var c="block"===o.css("display")?o.width():0;r.css("left",c),r.width(e(window).width()-c),r.css("position","fixed"),e("body").append(r),setTimeout((function(){n.css("visibility","unset"),r.remove()}),3e3)}function s(t){c(t,"notice-error")}function l(t){return t.is(jQuery(".form-table").eq(0))}function d(t,a,n){var i=!1,o=a.toLowerCase(),r=!l(t),c=n.find("fieldset");c.attr("disabled",r),c.find("input").attr("disabled",r),t.find("tbody").children().each((function(t,a){var r=e(a).find(".hcaptcha-integrations-logo img").attr("alt");if((r=(r=r||"").replace(" Logo","")).toLowerCase()>o)return n.insertBefore(e(a)),i=!0,!1})),i||t.find("tbody").append(n)}e(".form-table img").on("click",(function(o){function r(){var a,o,r=v?"on":"off",h=(o=document.querySelector(".kagg-dialog select"))&&null!==(a=o.value)&&void 0!==a?a:"",m={action:HCaptchaIntegrationsObject.action,nonce:HCaptchaIntegrationsObject.nonce,activate:v,entity:u,status:g,newTheme:h};p.addClass(r),e.post({url:HCaptchaIntegrationsObject.ajaxUrl,data:m}).done((function(a){if(void 0!==a.success)if(void 0!==a.data.themes&&(window.HCaptchaIntegrationsObject.themes=a.data.themes,window.HCaptchaIntegrationsObject.defaultTheme=a.data.defaultTheme),a.success){var o=e(".form-table").eq(v?0:1),r=i.position().top;!function(t,a,n){if("theme"===a){var i=e(".form-table"),o=t?"":'[data-label="'+n+'"]',r=i.eq(t?0:1).find('.hcaptcha-integrations-logo img[data-entity="theme"]'+o);if(r.length){var c=i.eq(t?1:0),s=r.closest("tr");d(c,r.attr("data-label"),s)}}}(v,u,h),d(o,f,p),function(t){c(t,"notice-success")}(a.data.message),function(a){for(var n=e(".form-table"),i=0,o=Object.entries(a);i<o.length;i++){var r=t(o[i],2),c=r[0],s=r[1],h="hcaptcha-integrations-"+c.replace(/_/g,"-"),u=e("tr.".concat(h));l(u.closest(".form-table"))!==s&&d(n.eq(s?0:1),u.find(".hcaptcha-integrations-logo img").attr("alt"),u)}}(a.data.stati),e("html, body").animate({scrollTop:p.offset().top-r-n.outerHeight()},1e3)}else{var g,m;s(null!==(g=null===(m=a.data)||void 0===m?void 0:m.message)&&void 0!==g?g:a.data)}else c(HCaptchaIntegrationsObject.unexpectedErrorMsg,"notice-error")})).fail((function(t){s(t.statusText)})).always((function(){p.removeClass("on off")}))}o.preventDefault(),n.remove(),e('<div id="hcaptcha-message"></div>').insertAfter(".hcaptcha-header-bar"),n=e(a);var h=e(o.target),u=h.data("entity");if(u=u||"",-1!==e.inArray(u,["core","theme","plugin"])&&-1===e.inArray(u,["core"])){var f=h.attr("alt");f=(f=f||"").replace(" Logo","");var p=h.closest("tr"),g=p.attr("class");g=g.replace("hcaptcha-integrations-","");var m,v,b="";if(p.find("fieldset").attr("disabled"))m="plugin"===u?HCaptchaIntegrationsObject.activateMsg:HCaptchaIntegrationsObject.activateThemeMsg,v=!0;else{if("plugin"===u)m=HCaptchaIntegrationsObject.deactivateMsg;else{for(var y in m=HCaptchaIntegrationsObject.deactivateThemeMsg,b="<p>"+HCaptchaIntegrationsObject.selectThemeMsg+"</p>",b+="<select>",HCaptchaIntegrationsObject.themes){var C=y===HCaptchaIntegrationsObject.defaultTheme?' selected="selected"':"";b+='<option value="'.concat(y,'"').concat(C,">").concat(HCaptchaIntegrationsObject.themes[y],"</option>")}b+="</select>"}v=!1}if(-1===e.inArray(u,["theme"])||v||0!==Object.keys(HCaptchaIntegrationsObject.themes).length){if(!p.find(".hcaptcha-integrations-logo").data("installed"))return m=(m=HCaptchaIntegrationsObject.installMsg).replace("%s",f),void kaggDialog.confirm({title:m,content:b,type:"install",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}});o.ctrlKey?r():(m=m.replace("%s",f),kaggDialog.confirm({title:m,content:b,type:v?"activate":"deactivate",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText},cancel:{text:HCaptchaIntegrationsObject.CancelBtnText}},onAction:function(t){t&&r()}}))}else kaggDialog.confirm({title:HCaptchaIntegrationsObject.onlyOneThemeMsg,content:"",type:"info",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}})}}));var h,u,f;r.on("input",(h=function(){var t=r.val().trim().toLowerCase(),a=e(".hcaptcha-integrations-logo img"),n=null;if(a.each((function(a,i){var o=e(i);if("core"!==o.data("entity")){var r,c=o.closest("tr");o.data("label").toLowerCase().includes(t)?(c.show(),n=null!==(r=n)&&void 0!==r?r:c):c.hide()}})),n){var i=n.offset().top+n.outerHeight()-e(window).height()+5;e("html").stop().animate({scrollTop:i},1e3)}},u=100,function(){var t=this,e=arguments;clearTimeout(f),f=setTimeout((function(){return h.apply(t,e)}),u)})),e("#hcaptcha-options").keydown((function(t){e(t.target).is(r)&&13===t.which&&t.preventDefault()}))};window.hCaptchaIntegrations=a,jQuery(document).ready(a)})();1 (()=>{function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,o,r,c=[],s=!0,l=!1;try{if(o=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;s=!1}else for(;!(s=(n=o.call(a)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){l=!0,i=t}finally{try{if(!s&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(l)throw i}}return c}}(t,a)||function(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=Array(e);a<e;a++)n[a]=t[a];return n}var a=function(e){var a=document.querySelector("#wpadminbar"),n=document.querySelector(".hcaptcha-settings-tabs"),i=document.querySelector(".hcaptcha-header-bar"),o="#hcaptcha-message",r=e(o),c=e("#wpwrap"),s=e("#adminmenuwrap"),l=e("#hcaptcha-integrations-search");function d(t,a){r.removeClass(),r.addClass(a+" notice settings-error is-dismissible"),r.html("<p>".concat(t,"</p>")),e(document).trigger("wp-updates-notice-added");var n=r.clone();r.css("visibility","hidden"),n.css("margin","0px"),n.css("top",c.position().top),n.css("z-index","999999");var i="block"===s.css("display")?s.width():0;n.css("left",i),n.width(e(window).width()-i),n.css("position","fixed"),e("body").append(n),setTimeout((function(){r.css("visibility","unset"),n.remove()}),3e3)}function h(t){d(t,"notice-error")}function u(t){return t.is(jQuery(".form-table").eq(0))}function f(t,a,n){var i=!1,o=a.toLowerCase(),r=!u(t),c=n.find("fieldset");c.attr("disabled",r),c.find("input").attr("disabled",r),t.find("tbody").children().each((function(t,a){var r=e(a).find(".hcaptcha-integrations-logo img").attr("alt");if((r=(r=r||"").replace(" Logo","")).toLowerCase()>o)return n.insertBefore(e(a)),i=!0,!1})),i||t.find("tbody").append(n)}e(".form-table img").on("click",(function(c){function s(){var o,r,c=y?"on":"off",s=(r=document.querySelector(".kagg-dialog select"))&&null!==(o=r.value)&&void 0!==o?o:"",l={action:HCaptchaIntegrationsObject.action,nonce:HCaptchaIntegrationsObject.nonce,activate:y,entity:p,status:b,newTheme:s};m.addClass(c),e.post({url:HCaptchaIntegrationsObject.ajaxUrl,data:l}).done((function(o){if(void 0!==o.success)if(void 0!==o.data.themes&&(window.HCaptchaIntegrationsObject.themes=o.data.themes,window.HCaptchaIntegrationsObject.defaultTheme=o.data.defaultTheme),o.success){var r,c=e(".form-table").eq(y?0:1);!function(t,a,n){if("theme"===a){var i=e(".form-table"),o=t?"":'[data-label="'+n+'"]',r=i.eq(t?0:1).find('.hcaptcha-integrations-logo img[data-entity="theme"]'+o);if(r.length){var c=i.eq(t?1:0),s=r.closest("tr");f(c,r.attr("data-label"),s)}}}(y,p,s),f(c,g,m),function(t){d(t,"notice-success")}(o.data.message),function(a){for(var n=e(".form-table"),i=0,o=Object.entries(a);i<o.length;i++){var r=t(o[i],2),c=r[0],s=r[1],l="hcaptcha-integrations-"+c.replace(/_/g,"-"),d=e("tr.".concat(l));u(d.closest(".form-table"))!==s&&f(n.eq(s?0:1),d.find(".hcaptcha-integrations-logo img").attr("alt"),d)}}(o.data.stati),e("html, body").animate({scrollTop:m.offset().top-(r=!a||"absolute"===window.getComputedStyle(a).position,(a&&!r?a.offsetHeight:0)+(n?n.offsetHeight:0)+(i?i.offsetHeight:0))},1e3)}else{var l,b;h(null!==(l=null===(b=o.data)||void 0===b?void 0:b.message)&&void 0!==l?l:o.data)}else d(HCaptchaIntegrationsObject.unexpectedErrorMsg,"notice-error")})).fail((function(t){h(t.statusText)})).always((function(){m.removeClass("on off")}))}c.preventDefault(),r.remove(),e('<div id="hcaptcha-message"></div>').insertAfter(".hcaptcha-header-bar"),r=e(o);var l=e(c.target),p=l.data("entity");if(p=p||"",-1!==e.inArray(p,["core","theme","plugin"])&&-1===e.inArray(p,["core"])){var g=l.attr("alt");g=(g=g||"").replace(" Logo","");var m=l.closest("tr"),b=m.attr("class");b=b.replace("hcaptcha-integrations-","");var v,y,C="";if(m.find("fieldset").attr("disabled"))v="plugin"===p?HCaptchaIntegrationsObject.activateMsg:HCaptchaIntegrationsObject.activateThemeMsg,y=!0;else{if("plugin"===p)v=HCaptchaIntegrationsObject.deactivateMsg;else{for(var w in v=HCaptchaIntegrationsObject.deactivateThemeMsg,C="<p>"+HCaptchaIntegrationsObject.selectThemeMsg+"</p>",C+="<select>",HCaptchaIntegrationsObject.themes){var j=w===HCaptchaIntegrationsObject.defaultTheme?' selected="selected"':"";C+='<option value="'.concat(w,'"').concat(j,">").concat(HCaptchaIntegrationsObject.themes[w],"</option>")}C+="</select>"}y=!1}if(-1===e.inArray(p,["theme"])||y||0!==Object.keys(HCaptchaIntegrationsObject.themes).length){if(!m.find(".hcaptcha-integrations-logo").data("installed"))return v=(v=HCaptchaIntegrationsObject.installMsg).replace("%s",g),void kaggDialog.confirm({title:v,content:C,type:"install",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}});c.ctrlKey?s():(v=v.replace("%s",g),kaggDialog.confirm({title:v,content:C,type:y?"activate":"deactivate",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText},cancel:{text:HCaptchaIntegrationsObject.CancelBtnText}},onAction:function(t){t&&s()}}))}else kaggDialog.confirm({title:HCaptchaIntegrationsObject.onlyOneThemeMsg,content:"",type:"info",buttons:{ok:{text:HCaptchaIntegrationsObject.OKBtnText}}})}}));var p,g,m;l.on("input",(p=function(){var t=l.val().trim().toLowerCase(),a=e(".hcaptcha-integrations-logo img"),n=null;if(a.each((function(a,i){var o=e(i);if("core"!==o.data("entity")){var r,c=o.closest("tr");o.data("label").toLowerCase().includes(t)?(c.show(),n=null!==(r=n)&&void 0!==r?r:c):c.hide()}})),n){var i=n.offset().top+n.outerHeight()-e(window).height()+5;e("html").stop().animate({scrollTop:i},1e3)}},g=100,function(){var t=this,e=arguments;clearTimeout(m),m=setTimeout((function(){return p.apply(t,e)}),g)})),e("#hcaptcha-options").keydown((function(t){e(t.target).is(l)&&13===t.which&&t.preventDefault()}))};window.hCaptchaIntegrations=a,jQuery(document).ready(a)})(); -
hcaptcha-for-forms-and-more/trunk/assets/js/settings-base.js
r3114572 r3143189 10 10 const msgSelector = '#hcaptcha-message'; 11 11 12 // Move WP notices to the message area. 13 $( h2Selector ).siblings().appendTo( msgSelector ); 12 function setHeaderBarTop() { 13 const adminBar = document.querySelector( '#wpadminbar' ); 14 const tabs = document.querySelector( '.hcaptcha-settings-tabs' ); 15 const headerBar = document.querySelector( '.hcaptcha-header-bar' ); 16 17 const isAbsolute = adminBar ? window.getComputedStyle( adminBar ).position === 'absolute' : true; 18 const adminBarHeight = ( adminBar && ! isAbsolute ) ? adminBar.offsetHeight : 0; 19 const tabsHeight = tabs ? tabs.offsetHeight : 0; 20 // The -1 to put header bar a bit under tabs. It is a precaution when heights are in fractional pixels. 21 const totalHeight = adminBarHeight + tabsHeight - 1; 22 23 if ( tabs ) { 24 tabs.style.top = `${ adminBarHeight }px`; 25 } 26 27 if ( headerBar ) { 28 headerBar.style.top = `${ totalHeight }px`; 29 } 30 } 14 31 15 32 /** … … 43 60 } 44 61 62 // Move WP notices to the message area. 63 $( h2Selector ).siblings().appendTo( msgSelector ); 64 65 window.addEventListener( 'resize', function() { 66 setHeaderBarTop(); 67 } ); 68 69 setHeaderBarTop(); 70 45 71 highLight(); 46 72 }; -
hcaptcha-for-forms-and-more/trunk/assets/js/settings-base.min.js
r3114572 r3143189 1 (()=>{var a=function(a){a(".hcaptcha-header h2").siblings().appendTo("#hcaptcha-message"),function(){var e=window.location.href,i=document.referrer;if(i&&i!==e){var n=window.location.hash;if(n){var s=a(n);s&&(s.is(":checkbox")?s.closest("fieldset").addClass("blink"):s.addClass("blink"))}}}()};window.hCaptchaSettingsBase=a,jQuery(document).ready(a)})();1 (()=>{var e=function(e){function t(){var e=document.querySelector("#wpadminbar"),t=document.querySelector(".hcaptcha-settings-tabs"),a=document.querySelector(".hcaptcha-header-bar"),o=!e||"absolute"===window.getComputedStyle(e).position,n=e&&!o?e.offsetHeight:0,c=n+(t?t.offsetHeight:0)-1;t&&(t.style.top="".concat(n,"px")),a&&(a.style.top="".concat(c,"px"))}e(".hcaptcha-header h2").siblings().appendTo("#hcaptcha-message"),window.addEventListener("resize",(function(){t()})),t(),function(){var t=window.location.href,a=document.referrer;if(a&&a!==t){var o=window.location.hash;if(o){var n=e(o);n&&(n.is(":checkbox")?n.closest("fieldset").addClass("blink"):n.addClass("blink"))}}}()};window.hCaptchaSettingsBase=e,jQuery(document).ready(e)})(); -
hcaptcha-for-forms-and-more/trunk/changelog.txt
r3129246 r3143189 1 = 4.5.0 = 2 * Added support for Jetpack forms in block theme templates. 3 * Added support for bbPress Login, Register and Lost Password forms. 4 * Added the second argument $atts to the 'hcap_hcaptcha_content' filter. 5 * Added support for MailPoet forms at any placement. 6 * Added the ability to have multiple MailPoet forms on the same page. 7 * Improved UX of the Integrations page. 8 * Fixed error messaging when there are several Jetpack forms on the same page. 9 * Fixed unconditional forcing hCaptcha in Jetpack forms. 10 * Fixed appearance of Beaver Builder editor with "Turn Off When Logged In" setting. 11 * Fixed appearance of Contact Form 7 editor with "Turn Off When Logged In" setting. 12 * Fixed appearance of Essential Addons editor with "Turn Off When Logged In" setting. 13 * Fixed appearance of Gravity Forms editor with "Turn Off When Logged In" setting. 14 * Fixed appearance of Fluent Forms editor with "Turn Off When Logged In" setting. 15 * Fixed appearance of Forminator editor with "Turn Off When Logged In" setting. 16 * Fixed appearance of Formidable Forms with "Turn Off When Logged In" setting. 17 * Fixed appearance of Ninja Forms editor with "Turn Off When Logged In" setting. 18 * Fixed appearance of WPForms editor with "Turn Off When Logged In" setting. 19 * Fixed fatal error on Gravity Forms Entries page. 20 * Fixed Elementor preview. 21 * Fixed Ninja Forms preview. 22 * Fixed hCaptcha nonce error on MailPoet admin pages. 23 * Fixed frontend error when recaptcha was activated in wpDiscuz. 24 1 25 = 4.4.0 = 2 26 * Added compatibility with Contact Form 7 Stripe integration. -
hcaptcha-for-forms-and-more/trunk/hcaptcha.php
r3129246 r3143189 11 11 * Plugin URI: https://www.hcaptcha.com/ 12 12 * Description: hCaptcha keeps out bots and spam while putting privacy first. It is a drop-in replacement for reCAPTCHA. 13 * Version: 4. 4.013 * Version: 4.5.0 14 14 * Requires at least: 5.3 15 15 * Requires PHP: 7.2 … … 40 40 * Plugin version. 41 41 */ 42 const HCAPTCHA_VERSION = '4. 4.0';42 const HCAPTCHA_VERSION = '4.5.0'; 43 43 44 44 /** -
hcaptcha-for-forms-and-more/trunk/readme.txt
r3129246 r3143189 5 5 Tested up to: 6.6 6 6 Requires PHP: 7.2 7 Stable tag: 4. 4.07 Stable tag: 4.5.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 17 17 Need to keep out bots? hCaptcha protects privacy while offering better protection against spam and abuse. Help build a better web. 18 18 19 [The hCaptcha for WP many advantages over similar captcha plugins](https://kagg.eu/why-choose-hcaptcha-for-wp/).19 hCaptcha for WP [makes security easy](https://www.hcaptcha.com/integration-hcaptcha-for-wp) with broad integration support, detailed analytics, and strong protection. Start protecting logins, forms, and more in minutes. 20 20 21 21 == How hCaptcha Works == … … 37 37 5. Contact Form 7 live form in the admin editor. 38 38 6. Elementor Pro Form. 39 7. Elementor Pro F rom in admin editor.39 7. Elementor Pro Form in admin editor. 40 40 8. General settings page. 41 41 9. Integrations settings page. … … 197 197 BBPress 198 198 `$source: 'bbpress/bbpress.php'` 199 `$form_id: 'new_topic' or 'reply'`199 `$form_id: 'new_topic', 'reply', 'login', 'register' or 'lost_password'` 200 200 201 201 Beaver Builder … … 233 233 Jetpack 234 234 `$source: 'jetpack/jetpack.php'` 235 `$form_id: 'contact '`235 `$form_id: 'contact_$form_hash'` 236 236 237 237 Kadence Form … … 395 395 = How to whitelist certain IPs = 396 396 397 You can use the following filter :397 You can use the following filter. It should be added to your plugin's (or mu-plugin's) main file. This filter won't work being added to a theme's functions.php file. 398 398 399 399 ` … … 495 495 * Avada Form 496 496 * Back In Stock Notifier Form 497 * bbPress New Topic and ReplyForms497 * bbPress New Topic, Reply, Login, Register and Lost Password Forms 498 498 * Beaver Builder Contact and Login Forms 499 499 * BuddyPress — Create Group and Registration Forms … … 566 566 == Changelog == 567 567 568 = 4.5.0 = 569 * Added support for Jetpack forms in block theme templates. 570 * Added support for bbPress Login, Register and Lost Password forms. 571 * Added the second argument $atts to the 'hcap_hcaptcha_content' filter. 572 * Added support for MailPoet forms at any placement. 573 * Added the ability to have multiple MailPoet forms on the same page. 574 * Improved UX of the Integrations page. 575 * Fixed error messaging when there are several Jetpack forms on the same page. 576 * Fixed unconditional forcing hCaptcha in Jetpack forms. 577 * Fixed appearance of Beaver Builder editor with "Turn Off When Logged In" setting. 578 * Fixed appearance of Contact Form 7 editor with "Turn Off When Logged In" setting. 579 * Fixed appearance of Essential Addons editor with "Turn Off When Logged In" setting. 580 * Fixed appearance of Gravity Forms editor with "Turn Off When Logged In" setting. 581 * Fixed appearance of Fluent Forms editor with "Turn Off When Logged In" setting. 582 * Fixed appearance of Forminator editor with "Turn Off When Logged In" setting. 583 * Fixed appearance of Formidable Forms with "Turn Off When Logged In" setting. 584 * Fixed appearance of Ninja Forms editor with "Turn Off When Logged In" setting. 585 * Fixed appearance of WPForms editor with "Turn Off When Logged In" setting. 586 * Fixed fatal error on Gravity Forms Entries page. 587 * Fixed Elementor preview. 588 * Fixed Ninja Forms preview. 589 * Fixed hCaptcha nonce error on MailPoet admin pages. 590 * Fixed frontend error when recaptcha was activated in wpDiscuz. 591 568 592 = 4.4.0 = 569 593 * Added compatibility with Contact Form 7 Stripe integration. -
hcaptcha-for-forms-and-more/trunk/src/php/CF7/Admin.php
r3129246 r3143189 11 11 namespace HCaptcha\CF7; 12 12 13 use HCaptcha\Helpers\Pages; 13 14 use WPCF7_TagGenerator; 14 15 … … 36 37 } 37 38 38 if ( ! $this->is_cf7_form_admin_page() ) {39 if ( ! Pages::is_cf7_edit_page() ) { 39 40 return; 40 41 } … … 294 295 } 295 296 } 296 297 /**298 * Check if the current page is a CF7 form create, edit or view page.299 *300 * @return bool301 */302 protected function is_cf7_form_admin_page(): bool {303 304 // phpcs:ignore WordPress.Security.NonceVerification.Recommended305 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';306 307 if ( ! in_array( $page, [ 'wpcf7-new', 'wpcf7' ], true ) ) {308 return false;309 }310 311 // phpcs:ignore WordPress.Security.NonceVerification.Recommended312 if ( ( 'wpcf7' === $page ) && ! isset( $_GET['post'] ) ) {313 return false;314 }315 316 return true;317 }318 297 } -
hcaptcha-for-forms-and-more/trunk/src/php/Divi/Login.php
r3114572 r3143189 9 9 10 10 use HCaptcha\Abstracts\LoginBase; 11 use Patchwork\Exceptions\NonNullToVoid; 11 12 12 13 /** … … 34 35 * Add hCaptcha to the login form. 35 36 * 36 * @param string| string[]$output Module output.37 * @param string $module_slug Module slug.37 * @param string|mixed $output Module output. 38 * @param string $module_slug Module slug. 38 39 * 39 * @return string| string[]40 * @return string|mixed 40 41 * @noinspection PhpUnusedParameterInspection 41 42 * @noinspection PhpUndefinedFunctionInspection … … 75 76 76 77 // Insert hCaptcha. 77 return preg_replace( $pattern, $replacement, $output );78 return (string) preg_replace( $pattern, $replacement, $output ); 78 79 } 79 80 } -
hcaptcha-for-forms-and-more/trunk/src/php/GravityForms/Field.php
r3115148 r3143189 53 53 * @param array $data Data. 54 54 */ 55 public function __construct( array$data = [] ) {55 public function __construct( $data = [] ) { 56 56 parent::__construct( $data ); 57 57 -
hcaptcha-for-forms-and-more/trunk/src/php/Helpers/HCaptcha.php
r3129246 r3143189 873 873 public static function add_type_module( string $tag ): string { 874 874 $search = [ 875 '/type=".+?" /',875 '/type=".+?" /', 876 876 '/<script /', 877 877 ]; 878 878 $replace = [ 879 879 '', 880 '<script type="module" ',880 '<script type="module" ', 881 881 ]; 882 882 -
hcaptcha-for-forms-and-more/trunk/src/php/Helpers/Request.php
r3129246 r3143189 1 1 <?php 2 2 /** 3 * Request class file.3 * Request class' file. 4 4 * 5 5 * @package hcaptcha-wp … … 115 115 return 'POST' === $request_method; 116 116 } 117 118 /** 119 * Filter input in WP style. 120 * Nonce must be checked in the calling function. 121 * 122 * @param int $type Input type. 123 * @param string $var_name Variable name. 124 * 125 * @return string 126 */ 127 public static function filter_input( int $type, string $var_name ): string { 128 switch ( $type ) { 129 case INPUT_GET: 130 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 131 return isset( $_GET[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_GET[ $var_name ] ) ) : ''; 132 case INPUT_POST: 133 // phpcs:ignore WordPress.Security.NonceVerification.Missing 134 return isset( $_POST[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_POST[ $var_name ] ) ) : ''; 135 case INPUT_SERVER: 136 return isset( $_SERVER[ $var_name ] ) ? sanitize_text_field( wp_unslash( $_SERVER[ $var_name ] ) ) : ''; 137 default: 138 return ''; 139 } 140 } 117 141 } -
hcaptcha-for-forms-and-more/trunk/src/php/Jetpack/JetpackBase.php
r3114572 r3143189 34 34 35 35 /** 36 * Errored form hash. 37 * 38 * @var string|null 39 */ 40 protected $error_form_hash; 41 42 /** 36 43 * Constructor. 37 44 */ … … 46 53 */ 47 54 private function init_hooks(): void { 48 add_filter( 'the_content', [ $this, 'add_captcha' ] ); 55 // This filter works for a Jetpack classic and block form on a page or in a template. 56 add_filter( 'jetpack_contact_form_html', [ $this, 'add_captcha' ] ); 57 58 // This filter works for a Jetpack form in a classic widget. 49 59 add_filter( 'widget_text', [ $this, 'add_captcha' ], 0 ); 50 60 … … 83 93 } 84 94 95 $this->error_form_hash = $this->get_submitted_form_hash(); 96 85 97 $error = new WP_Error(); 98 86 99 $error->add( 'invalid_hcaptcha', $this->error_message ); 87 100 add_filter( 'hcap_hcaptcha_content', [ $this, 'error_message' ] ); … … 93 106 * Print error message. 94 107 * 95 * @param string|mixed $hcaptcha_content Content of hCaptcha. 108 * @param string|mixed $hcaptcha The hCaptcha form. 109 * @param array $atts The hCaptcha shortcode attributes. 96 110 * 97 111 * @return string|mixed 98 112 */ 99 public function error_message( $hcaptcha _content = '') {113 public function error_message( $hcaptcha = '', array $atts = [] ) { 100 114 if ( null === $this->error_message ) { 101 return $hcaptcha_content; 115 return $hcaptcha; 116 } 117 118 $hash = $atts['id']['form_id'] ?? ''; 119 $hash = str_replace( 'contact_', '', $hash ); 120 121 if ( $hash !== $this->error_form_hash ) { 122 return $hcaptcha; 102 123 } 103 124 … … 112 133 HTML; 113 134 114 return $hcaptcha _content. $message;135 return $hcaptcha . $message; 115 136 } 116 137 … … 131 152 HCaptcha::css_display( $css ); 132 153 } 154 155 /** 156 * Get form hash. 157 * 158 * @param string $form Jetpack form. 159 * 160 * @return string 161 */ 162 protected function get_form_hash( string $form ): string { 163 return preg_match( "/name='contact-form-hash' value='(.+)'/", $form, $m ) 164 ? '_' . $m[1] 165 : ''; 166 } 167 168 /** 169 * Get form hash. 170 * 171 * @return string|null 172 */ 173 private function get_submitted_form_hash(): ?string { 174 // phpcs:disable WordPress.Security.NonceVerification.Missing 175 return isset( $_POST['contact-form-hash'] ) 176 ? sanitize_text_field( wp_unslash( $_POST['contact-form-hash'] ) ) 177 : null; 178 // phpcs:enable WordPress.Security.NonceVerification.Missing 179 } 133 180 } -
hcaptcha-for-forms-and-more/trunk/src/php/Jetpack/JetpackForm.php
r3051014 r3143189 27 27 // Jetpack classic form. 28 28 $content = (string) preg_replace_callback( 29 '~(\[contact-form[\s\S]*?][\s\S]*?)(\[/contact-form])~',30 [ $this, ' classic_callback' ],29 "~<form [\s\S]*?class='contact-form[\s\S]*?(<button type='submit')[\s\S]*?</form>~", 30 [ $this, 'replace_callback' ], 31 31 $content 32 32 ); … … 35 35 return (string) preg_replace_callback( 36 36 '~<form [\s\S]*?wp-block-jetpack-contact-form[\s\S]*?(<div class="wp-block-jetpack-button wp-block-button"[\s\S]*?<button [\s\S]*?type="submit"[\s\S]*?</button>)[\s\S]*?</form>~', 37 [ $this, ' block_callback' ],37 [ $this, 'replace_callback' ], 38 38 $content 39 39 ); 40 }41 42 /**43 * Add hCaptcha shortcode to the provided shortcode for a Jetpack classic contact form.44 *45 * @param array $matches Matches.46 *47 * @return string48 */49 public function classic_callback( array $matches ): string {50 if ( has_shortcode( $matches[0], 'hcaptcha' ) ) {51 return $matches[0];52 }53 54 $args = [55 'action' => self::ACTION,56 'name' => self::NAME,57 'force' => true,58 'id' => [59 'source' => HCaptcha::get_class_source( __CLASS__ ),60 'form_id' => 'contact',61 ],62 ];63 64 $hcaptcha = '<div class="grunion-field-wrap">' . HCaptcha::form( $args ) . '</div>';65 66 return $matches[1] . $this->error_message( $hcaptcha ) . $matches[2];67 40 } 68 41 … … 74 47 * @return string 75 48 */ 76 public function block_callback( array $matches ): string {49 public function replace_callback( array $matches ): string { 77 50 if ( has_shortcode( $matches[0], 'hcaptcha' ) ) { 78 51 return $matches[0]; 79 52 } 80 53 54 $hash = $this->get_form_hash( $matches[0] ); 55 81 56 $args = [ 82 57 'action' => self::ACTION, 83 58 'name' => self::NAME, 84 'force' => true,85 59 'id' => [ 86 60 'source' => HCaptcha::get_class_source( __CLASS__ ), 87 'form_id' => 'contact' ,61 'form_id' => 'contact' . $hash, 88 62 ], 89 63 ]; … … 91 65 $hcaptcha = '<div class="grunion-field-wrap">' . HCaptcha::form( $args ) . '</div>'; 92 66 67 if ( false !== strpos( $matches[0], $hcaptcha ) ) { 68 return $matches[0]; 69 } 70 71 $hcaptcha = $this->error_message( $hcaptcha, $args ); 72 93 73 return str_replace( 94 74 $matches[1], 95 $ this->error_message( $hcaptcha ). $matches[1],75 $hcaptcha . $matches[1], 96 76 $matches[0] 97 77 ); -
hcaptcha-for-forms-and-more/trunk/src/php/MailPoet/Form.php
r3129246 r3143189 14 14 15 15 use HCaptcha\Helpers\HCaptcha; 16 use HCaptcha\Helpers\Request; 16 17 use MailPoet\API\JSON\API; 17 18 use MailPoet\API\JSON\Response; 18 use WP_Block;19 19 20 20 /** … … 51 51 */ 52 52 private function init_hooks(): void { 53 add_filter( ' render_block', [ $this, 'add_captcha' ], 10, 3);53 add_filter( 'the_content', [ $this, 'the_content_filter' ], 20 ); 54 54 add_action( 'mailpoet_api_setup', [ $this, 'verify' ] ); 55 55 add_action( 'wp_print_footer_scripts', [ $this, 'enqueue_scripts' ], 9 ); … … 57 57 58 58 /** 59 * Add hcaptcha to MailPoet form.59 * The content filter. 60 60 * 61 * @param string|mixed $block_content The block content. 62 * @param array $block The full block, including name and attributes. 63 * @param WP_Block $instance The block instance. 61 * @param string|mixed $content Content. 64 62 * 65 63 * @return string 66 * @noinspection PhpUnusedParameterInspection67 64 */ 68 public function add_captcha( $block_content, array $block, WP_Block $instance ): string { 69 if ( 'mailpoet/subscription-form-block' !== $block['blockName'] ) { 70 return (string) $block_content; 65 public function the_content_filter( $content ): string { 66 $content = (string) $content; 67 68 if ( ! preg_match_all( 69 '~<form[\s\S]+?"data\[form_id]" value="(\d+?)"[\s\S]+?(<input type="submit")[\s\S]+?</form>~', 70 $content, 71 $matches 72 ) ) { 73 return $content; 71 74 } 72 75 73 $form_id = $block['attrs']['formId'] ?? 0; 74 $search = '<input type="submit" class="mailpoet_submit"'; 75 $args = [ 76 'action' => self::ACTION, 77 'name' => self::NONCE, 78 'id' => [ 79 'source' => HCaptcha::get_class_source( __CLASS__ ), 80 'form_id' => $form_id, 81 ], 82 ]; 76 foreach ( $matches[0] as $key => $form ) { 77 if ( false !== strpos( $form, 'h-captcha' ) ) { 78 continue; 79 } 83 80 84 return str_replace( 85 $search, 86 HCaptcha::form( $args ) . $search, 87 (string) $block_content 88 ); 81 $form_id = (int) $matches[1][ $key ]; 82 83 $args = [ 84 'action' => self::ACTION, 85 'name' => self::NONCE, 86 'id' => [ 87 'source' => HCaptcha::get_class_source( __CLASS__ ), 88 'form_id' => $form_id, 89 ], 90 ]; 91 $hcaptcha = HCaptcha::form( $args ); 92 93 $submit = $matches[2][ $key ]; 94 $replace = str_replace( $submit, $hcaptcha . $submit, $form ); 95 $content = str_replace( $form, $replace, $content ); 96 } 97 98 return $content; 89 99 } 90 100 … … 93 103 * 94 104 * @param API $api MailPoet API instance. 105 * 106 * @return void 95 107 */ 96 108 public function verify( API $api ): void { 97 if ( ! wp_doing_ajax() ) { 109 if ( 110 Request::filter_input( INPUT_POST, 'action' ) !== 'mailpoet' || 111 Request::filter_input( INPUT_POST, 'endpoint' ) !== 'subscribers' || 112 Request::filter_input( INPUT_POST, 'method' ) !== 'subscribe' 113 ) { 114 // Process frontend subscription ajax request only. 98 115 return; 99 116 } -
hcaptcha-for-forms-and-more/trunk/src/php/Main.php
r3129246 r3143189 24 24 use HCaptcha\ElementorPro\HCaptchaHandler; 25 25 use HCaptcha\Helpers\HCaptcha; 26 use HCaptcha\Helpers\Pages; 26 27 use HCaptcha\Helpers\Request; 27 28 use HCaptcha\Jetpack\JetpackForm; … … 69 70 70 71 /** 72 * Priority of the plugins_loaded action to load Main. 73 */ 74 public const LOAD_PRIORITY = Migrations::LOAD_PRIORITY + 1; 75 76 /** 71 77 * Form shown somewhere, use this flag to run the script. 72 78 * … … 98 104 99 105 /** 106 * Migrations class instance. 107 * 108 * @var Migrations 109 */ 110 protected $migrations; 111 112 /** 100 113 * Settings class instance. 101 114 * … … 125 138 public function init(): void { 126 139 if ( Request::is_xml_rpc() ) { 140 // @codeCoverageIgnoreStart 127 141 return; 128 } 129 130 new Migrations(); 142 // @codeCoverageIgnoreEnd 143 } 144 145 $this->migrations = new Migrations(); 131 146 132 147 if ( wp_doing_cron() ) { … … 136 151 ( new Fix() )->init(); 137 152 138 add_action( 'plugins_loaded', [ $this, 'init_hooks' ], -PHP_INT_MAX);153 add_action( 'plugins_loaded', [ $this, 'init_hooks' ], self::LOAD_PRIORITY ); 139 154 } 140 155 … … 172 187 $this->load( Events::class ); 173 188 174 add_action( 'plugins_loaded', [ $this, 'load_modules' ], -PHP_INT_MAX+ 1 );189 add_action( 'plugins_loaded', [ $this, 'load_modules' ], self::LOAD_PRIORITY + 1 ); 175 190 add_filter( 'hcap_whitelist_ip', [ $this, 'whitelist_ip' ], -PHP_INT_MAX, 2 ); 176 191 add_action( 'before_woocommerce_init', [ $this, 'declare_wc_compatibility' ] ); … … 250 265 ); 251 266 252 $activate = ( ! $deactivate ) || $this->is_e lementor_pro_edit_page();267 $activate = ( ! $deactivate ) || $this->is_edit_page(); 253 268 254 269 /** … … 261 276 262 277 /** 263 * Whether we are on the Elementor Pro edit post/page and hCaptcha for Elementor Prois active.278 * Whether we are on the admin edit page for a component and component is active. 264 279 * 265 280 * @return bool 266 281 */ 267 private function is_elementor_pro_edit_page(): bool { 268 if ( ! $this->settings()->is_on( 'elementor_pro_status' ) ) { 269 return false; 270 } 271 272 // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing 273 $request1 = ( 274 isset( $_SERVER['REQUEST_URI'], $_GET['post'], $_GET['action'] ) && 275 0 === strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/wp-admin/post.php' ) && 276 'elementor' === $_GET['action'] 282 private function is_edit_page(): bool { 283 $settings = $this->settings(); 284 $components = [ 285 'beaver_builder', 286 'cf7', 287 'elementor_pro', 288 'gravity', 289 'fluent', 290 'forminator', 291 'formidable_forms', 292 'ninja', 293 'wpforms', 294 ]; 295 296 return array_reduce( 297 $components, 298 static function ( $carry, $component ) use ( $settings ) { 299 $method = 'is_' . $component . '_edit_page'; 300 301 if ( 302 ! method_exists( Pages::class, $method ) || 303 ! $settings->is_on( $component . '_status' ) 304 ) { 305 return $carry; 306 } 307 308 return $carry || Pages::$method(); 309 }, 310 false 277 311 ); 278 $request2 = (279 isset( $_SERVER['REQUEST_URI'], $_GET['elementor-preview'] ) &&280 0 === strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/elementor' )281 );282 $request3 = (283 isset( $_POST['action'] ) && 'elementor_ajax' === $_POST['action']284 );285 286 // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing287 288 return $request1 || $request2 || $request3;289 312 } 290 313 … … 323 346 * 324 347 * @param bool $add_csp_headers Add Content Security Policy (CSP) headers. 325 * @param array $headers Current headers.348 * @param array $headers Current headers. 326 349 */ 327 350 if ( ! apply_filters( 'hcap_add_csp_headers', false, $headers ) ) { … … 863 886 BackInStockNotifier\Form::class, 864 887 ], 888 'bbPress Login Form' => [ 889 [ 'bbp_status', null ], 890 'bbpress/bbpress.php', 891 BBPress\Login::class, 892 ], 893 'bbPress Lost Password Form' => [ 894 [ 'bbp_status', null ], 895 'bbpress/bbpress.php', 896 BBPress\LostPassword::class, 897 ], 865 898 'bbPress New Topic' => [ 866 899 [ 'bbp_status', 'new_topic' ], 867 900 'bbpress/bbpress.php', 868 901 BBPress\NewTopic::class, 902 ], 903 'bbPress Register Form' => [ 904 [ 'bbp_status', null ], 905 'bbpress/bbpress.php', 906 BBPress\Register::class, 869 907 ], 870 908 'bbPress Reply' => [ -
hcaptcha-for-forms-and-more/trunk/src/php/Migrations/Migrations.php
r3114572 r3143189 37 37 38 38 /** 39 * Priority of the plugins_loaded action to load Migrations. 40 */ 41 public const LOAD_PRIORITY = -PHP_INT_MAX; 42 43 /** 39 44 * Plugin name. 40 45 */ … … 67 72 */ 68 73 private function init_hooks(): void { 69 add_action( 'plugins_loaded', [ $this, 'migrate' ], - PHP_INT_MAX);74 add_action( 'plugins_loaded', [ $this, 'migrate' ], self::LOAD_PRIORITY ); 70 75 } 71 76 … … 142 147 } 143 148 144 return wp_doing_cron() || is_admin() || ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ); 149 return ( 150 ( is_admin() && ! wp_doing_ajax() ) || 151 wp_doing_cron() || 152 ( defined( 'WP_CLI' ) && constant( 'WP_CLI' ) ) 153 ); 154 } 155 156 /** 157 * Send plugin statistics. 158 * 159 * @return void 160 */ 161 public function send_plugin_stats(): void { 162 /** 163 * Send plugin statistics. 164 */ 165 do_action( 'hcap_send_plugin_stats' ); 145 166 } 146 167 … … 158 179 159 180 // Send statistics on plugin update. 160 add_action( 161 'init', 162 static function () { 163 /** 164 * Send plugin statistics. 165 */ 166 do_action( 'hcap_send_plugin_stats' ); 167 } 168 ); 181 add_action( 'init', [ $this, 'send_plugin_stats' ] ); 169 182 } 170 183 … … 199 212 200 213 /** 201 * Output message into log file.214 * Output message into the log file. 202 215 * 203 216 * @param string $message Message to log. -
hcaptcha-for-forms-and-more/trunk/src/php/NF/Field.php
r3114572 r3143189 18 18 * Class Field 19 19 */ 20 class Field extends NF_Abstracts_Field {20 class Field extends NF_Abstracts_Field implements Base { 21 21 22 22 // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore 23 23 24 24 /** 25 * Name.25 * Field name. 26 26 * 27 27 * @var string 28 28 */ 29 protected $_name = 'hcaptcha-for-ninja-forms';29 protected $_name = self::NAME; 30 30 31 31 /** 32 * Type.32 * Filed type. 33 33 * 34 34 * @var string 35 35 */ 36 protected $_type = 'hcaptcha';36 protected $_type = self::TYPE; 37 37 38 38 /** -
hcaptcha-for-forms-and-more/trunk/src/php/NF/NF.php
r3114572 r3143189 15 15 * Support Ninja Forms. 16 16 */ 17 class NF {17 class NF implements Base { 18 18 19 19 /** … … 42 42 * @var int 43 43 */ 44 pr ivate$form_id = 0;44 protected $form_id = 0; 45 45 46 46 /** … … 49 49 * @var string 50 50 */ 51 pr ivate$templates_dir;51 protected $templates_dir; 52 52 53 53 /** … … 66 66 */ 67 67 public function init_hooks(): void { 68 $name = Base::NAME; 69 68 70 add_action( 'toplevel_page_ninja-forms', [ $this, 'admin_template' ], 11 ); 69 71 add_action( 'nf_admin_enqueue_scripts', [ $this, 'nf_admin_enqueue_scripts' ] ); … … 72 74 add_filter( 'ninja_forms_field_template_file_paths', [ $this, 'template_file_paths' ] ); 73 75 add_action( 'nf_get_form_id', [ $this, 'set_form_id' ] ); 74 add_filter( 'ninja_forms_localize_field_hcaptcha-for-ninja-forms', [ $this, 'localize_field' ] ); 76 add_filter( "ninja_forms_localize_field_$name", [ $this, 'localize_field' ] ); 77 add_filter( "ninja_forms_localize_field_{$name}_preview", [ $this, 'localize_field' ] ); 75 78 add_action( 'wp_print_footer_scripts', [ $this, 'nf_captcha_script' ], 9 ); 76 79 } … … 96 99 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 97 100 echo str_replace( 98 'tmpl-nf-field- hcaptcha',99 'tmpl-nf-field- hcaptcha-for-ninja-forms',101 'tmpl-nf-field-' . Base::TYPE, 102 'tmpl-nf-field-' . Base::NAME, 100 103 $template 101 104 ); … … 111 114 112 115 // Add hCaptcha to the preloaded form data. 113 $data = $wp_scripts->registered['nf-builder']->extra['data'] ;116 $data = $wp_scripts->registered['nf-builder']->extra['data'] ?? ''; 114 117 115 118 if ( ! preg_match( '/var nfDashInlineVars = (.+);/', $data, $m ) ) { … … 121 124 122 125 foreach ( $vars['preloadedFormData']['fields'] as & $field ) { 123 if ( 'hcaptcha-for-ninja-forms' === $field['type'] ) { 126 // See comment in admin_template(). 127 if ( Base::NAME === $field['type'] ) { 124 128 $found = true; 125 129 $search = 'class="h-captcha"'; … … 129 133 $this->get_hcaptcha( (int) $field['id'] ) 130 134 ); 135 131 136 break; 132 137 } … … 187 192 $fields = (array) $fields; 188 193 189 $fields[ 'hcaptcha-for-ninja-forms'] = new Field();194 $fields[ Base::NAME ] = new Field(); 190 195 191 196 return $fields; … … 203 208 204 209 if ( false === $index ) { 210 // @codeCoverageIgnoreStart 205 211 return; 206 } 207 208 $hcaptcha_key = 'hcaptcha-for-ninja-forms'; 212 // @codeCoverageIgnoreEnd 213 } 214 215 $hcaptcha_key = Base::NAME; 209 216 $hcaptcha_value = $fields[ $hcaptcha_key ]; 210 217 … … 255 262 256 263 $field['settings']['hcaptcha'] = $field['settings']['hcaptcha'] ?? $this->get_hcaptcha( (int) $field['id'] ); 264 265 // Mark hCaptcha as shown in any case. Needed on the preview page. 266 hcaptcha()->form_shown = true; 257 267 258 268 return $field; -
hcaptcha-for-forms-and-more/trunk/src/php/Settings/Abstracts/SettingsBase.php
r3114572 r3143189 233 233 'select' => [ $this, 'print_select_field' ], 234 234 'multiple' => [ $this, 'print_multiple_select_field' ], 235 'file' => [ $this, 'print_file_field' ], 235 236 'table' => [ $this, 'print_table_field' ], 236 237 'button' => [ $this, 'print_button_field' ], … … 260 261 $this->init_settings(); 261 262 262 if ( $this->is_main_menu_page() || $this->is_tab_active( $this) ) {263 if ( is_admin() && ( $this->is_main_menu_page() || $this->is_tab_active( $this ) ) ) { 263 264 $this->init_hooks(); 264 265 } … … 708 709 */ 709 710 public function tabs_callback(): void { 711 if ( ! count( $this->tabs ?? [] ) ) { 712 return; 713 } 714 710 715 ?> 711 716 <div class="<?php echo esc_attr( static::PREFIX . '-settings-tabs' ); ?>"> … … 1236 1241 1237 1242 /** 1243 * Print file field. 1244 * 1245 * @param array $arguments Field arguments. 1246 * 1247 * @return void 1248 * @noinspection HtmlUnknownAttribute 1249 */ 1250 protected function print_file_field( array $arguments ): void { 1251 $multiple = (bool) ( $arguments['multiple'] ?? '' ); 1252 $accept = $arguments['accept'] ?? ''; 1253 1254 printf( 1255 '<input %1$s name="%2$s[%3$s]%4$s" id="%3$s" type="file" %5$s %6$s/>', 1256 disabled( $arguments['disabled'], true, false ), 1257 esc_html( $this->option_name() ), 1258 esc_attr( $arguments['field_id'] ), 1259 esc_attr( $multiple ? '[]' : '' ), 1260 esc_attr( $multiple ? 'multiple' : '' ), 1261 $accept ? 'accept="' . esc_attr( $accept ) . '"' : '' 1262 ); 1263 } 1264 1265 /** 1238 1266 * Print table field. 1239 1267 * … … 1461 1489 1462 1490 foreach ( $this->form_fields() as $key => $form_field ) { 1491 if ( 'file' === $form_field['type'] ) { 1492 unset( $value[ $key ], $old_value[ $key ] ); 1493 continue; 1494 } 1495 1463 1496 if ( 'checkbox' !== $form_field['type'] || isset( $value[ $key ] ) ) { 1464 1497 continue; … … 1620 1653 <?php 1621 1654 } 1655 1656 /** 1657 * Get savable for fields. 1658 * 1659 * @return array 1660 */ 1661 protected function get_savable_form_fields(): array { 1662 $not_savable_form_fields = [ 'button', 'file' ]; 1663 1664 return array_filter( 1665 $this->form_fields, 1666 static function ( $field ) use ( $not_savable_form_fields ) { 1667 return ! in_array( $field['type'] ?? '', $not_savable_form_fields, true ); 1668 } 1669 ); 1670 } 1622 1671 } -
hcaptcha-for-forms-and-more/trunk/src/php/Settings/Integrations.php
r3129246 r3143189 213 213 'type' => 'checkbox', 214 214 'options' => [ 215 'login' => __( 'Login Form', 'hcaptcha-for-forms-and-more' ), 216 'lost_pass' => __( 'Lost Password Form', 'hcaptcha-for-forms-and-more' ), 215 217 'new_topic' => __( 'New Topic Form', 'hcaptcha-for-forms-and-more' ), 218 'register' => __( 'Register Form', 'hcaptcha-for-forms-and-more' ), 216 219 'reply' => __( 'Reply Form', 'hcaptcha-for-forms-and-more' ), 217 220 ], -
hcaptcha-for-forms-and-more/trunk/src/php/Settings/PluginSettingsBase.php
r3114572 r3143189 197 197 settings_fields( $this->option_group() ); // Hidden protection fields. 198 198 199 if ( ! empty( $this-> form_fields) ) {199 if ( ! empty( $this->get_savable_form_fields() ) ) { 200 200 $this->submit_button(); 201 201 } -
hcaptcha-for-forms-and-more/trunk/src/php/Settings/Settings.php
r3114572 r3143189 106 106 */ 107 107 public function get_tab( string $classname ): ?PluginSettingsBase { 108 $tabs = hcaptcha()->settings()->get_tabs(); 109 110 foreach ( $tabs as $tab ) { 108 foreach ( $this->tabs as $tab ) { 111 109 if ( is_a( $tab, $classname ) ) { 112 110 return $tab; -
hcaptcha-for-forms-and-more/trunk/src/php/Spectra/Form.php
r3114572 r3143189 37 37 * @var bool 38 38 */ 39 pr ivate$has_recaptcha_field;39 protected $has_recaptcha_field; 40 40 41 41 /** … … 79 79 return $block_content; 80 80 } 81 82 $block_content = (string) $block_content; 81 83 82 84 $args = [ … … 89 91 ]; 90 92 91 $block_content = (string) $block_content;92 93 93 $this->has_recaptcha_field = false; 94 94 … … 198 198 * @return bool 199 199 */ 200 pr ivatefunction has_recaptcha(): bool {200 protected function has_recaptcha(): bool { 201 201 // Spectra checks nonce. 202 202 // phpcs:disable WordPress.Security.NonceVerification.Missing -
hcaptcha-for-forms-and-more/trunk/src/php/WPDiscuz/Base.php
r3114572 r3143189 24 24 * 25 25 * @return void 26 * @noinspection PhpUndefinedFunctionInspection 26 27 */ 27 28 protected function init_hooks(): void { 28 add_filter( 29 'wpdiscuz_recaptcha_site_key', 30 static function () { 31 // Block output of reCaptcha by wpDiscuz. 32 return ''; 33 } 29 if ( ! function_exists( 'wpDiscuz' ) ) { 30 return; 31 } 32 33 $wpd_recaptcha = wpDiscuz()->options->recaptcha; 34 $wpd_recaptcha = array_merge( 35 $wpd_recaptcha, 36 [ 37 'siteKey' => '', 38 'showForGuests' => 0, 39 'showForUsers' => 0, 40 ] 34 41 ); 42 43 // Block output of reCaptcha by wpDiscuz. 44 wpDiscuz()->options->recaptcha = $wpd_recaptcha; 35 45 36 46 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ], 11 ); -
hcaptcha-for-forms-and-more/trunk/src/php/includes/functions.php
r3064004 r3143189 11 11 * Display hCaptcha shortcode. 12 12 * 13 * @param array|string $atts hcaptcha shortcode attributes.13 * @param array|string $atts The hCaptcha shortcode attributes. 14 14 * 15 15 * @return string … … 38 38 39 39 /** 40 * Filters the content of the h captcha form.40 * Filters the content of the hCaptcha form. 41 41 * 42 * @param string $form The hcaptcha form. 42 * @param string $form The hCaptcha form. 43 * @param array $atts The hCaptcha shortcode attributes. 43 44 */ 44 return (string) apply_filters( 'hcap_hcaptcha_content', HCaptcha::form( $atts ) );45 return (string) apply_filters( 'hcap_hcaptcha_content', HCaptcha::form( $atts ), $atts ); 45 46 } 46 47 -
hcaptcha-for-forms-and-more/trunk/src/php/includes/request.php
r3114572 r3143189 314 314 function hcaptcha_get_verify_output( string $empty_message, string $fail_message, string $nonce_field_name, string $nonce_action_name ): ?string { 315 315 if ( ! empty( $empty_message ) || ! empty( $fail_message ) ) { 316 // @codeCoverageIgnoreStart 316 317 _deprecated_argument( __FUNCTION__, '2.1.0' ); 318 // @codeCoverageIgnoreEnd 317 319 } 318 320 -
hcaptcha-for-forms-and-more/trunk/vendor/autoload.php
r3114572 r3143189 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470::getLoader();25 return ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f::getLoader(); -
hcaptcha-for-forms-and-more/trunk/vendor/composer/autoload_classmap.php
r3129246 r3143189 23 23 'HCaptcha\\Avada\\Form' => $baseDir . '/src/php/Avada/Form.php', 24 24 'HCaptcha\\BBPress\\Base' => $baseDir . '/src/php/BBPress/Base.php', 25 'HCaptcha\\BBPress\\Login' => $baseDir . '/src/php/BBPress/Login.php', 26 'HCaptcha\\BBPress\\LostPassword' => $baseDir . '/src/php/BBPress/LostPassword.php', 25 27 'HCaptcha\\BBPress\\NewTopic' => $baseDir . '/src/php/BBPress/NewTopic.php', 28 'HCaptcha\\BBPress\\Register' => $baseDir . '/src/php/BBPress/Register.php', 26 29 'HCaptcha\\BBPress\\Reply' => $baseDir . '/src/php/BBPress/Reply.php', 27 30 'HCaptcha\\BackInStockNotifier\\Form' => $baseDir . '/src/php/BackInStockNotifier/Form.php', … … 71 74 'HCaptcha\\HTMLForms\\Form' => $baseDir . '/src/php/HTMLForms/Form.php', 72 75 'HCaptcha\\Helpers\\HCaptcha' => $baseDir . '/src/php/Helpers/HCaptcha.php', 76 'HCaptcha\\Helpers\\Pages' => $baseDir . '/src/php/Helpers/Pages.php', 73 77 'HCaptcha\\Helpers\\Request' => $baseDir . '/src/php/Helpers/Request.php', 74 78 'HCaptcha\\Jetpack\\JetpackBase' => $baseDir . '/src/php/Jetpack/JetpackBase.php', … … 88 92 'HCaptcha\\MemberPress\\Register' => $baseDir . '/src/php/MemberPress/Register.php', 89 93 'HCaptcha\\Migrations\\Migrations' => $baseDir . '/src/php/Migrations/Migrations.php', 94 'HCaptcha\\NF\\Base' => $baseDir . '/src/php/NF/Base.php', 90 95 'HCaptcha\\NF\\Field' => $baseDir . '/src/php/NF/Field.php', 91 96 'HCaptcha\\NF\\NF' => $baseDir . '/src/php/NF/NF.php', -
hcaptcha-for-forms-and-more/trunk/vendor/composer/autoload_real.php
r3129246 r3143189 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit a6c3d020c47c988d11030e9a250364705 class ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit a6c3d020c47c988d11030e9a25036470', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit02b6959c9a88d67618a6c0c1eb5fcc5f', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit a6c3d020c47c988d11030e9a25036470::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::getInitializer($loader)); 31 31 32 32 $loader->setClassMapAuthoritative(true); -
hcaptcha-for-forms-and-more/trunk/vendor/composer/autoload_static.php
r3129246 r3143189 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit a6c3d020c47c988d11030e9a250364707 class ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 51 51 'HCaptcha\\Avada\\Form' => __DIR__ . '/../..' . '/src/php/Avada/Form.php', 52 52 'HCaptcha\\BBPress\\Base' => __DIR__ . '/../..' . '/src/php/BBPress/Base.php', 53 'HCaptcha\\BBPress\\Login' => __DIR__ . '/../..' . '/src/php/BBPress/Login.php', 54 'HCaptcha\\BBPress\\LostPassword' => __DIR__ . '/../..' . '/src/php/BBPress/LostPassword.php', 53 55 'HCaptcha\\BBPress\\NewTopic' => __DIR__ . '/../..' . '/src/php/BBPress/NewTopic.php', 56 'HCaptcha\\BBPress\\Register' => __DIR__ . '/../..' . '/src/php/BBPress/Register.php', 54 57 'HCaptcha\\BBPress\\Reply' => __DIR__ . '/../..' . '/src/php/BBPress/Reply.php', 55 58 'HCaptcha\\BackInStockNotifier\\Form' => __DIR__ . '/../..' . '/src/php/BackInStockNotifier/Form.php', … … 99 102 'HCaptcha\\HTMLForms\\Form' => __DIR__ . '/../..' . '/src/php/HTMLForms/Form.php', 100 103 'HCaptcha\\Helpers\\HCaptcha' => __DIR__ . '/../..' . '/src/php/Helpers/HCaptcha.php', 104 'HCaptcha\\Helpers\\Pages' => __DIR__ . '/../..' . '/src/php/Helpers/Pages.php', 101 105 'HCaptcha\\Helpers\\Request' => __DIR__ . '/../..' . '/src/php/Helpers/Request.php', 102 106 'HCaptcha\\Jetpack\\JetpackBase' => __DIR__ . '/../..' . '/src/php/Jetpack/JetpackBase.php', … … 116 120 'HCaptcha\\MemberPress\\Register' => __DIR__ . '/../..' . '/src/php/MemberPress/Register.php', 117 121 'HCaptcha\\Migrations\\Migrations' => __DIR__ . '/../..' . '/src/php/Migrations/Migrations.php', 122 'HCaptcha\\NF\\Base' => __DIR__ . '/../..' . '/src/php/NF/Base.php', 118 123 'HCaptcha\\NF\\Field' => __DIR__ . '/../..' . '/src/php/NF/Field.php', 119 124 'HCaptcha\\NF\\NF' => __DIR__ . '/../..' . '/src/php/NF/NF.php', … … 191 196 { 192 197 return \Closure::bind(function () use ($loader) { 193 $loader->prefixLengthsPsr4 = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$prefixLengthsPsr4;194 $loader->prefixDirsPsr4 = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$prefixDirsPsr4;195 $loader->classMap = ComposerStaticInit a6c3d020c47c988d11030e9a25036470::$classMap;198 $loader->prefixLengthsPsr4 = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$prefixLengthsPsr4; 199 $loader->prefixDirsPsr4 = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$prefixDirsPsr4; 200 $loader->classMap = ComposerStaticInit02b6959c9a88d67618a6c0c1eb5fcc5f::$classMap; 196 201 197 202 }, null, ClassLoader::class); -
hcaptcha-for-forms-and-more/trunk/vendor/composer/installed.php
r3129246 r3143189 2 2 'root' => array( 3 3 'name' => 'hcaptcha/hcaptcha-wordpress-plugin', 4 'pretty_version' => '4. 4.0',5 'version' => '4. 4.0.0',6 'reference' => ' 25bdd39c5629233960c20655da571516f475acb3',4 'pretty_version' => '4.5.0', 5 'version' => '4.5.0.0', 6 'reference' => '0ba34f4533d55163e1ba8af8e119a49ec192be45', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'hcaptcha/hcaptcha-wordpress-plugin' => array( 14 'pretty_version' => '4. 4.0',15 'version' => '4. 4.0.0',16 'reference' => ' 25bdd39c5629233960c20655da571516f475acb3',14 'pretty_version' => '4.5.0', 15 'version' => '4.5.0.0', 16 'reference' => '0ba34f4533d55163e1ba8af8e119a49ec192be45', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.