diff --git a/cleantalk.php b/cleantalk.php index 30dda1f11..1cad49eb8 100644 --- a/cleantalk.php +++ b/cleantalk.php @@ -3171,6 +3171,11 @@ function apbctGetContactsEncoder() $contacts_encoder_params->obfuscation_text = $apbct->settings['data__email_decoder_obfuscation_custom_text']; $contacts_encoder_params->do_encode_emails = (int)$apbct->settings['data__email_decoder_encode_email_addresses']; $contacts_encoder_params->do_encode_phones = (int)$apbct->settings['data__email_decoder_encode_phone_numbers']; + $contacts_encoder_params->excluded_strings = \Cleantalk\Common\ContactsEncoder\Exclusions\ExclusionsService::parseExcludedStrings( + isset($apbct->settings['data__email_decoder_excluded_strings']) + ? $apbct->settings['data__email_decoder_excluded_strings'] + : '' + ); return ContactsEncoder::getInstance($contacts_encoder_params); } diff --git a/css/cleantalk-admin-settings-page.min.css b/css/cleantalk-admin-settings-page.min.css index eaa208fd8..dbba03e03 100644 --- a/css/cleantalk-admin-settings-page.min.css +++ b/css/cleantalk-admin-settings-page.min.css @@ -1 +1 @@ -.apbct_settings-page{padding-right:10px}.apbct_settings-field_content,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px 0}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%;padding-bottom:10px}.apbct_settings-field_title--select,.apbct_settings-field_title--textarea{margin:0;width:210px;padding-right:10px;padding-bottom:10px;font-size:14px;vertical-align:top}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;display:inline-block;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-auto.cleantalk_link_text_center{text-align:center}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;display:inline-block;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}.apbct-icon-upload-cloud{margin-left:3px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{display:inline-block;position:relative;padding:5px;margin:4px;border:3px solid #f03232;border-radius:5px;background-color:#ffc8c8}.ct_settings_banner{text-align:right;display:inline-block;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{display:inline-block;width:370px;margin-right:3em;padding:.8em .8em 15px .8em;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a{color:#78c8e6}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block;margin:0 auto;font-size:25px;line-height:20px;color:#78c8e6;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:#78c8e6;margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.--invisible{visibility:hidden}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.key_changed_success{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content{text-align:center}#cleantalk-modal-content>*{display:block;width:100%}.cleantalk-confirm-modal_header{font-size:15px;font-weight:500}.cleantalk-confirm-modal_text-block{padding:10px 0}.cleantalk-confirm-modal_buttons-block{display:flex!important;gap:10px;justify-content:center}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0 none;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:0;width:200px}#apbct_hidden_section_nav ul{z-index:9999;width:100%;top:40px}.apbct_settings__position_main_save_button{text-align:right;margin-right:40px}#apbct_settings__after_advanced_settings{margin-bottom:20px;width:70%}#apbct_settings__button_section{position:static;z-index:9999;padding-bottom:40px;bottom:0}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}.apbct_notification__advanced_settings{margin:20px 0;font-weight:400}.apbct_settings_top_info__div{float:right;padding:0 20px 0 0;font-size:13px;position:relative}.apbct_settings_top_info__p{padding:0;margin:2px}.apbct_settings_top_info__btn{display:inline-flex;gap:10px}.apbct_hidden_section_nav_mob_btn{display:none;background-image:url(images/menu.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center}.apbct_hidden_section_nav_mob_btn-close{display:none}.apbct_settings__footer{background:#c2c2c2;position:absolute;left:0;padding-bottom:30px;padding-left:21px;z-index:-1}.apbct_settings_top_info__sub_btn{display:flex;flex-wrap:wrap;gap:10px;margin:15px 0}.apbct_settings__key_line{display:flex;align-items:center;justify-content:flex-start;flex-direction:row}.apbct_settings__key_line__elements{margin-right:10px}.apbct_setting__key_line__buttons{margin:0}.apbct_setting__key_line__get_key_manual_chunk{margin:10px 0 10px 0;border:1px solid #d3d3d3;border-radius:3px;padding:10px;background:#fff}.apbct_settings__key_line__service_block{margin-left:10px}#apbct_settings__public_offer{margin-top:10px;display:flex;align-items:center}#cleantalk_apikey_wrapper{max-width:65%}.apcbt_contact_data_encoder__line{max-width:70%;display:flex;flex-wrap:wrap;flex-direction:row}.apbct_warning_red_point{display:inline-block;width:4px;height:4px;background:red;border-radius:100%;margin:0 10px 3px 3px;vertical-align:middle;position:relative}.apbct_warning_red_point::after{content:'';position:absolute;left:50%;top:50%;width:12px;height:12px;border:1.5px solid rgba(255,2,2,.65);border-radius:50%;animation:apbct_pulsate 1.2s ease-out infinite;opacity:.7;pointer-events:none;transform:translate(-50%,-50%)}#apbct_summary_and_support{display:flex;flex-wrap:wrap;width:-webkit-fill-available;border:1px solid #ddd;border-radius:3px;padding:10px;background:#ededed;margin-top:4em}#apbct_summary_and_support-left_side{width:69%;padding:0 20px 0 0}#apbct_summary_and_support-right_side{width:31%;padding:0 20px;border-left:1px solid #dcdcde}#apbct_summary_and_support-sides_wrap{display:flex;flex-direction:row;margin:10px 0 10px;width:100%}.apbct_summary_and_support-side_header{margin:.5em 0}.apbct_summary_and_support-inner_header{margin:2em 0 .5em;font-size:medium}.apbct_summary_and_support-inner_header::after{content:'';display:block;width:100%;height:1px;background:linear-gradient(90deg,#d3d3d357 0,rgba(211,211,211,.14) 10%,transparent 100%);margin-top:5px}.apbct_summary_and_support-support_buttons_wrapper{display:flex;flex-direction:column}#apbct_summary_and_support-create_user_button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.apbct_summary_and_support-user_creation_result{background:#eee;margin-top:10px;padding:5px;border:1px solid #d3d3d3;display:none}.apbct_summary-list_of_items{display:flex;flex-direction:column}.apbct_summary_list_item{margin-bottom:2px}.apbct-green{color:green}.apbct-red{color:red}#apbct_negative_reports_table{width:100%;border-collapse:collapse;margin:10px 5px}#apbct_sending_report_div{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;flex-wrap:nowrap}#apbct_sending_report_disabled_notice{margin-right:5px}.apbct-real-user-popup-img{align-self:start;margin:0!important;height:1.1em;vertical-align:initial}@keyframes apbct_pulsate{0%{transform:translate(-50%,-50%) scale(1);opacity:.7}100%{transform:translate(-50%,-50%) scale(1.5);opacity:0}}@media (max-width:768px){.apbct_settings_top_info__btn{display:inline-grid;width:100%;gap:5px}#apbct_settings__advanced_settings_inner,#apbct_settings__after_advanced_settings{width:100%}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:100%}.apbct_settings_top_info__sub_btn .apbct_bottom_links--left,.apbct_settings_top_info__sub_btn .apbct_bottom_links--other{margin-left:0;margin-right:0}#apbct_hidden_section_nav ul{display:none;background-color:#dadee3bd;margin:0;padding:10px;border-radius:3px;right:0;width:auto}#apbct_hidden_section_nav{right:0;min-width:167px}.apbct_setting_radio::before{height:6px!important;width:6px!important;margin:4px!important}.apbct_setting_checkbox::before{height:15px!important;width:15px!important;margin:0 -.05rem!important}.apbct_setting_checkbox,.apbct_setting_radio{height:16px!important;width:16px!important}.apbct_hidden_section_nav_mob_btn{display:block;width:32px;height:28px;right:20px;top:20px;position:fixed}.apbct_hidden_section_nav_mob_btn-close{display:block;position:relative;float:right;width:20px;height:22px;top:-5px;right:-5px;background-image:url(images/cancel.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center;text-align:center}.apbct_long_desc{left:-2%!important;max-width:95%;margin-top:10%}.apbct_long_desc__angle{display:none}.ct_rate_block{max-width:240px;margin-right:20px}.apbct_settings__key_line{display:flex;align-items:flex-start;flex-direction:column;width:100%}.apbct_settings__key_line__elements{margin:5px 0 5px 0}#apbct_setting_apikey,.apbct_setting__key_line__buttons,.apbct_settings__key_line__elements{width:100%}#cleantalk_apikey_wrapper{max-width:100%}#apbct_settings__button_section{position:fixed;right:20px}.apcbt_contact_data_encoder__line{max-width:100%;margin-top:5px}#apbct_summary_and_support-right_side{border-top:1px solid #dcdcde;border-left:0;margin:35px 0 0;padding:0;width:-webkit-fill-available}#apbct_summary_and_support-left_side{border-top:1px solid #dcdcde;width:-webkit-fill-available}#apbct_summary_and_support-sides_wrap{flex-direction:column}}.apbct-trial-renew-fullpage{display:flex;position:fixed;width:stretch;top:0;bottom:0;overflow-y:auto;justify-content:center;align-items:flex-start;font-family:Inter,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;color:#444;background-color:#f0f0f0;z-index:99}.apbct-trial-renew-fullpage-notice{padding:32px 64px 64px 64px!important;margin-top:5em!important;margin-bottom:5em!important}.apbct-trial-renew-fullpage-body{margin-top:32px;margin-left:32px}.apbct-banner-header{display:flex;justify-content:space-between}.apbct-trial-renew-fullpage-body .apbct-banner-button-wrapper{display:flex;margin:0}.apbct-trial-renew-fullpage-image{flex:1 1 0;min-width:0;max-width:576px;height:auto;object-fit:contain;margin:auto 0;align-self:flex-start}.apbct-banner-desc-block-row{line-height:22px}.apbct-banner-red-point{display:inline-block;width:8px;height:8px;background-color:#bb3323;border-radius:50%;margin-right:8px;vertical-align:middle}.apbct-banner-error{background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-banner-background-container{display:grid;max-width:644px;gap:16px;padding:32px;background-color:#f3f6f9;border-radius:8px}.apbct-banner-desc-block-title{font-size:18px;font-weight:700;line-height:22px;color:#0a0a0a;margin-bottom:8px}.apbct-banner-stat-value{margin-bottom:0;color:#444;vertical-align:middle}.apbct-banner-desc-block-text{font-size:14px;line-height:22px;color:#717182;margin-left:12px;margin-top:0;vertical-align:middle}.apbct-banner-desc-blocks{display:grid;gap:16px;flex:1 1 0;min-width:0}.apbct-banner-desc-blocks-content{display:flex;gap:72px;flex-wrap:wrap;justify-content:center;margin:32px 0}.apbct-banner-check{vertical-align:middle}.apbct-trial-renew-upgrade{display:none;text-align:center}.apbct-trial-renew-upgrade-link{font-size:16px;line-height:22px;letter-spacing:0;text-decoration:underline solid 0 #026e88!important;text-underline-offset:25%;color:#026e88!important}@media (max-width:1366px){.apbct-banner-header{display:grid;gap:16px}.apbct-banner-desc-blocks-content{display:grid;gap:38px;place-items:center}.apbct-trial-renew-upgrade{display:block}}@media (max-width:1200px){.apbct-banner-desc-blocks-content{gap:32px}}@media (max-width:782px){.apbct-trial-renew-fullpage{padding-top:50px;padding-bottom:50px}.apbct-trial-renew-fullpage-notice{padding:24px 24px 32px 24px!important}.apbct-trial-renew-fullpage-body{margin-top:20px;margin-left:0}.apbct-banner-desc-blocks-content{gap:24px}.apbct-banner-background-container{padding:20px}.apbct-trial-renew-fullpage-image{width:100%}}@media (max-width:480px){.apbct-trial-renew-fullpage-notice{padding:16px 12px 24px 12px!important}.apbct-banner-background-container{padding:16px}.apbct-banner-desc-blocks-content{gap:16px}.apbct-banner-desc-block-title{font-size:16px}} \ No newline at end of file +.apbct_settings-page{padding-right:10px}.apbct_settings-field_content,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px 0}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content{display:inline-block}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%;padding-bottom:10px}.apbct_settings-field_title--select,.apbct_settings-field_title--textarea{margin:0;width:210px;padding-right:10px;padding-bottom:10px;font-size:14px;vertical-align:top}.apbct_settings-field_title--with-help{width:auto;white-space:nowrap}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;display:inline-block;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-auto.cleantalk_link_text_center{text-align:center}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;display:inline-block;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}.apbct-icon-upload-cloud{margin-left:3px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{display:inline-block;position:relative;padding:5px;margin:4px;border:3px solid #f03232;border-radius:5px;background-color:#ffc8c8}.ct_settings_banner{text-align:right;display:inline-block;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{display:inline-block;width:370px;margin-right:3em;padding:.8em .8em 15px .8em;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a{color:#78c8e6}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block;margin:0 auto;font-size:25px;line-height:20px;color:#78c8e6;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:#78c8e6;margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.--invisible{visibility:hidden}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.key_changed_success{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content{text-align:center}#cleantalk-modal-content>*{display:block;width:100%}.cleantalk-confirm-modal_header{font-size:15px;font-weight:500}.cleantalk-confirm-modal_text-block{padding:10px 0}.cleantalk-confirm-modal_buttons-block{display:flex!important;gap:10px;justify-content:center}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0 none;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:0;width:200px}#apbct_hidden_section_nav ul{z-index:9999;width:100%;top:40px}.apbct_settings__position_main_save_button{text-align:right;margin-right:40px}#apbct_settings__after_advanced_settings{margin-bottom:20px;width:70%}#apbct_settings__button_section{position:static;z-index:9999;padding-bottom:40px;bottom:0}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}.apbct_notification__advanced_settings{margin:20px 0;font-weight:400}.apbct_settings_top_info__div{float:right;padding:0 20px 0 0;font-size:13px;position:relative}.apbct_settings_top_info__p{padding:0;margin:2px}.apbct_settings_top_info__btn{display:inline-flex;gap:10px}.apbct_hidden_section_nav_mob_btn{display:none;background-image:url(images/menu.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center}.apbct_hidden_section_nav_mob_btn-close{display:none}.apbct_settings__footer{background:#c2c2c2;position:absolute;left:0;padding-bottom:30px;padding-left:21px;z-index:-1}.apbct_settings_top_info__sub_btn{display:flex;flex-wrap:wrap;gap:10px;margin:15px 0}.apbct_settings__key_line{display:flex;align-items:center;justify-content:flex-start;flex-direction:row}.apbct_settings__key_line__elements{margin-right:10px}.apbct_setting__key_line__buttons{margin:0}.apbct_setting__key_line__get_key_manual_chunk{margin:10px 0 10px 0;border:1px solid #d3d3d3;border-radius:3px;padding:10px;background:#fff}.apbct_settings__key_line__service_block{margin-left:10px}#apbct_settings__public_offer{margin-top:10px;display:flex;align-items:center}#cleantalk_apikey_wrapper{max-width:65%}.apcbt_contact_data_encoder__line{max-width:70%;display:flex;flex-wrap:wrap;flex-direction:row}.apbct_warning_red_point{display:inline-block;width:4px;height:4px;background:red;border-radius:100%;margin:0 10px 3px 3px;vertical-align:middle;position:relative}.apbct_warning_red_point::after{content:'';position:absolute;left:50%;top:50%;width:12px;height:12px;border:1.5px solid rgba(255,2,2,.65);border-radius:50%;animation:apbct_pulsate 1.2s ease-out infinite;opacity:.7;pointer-events:none;transform:translate(-50%,-50%)}#apbct_summary_and_support{display:flex;flex-wrap:wrap;width:-webkit-fill-available;border:1px solid #ddd;border-radius:3px;padding:10px;background:#ededed;margin-top:4em}#apbct_summary_and_support-left_side{width:69%;padding:0 20px 0 0}#apbct_summary_and_support-right_side{width:31%;padding:0 20px;border-left:1px solid #dcdcde}#apbct_summary_and_support-sides_wrap{display:flex;flex-direction:row;margin:10px 0 10px;width:100%}.apbct_summary_and_support-side_header{margin:.5em 0}.apbct_summary_and_support-inner_header{margin:2em 0 .5em;font-size:medium}.apbct_summary_and_support-inner_header::after{content:'';display:block;width:100%;height:1px;background:linear-gradient(90deg,#d3d3d357 0,rgba(211,211,211,.14) 10%,transparent 100%);margin-top:5px}.apbct_summary_and_support-support_buttons_wrapper{display:flex;flex-direction:column}#apbct_summary_and_support-create_user_button{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.apbct_summary_and_support-user_creation_result{background:#eee;margin-top:10px;padding:5px;border:1px solid #d3d3d3;display:none}.apbct_summary-list_of_items{display:flex;flex-direction:column}.apbct_summary_list_item{margin-bottom:2px}.apbct-green{color:green}.apbct-red{color:red}#apbct_negative_reports_table{width:100%;border-collapse:collapse;margin:10px 5px}#apbct_sending_report_div{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;flex-wrap:nowrap}#apbct_sending_report_disabled_notice{margin-right:5px}.apbct-real-user-popup-img{align-self:start;margin:0!important;height:1.1em;vertical-align:initial}@keyframes apbct_pulsate{0%{transform:translate(-50%,-50%) scale(1);opacity:.7}100%{transform:translate(-50%,-50%) scale(1.5);opacity:0}}@media (max-width:768px){.apbct_settings_top_info__btn{display:inline-grid;width:100%;gap:5px}#apbct_settings__advanced_settings_inner,#apbct_settings__after_advanced_settings{width:100%}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:100%}.apbct_settings_top_info__sub_btn .apbct_bottom_links--left,.apbct_settings_top_info__sub_btn .apbct_bottom_links--other{margin-left:0;margin-right:0}#apbct_hidden_section_nav ul{display:none;background-color:#dadee3bd;margin:0;padding:10px;border-radius:3px;right:0;width:auto}#apbct_hidden_section_nav{right:0;min-width:167px}.apbct_setting_radio::before{height:6px!important;width:6px!important;margin:4px!important}.apbct_setting_checkbox::before{height:15px!important;width:15px!important;margin:0 -.05rem!important}.apbct_setting_checkbox,.apbct_setting_radio{height:16px!important;width:16px!important}.apbct_hidden_section_nav_mob_btn{display:block;width:32px;height:28px;right:20px;top:20px;position:fixed}.apbct_hidden_section_nav_mob_btn-close{display:block;position:relative;float:right;width:20px;height:22px;top:-5px;right:-5px;background-image:url(images/cancel.svg);background-repeat:no-repeat;background-size:contain;background-position-y:center;text-align:center}.apbct_long_desc{left:-2%!important;max-width:95%;margin-top:10%}.apbct_long_desc__angle{display:none}.ct_rate_block{max-width:240px;margin-right:20px}.apbct_settings__key_line{display:flex;align-items:flex-start;flex-direction:column;width:100%}.apbct_settings__key_line__elements{margin:5px 0 5px 0}#apbct_setting_apikey,.apbct_setting__key_line__buttons,.apbct_settings__key_line__elements{width:100%}#cleantalk_apikey_wrapper{max-width:100%}#apbct_settings__button_section{position:fixed;right:20px}.apcbt_contact_data_encoder__line{max-width:100%;margin-top:5px}#apbct_summary_and_support-right_side{border-top:1px solid #dcdcde;border-left:0;margin:35px 0 0;padding:0;width:-webkit-fill-available}#apbct_summary_and_support-left_side{border-top:1px solid #dcdcde;width:-webkit-fill-available}#apbct_summary_and_support-sides_wrap{flex-direction:column}}.apbct-trial-renew-fullpage{display:flex;position:fixed;width:stretch;top:0;bottom:0;overflow-y:auto;justify-content:center;align-items:flex-start;font-family:Inter,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;color:#444;background-color:#f0f0f0;z-index:99}.apbct-trial-renew-fullpage-notice{padding:32px 64px 64px 64px!important;margin-top:5em!important;margin-bottom:5em!important}.apbct-trial-renew-fullpage-body{margin-top:32px;margin-left:32px}.apbct-banner-header{display:flex;justify-content:space-between}.apbct-trial-renew-fullpage-body .apbct-banner-button-wrapper{display:flex;margin:0}.apbct-trial-renew-fullpage-image{flex:1 1 0;min-width:0;max-width:576px;height:auto;object-fit:contain;margin:auto 0;align-self:flex-start}.apbct-banner-desc-block-row{line-height:22px}.apbct-banner-red-point{display:inline-block;width:8px;height:8px;background-color:#bb3323;border-radius:50%;margin-right:8px;vertical-align:middle}.apbct-banner-error{background-color:#fff!important;box-shadow:0 4px 15px #84848440!important;border-left-color:#bb3323!important}.apbct-banner-background-container{display:grid;max-width:644px;gap:16px;padding:32px;background-color:#f3f6f9;border-radius:8px}.apbct-banner-desc-block-title{font-size:18px;font-weight:700;line-height:22px;color:#0a0a0a;margin-bottom:8px}.apbct-banner-stat-value{margin-bottom:0;color:#444;vertical-align:middle}.apbct-banner-desc-block-text{font-size:14px;line-height:22px;color:#717182;margin-left:12px;margin-top:0;vertical-align:middle}.apbct-banner-desc-blocks{display:grid;gap:16px;flex:1 1 0;min-width:0}.apbct-banner-desc-blocks-content{display:flex;gap:72px;flex-wrap:wrap;justify-content:center;margin:32px 0}.apbct-banner-check{vertical-align:middle}.apbct-trial-renew-upgrade{display:none;text-align:center}.apbct-trial-renew-upgrade-link{font-size:16px;line-height:22px;letter-spacing:0;text-decoration:underline solid 0 #026e88!important;text-underline-offset:25%;color:#026e88!important}@media (max-width:1366px){.apbct-banner-header{display:grid;gap:16px}.apbct-banner-desc-blocks-content{display:grid;gap:38px;place-items:center}.apbct-trial-renew-upgrade{display:block}}@media (max-width:1200px){.apbct-banner-desc-blocks-content{gap:32px}}@media (max-width:782px){.apbct-trial-renew-fullpage{padding-top:50px;padding-bottom:50px}.apbct-trial-renew-fullpage-notice{padding:24px 24px 32px 24px!important}.apbct-trial-renew-fullpage-body{margin-top:20px;margin-left:0}.apbct-banner-desc-blocks-content{gap:24px}.apbct-banner-background-container{padding:20px}.apbct-trial-renew-fullpage-image{width:100%}}@media (max-width:480px){.apbct-trial-renew-fullpage-notice{padding:16px 12px 24px 12px!important}.apbct-banner-background-container{padding:16px}.apbct-banner-desc-blocks-content{gap:16px}.apbct-banner-desc-block-title{font-size:16px}} \ No newline at end of file diff --git a/css/src/cleantalk-admin-settings-page.css b/css/src/cleantalk-admin-settings-page.css index 8b307d064..2922bd8a6 100644 --- a/css/src/cleantalk-admin-settings-page.css +++ b/css/src/cleantalk-admin-settings-page.css @@ -59,6 +59,10 @@ i.animate-spin { font-size: 14px; vertical-align: top; } +.apbct_settings-field_title--with-help{ + width: auto; + white-space: nowrap; +} .apbct_settings-field_title--radio{ display: inline-block; margin: 0; diff --git a/inc/cleantalk-settings.php b/inc/cleantalk-settings.php index f62950ca4..69b0ca5ea 100644 --- a/inc/cleantalk-settings.php +++ b/inc/cleantalk-settings.php @@ -659,7 +659,8 @@ function apbct_settings__set_fields() 'data__email_decoder_obfuscation_mode', 'data__email_decoder_obfuscation_custom_text', 'data__email_decoder_encode_phone_numbers', - 'data__email_decoder_encode_email_addresses' + 'data__email_decoder_encode_email_addresses', + 'data__email_decoder_excluded_strings' ), 'long_description' => true, ), @@ -676,6 +677,14 @@ function apbct_settings__set_fields() 'parent' => 'data__email_decoder', 'long_description' => true, ), + 'data__email_decoder_excluded_strings' => array( + 'type' => 'textarea', + 'title' => __('Do not encode these contacts', 'cleantalk-spam-protect'), + 'description' => ContactsEncoder::getExcludedStringsDescription(), + 'parent' => 'data__email_decoder', + 'class' => 'apbct_settings-field_wrapper--sub', + 'long_description' => true, + ), 'data__email_decoder_obfuscation_mode' => array( 'title' => __('Encoder obfuscation mode', 'cleantalk-spam-protect'), 'description' => ContactsEncoder::getObfuscationModesDescription(), @@ -2382,6 +2391,7 @@ function apbct_settings__validate($incoming_settings) 'data__email_decoder_obfuscation_mode', 'data__email_decoder_obfuscation_custom_text', 'data__email_decoder_buffer', + 'data__email_decoder_excluded_strings', ); $incoming_settings = apbct_settings__keep_settings_state_values( $incoming_settings, @@ -2716,6 +2726,12 @@ function apbct_settings__validate($incoming_settings) $incoming_settings['data__email_decoder_obfuscation_custom_text'] = ContactsEncoder::getDefaultReplacingText(); } + $incoming_settings['data__email_decoder_excluded_strings'] = apbct_settings__sanitize__excluded_contact_strings( + isset($incoming_settings['data__email_decoder_excluded_strings']) + ? $incoming_settings['data__email_decoder_excluded_strings'] + : '' + ); + //sync discussion and plugin settings if (isset($incoming_settings['cleantalk_allowed_moderation'])) { update_option('cleantalk_allowed_moderation', TT::toString($incoming_settings['cleantalk_allowed_moderation'], '0')); @@ -3264,6 +3280,32 @@ function apbct_settings__sanitize__exclusions($exclusions, $regexp = false, $url } } +/** + * Sanitize the Contacts Encoder skip-list: one value per line, max 20 items, 128 chars each. + * + * @param mixed $exclusions + * + * @return string + */ +function apbct_settings__sanitize__excluded_contact_strings($exclusions) +{ + if ( ! is_string($exclusions) ) { + return ''; + } + + $parts = \Cleantalk\Common\ContactsEncoder\Exclusions\ExclusionsService::parseExcludedStrings($exclusions); + $parts = array_slice($parts, 0, 20); + $result = array(); + foreach ( $parts as $part ) { + $part = trim(substr($part, 0, 128), " \n\r\t\v\x00"); + if ( $part !== '' ) { + $result[] = $part; + } + } + + return implode("\n", array_values(array_unique($result))); +} + function apbct_settings__get__long_description() { global $apbct; @@ -3434,6 +3476,10 @@ function apbct_settings__get_long_descriptions_data() 'title' => __('Contact data encoding: phone numbers', 'cleantalk-spam-protect'), 'desc' => ContactsEncoder::getPhonesEncodingLongDescription(), ), + 'data__email_decoder_excluded_strings' => array( + 'title' => __('Contact data encoding: do not encode these contacts', 'cleantalk-spam-protect'), + 'desc' => ContactsEncoder::getExcludedStringsLongDescription(), + ), 'data__email_decoder' => array( 'title' => __('Contact data encoding', 'cleantalk-spam-protect'), 'desc' => ContactsEncoder::getEmailEncoderCommonLongDescription(), diff --git a/js/cleantalk-admin-settings-page.min.js b/js/cleantalk-admin-settings-page.min.js index f8bd99837..012ff03aa 100644 --- a/js/cleantalk-admin-settings-page.min.js +++ b/js/cleantalk-admin-settings-page.min.js @@ -1,2 +1,2 @@ -let __=wp.i18n.__;function handleAnchorDetection(t){"none"===document.querySelector("#apbct_settings__advanced_settings").style.display&&apbctExceptedShowHide("apbct_settings__advanced_settings"),scrollToAnchor("#"+t)}function scrollToAnchor(t){t=document.querySelector(t);t&&t.scrollIntoView({block:"end"})}function apbctManageEmailEncoderCustomTextField(){var t=document.querySelector("#apbct_setting_data__email_decoder_obfuscation_custom_text");let e;null!==t&&(e=void 0!==t.parentElement?t.parentElement:null),document.querySelectorAll(".apbct_setting---data__email_decoder_obfuscation_mode").forEach(t=>{e&&t.checked&&"replace"!==t.value&&e.classList.add("hidden"),t.addEventListener("click",t=>{void 0!==e&&("replace"===t.target.value?e.classList.remove("hidden"):e.classList.add("hidden"))})})}function apbctManageAntiCrawlerDependency(){let e=document.querySelector("#apbct_setting_sfw__anti_crawler"),n=document.querySelector("#apbct_setting_sfw__enabled");e&&n&&e.addEventListener("change",()=>{var t;e.checked&&!n.checked&&(n.checked=!0,null!==(t=n.getAttribute("apbct_children")))&&apbctSettingsDependencies(t,1)})}function apbctBannerCheck(){let c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbctGetElems(a){for(let t=0,e=(a=a.split(",")).length,n;t{document.getElementById(t)&&"none"!==document.getElementById(t).style.display&&apbctShowHideElem(t)})}function apbctShowRequiredGroups(t,e){var n=document.getElementById("apbct_settings__dwpms_settings");n&&"none"===n.style.display&&((n=t).preventDefault(),apbctShowHideElem("apbct_settings__dwpms_settings"),document.getElementById(e).dispatchEvent(new n.constructor(n.type,n)))}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbctGetElemsNative(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependenciesGetState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependenciesGetState(t){let e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function onApbctCookieTypeChange(t){t=t?.target?.value?.toString()||null;null===t||"1"!==t&&"0"!==t||(cleantalkModal.loaded=!1,cleantalkModal.open(!1),cleantalkModal.confirm(__("Attention!","cleantalk-spam-protect"),__("Cache solutions detected. ","cleantalk-spam-protect")+__("Switching cookie mode to 'On' or 'Off' may affect filtering quality. ","cleantalk-spam-protect")+__("The recommended setting is 'Auto'.","cleantalk-spam-protect"),"",t=>{!0===t&&jQuery("#apbct_setting_data__set_cookies__Auto").click()},__('Set to "Auto"',"cleantalk-spam-protect"),__("Confirm mode change","cleantalk-spam-protect")))}function apbctSettingsShowDescription(t,e){function c(t){var e=0!=jQuery(t.target).parent(".apbct_long_desc").length,t=jQuery(t.target).hasClass("apbct_long_desc__cancel");(0");var n=jQuery("#apbct_long_desc__"+e);n.append("").append("
").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){t&&t.title&&t.desc&&(a.empty().append("
").append("").append("

"+t.title+"

").append("

"+t.desc+"

"),jQuery(document).on("click",c))}},n)}function apbctNavigationMenuPosition(){var t,e,n=document.querySelector("#apbct_hidden_section_nav ul"),a=document.querySelector("#apbct_settings__button_section");n&&a&&(t=window.scrollY,e=window.innerWidth,1e3"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");let n={};if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var a=e.val();if(""===a)return void e.css("border-color","red");n={template_name:a}}else n={template_id:t.data("id")};let c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){let c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):document.location.reload())}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbctSettingsShowDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbctBannerCheck(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbctSaveButtonPosition();let t;window.addEventListener("scroll",function(){clearTimeout(t),t=setTimeout(function(){apbctSaveButtonPosition()},50),apbctNavigationMenuPosition()}),jQuery("#ct_adv_showhide a").on("click",apbctSaveButtonPosition),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val(),e=(jQuery("#apbct_settings__key_line__save_settings").off("click"),""!==t&&null===t.match(/^[a-z\d]{8,30}\s*$/));jQuery("#apbct_settings__key_is_bad").hide(),jQuery("#apbct_showApiKey").hide(),jQuery("#apbct_settings__account_name_ob").hide(),""===t?(jQuery("#apbct_button__key_line__save_changes_wrapper").hide(),jQuery("#apbct_button__get_key_auto").length&&jQuery("#apbct_button__get_key_auto__wrapper").show()):(jQuery("#apbct_button__key_line__save_changes_wrapper").show(),jQuery("#apbct_button__get_key_auto__wrapper").hide(),e&&jQuery("#apbct_settings__key_line__save_settings").on("click",function(t){t.preventDefault(),jQuery("#apbct_settings__key_is_bad").show(),apbctHighlightElement("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||ctSettingsPage.ip_license||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("

Synchronization process failed. Please, check the acces key and restart the synch.

").insertAfter(jQuery("#apbct_button__sync")),apbctHighlightElement("apbct_setting_apikey",3),apbctHighlightElement("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();let e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))}),jQuery('button[id*="apbct-action-adjust-change-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_change"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-change-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),jQuery('button[id*="apbct-action-adjust-reverse-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_reverse"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-reverse-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),document.querySelector(".apbct_hidden_section_nav_mob_btn")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="block",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="none"}),document.querySelector(".apbct_hidden_section_nav_mob_btn-close")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="none",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="block"}),apbctManageEmailEncoderCustomTextField(),apbctManageAntiCrawlerDependency(),window.location.hash&&handleAnchorDetection(window.location.hash.substring(1)),jQuery("body").on("click",".apbct-trial-renew-fullpage .notice-dismiss",function(t){t.preventDefault(),sessionStorage.setItem("apbct_trial_fullpage_dismissed","1"),jQuery(".apbct-trial-renew-fullpage").hide(),jQuery("#apbct-settings-page-wrap").show()})}); +let __=wp.i18n.__;function handleAnchorDetection(t){"none"===document.querySelector("#apbct_settings__advanced_settings").style.display&&apbctExceptedShowHide("apbct_settings__advanced_settings"),scrollToAnchor("#"+t)}function scrollToAnchor(t){t=document.querySelector(t);t&&t.scrollIntoView({block:"end"})}function apbctManageEmailEncoderCustomTextField(){var t=document.querySelector("#apbct_setting_data__email_decoder_obfuscation_custom_text");let e;null!==t&&(e=void 0!==t.parentElement?t.parentElement:null),document.querySelectorAll(".apbct_setting---data__email_decoder_obfuscation_mode").forEach(t=>{e&&t.checked&&"replace"!==t.value&&e.classList.add("hidden"),t.addEventListener("click",t=>{void 0!==e&&("replace"===t.target.value?e.classList.remove("hidden"):e.classList.add("hidden"))})})}function apbctManageAntiCrawlerDependency(){let e=document.querySelector("#apbct_setting_sfw__anti_crawler"),n=document.querySelector("#apbct_setting_sfw__enabled");e&&n&&e.addEventListener("change",()=>{var t;e.checked&&!n.checked&&(n.checked=!0,null!==(t=n.getAttribute("apbct_children")))&&apbctSettingsDependencies(t,1)})}function apbctBannerCheck(){let c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbctGetElems(a){for(let t=0,e=(a=a.split(",")).length,n;t{document.getElementById(t)&&"none"!==document.getElementById(t).style.display&&apbctShowHideElem(t)})}function apbctShowRequiredGroups(t,e){var n=document.getElementById("apbct_settings__dwpms_settings");n&&"none"===n.style.display&&((n=t).preventDefault(),apbctShowHideElem("apbct_settings__dwpms_settings"),document.getElementById(e).dispatchEvent(new n.constructor(n.type,n)))}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbctGetElemsNative(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependenciesGetState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependenciesGetState(t){let e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function onApbctCookieTypeChange(t){t=t?.target?.value?.toString()||null;null===t||"1"!==t&&"0"!==t||(cleantalkModal.loaded=!1,cleantalkModal.open(!1),cleantalkModal.confirm(__("Attention!","cleantalk-spam-protect"),__("Cache-problem solutions detected in the environment. ","cleantalk-spam-protect")+__("Switching cookie mode to 'On' or 'Off' may affect filtering quality. ","cleantalk-spam-protect")+__("The recommended setting is 'Auto'.","cleantalk-spam-protect"),"",t=>{!0===t&&jQuery("#apbct_setting_data__set_cookies__Auto").click()},__('Set to "Auto"',"cleantalk-spam-protect"),__("Confirm mode change","cleantalk-spam-protect")))}function apbctSettingsShowDescription(t,e){function c(t){var e=0!=jQuery(t.target).parent(".apbct_long_desc").length,t=jQuery(t.target).hasClass("apbct_long_desc__cancel");(0");var n=jQuery("#apbct_long_desc__"+e);n.append("").append("
").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){t&&t.title&&t.desc&&(a.empty().append("
").append("").append("

"+t.title+"

").append("

"+t.desc+"

"),jQuery(document).on("click",c))}},n)}function apbctNavigationMenuPosition(){var t,e,n=document.querySelector("#apbct_hidden_section_nav ul"),a=document.querySelector("#apbct_settings__button_section");n&&a&&(t=window.scrollY,e=window.innerWidth,1e3"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");let n={};if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var a=e.val();if(""===a)return void e.css("border-color","red");n={template_name:a}}else n={template_id:t.data("id")};let c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){let c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):document.location.reload())}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbctSettingsShowDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbctBannerCheck(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbctSaveButtonPosition();let t;window.addEventListener("scroll",function(){clearTimeout(t),t=setTimeout(function(){apbctSaveButtonPosition()},50),apbctNavigationMenuPosition()}),jQuery("#ct_adv_showhide a").on("click",apbctSaveButtonPosition),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val(),e=(jQuery("#apbct_settings__key_line__save_settings").off("click"),""!==t&&null===t.match(/^[a-z\d]{8,30}\s*$/));jQuery("#apbct_settings__key_is_bad").hide(),jQuery("#apbct_showApiKey").hide(),jQuery("#apbct_settings__account_name_ob").hide(),""===t?(jQuery("#apbct_button__key_line__save_changes_wrapper").hide(),jQuery("#apbct_button__get_key_auto").length&&jQuery("#apbct_button__get_key_auto__wrapper").show()):(jQuery("#apbct_button__key_line__save_changes_wrapper").show(),jQuery("#apbct_button__get_key_auto__wrapper").hide(),e&&jQuery("#apbct_settings__key_line__save_settings").on("click",function(t){t.preventDefault(),jQuery("#apbct_settings__key_is_bad").show(),apbctHighlightElement("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||ctSettingsPage.ip_license||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("

Synchronization process failed. Please, check the acces key and restart the synch.

").insertAfter(jQuery("#apbct_button__sync")),apbctHighlightElement("apbct_setting_apikey",3),apbctHighlightElement("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();let e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))}),jQuery('button[id*="apbct-action-adjust-change-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_change"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-change-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),jQuery('button[id*="apbct-action-adjust-reverse-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_reverse"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-reverse-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),document.querySelector(".apbct_hidden_section_nav_mob_btn")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="block",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="none"}),document.querySelector(".apbct_hidden_section_nav_mob_btn-close")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="none",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="block"}),apbctManageEmailEncoderCustomTextField(),apbctManageAntiCrawlerDependency(),window.location.hash&&handleAnchorDetection(window.location.hash.substring(1)),jQuery("body").on("click",".apbct-trial-renew-fullpage .notice-dismiss",function(t){t.preventDefault(),sessionStorage.setItem("apbct_trial_fullpage_dismissed","1"),jQuery(".apbct-trial-renew-fullpage").hide(),jQuery("#apbct-settings-page-wrap").show()})}); //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map diff --git a/js/cleantalk-admin-settings-page.min.js.map b/js/cleantalk-admin-settings-page.min.js.map index 602793fdd..501ab4445 100644 --- a/js/cleantalk-admin-settings-page.min.js.map +++ b/js/cleantalk-admin-settings-page.min.js.map @@ -1 +1 @@ -{"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["const {__} = wp.i18n;\njQuery(document).ready(function() {\n // Crunch for Right to Left direction languages\n if (document.getElementsByClassName('apbct_settings-title')[0]) {\n if (getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl') {\n jQuery('.apbct_switchers').css('text-align', 'right');\n }\n }\n\n // Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(e) {\n e.preventDefault();\n jQuery(this).hide();\n jQuery('.apbct_settings-field--api_key').val(jQuery('.apbct_settings-field--api_key').attr('key'));\n jQuery('.apbct_settings-field--api_key+div').css('display', 'inline');\n });\n\n /**\n * Validate apikey and hide get auto btn\n */\n jQuery( document ).on('click', '#apbct_settings_templates_import_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n let templateNameInput = jQuery('#apbct_settings_templates_import_name');\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n let data = {\n 'template_id': optionSelected.data('id'),\n 'template_name': optionSelected.data('name'),\n 'settings': optionSelected.data('settings'),\n };\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_import', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Export settings\n jQuery( document ).on('click', '#apbct_settings_templates_export_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n let templateNameInput = jQuery('#apbct_settings_templates_export_name');\n let data = {};\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n if ( optionSelected.data('id') === 'new_template' ) {\n let templateName = templateNameInput.val();\n if ( templateName === '' ) {\n templateNameInput.css('border-color', 'red');\n return;\n }\n data = {\n 'template_name': templateName,\n };\n } else {\n data = {\n 'template_id': optionSelected.data('id'),\n };\n }\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_export', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Reset settings\n jQuery( document ).on('click', '#apbct_settings_templates_reset_button', function() {\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_reset'},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Sync button\n jQuery('#apbct_button__sync').on('click', function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_sync'},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__sync' ),\n spinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__sync .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__sync .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n if ( ctSettingsPage.key_changed ) {\n jQuery('.key_changed_sync').hide(300);\n jQuery('.key_changed_success').show(300);\n setTimeout(function() {\n document.location.reload();\n }, 3000);\n } else {\n document.location.reload();\n }\n }\n },\n },\n );\n });\n\n if ( ctSettingsPage.key_changed ) {\n jQuery('#apbct_button__sync').click();\n }\n\n jQuery(document).on('click', '.apbct_settings-long_description---show', function() {\n self = jQuery(this);\n apbctSettingsShowDescription(self, self.attr('setting'));\n });\n\n if (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length) {\n apbctBannerCheck();\n }\n\n jQuery(document).on('change', '#apbct_settings_templates_export', function() {\n let optionSelected = jQuery('option:selected', this);\n if ( optionSelected.data('id') === 'new_template' ) {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n } else {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n }\n });\n\n apbctSaveButtonPosition();\n let debounceTimer;\n window.addEventListener('scroll', function() {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(function() {\n apbctSaveButtonPosition();\n }, 50);\n apbctNavigationMenuPosition();\n });\n jQuery('#ct_adv_showhide a').on('click', apbctSaveButtonPosition);\n\n\n /**\n * Change cleantalk account email\n */\n jQuery('#apbct-change-account-email').on('click', function(e) {\n e.preventDefault();\n\n let $this = jQuery(this);\n let accountEmailField = jQuery('#apbct-account-email');\n let accountEmail = accountEmailField.text();\n\n $this.toggleClass('active');\n\n if ($this.hasClass('active')) {\n $this.text($this.data('save-text'));\n accountEmailField.attr('contenteditable', 'true');\n accountEmailField.on('keydown', function(e) {\n if (e.code === 'Enter') {\n e.preventDefault();\n }\n });\n accountEmailField.on('input', function(e) {\n if (e.inputType === 'insertParagraph') {\n e.preventDefault();\n }\n });\n } else {\n apbct_admin_sendAJAX(\n {\n action: 'apbct_update_account_email',\n accountEmail: accountEmail,\n },\n {\n timeout: 5000,\n callback: function(result, data, params, obj) {\n if (result.error !== undefined) {\n jQuery('#apbct-account-email').css('border-color', 'red');\n }\n },\n },\n );\n\n accountEmailField.attr('contenteditable', 'false');\n $this.text($this.data('default-text'));\n }\n });\n\n /**\n * Validate apkikey and hide get auto btn\n */\n jQuery('#apbct_setting_apikey').on('input', function() {\n let enteredValue = jQuery(this).val();\n jQuery('#apbct_settings__key_line__save_settings').off('click');\n let keyBad = enteredValue !== '' && enteredValue.match(/^[a-z\\d]{8,30}\\s*$/) === null;\n jQuery('#apbct_settings__key_is_bad').hide();\n jQuery('#apbct_showApiKey').hide();\n jQuery('#apbct_settings__account_name_ob').hide();\n if (enteredValue === '') {\n jQuery('#apbct_button__key_line__save_changes_wrapper').hide();\n if (jQuery('#apbct_button__get_key_auto').length) {\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n }\n } else {\n jQuery('#apbct_button__key_line__save_changes_wrapper').show();\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n if (keyBad) {\n jQuery('#apbct_settings__key_line__save_settings').on('click',\n function(e) {\n e.preventDefault();\n jQuery('#apbct_settings__key_is_bad').show();\n apbctHighlightElement('apbct_setting_apikey', 3);\n },\n );\n }\n }\n });\n\n if ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n }\n\n /**\n * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n */\n if ( !ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license ) {\n jQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n function(e) {\n e.preventDefault();\n if (!jQuery('#sync_required_notice').length) {\n jQuery( '

' +\n 'Synchronization process failed. Please, check the acces key and restart the synch.' +\n '

' ).insertAfter( jQuery('#apbct_button__sync') );\n }\n apbctHighlightElement('apbct_setting_apikey', 3);\n apbctHighlightElement('apbct_button__sync', 3);\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n },\n );\n }\n\n /**\n * Open WP gallery for adding custom logo\n */\n jQuery('#apbct-custom-logo-open-gallery').click(function(e) {\n e.preventDefault();\n\n const button = jQuery(this);\n\n const customUploader = wp.media({\n library: {\n type: 'image',\n },\n multiple: false,\n });\n\n customUploader.on('select', function() {\n const image = customUploader.state().get('selection').first().toJSON();\n\n button.parent().prev().attr( 'src', image.url );\n jQuery('#cleantalk_custom_logo').val( image.id );\n });\n\n customUploader.open();\n });\n\n /**\n * Remove selected logo\n */\n jQuery('#apbct-custom-logo-remove-image').click(function(e) {\n e.preventDefault();\n\n if ( true === confirm( 'Sure?' ) ) {\n const src = jQuery(this).parent().prev().data('src');\n jQuery(this).parent().prev().attr('src', src);\n jQuery(this).prev().prev().val('');\n }\n });\n\n jQuery('button[id*=\"apbct-action-adjust-change-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_change';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-change-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n jQuery('button[id*=\"apbct-action-adjust-reverse-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_reverse';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-reverse-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'block';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'none';\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn-close')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'none';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'block';\n });\n\n // Hide/show EmailEncoder replacing text textarea\n apbctManageEmailEncoderCustomTextField();\n\n // Turn SpamFireWall on with Anti-Crawler\n apbctManageAntiCrawlerDependency();\n\n if (window.location.hash) {\n const anchor = window.location.hash.substring(1);\n handleAnchorDetection(anchor);\n }\n\n // Fullpage trial/renew banner dismiss handler\n jQuery('body').on('click', '.apbct-trial-renew-fullpage .notice-dismiss', function(e) {\n e.preventDefault();\n sessionStorage.setItem('apbct_trial_fullpage_dismissed', '1');\n jQuery('.apbct-trial-renew-fullpage').hide();\n jQuery('#apbct-settings-page-wrap').show();\n });\n});\n\n/**\n * Detect ancors and open advanced settings before scroll\n * @param {string} anchor\n */\nfunction handleAnchorDetection(anchor) {\n let advSettings = document.querySelector('#apbct_settings__advanced_settings');\n if ( 'none' === advSettings.style.display ) {\n apbctExceptedShowHide('apbct_settings__advanced_settings');\n }\n scrollToAnchor('#' + anchor);\n}\n\n/**\n * Scroll to the target element ID\n * @param {string} anchorId Anchor target element ID\n */\nfunction scrollToAnchor(anchorId) {\n const targetElement = document.querySelector(anchorId);\n if (targetElement) {\n targetElement.scrollIntoView({\n block: 'end',\n });\n }\n}\n\n/**\n * Hide/show EmailEncoder replacing text textarea\n */\nfunction apbctManageEmailEncoderCustomTextField() {\n const replacingText = document\n .querySelector('#apbct_setting_data__email_decoder_obfuscation_custom_text');\n let replacingTextWrapperSub;\n if (replacingText !== null) {\n replacingTextWrapperSub = typeof replacingText.parentElement !== 'undefined' ?\n replacingText.parentElement :\n null;\n }\n document.querySelectorAll('.apbct_setting---data__email_decoder_obfuscation_mode').forEach((elem) => {\n // visibility set on saved settings\n if (replacingTextWrapperSub && elem.checked && elem.value !== 'replace') {\n replacingTextWrapperSub.classList.add('hidden');\n }\n // visibility set on change\n elem.addEventListener('click', (event) => {\n if (typeof replacingTextWrapperSub !== 'undefined') {\n if (event.target.value === 'replace') {\n replacingTextWrapperSub.classList.remove('hidden');\n } else {\n replacingTextWrapperSub.classList.add('hidden');\n }\n }\n });\n });\n}\n\n/**\n * Anti-Crawler is an add-on to SFW, so check SpamFireWall on enabling Anti-Crawler\n */\nfunction apbctManageAntiCrawlerDependency() {\n const antiCrawler = document.querySelector('#apbct_setting_sfw__anti_crawler');\n const spamFireWall = document.querySelector('#apbct_setting_sfw__enabled');\n if (!antiCrawler || !spamFireWall) {\n return;\n }\n antiCrawler.addEventListener('change', () => {\n if (! antiCrawler.checked || spamFireWall.checked) {\n return;\n }\n spamFireWall.checked = true;\n const childrens = spamFireWall.getAttribute('apbct_children');\n if (childrens !== null) {\n apbctSettingsDependencies(childrens, 1);\n }\n });\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbctBannerCheck() {\n let bannerChecker = setInterval( function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__check_renew_banner'},\n {\n callback: function(result, data, params, obj) {\n if (result.close_renew_banner) {\n if (jQuery('#cleantalk_notice_renew').length) {\n jQuery('#cleantalk_notice_renew').hide('slow');\n }\n if (jQuery('#cleantalk_notice_trial').length) {\n jQuery('#cleantalk_notice_trial').hide('slow');\n }\n clearInterval(bannerChecker);\n }\n },\n },\n );\n }, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param {string|array} elems\n * @return {*}\n */\nfunction apbctGetElems(elems) {\n elems = elems.split(',');\n for ( let i=0, len = elems.length, tmp; i < len; i++) {\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param {string|array} elems\n * @return {array}\n */\nfunction apbctGetElemsNative(elems) {\n // Make array from a string\n if (typeof elems === 'string') {\n elems = elems.split(',');\n }\n\n let out = [];\n\n elems.forEach(function(elem, i, arr) {\n // try to get elements with such IDs\n let tmp = document.getElementById(elem);\n if (tmp !== null) {\n out.push( tmp[key] );\n return;\n }\n\n // try to get elements with such class name\n // write each elem from collection to new element of output array\n tmp = document.getElementsByClassName(elem);\n if (tmp !== null && tmp.length !==0 ) {\n for (key in tmp) {\n if ( +key >= 0 ) {\n out.push( tmp[key] );\n }\n }\n }\n });\n\n return out;\n}\n\n/**\n * @param {string|array} elems\n */\nfunction apbctShowHideElem(elems) {\n elems = apbctGetElems(elems);\n for ( let i=0, len = elems.length; i < len; i++) {\n elems[i].each(function(i, elem) {\n elem = jQuery(elem);\n let label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(':visible')) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * @param {string|array} element\n */\nfunction apbctExceptedShowHide(element) { // eslint-disable-line no-unused-vars\n let toHide = [\n 'apbct_settings__dwpms_settings',\n 'apbct_settings__advanced_settings',\n 'trusted_and_affiliate__special_span',\n ];\n let index = toHide.indexOf(element);\n if (index !== -1) {\n toHide.splice(index, 1);\n }\n apbctShowHideElem(element);\n toHide.forEach((toHideElem) => {\n if (document.getElementById(toHideElem) && document.getElementById(toHideElem).style.display !== 'none') {\n apbctShowHideElem(toHideElem);\n }\n });\n}\n\n/**\n * @param {mixed} event\n * @param {string} id\n */\nfunction apbctShowRequiredGroups(event, id) { // eslint-disable-line no-unused-vars\n let required = document.getElementById('apbct_settings__dwpms_settings');\n if (required && required.style.display === 'none') {\n let originEvent = event;\n event.preventDefault();\n apbctShowHideElem('apbct_settings__dwpms_settings');\n document.getElementById(id).dispatchEvent(new originEvent.constructor(originEvent.type, originEvent));\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param {string|array} ids\n * @param {int} enable\n */\nfunction apbctSettingsDependencies(ids, enable) { // eslint-disable-line no-unused-vars\n enable = ! isNaN(enable) ? enable : null;\n\n // Get elements\n let elems = apbctGetElemsNative( ids );\n\n elems.forEach(function(elem, i, arr) {\n let doDisable = function() {\n elem.setAttribute('disabled', 'disabled');\n };\n let doEnable = function() {\n elem.removeAttribute('disabled');\n };\n\n // Set defined state\n if (enable === null) {\n enable = elem.getAttribute('disabled') === null ? 0 : 1;\n }\n\n enable === 1 ? doEnable() : doDisable();\n\n if ( elem.getAttribute('apbct_children') !== null) {\n let state = apbctSettingsDependenciesGetState( elem ) && enable;\n if ( state !== null ) {\n apbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n }\n }\n });\n}\n\n/**\n * @param {HTMLElement} elem\n * @return {int|null}\n */\nfunction apbctSettingsDependenciesGetState(elem) { // eslint-disable-line no-unused-vars\n let state;\n\n switch ( elem.getAttribute( 'type' ) ) {\n case 'checkbox':\n state = +elem.checked;\n break;\n case 'radio':\n state = +(+elem.getAttribute('value') === 1);\n break;\n default:\n state = null;\n }\n\n return state;\n}\n\n/**\n * Warn user about cookie type change if cache solutions found in environment.\n * #Call inlined from SettingsField\n * @param {object} event\n */\nfunction onApbctCookieTypeChange(event) { // eslint-disable-line no-unused-vars\n const switchToMode = event?.target?.value?.toString() || null;\n if (\n switchToMode !== null &&\n (\n switchToMode === '1' || // cookies on\n switchToMode === '0' // cookies off\n )\n ) {\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n __('Attention!', 'cleantalk-spam-protect'),\n (\n __(\n 'Cache solutions detected. ',\n 'cleantalk-spam-protect',\n ) +\n __(\n 'Switching cookie mode to \\'On\\' or \\'Off\\' may affect filtering quality. ',\n 'cleantalk-spam-protect',\n ) +\n __('The recommended setting is \\'Auto\\'.', 'cleantalk-spam-protect')\n ),\n '',\n (decision)=>{\n decision === true && jQuery('#apbct_setting_data__set_cookies__Auto').click();\n },\n __('Set to \"Auto\"', 'cleantalk-spam-protect'),\n __('Confirm mode change', 'cleantalk-spam-protect'),\n );\n }\n}\n\n/**\n * @param {HTMLElement} label\n * @param {string} settingId\n */\nfunction apbctSettingsShowDescription(label, settingId) {\n let removeDescFunc = function(e) {\n const callerIsPopup = jQuery(e.target).parent('.apbct_long_desc').length != 0;\n const callerIsHideCross = jQuery(e.target).hasClass('apbct_long_desc__cancel');\n const descIsShown = jQuery('.apbct_long_desc__title').length > 0;\n if (descIsShown && !callerIsPopup || callerIsHideCross) {\n jQuery('.apbct_long_desc').remove();\n jQuery(document).off('click', removeDescFunc);\n }\n };\n\n label.after('
');\n let obj = jQuery('#apbct_long_desc__'+settingId);\n obj.append('')\n .append('
')\n .css({\n top: label.position().top - 5,\n left: label.position().left + 25,\n });\n\n\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__get__long_description', setting_id: settingId},\n {\n spinner: obj.children('img'),\n callback: function(result, data, params, obj) {\n if (result && result.title && result.desc) {\n obj.empty()\n .append('
')\n .append('')\n .append('

'+result.title+'

')\n .append('

'+result.desc+'

');\n\n jQuery(document).on('click', removeDescFunc);\n }\n },\n },\n obj,\n );\n}\n\n/**\n * Set position for navigation menu\n * @return {void}\n */\nfunction apbctNavigationMenuPosition() {\n const navBlock = document.querySelector('#apbct_hidden_section_nav ul');\n const rightBtnSave = document.querySelector('#apbct_settings__button_section');\n if (!navBlock || !rightBtnSave) {\n return;\n }\n const scrollPosition = window.scrollY;\n const windowWidth = window.innerWidth;\n if (scrollPosition > 1000) {\n navBlock.style.position = 'fixed';\n rightBtnSave.style.position = 'fixed';\n } else {\n navBlock.style.position = 'static';\n rightBtnSave.style.position = 'static';\n }\n\n if (windowWidth < 768) {\n rightBtnSave.style.position = 'fixed';\n }\n}\n\n/**\n * Set position for save button, hide it if scrolled to the bottom\n * @return {void}\n */\nfunction apbctSaveButtonPosition() {\n if (\n document.getElementById('apbct_settings__before_advanced_settings') === null ||\n document.getElementById('apbct_settings__after_advanced_settings') === null ||\n document.getElementById('apbct_settings__button_section') === null ||\n document.getElementById('apbct_settings__advanced_settings') === null ||\n document.getElementById('apbct_hidden_section_nav') === null\n ) {\n return;\n }\n\n if (!ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license) {\n jQuery('#apbct_settings__main_save_button').hide();\n return;\n }\n\n const additionalSaveButton =\n document.querySelector('#apbct_settings__button_section, cleantalk_link[value=\"save_changes\"]');\n if (!additionalSaveButton) {\n return;\n }\n\n const scrollPosition = window.scrollY;\n const documentHeight = document.documentElement.scrollHeight;\n const windowHeight = window.innerHeight;\n const threshold = 800;\n if (scrollPosition + windowHeight >= documentHeight - threshold) {\n additionalSaveButton.style.display = 'none';\n } else {\n additionalSaveButton.style.display = 'block';\n }\n\n const advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n const mainSaveButton = document.getElementById('apbct_settings__block_main_save_button');\n if (!advSettingsBlock || !mainSaveButton) {\n return;\n }\n\n if (advSettingsBlock.style.display == 'none') {\n mainSaveButton.classList.remove('apbct_settings__position_main_save_button');\n } else {\n mainSaveButton.classList.add('apbct_settings__position_main_save_button');\n }\n}\n\n/**\n * Hightlights element\n *\n * @param {string} id\n * @param {int} times\n */\nfunction apbctHighlightElement(id, times) {\n times = times-1 || 0;\n let keyField = jQuery('#'+id);\n jQuery('html, body').animate({scrollTop: keyField.offset().top - 100}, 'slow');\n keyField.addClass('apbct_highlighted');\n keyField.animate({opacity: 0}, 400, 'linear', function() {\n keyField.animate({opacity: 1}, 400, 'linear', function() {\n if (times>0) {\n apbctHighlightElement(id, times);\n } else {\n keyField.removeClass('apbct_highlighted');\n }\n });\n });\n}\n\n/**\n * Open modal to create support user\n */\nfunction apbctCreateSupportUser() { // eslint-disable-line no-unused-vars\n const localTextArray = ctSettingsPage.support_user_creation_msg_array;\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n localTextArray.confirm_header,\n localTextArray.confirm_text,\n '',\n apbctCreateSupportUserCallback,\n );\n}\n\n/**\n * Create support user\n */\nfunction apbctCreateSupportUserCallback() {\n const preloader = jQuery('#apbct_summary_and_support-create_user_button_preloader');\n preloader.css('display', 'block');\n apbct_admin_sendAJAX(\n {\n action: 'apbct_action__create_support_user',\n },\n {\n timeout: 10000,\n notJson: 1,\n callback: function(result, data, params, obj) {\n let localTextArray = ctSettingsPage.support_user_creation_msg_array;\n let popupMsg = localTextArray.default_error;\n const responseValid = (\n typeof result === 'object' &&\n result.hasOwnProperty('success') &&\n result.hasOwnProperty('user_created') &&\n result.hasOwnProperty('mail_sent') &&\n result.hasOwnProperty('cron_updated') &&\n result.hasOwnProperty('user_data') &&\n result.hasOwnProperty('result_code') &&\n typeof result.user_data === 'object' &&\n result.user_data.hasOwnProperty('username') &&\n result.user_data.hasOwnProperty('email') &&\n result.user_data.hasOwnProperty('password')\n );\n if (responseValid && result.success) {\n if (result.user_created) {\n let mailSentMsg = '';\n let successCreationMsg = '';\n let cronUpdatedMsg = localTextArray.cron_updated;\n\n if (result.mail_sent) {\n mailSentMsg = localTextArray.mail_sent_success;\n } else {\n mailSentMsg = localTextArray.mail_sent_error;\n }\n\n if (result.result_code === 0) {\n successCreationMsg = localTextArray.user_updated;\n } else {\n successCreationMsg = localTextArray.user_created;\n }\n\n jQuery('#apbct_summary_and_support-user_creation_username').text(result.user_data.username);\n jQuery('#apbct_summary_and_support-user_creation_email').text(result.user_data.email);\n jQuery('#apbct_summary_and_support-user_creation_password').text(result.user_data.password);\n jQuery('#apbct_summary_and_support-user_creation_mail_sent').text(mailSentMsg);\n jQuery('#apbct_summary_and_support-user_creation_title').text(successCreationMsg);\n jQuery('#apbct_summary_and_support-user_creation_cron_updated').text(cronUpdatedMsg);\n jQuery('.apbct_summary_and_support-user_creation_result').css('display', 'block');\n const createUserButton = jQuery('#apbct_summary_and_support-create_user_button');\n createUserButton.attr('disabled', true);\n createUserButton.css('color', 'rgba(93,89,86,0.55)');\n createUserButton.css('background', '#cccccc');\n preloader.css('display', 'none');\n return;\n } else {\n if (result.result_code === -2) {\n popupMsg = localTextArray.invalid_permission;\n } else if (result.result_code === -1) {\n popupMsg = localTextArray.unknown_creation_error;\n } else if (result.result_code === -4) {\n popupMsg = localTextArray.on_cooldown;\n } else if (result.result_code === -5) {\n popupMsg = localTextArray.email_is_busy;\n }\n }\n }\n preloader.css('display', 'none');\n cleantalkModal.loaded = popupMsg;\n cleantalkModal.open();\n },\n errorOutput: function(msg) {\n preloader.css('display', 'none');\n cleantalkModal.loaded = msg;\n cleantalkModal.open();\n },\n },\n );\n}\n"],"names":["__","wp","i18n","handleAnchorDetection","anchor","document","querySelector","style","display","apbctExceptedShowHide","scrollToAnchor","anchorId","targetElement","scrollIntoView","block","apbctManageEmailEncoderCustomTextField","replacingText","let","replacingTextWrapperSub","parentElement","querySelectorAll","forEach","elem","checked","value","classList","add","addEventListener","event","target","remove","apbctManageAntiCrawlerDependency","antiCrawler","spamFireWall","childrens","getAttribute","apbctSettingsDependencies","apbctBannerCheck","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbctGetElems","elems","i","len","split","tmp","apbctGetElemsNative","out","arr","getElementById","push","key","getElementsByClassName","apbctShowHideElem","each","label","next","prev","is","show","element","toHide","index","indexOf","splice","toHideElem","apbctShowRequiredGroups","id","required","originEvent","preventDefault","dispatchEvent","constructor","type","ids","enable","isNaN","state","removeAttribute","setAttribute","apbctSettingsDependenciesGetState","onApbctCookieTypeChange","switchToMode","toString","cleantalkModal","loaded","open","confirm","decision","click","apbctSettingsShowDescription","settingId","removeDescFunc","e","callerIsPopup","parent","callerIsHideCross","hasClass","off","after","append","css","top","position","left","setting_id","spinner","children","title","desc","empty","on","apbctNavigationMenuPosition","scrollPosition","windowWidth","navBlock","rightBtnSave","window","scrollY","innerWidth","apbctSaveButtonPosition","advSettingsBlock","mainSaveButton","ctSettingsPage","key_is_ok","ip_license","additionalSaveButton","documentHeight","documentElement","scrollHeight","innerHeight","apbctHighlightElement","times","keyField","animate","scrollTop","offset","addClass","opacity","removeClass","apbctCreateSupportUser","localTextArray","support_user_creation_msg_array","confirm_header","confirm_text","apbctCreateSupportUserCallback","preloader","timeout","notJson","popupMsg","default_error","hasOwnProperty","user_data","success","user_created","mailSentMsg","successCreationMsg","cronUpdatedMsg","cron_updated","createUserButton","mail_sent","mail_sent_success","mail_sent_error","result_code","user_updated","text","username","email","password","attr","invalid_permission","unknown_creation_error","on_cooldown","email_is_busy","errorOutput","msg","ready","getComputedStyle","direction","this","val","optionSelected","console","log","template_id","template_name","settings","button","insertAfter","setTimeout","location","reload","close","templateNameInput","templateName","key_changed","self","find","debounceTimer","clearTimeout","$this","accountEmailField","accountEmail","toggleClass","code","inputType","undefined","error","enteredValue","keyBad","match","customUploader","media","library","multiple","image","get","first","toJSON","url","src","adjust","hash","substring","session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F,CAAC,EAEDH,SAASC,cAAc,yCAAyC,GAAGqB,iBAAiB,QAAS,KACzFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,OACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,OAChF,CAAC,EAGDO,uCAAuC,EAGvCgB,iCAAiC,EAE7BkG,OAAOyE,SAASgC,MAEhBvO,sBADe8H,OAAOyE,SAASgC,KAAKC,UAAU,CAAC,CACnB,EAIhC3L,OAAO,MAAM,EAAE2E,GAAG,QAAS,8CAA+C,SAASlB,GAC/EA,EAAEvB,eAAe,EACjB0J,eAAeC,QAAQ,iCAAkC,GAAG,EAC5D7L,OAAO,6BAA6B,EAAEE,KAAK,EAC3CF,OAAO,2BAA2B,EAAEuB,KAAK,CAC7C,CAAC,CACL,CAAC"} \ No newline at end of file +{"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["const {__} = wp.i18n;\njQuery(document).ready(function() {\n // Crunch for Right to Left direction languages\n if (document.getElementsByClassName('apbct_settings-title')[0]) {\n if (getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl') {\n jQuery('.apbct_switchers').css('text-align', 'right');\n }\n }\n\n // Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(e) {\n e.preventDefault();\n jQuery(this).hide();\n jQuery('.apbct_settings-field--api_key').val(jQuery('.apbct_settings-field--api_key').attr('key'));\n jQuery('.apbct_settings-field--api_key+div').css('display', 'inline');\n });\n\n /**\n * Validate apikey and hide get auto btn\n */\n jQuery( document ).on('click', '#apbct_settings_templates_import_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n let templateNameInput = jQuery('#apbct_settings_templates_import_name');\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n let data = {\n 'template_id': optionSelected.data('id'),\n 'template_name': optionSelected.data('name'),\n 'settings': optionSelected.data('settings'),\n };\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_import', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Export settings\n jQuery( document ).on('click', '#apbct_settings_templates_export_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n let templateNameInput = jQuery('#apbct_settings_templates_export_name');\n let data = {};\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n if ( optionSelected.data('id') === 'new_template' ) {\n let templateName = templateNameInput.val();\n if ( templateName === '' ) {\n templateNameInput.css('border-color', 'red');\n return;\n }\n data = {\n 'template_name': templateName,\n };\n } else {\n data = {\n 'template_id': optionSelected.data('id'),\n };\n }\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_export', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Reset settings\n jQuery( document ).on('click', '#apbct_settings_templates_reset_button', function() {\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_reset'},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Sync button\n jQuery('#apbct_button__sync').on('click', function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_sync'},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__sync' ),\n spinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__sync .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__sync .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n if ( ctSettingsPage.key_changed ) {\n jQuery('.key_changed_sync').hide(300);\n jQuery('.key_changed_success').show(300);\n setTimeout(function() {\n document.location.reload();\n }, 3000);\n } else {\n document.location.reload();\n }\n }\n },\n },\n );\n });\n\n if ( ctSettingsPage.key_changed ) {\n jQuery('#apbct_button__sync').click();\n }\n\n jQuery(document).on('click', '.apbct_settings-long_description---show', function() {\n self = jQuery(this);\n apbctSettingsShowDescription(self, self.attr('setting'));\n });\n\n if (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length) {\n apbctBannerCheck();\n }\n\n jQuery(document).on('change', '#apbct_settings_templates_export', function() {\n let optionSelected = jQuery('option:selected', this);\n if ( optionSelected.data('id') === 'new_template' ) {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n } else {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n }\n });\n\n apbctSaveButtonPosition();\n let debounceTimer;\n window.addEventListener('scroll', function() {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(function() {\n apbctSaveButtonPosition();\n }, 50);\n apbctNavigationMenuPosition();\n });\n jQuery('#ct_adv_showhide a').on('click', apbctSaveButtonPosition);\n\n\n /**\n * Change cleantalk account email\n */\n jQuery('#apbct-change-account-email').on('click', function(e) {\n e.preventDefault();\n\n let $this = jQuery(this);\n let accountEmailField = jQuery('#apbct-account-email');\n let accountEmail = accountEmailField.text();\n\n $this.toggleClass('active');\n\n if ($this.hasClass('active')) {\n $this.text($this.data('save-text'));\n accountEmailField.attr('contenteditable', 'true');\n accountEmailField.on('keydown', function(e) {\n if (e.code === 'Enter') {\n e.preventDefault();\n }\n });\n accountEmailField.on('input', function(e) {\n if (e.inputType === 'insertParagraph') {\n e.preventDefault();\n }\n });\n } else {\n apbct_admin_sendAJAX(\n {\n action: 'apbct_update_account_email',\n accountEmail: accountEmail,\n },\n {\n timeout: 5000,\n callback: function(result, data, params, obj) {\n if (result.error !== undefined) {\n jQuery('#apbct-account-email').css('border-color', 'red');\n }\n },\n },\n );\n\n accountEmailField.attr('contenteditable', 'false');\n $this.text($this.data('default-text'));\n }\n });\n\n /**\n * Validate apkikey and hide get auto btn\n */\n jQuery('#apbct_setting_apikey').on('input', function() {\n let enteredValue = jQuery(this).val();\n jQuery('#apbct_settings__key_line__save_settings').off('click');\n let keyBad = enteredValue !== '' && enteredValue.match(/^[a-z\\d]{8,30}\\s*$/) === null;\n jQuery('#apbct_settings__key_is_bad').hide();\n jQuery('#apbct_showApiKey').hide();\n jQuery('#apbct_settings__account_name_ob').hide();\n if (enteredValue === '') {\n jQuery('#apbct_button__key_line__save_changes_wrapper').hide();\n if (jQuery('#apbct_button__get_key_auto').length) {\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n }\n } else {\n jQuery('#apbct_button__key_line__save_changes_wrapper').show();\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n if (keyBad) {\n jQuery('#apbct_settings__key_line__save_settings').on('click',\n function(e) {\n e.preventDefault();\n jQuery('#apbct_settings__key_is_bad').show();\n apbctHighlightElement('apbct_setting_apikey', 3);\n },\n );\n }\n }\n });\n\n if ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n }\n\n /**\n * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n */\n if ( !ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license ) {\n jQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n function(e) {\n e.preventDefault();\n if (!jQuery('#sync_required_notice').length) {\n jQuery( '

' +\n 'Synchronization process failed. Please, check the acces key and restart the synch.' +\n '

' ).insertAfter( jQuery('#apbct_button__sync') );\n }\n apbctHighlightElement('apbct_setting_apikey', 3);\n apbctHighlightElement('apbct_button__sync', 3);\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n },\n );\n }\n\n /**\n * Open WP gallery for adding custom logo\n */\n jQuery('#apbct-custom-logo-open-gallery').click(function(e) {\n e.preventDefault();\n\n const button = jQuery(this);\n\n const customUploader = wp.media({\n library: {\n type: 'image',\n },\n multiple: false,\n });\n\n customUploader.on('select', function() {\n const image = customUploader.state().get('selection').first().toJSON();\n\n button.parent().prev().attr( 'src', image.url );\n jQuery('#cleantalk_custom_logo').val( image.id );\n });\n\n customUploader.open();\n });\n\n /**\n * Remove selected logo\n */\n jQuery('#apbct-custom-logo-remove-image').click(function(e) {\n e.preventDefault();\n\n if ( true === confirm( 'Sure?' ) ) {\n const src = jQuery(this).parent().prev().data('src');\n jQuery(this).parent().prev().attr('src', src);\n jQuery(this).prev().prev().val('');\n }\n });\n\n jQuery('button[id*=\"apbct-action-adjust-change-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_change';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-change-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n jQuery('button[id*=\"apbct-action-adjust-reverse-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_reverse';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-reverse-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'block';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'none';\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn-close')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'none';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'block';\n });\n\n // Hide/show EmailEncoder replacing text textarea\n apbctManageEmailEncoderCustomTextField();\n\n // Turn SpamFireWall on with Anti-Crawler\n apbctManageAntiCrawlerDependency();\n\n if (window.location.hash) {\n const anchor = window.location.hash.substring(1);\n handleAnchorDetection(anchor);\n }\n\n // Fullpage trial/renew banner dismiss handler\n jQuery('body').on('click', '.apbct-trial-renew-fullpage .notice-dismiss', function(e) {\n e.preventDefault();\n sessionStorage.setItem('apbct_trial_fullpage_dismissed', '1');\n jQuery('.apbct-trial-renew-fullpage').hide();\n jQuery('#apbct-settings-page-wrap').show();\n });\n});\n\n/**\n * Detect ancors and open advanced settings before scroll\n * @param {string} anchor\n */\nfunction handleAnchorDetection(anchor) {\n let advSettings = document.querySelector('#apbct_settings__advanced_settings');\n if ( 'none' === advSettings.style.display ) {\n apbctExceptedShowHide('apbct_settings__advanced_settings');\n }\n scrollToAnchor('#' + anchor);\n}\n\n/**\n * Scroll to the target element ID\n * @param {string} anchorId Anchor target element ID\n */\nfunction scrollToAnchor(anchorId) {\n const targetElement = document.querySelector(anchorId);\n if (targetElement) {\n targetElement.scrollIntoView({\n block: 'end',\n });\n }\n}\n\n/**\n * Hide/show EmailEncoder replacing text textarea\n */\nfunction apbctManageEmailEncoderCustomTextField() {\n const replacingText = document\n .querySelector('#apbct_setting_data__email_decoder_obfuscation_custom_text');\n let replacingTextWrapperSub;\n if (replacingText !== null) {\n replacingTextWrapperSub = typeof replacingText.parentElement !== 'undefined' ?\n replacingText.parentElement :\n null;\n }\n document.querySelectorAll('.apbct_setting---data__email_decoder_obfuscation_mode').forEach((elem) => {\n // visibility set on saved settings\n if (replacingTextWrapperSub && elem.checked && elem.value !== 'replace') {\n replacingTextWrapperSub.classList.add('hidden');\n }\n // visibility set on change\n elem.addEventListener('click', (event) => {\n if (typeof replacingTextWrapperSub !== 'undefined') {\n if (event.target.value === 'replace') {\n replacingTextWrapperSub.classList.remove('hidden');\n } else {\n replacingTextWrapperSub.classList.add('hidden');\n }\n }\n });\n });\n}\n\n/**\n * Anti-Crawler is an add-on to SFW, so check SpamFireWall on enabling Anti-Crawler\n */\nfunction apbctManageAntiCrawlerDependency() {\n const antiCrawler = document.querySelector('#apbct_setting_sfw__anti_crawler');\n const spamFireWall = document.querySelector('#apbct_setting_sfw__enabled');\n if (!antiCrawler || !spamFireWall) {\n return;\n }\n antiCrawler.addEventListener('change', () => {\n if (! antiCrawler.checked || spamFireWall.checked) {\n return;\n }\n spamFireWall.checked = true;\n const childrens = spamFireWall.getAttribute('apbct_children');\n if (childrens !== null) {\n apbctSettingsDependencies(childrens, 1);\n }\n });\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbctBannerCheck() {\n let bannerChecker = setInterval( function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__check_renew_banner'},\n {\n callback: function(result, data, params, obj) {\n if (result.close_renew_banner) {\n if (jQuery('#cleantalk_notice_renew').length) {\n jQuery('#cleantalk_notice_renew').hide('slow');\n }\n if (jQuery('#cleantalk_notice_trial').length) {\n jQuery('#cleantalk_notice_trial').hide('slow');\n }\n clearInterval(bannerChecker);\n }\n },\n },\n );\n }, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param {string|array} elems\n * @return {*}\n */\nfunction apbctGetElems(elems) {\n elems = elems.split(',');\n for ( let i=0, len = elems.length, tmp; i < len; i++) {\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param {string|array} elems\n * @return {array}\n */\nfunction apbctGetElemsNative(elems) {\n // Make array from a string\n if (typeof elems === 'string') {\n elems = elems.split(',');\n }\n\n let out = [];\n\n elems.forEach(function(elem, i, arr) {\n // try to get elements with such IDs\n let tmp = document.getElementById(elem);\n if (tmp !== null) {\n out.push( tmp[key] );\n return;\n }\n\n // try to get elements with such class name\n // write each elem from collection to new element of output array\n tmp = document.getElementsByClassName(elem);\n if (tmp !== null && tmp.length !==0 ) {\n for (key in tmp) {\n if ( +key >= 0 ) {\n out.push( tmp[key] );\n }\n }\n }\n });\n\n return out;\n}\n\n/**\n * @param {string|array} elems\n */\nfunction apbctShowHideElem(elems) {\n elems = apbctGetElems(elems);\n for ( let i=0, len = elems.length; i < len; i++) {\n elems[i].each(function(i, elem) {\n elem = jQuery(elem);\n let label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(':visible')) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * @param {string|array} element\n */\nfunction apbctExceptedShowHide(element) { // eslint-disable-line no-unused-vars\n let toHide = [\n 'apbct_settings__dwpms_settings',\n 'apbct_settings__advanced_settings',\n 'trusted_and_affiliate__special_span',\n ];\n let index = toHide.indexOf(element);\n if (index !== -1) {\n toHide.splice(index, 1);\n }\n apbctShowHideElem(element);\n toHide.forEach((toHideElem) => {\n if (document.getElementById(toHideElem) && document.getElementById(toHideElem).style.display !== 'none') {\n apbctShowHideElem(toHideElem);\n }\n });\n}\n\n/**\n * @param {mixed} event\n * @param {string} id\n */\nfunction apbctShowRequiredGroups(event, id) { // eslint-disable-line no-unused-vars\n let required = document.getElementById('apbct_settings__dwpms_settings');\n if (required && required.style.display === 'none') {\n let originEvent = event;\n event.preventDefault();\n apbctShowHideElem('apbct_settings__dwpms_settings');\n document.getElementById(id).dispatchEvent(new originEvent.constructor(originEvent.type, originEvent));\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param {string|array} ids\n * @param {int} enable\n */\nfunction apbctSettingsDependencies(ids, enable) { // eslint-disable-line no-unused-vars\n enable = ! isNaN(enable) ? enable : null;\n\n // Get elements\n let elems = apbctGetElemsNative( ids );\n\n elems.forEach(function(elem, i, arr) {\n let doDisable = function() {\n elem.setAttribute('disabled', 'disabled');\n };\n let doEnable = function() {\n elem.removeAttribute('disabled');\n };\n\n // Set defined state\n if (enable === null) {\n enable = elem.getAttribute('disabled') === null ? 0 : 1;\n }\n\n enable === 1 ? doEnable() : doDisable();\n\n if ( elem.getAttribute('apbct_children') !== null) {\n let state = apbctSettingsDependenciesGetState( elem ) && enable;\n if ( state !== null ) {\n apbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n }\n }\n });\n}\n\n/**\n * @param {HTMLElement} elem\n * @return {int|null}\n */\nfunction apbctSettingsDependenciesGetState(elem) { // eslint-disable-line no-unused-vars\n let state;\n\n switch ( elem.getAttribute( 'type' ) ) {\n case 'checkbox':\n state = +elem.checked;\n break;\n case 'radio':\n state = +(+elem.getAttribute('value') === 1);\n break;\n default:\n state = null;\n }\n\n return state;\n}\n\n/**\n * Warn user about cookie type change if cache solutions found in environment.\n * #Call inlined from SettingsField\n * @param {object} event\n */\nfunction onApbctCookieTypeChange(event) { // eslint-disable-line no-unused-vars\n const switchToMode = event?.target?.value?.toString() || null;\n if (\n switchToMode !== null &&\n (\n switchToMode === '1' || // cookies on\n switchToMode === '0' // cookies off\n )\n ) {\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n __('Attention!', 'cleantalk-spam-protect'),\n (\n __(\n 'Cache-problem solutions detected in the environment. ',\n 'cleantalk-spam-protect',\n ) +\n __(\n 'Switching cookie mode to \\'On\\' or \\'Off\\' may affect filtering quality. ',\n 'cleantalk-spam-protect',\n ) +\n __('The recommended setting is \\'Auto\\'.', 'cleantalk-spam-protect')\n ),\n '',\n (decision)=>{\n decision === true && jQuery('#apbct_setting_data__set_cookies__Auto').click();\n },\n __('Set to \"Auto\"', 'cleantalk-spam-protect'),\n __('Confirm mode change', 'cleantalk-spam-protect'),\n );\n }\n}\n\n/**\n * @param {HTMLElement} label\n * @param {string} settingId\n */\nfunction apbctSettingsShowDescription(label, settingId) {\n let removeDescFunc = function(e) {\n const callerIsPopup = jQuery(e.target).parent('.apbct_long_desc').length != 0;\n const callerIsHideCross = jQuery(e.target).hasClass('apbct_long_desc__cancel');\n const descIsShown = jQuery('.apbct_long_desc__title').length > 0;\n if (descIsShown && !callerIsPopup || callerIsHideCross) {\n jQuery('.apbct_long_desc').remove();\n jQuery(document).off('click', removeDescFunc);\n }\n };\n\n label.after('
');\n let obj = jQuery('#apbct_long_desc__'+settingId);\n obj.append('')\n .append('
')\n .css({\n top: label.position().top - 5,\n left: label.position().left + 25,\n });\n\n\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__get__long_description', setting_id: settingId},\n {\n spinner: obj.children('img'),\n callback: function(result, data, params, obj) {\n if (result && result.title && result.desc) {\n obj.empty()\n .append('
')\n .append('')\n .append('

'+result.title+'

')\n .append('

'+result.desc+'

');\n\n jQuery(document).on('click', removeDescFunc);\n }\n },\n },\n obj,\n );\n}\n\n/**\n * Set position for navigation menu\n * @return {void}\n */\nfunction apbctNavigationMenuPosition() {\n const navBlock = document.querySelector('#apbct_hidden_section_nav ul');\n const rightBtnSave = document.querySelector('#apbct_settings__button_section');\n if (!navBlock || !rightBtnSave) {\n return;\n }\n const scrollPosition = window.scrollY;\n const windowWidth = window.innerWidth;\n if (scrollPosition > 1000) {\n navBlock.style.position = 'fixed';\n rightBtnSave.style.position = 'fixed';\n } else {\n navBlock.style.position = 'static';\n rightBtnSave.style.position = 'static';\n }\n\n if (windowWidth < 768) {\n rightBtnSave.style.position = 'fixed';\n }\n}\n\n/**\n * Set position for save button, hide it if scrolled to the bottom\n * @return {void}\n */\nfunction apbctSaveButtonPosition() {\n if (\n document.getElementById('apbct_settings__before_advanced_settings') === null ||\n document.getElementById('apbct_settings__after_advanced_settings') === null ||\n document.getElementById('apbct_settings__button_section') === null ||\n document.getElementById('apbct_settings__advanced_settings') === null ||\n document.getElementById('apbct_hidden_section_nav') === null\n ) {\n return;\n }\n\n if (!ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license) {\n jQuery('#apbct_settings__main_save_button').hide();\n return;\n }\n\n const additionalSaveButton =\n document.querySelector('#apbct_settings__button_section, cleantalk_link[value=\"save_changes\"]');\n if (!additionalSaveButton) {\n return;\n }\n\n const scrollPosition = window.scrollY;\n const documentHeight = document.documentElement.scrollHeight;\n const windowHeight = window.innerHeight;\n const threshold = 800;\n if (scrollPosition + windowHeight >= documentHeight - threshold) {\n additionalSaveButton.style.display = 'none';\n } else {\n additionalSaveButton.style.display = 'block';\n }\n\n const advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n const mainSaveButton = document.getElementById('apbct_settings__block_main_save_button');\n if (!advSettingsBlock || !mainSaveButton) {\n return;\n }\n\n if (advSettingsBlock.style.display == 'none') {\n mainSaveButton.classList.remove('apbct_settings__position_main_save_button');\n } else {\n mainSaveButton.classList.add('apbct_settings__position_main_save_button');\n }\n}\n\n/**\n * Hightlights element\n *\n * @param {string} id\n * @param {int} times\n */\nfunction apbctHighlightElement(id, times) {\n times = times-1 || 0;\n let keyField = jQuery('#'+id);\n jQuery('html, body').animate({scrollTop: keyField.offset().top - 100}, 'slow');\n keyField.addClass('apbct_highlighted');\n keyField.animate({opacity: 0}, 400, 'linear', function() {\n keyField.animate({opacity: 1}, 400, 'linear', function() {\n if (times>0) {\n apbctHighlightElement(id, times);\n } else {\n keyField.removeClass('apbct_highlighted');\n }\n });\n });\n}\n\n/**\n * Open modal to create support user\n */\nfunction apbctCreateSupportUser() { // eslint-disable-line no-unused-vars\n const localTextArray = ctSettingsPage.support_user_creation_msg_array;\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n localTextArray.confirm_header,\n localTextArray.confirm_text,\n '',\n apbctCreateSupportUserCallback,\n );\n}\n\n/**\n * Create support user\n */\nfunction apbctCreateSupportUserCallback() {\n const preloader = jQuery('#apbct_summary_and_support-create_user_button_preloader');\n preloader.css('display', 'block');\n apbct_admin_sendAJAX(\n {\n action: 'apbct_action__create_support_user',\n },\n {\n timeout: 10000,\n notJson: 1,\n callback: function(result, data, params, obj) {\n let localTextArray = ctSettingsPage.support_user_creation_msg_array;\n let popupMsg = localTextArray.default_error;\n const responseValid = (\n typeof result === 'object' &&\n result.hasOwnProperty('success') &&\n result.hasOwnProperty('user_created') &&\n result.hasOwnProperty('mail_sent') &&\n result.hasOwnProperty('cron_updated') &&\n result.hasOwnProperty('user_data') &&\n result.hasOwnProperty('result_code') &&\n typeof result.user_data === 'object' &&\n result.user_data.hasOwnProperty('username') &&\n result.user_data.hasOwnProperty('email') &&\n result.user_data.hasOwnProperty('password')\n );\n if (responseValid && result.success) {\n if (result.user_created) {\n let mailSentMsg = '';\n let successCreationMsg = '';\n let cronUpdatedMsg = localTextArray.cron_updated;\n\n if (result.mail_sent) {\n mailSentMsg = localTextArray.mail_sent_success;\n } else {\n mailSentMsg = localTextArray.mail_sent_error;\n }\n\n if (result.result_code === 0) {\n successCreationMsg = localTextArray.user_updated;\n } else {\n successCreationMsg = localTextArray.user_created;\n }\n\n jQuery('#apbct_summary_and_support-user_creation_username').text(result.user_data.username);\n jQuery('#apbct_summary_and_support-user_creation_email').text(result.user_data.email);\n jQuery('#apbct_summary_and_support-user_creation_password').text(result.user_data.password);\n jQuery('#apbct_summary_and_support-user_creation_mail_sent').text(mailSentMsg);\n jQuery('#apbct_summary_and_support-user_creation_title').text(successCreationMsg);\n jQuery('#apbct_summary_and_support-user_creation_cron_updated').text(cronUpdatedMsg);\n jQuery('.apbct_summary_and_support-user_creation_result').css('display', 'block');\n const createUserButton = jQuery('#apbct_summary_and_support-create_user_button');\n createUserButton.attr('disabled', true);\n createUserButton.css('color', 'rgba(93,89,86,0.55)');\n createUserButton.css('background', '#cccccc');\n preloader.css('display', 'none');\n return;\n } else {\n if (result.result_code === -2) {\n popupMsg = localTextArray.invalid_permission;\n } else if (result.result_code === -1) {\n popupMsg = localTextArray.unknown_creation_error;\n } else if (result.result_code === -4) {\n popupMsg = localTextArray.on_cooldown;\n } else if (result.result_code === -5) {\n popupMsg = localTextArray.email_is_busy;\n }\n }\n }\n preloader.css('display', 'none');\n cleantalkModal.loaded = popupMsg;\n cleantalkModal.open();\n },\n errorOutput: function(msg) {\n preloader.css('display', 'none');\n cleantalkModal.loaded = msg;\n cleantalkModal.open();\n },\n },\n );\n}\n"],"names":["__","wp","i18n","handleAnchorDetection","anchor","document","querySelector","style","display","apbctExceptedShowHide","scrollToAnchor","anchorId","targetElement","scrollIntoView","block","apbctManageEmailEncoderCustomTextField","replacingText","let","replacingTextWrapperSub","parentElement","querySelectorAll","forEach","elem","checked","value","classList","add","addEventListener","event","target","remove","apbctManageAntiCrawlerDependency","antiCrawler","spamFireWall","childrens","getAttribute","apbctSettingsDependencies","apbctBannerCheck","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbctGetElems","elems","i","len","split","tmp","apbctGetElemsNative","out","arr","getElementById","push","key","getElementsByClassName","apbctShowHideElem","each","label","next","prev","is","show","element","toHide","index","indexOf","splice","toHideElem","apbctShowRequiredGroups","id","required","originEvent","preventDefault","dispatchEvent","constructor","type","ids","enable","isNaN","state","removeAttribute","setAttribute","apbctSettingsDependenciesGetState","onApbctCookieTypeChange","switchToMode","toString","cleantalkModal","loaded","open","confirm","decision","click","apbctSettingsShowDescription","settingId","removeDescFunc","e","callerIsPopup","parent","callerIsHideCross","hasClass","off","after","append","css","top","position","left","setting_id","spinner","children","title","desc","empty","on","apbctNavigationMenuPosition","scrollPosition","windowWidth","navBlock","rightBtnSave","window","scrollY","innerWidth","apbctSaveButtonPosition","advSettingsBlock","mainSaveButton","ctSettingsPage","key_is_ok","ip_license","additionalSaveButton","documentHeight","documentElement","scrollHeight","innerHeight","apbctHighlightElement","times","keyField","animate","scrollTop","offset","addClass","opacity","removeClass","apbctCreateSupportUser","localTextArray","support_user_creation_msg_array","confirm_header","confirm_text","apbctCreateSupportUserCallback","preloader","timeout","notJson","popupMsg","default_error","hasOwnProperty","user_data","success","user_created","mailSentMsg","successCreationMsg","cronUpdatedMsg","cron_updated","createUserButton","mail_sent","mail_sent_success","mail_sent_error","result_code","user_updated","text","username","email","password","attr","invalid_permission","unknown_creation_error","on_cooldown","email_is_busy","errorOutput","msg","ready","getComputedStyle","direction","this","val","optionSelected","console","log","template_id","template_name","settings","button","insertAfter","setTimeout","location","reload","close","templateNameInput","templateName","key_changed","self","find","debounceTimer","clearTimeout","$this","accountEmailField","accountEmail","toggleClass","code","inputType","undefined","error","enteredValue","keyBad","match","customUploader","media","library","multiple","image","get","first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mC,EAAEC,MAAMC,QAAU,MAChF,CAAC,EAEDH,SAASC,cAAc,yCAAyC,GAAGqB,iBAAiB,QAAS,KACzFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,OACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,OAChF,CAAC,EAGDO,uCAAuC,EAGvCgB,iCAAiC,EAE7BkG,OAAOyE,SAASgC,MAEhBvO,sBADe8H,OAAOyE,SAASgC,KAAKC,UAAU,CAAC,CACnB,EAIhC3L,OAAO,MAAM,EAAE2E,GAAG,QAAS,8CAA+C,SAASlB,GAC/EA,EAAEvB,eAAe,EACjB0J,eAAeC,QAAQ,iCAAkC,GAAG,EAC5D7L,OAAO,6BAA6B,EAAEE,KAAK,EAC3CF,OAAO,2BAA2B,EAAEuB,KAAK,CAC7C,CAAC,CACL,CAAC"} \ No newline at end of file diff --git a/js/src/cleantalk-admin-settings-page.js b/js/src/cleantalk-admin-settings-page.js index 05cf500b6..3d576e00f 100644 --- a/js/src/cleantalk-admin-settings-page.js +++ b/js/src/cleantalk-admin-settings-page.js @@ -705,7 +705,7 @@ function onApbctCookieTypeChange(event) { // eslint-disable-line no-unused-vars __('Attention!', 'cleantalk-spam-protect'), ( __( - 'Cache solutions detected. ', + 'Cache-problem solutions detected in the environment. ', 'cleantalk-spam-protect', ) + __( diff --git a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php index c7ecd24fe..3cceeda4a 100644 --- a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php +++ b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php @@ -470,6 +470,36 @@ public static function getEmailsEncodingDescription() return __('Encode email addresses', 'cleantalk-spam-protect'); } + public static function getExcludedStringsDescription() + { + return __( + 'List emails, phone numbers or text fragments that must never be encoded. Put one value per line. Each value is limited to 128 characters, up to 20 values.', + 'cleantalk-spam-protect' + ); + } + + public static function getExcludedStringsLongDescription() + { + $tmp = ' +

%s

+

%s

+

%s

+

%s

+

%s

+

%s

+ '; + $tmp = sprintf( + $tmp, + __('Use this list when you need a contact to stay readable everywhere, including titles, menus and widgets — WordPress does not run shortcodes in those places.', 'cleantalk-spam-protect'), + __('Put one value per line:', 'cleantalk-spam-protect'), + __('an email, e.g. support@example.com', 'cleantalk-spam-protect'), + __('a phone number, e.g. +1 (234) 567-8901 — format differences are ignored', 'cleantalk-spam-protect'), + __('a text fragment, e.g. example.com to skip all emails on that domain', 'cleantalk-spam-protect'), + __('Each value is sliced to 128 characters. The list is limited to 20 values.', 'cleantalk-spam-protect') + ); + return $tmp; + } + public static function getPhonesEncodingLongDescription() { $tmp = ' diff --git a/lib/Cleantalk/ApbctWP/PluginSettingsPage/SettingsField.php b/lib/Cleantalk/ApbctWP/PluginSettingsPage/SettingsField.php index a4fc546f4..fe5f8d68b 100644 --- a/lib/Cleantalk/ApbctWP/PluginSettingsPage/SettingsField.php +++ b/lib/Cleantalk/ApbctWP/PluginSettingsPage/SettingsField.php @@ -253,7 +253,8 @@ private function getRadioChildrenChunk($option) public function anyCacheDetectedInEnvironment() { - return apbct_is_varnish_cache_exists() || apbct_is_advanced_cache_exists() || apbct_is_10web_booster_exists() || apbct_is_cache_plugins_exists(); + global $apbct; + return $apbct->isAltSessionsRequired(); } /** @@ -480,7 +481,11 @@ class="apbct_setting_{{type}} apbct_setting---{{name}}" */ private function getInputTextarea() { - $title_layout = '

{{title}} {{popup_description}}

'; + $title_class = 'apbct_settings-field_title apbct_settings-field_title--{{type}}'; + if ( $this->description_popup !== '' ) { + $title_class .= ' apbct_settings-field_title--with-help'; + } + $title_layout = '

{{title}} {{popup_description}}

'; $raw_value = empty($this->value) ? TT::getArrayValueAsString($this->params, 'value') : $this->value; if (is_array($raw_value)) { diff --git a/lib/Cleantalk/ApbctWP/State.php b/lib/Cleantalk/ApbctWP/State.php index 53c0ff27b..92b1cbd0d 100644 --- a/lib/Cleantalk/ApbctWP/State.php +++ b/lib/Cleantalk/ApbctWP/State.php @@ -94,6 +94,7 @@ class State extends \Cleantalk\Common\State 'data__email_decoder_obfuscation_custom_text' => '', 'data__email_decoder_encode_phone_numbers' => 0, 'data__email_decoder_encode_email_addresses' => 1, + 'data__email_decoder_excluded_strings' => '', 'data__wc_store_blocked_orders' => 0, // Exclusions diff --git a/lib/Cleantalk/Common/ContactsEncoder/ContactsEncoder.php b/lib/Cleantalk/Common/ContactsEncoder/ContactsEncoder.php index 46425bb20..beda1fafc 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/ContactsEncoder.php +++ b/lib/Cleantalk/Common/ContactsEncoder/ContactsEncoder.php @@ -308,6 +308,10 @@ public function modifyGlobalEmails($content) $position = $this->advanceMatchCursor($matches[0], $match_cursor); + if ( $this->exclusions->isContactExcluded($matches[0]) ) { + return $matches[0]; + } + if ( isset($matches[3]) && in_array(strtolower($matches[3]), ['.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp']) ) { return $matches[0]; } @@ -372,6 +376,10 @@ function ($matches) use (&$match_cursor) { $position = $this->advanceMatchCursor($matches[0], $match_cursor); + if ( $this->exclusions->isContactExcluded($matches[0]) ) { + return $matches[0]; + } + if ( $this->helper->isTelTag($matches[0]) ) { return $this->encodeTelLink($matches[0]); } diff --git a/lib/Cleantalk/Common/ContactsEncoder/Dto/Params.php b/lib/Cleantalk/Common/ContactsEncoder/Dto/Params.php index e73403182..f0e4acff3 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/Dto/Params.php +++ b/lib/Cleantalk/Common/ContactsEncoder/Dto/Params.php @@ -19,4 +19,11 @@ class Params public $obfuscation_text = 'hidden contact data'; public $do_encode_emails = 1; public $do_encode_phones = 0; + + /** + * Emails, phones or text fragments that must never be encoded. + * + * @var string[] + */ + public $excluded_strings = array(); } diff --git a/lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php b/lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php index 39c1dbf31..692324a17 100644 --- a/lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php +++ b/lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php @@ -82,4 +82,125 @@ protected function byLoggedIn() { return $this->params->is_logged_in; } + + /** + * Split a settings textarea into unique non-empty exclusion strings (one value per line). + * + * @param string $raw + * + * @return string[] + * @psalm-suppress PossiblyUnusedMethod Public API for host apps that store the list as raw text + */ + public static function parseExcludedStrings($raw) + { + if ( ! is_string($raw) || $raw === '' ) { + return array(); + } + + $parts = preg_split('/\R+/', $raw); + if ( ! is_array($parts) ) { + return array(); + } + + $result = array(); + foreach ( $parts as $part ) { + $part = trim($part, " \n\r\t\v\x00"); + if ( $part !== '' ) { + $result[] = $part; + } + } + + return array_values(array_unique($result)); + } + + /** + * Whether a matched email or phone must stay unencoded. + * + * @param string $match + * + * @return bool + */ + public function isContactExcluded($match) + { + if ( ! is_string($match) || $match === '' ) { + return false; + } + + if ( empty($this->params->excluded_strings) || ! is_array($this->params->excluded_strings) ) { + return false; + } + + $normalized_match = $this->normalizeContactString($match); + $match_digits = $this->extractDigits($match); + + foreach ( $this->params->excluded_strings as $exclusion ) { + if ( ! is_string($exclusion) || $exclusion === '' ) { + continue; + } + + $normalized_exclusion = $this->normalizeContactString($exclusion); + if ( $normalized_exclusion === '' ) { + continue; + } + + if ( $normalized_match === $normalized_exclusion ) { + return true; + } + + if ( strpos($normalized_match, $normalized_exclusion) !== false ) { + return true; + } + + // Digit compare is for phones only. Emails with long number sequences + // must not match an excluded phone (or the other way around). + if ( + strpos($normalized_match, '@') === false + && strpos($normalized_exclusion, '@') === false + ) { + $exclusion_digits = $this->extractDigits($exclusion); + if ( + strlen($exclusion_digits) >= 8 + && strlen($match_digits) >= 8 + && ( + strpos($match_digits, $exclusion_digits) !== false + || strpos($exclusion_digits, $match_digits) !== false + ) + ) { + return true; + } + } + } + + return false; + } + + /** + * @param string $value + * + * @return string + */ + private function normalizeContactString($value) + { + $value = trim($value, " \n\r\t\v\x00"); + if ( stripos($value, 'mailto:') === 0 ) { + $value = substr($value, 7); + } + if ( stripos($value, 'tel:') === 0 ) { + $value = substr($value, 4); + } + + return strtolower(trim($value, " \n\r\t\v\x00")); + } + + /** + * @param string $value + * + * @return string + */ + private function extractDigits($value) + { + $digits = preg_replace('/\D+/', '', $value); + + return is_string($digits) ? $digits : ''; + } } diff --git a/lib/Cleantalk/Common/Helper.php b/lib/Cleantalk/Common/Helper.php index 71fbefcd0..b3c5afbd1 100644 --- a/lib/Cleantalk/Common/Helper.php +++ b/lib/Cleantalk/Common/Helper.php @@ -590,11 +590,16 @@ public static function ipResolve($ip) } /** - * Resolve DNS to IP + * Resolve DNS to IP. * - * @param $host + * $host must be a full URL that passes FILTER_VALIDATE_URL (scheme required). + * A bare hostname such as HTTP_HOST, or any non-string value, is rejected + * and $out is returned. * - * @return false|string + * @param mixed $host Full URL (FILTER_VALIDATE_URL); other types are rejected + * @param bool|string $out Fallback when $host is invalid or lookup fails + * + * @return bool|string First A-record IPv4 on success, otherwise $out * @psalm-suppress PossiblyUnusedMethod */ public static function dnsResolve($host) @@ -925,7 +930,9 @@ public static function getMimeType($data, $type = '') } elseif (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $type = finfo_buffer($finfo, $data); - finfo_close($finfo); + if (PHP_VERSION_ID < 80000) { + finfo_close($finfo); + } } // @ToDo the method must return comparison result: return $type === mime_content_type($data) diff --git a/tests/ApbctWP/ContactsEncoder/Exclusions/TestExclusionsService.php b/tests/ApbctWP/ContactsEncoder/Exclusions/TestExclusionsService.php index a48357a8a..2c16d61ab 100644 --- a/tests/ApbctWP/ContactsEncoder/Exclusions/TestExclusionsService.php +++ b/tests/ApbctWP/ContactsEncoder/Exclusions/TestExclusionsService.php @@ -651,6 +651,58 @@ public function testByContentSignsIgnoresNonArrayFilterResult() $this->assertFalse($result); } + public function testIsContactExcludedMatchesEmailAndPhoneVariants() + { + $params = new Params(); + $params->api_key = 'testapikey'; + $params->excluded_strings = array('keep@example.com', '+1 800 555-1234', 'company.org'); + $service = new ExclusionsService($params); + + $this->assertTrue($service->isContactExcluded('keep@example.com')); + $this->assertTrue($service->isContactExcluded('mailto:keep@example.com')); + $this->assertTrue($service->isContactExcluded('office@company.org')); + $this->assertTrue($service->isContactExcluded('(800) 555-1234')); + $this->assertFalse($service->isContactExcluded('public@other.net')); + $this->assertFalse($service->isContactExcluded('(800) 555-9999')); + } + + public function testIsContactExcludedDoesNotCrossMatchEmailAndPhoneDigits() + { + $params = new Params(); + $params->api_key = 'testapikey'; + $params->excluded_strings = array('+1 800 555-1234', 'user12345678@example.com'); + $service = new ExclusionsService($params); + + $this->assertFalse($service->isContactExcluded('ticket18005551234@shop.com')); + $this->assertFalse($service->isContactExcluded('123-456-7890')); + $this->assertTrue($service->isContactExcluded('(800) 555-1234')); + $this->assertTrue($service->isContactExcluded('user12345678@example.com')); + } + + public function testParseExcludedStringsSplitsLines() + { + $parsed = \Cleantalk\Common\ContactsEncoder\Exclusions\ExclusionsService::parseExcludedStrings( + "keep@example.com\n+1 800 555-1234\nexample.com\n" + ); + + $this->assertSame( + array('keep@example.com', '+1 800 555-1234', 'example.com'), + $parsed + ); + } + + public function testParseExcludedStringsKeepsCommaInsideALine() + { + $parsed = \Cleantalk\Common\ContactsEncoder\Exclusions\ExclusionsService::parseExcludedStrings( + "keep@example.com, office@example.com\n+1 800 555-1234" + ); + + $this->assertSame( + array('keep@example.com, office@example.com', '+1 800 555-1234'), + $parsed + ); + } + /** * Helper method to invoke private methods for testing * diff --git a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php index 6d31823f9..b767ed4b8 100644 --- a/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php +++ b/tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php @@ -224,6 +224,94 @@ public function testModifyContentSkipsEmailsInsideOptionTags() $this->assertStringContainsString('apbct-email-encoder', $result); } + /** + * Settings skip list keeps listed emails plain, including in title-like strings. + */ + public function testModifyContentSkipsEmailsFromExcludedStringsSetting() + { + global $apbct; + $previous = isset($apbct->settings['data__email_decoder_excluded_strings']) + ? $apbct->settings['data__email_decoder_excluded_strings'] + : ''; + + $keep = 'keep@example.com'; + $encode = 'public@other.net'; + $title = 'Contact ' . $keep . ' or ' . $encode; + + $apbct->settings['data__email_decoder_excluded_strings'] = $keep; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $result = $this->contacts_encoder->modifyContent($title); + + $apbct->settings['data__email_decoder_excluded_strings'] = $previous; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $this->assertStringContainsString($keep, $result); + $this->assertStringNotContainsString($encode, $result); + $this->assertStringContainsString('apbct-email-encoder', $result); + } + + /** + * Domain fragment in the skip list excludes every matching email. + */ + public function testModifyContentSkipsEmailsByDomainFragment() + { + global $apbct; + $previous = isset($apbct->settings['data__email_decoder_excluded_strings']) + ? $apbct->settings['data__email_decoder_excluded_strings'] + : ''; + + $skip = 'office@company.org'; + $encode = 'user@other.net'; + + $apbct->settings['data__email_decoder_excluded_strings'] = 'company.org'; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $result = $this->contacts_encoder->modifyContent($skip . ' ' . $encode); + + $apbct->settings['data__email_decoder_excluded_strings'] = $previous; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $this->assertStringContainsString($skip, $result); + $this->assertStringNotContainsString($encode, $result); + $this->assertStringContainsString('apbct-email-encoder', $result); + } + + /** + * Phone skip list matches format variants by digits. + */ + public function testModifyContentSkipsPhonesFromExcludedStringsSetting() + { + global $apbct; + $previous_strings = isset($apbct->settings['data__email_decoder_excluded_strings']) + ? $apbct->settings['data__email_decoder_excluded_strings'] + : ''; + $previous_phones = $apbct->settings['data__email_decoder_encode_phone_numbers']; + + $keep = '(800) 555-1234'; + $encode = '(800) 555-9999'; + + $apbct->settings['data__email_decoder_encode_phone_numbers'] = 1; + $apbct->settings['data__email_decoder_excluded_strings'] = '+1 800 555-1234'; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $result = $this->contacts_encoder->modifyContent('Call ' . $keep . ' or ' . $encode); + + $apbct->settings['data__email_decoder_excluded_strings'] = $previous_strings; + $apbct->settings['data__email_decoder_encode_phone_numbers'] = $previous_phones; + $this->contacts_encoder->dropInstance(); + $this->contacts_encoder = apbctGetContactsEncoder(); + + $this->assertStringContainsString($keep, $result); + $this->assertStringNotContainsString($encode, $result); + $this->assertStringContainsString('apbct-email-encoder', $result); + } + /** * aria-label values must survive email encoding round-trip intact. */ @@ -367,6 +455,22 @@ public function testGetPhonesEncodingLongDescription() $this->assertStringEndsWith('>', $description); } + public function testGetExcludedStringsDescription() + { + $description = ContactsEncoder::getExcludedStringsDescription(); + $this->assertIsString($description); + $this->assertNotEmpty($description); + + $long = ContactsEncoder::getExcludedStringsLongDescription(); + $this->assertIsString($long); + $this->assertStringContainsString('128 characters', $long); + $this->assertStringContainsString('one value per line', $description); + $this->assertStringNotContainsString('comma', strtolower($description)); + $this->assertStringNotContainsString('comma', strtolower($long)); + $this->assertStringNotContainsString('apbct_skip_encoding', $description); + $this->assertStringNotContainsString('apbct_skip_encoding', $long); + } + public function testModifyBuffer() { global $apbct; diff --git a/tests/Common/HelperTest.php b/tests/Common/HelperTest.php index 65b17355e..832f8f2fe 100644 --- a/tests/Common/HelperTest.php +++ b/tests/Common/HelperTest.php @@ -149,4 +149,15 @@ public function test_ipResolve_return_type() 'ipResolve should return false or a non-empty string hostname' ); } + + /** + * Detect MIME from a data buffer. Must not call deprecated finfo_close() on PHP 8.5+. + */ + public function test_getMimeType_from_buffer() + { + $type = Helper::getMimeType('hello', 'text/plain'); + + $this->assertIsString($type); + $this->assertNotSame('', $type); + } } diff --git a/tests/StandaloneFunctions/SettingsTest.php b/tests/StandaloneFunctions/SettingsTest.php index a9e9c6ca6..b3f7f6b9f 100644 --- a/tests/StandaloneFunctions/SettingsTest.php +++ b/tests/StandaloneFunctions/SettingsTest.php @@ -122,6 +122,27 @@ public function test_apbct_settings__sanitize__exclusions__wrong_params() $this->assertIsString(apbct_settings__sanitize__exclusions('', 0)); } + public function test_apbct_settings__sanitize__excluded_contact_strings() + { + $this->assertSame('', apbct_settings__sanitize__excluded_contact_strings(null)); + $this->assertSame('', apbct_settings__sanitize__excluded_contact_strings('')); + $this->assertSame( + "keep@example.com\n+1 800 555-1234", + apbct_settings__sanitize__excluded_contact_strings("keep@example.com\n+1 800 555-1234\n") + ); + $this->assertSame( + 'keep@example.com, office@example.com', + apbct_settings__sanitize__excluded_contact_strings('keep@example.com, office@example.com') + ); + + $lines = array(); + for ( $i = 1; $i <= 25; $i++ ) { + $lines[] = 'user' . $i . '@example.com'; + } + $sanitized = apbct_settings__sanitize__excluded_contact_strings(implode("\n", $lines)); + $this->assertCount(20, explode("\n", $sanitized)); + } + public function test_apbct_settings__set_fields() { $fields = apbct_settings__set_fields();