Comments – wpDiscuz - Version 7.3.4

Version Description

Download this release

Release Info

Developer AdvancedCoding
Plugin Icon 128x128 Comments – wpDiscuz
Version 7.3.4
Comparing to
See all releases

Code changes from version 7.3.3 to 7.3.4

assets/js/wpdiscuz-combo-no_quill.min.js CHANGED
@@ -3,7 +3,7 @@
3
  /* Autogrow */
4
  jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
5
  /* wpDiscuz */
6
- var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?o="wpdiscuz-message-success":"warning"===t[n]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(a instanceof Array?a[n]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(e,t,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(o){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]]&&(e=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]](e,t,a))}),e},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,n=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,i=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),d=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,_=wpdiscuzAjaxObj.cookiehash,g=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),z=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,v=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),x=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),C=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),k=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=(I=parseInt(wpdiscuzAjaxObj.scrollSize))||32,T=[],D=[],F=[],E=!1,M=1,L=e("html").css("scroll-behavior"),R=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(t){var a=e(".wpd-form").not(":hidden");if(a.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<a.length;o++)if("\n"!==wpDiscuzEditor.createEditor(e(a[o]).find(".ql-container").attr("id")).getText())return t.preventDefault(),void(t.returnValue="")}else for(o=0;o<a.length;o++)if(e(a[o]).find(".wc_comment").val())return t.preventDefault(),void(t.returnValue="")}),wpdiscuzLoadRichEditor||(e(document).delegate("textarea.wc_comment","input",function(){me(e(this))}),e.each(e("textarea.wc_comment"),function(){me(e(this))})),e(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(z)}),e(document).on("focus","#wpdcom textarea",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||H({comment_author:Cookies.get("comment_author_"+_),comment_author_email:Cookies.get("comment_author_email_"+_),comment_author_url:Cookies.get("comment_author_url_"+_)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).on("click","#wpd-insert-source-code",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).on("click",".wpd-reply-button",function(){var i=$(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+i).focus()},z):setTimeout(function(){e("#wc-textarea-"+i).trigger("focus")},z),e("#wpd-secondary-form-wrapper-"+i).slideToggle(z)):function(a){var o=$(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var n=e("#wpd-secondary-form-wrapper-"+o);if(!t){var i={comment_author:Cookies.get("comment_author_"+_),comment_author_email:Cookies.get("comment_author_email_"+_),comment_author_url:Cookies.get("comment_author_url_"+_)};H(i)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},z):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},z);n.slideToggle(z,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===n){var i=X(t);setTimeout(function(){if(!D[i])try{D[i]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(i)}),e(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.trigger("select"),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),e(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=$(e(this),0),o=e(this),n=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&g?function(t,a){var o=X(t),n=new FormData;n.append("action","wpdShowReplies"),n.append("commentId",o),ue(v,!0,n).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),we(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,n){console.log(n),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(n.removeClass("fa-chevron-up"),n.addClass("fa-chevron-down"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(n.removeClass("fa-chevron-down"),n.addClass("fa-chevron-up"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).on("mouseenter",".wpd-new-loaded-comment",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).on("click",".wpd-sbs-toggle",function(){e(".wpdiscuz-subscribe-bar").slideToggle(z)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&e("#wpdiscuz-subscribe-form").length&&("2.0"===n?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===n&&e(document).on("click","#wpdiscuz_subscription_button",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===n){var S=e(window).width(),P=e("#wpdcom").width();P>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),P>=940&&P<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),P>=810&&P<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),P>=730&&P<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),P>=610&&P<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),S>650&&(P>=510&&P<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),P>=470&&P<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),P<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function q(t,a,o){ue(v||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(z),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e(".wpd-thread-info").html(a.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(a.data.wc_all_comments_count_bubble_html);var n=z;a.data.is_main?oe(a.data.message):(n=z+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),ue(v,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),ue(v,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,n=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+_,a),Cookies.set("comment_author_"+_,o),n.length&&Cookies.set("comment_author_url_"+_,n)):(u=parseInt(u),Cookies.set("comment_author_email_"+_,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+_,o,{expires:u,path:"/"}),n.length&&Cookies.set("comment_author_url_"+_,n,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").prop("checked",!0)}(a.data):b||e(".wpd-cookies-checkbox").prop("checked",!1),t.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]):me(t.find(".wc_comment")),H(a.data),e(".wmu-preview-wrap",t).remove(),T.length&&(T.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),T=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){te(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-I},1e3,ae)},n),we(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"),we(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,n){console.log(n),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function H(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function U(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var i=e(this),s=1,d=e(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(s=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===Y(t,!1)&&(o=Y(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),ee(d,"#wpd-editor-"+e(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==e(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(p=d,r=!0,"2.0"===n&&e("input[name=wc_captcha]",p).length&&!e("input[name=wc_captcha]",p).val().length?(r=!1,e(".wpdiscuz-recaptcha",p).css("border","1px solid red")):"2.0"===n&&e("input[name=wc_captcha]",p).length&&e(".wpdiscuz-recaptcha",p).css("border","none"),r)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+_,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){T.push(e(this))}))})}(d),e(i).removeClass("wpd_not_clicked");var c=new FormData;if(c.append("action","wpdAddComment"),e(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&c.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&c.append(this.name+"",e(this).val())}),c.append("wpd_comment_depth",s),wpdiscuzAjaxObj.wpdiscuz_zs&&c.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",d).length?e(".wpd-cookies-checkbox",d).prop("checked")||(b=!1):t&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===n&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){c.append("g-recaptcha-response",e),q(d,c,i)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else q(d,c,i)}var p,r;!function(e){if((a||o)&&"2.0"===n){var t=X(e);grecaptcha.reset(D[t])}}(e(".wpdiscuz_unique_id",d).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),e(document).on("click",".wpd_editable_comment",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&U($(e(".wpdiscuz-edit-form-wrap"),0),w);var t=e(this),a=$(t,0),o=X(a),n=new FormData;n.append("action","wpdEditComment"),n.append("commentId",o),w=e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),ue(v,!0,n).done(function(o){if("object"==typeof o)if(o.success){if(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(o.data.html),wpdiscuzLoadRichEditor){var n=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a);n.clipboard.dangerouslyPasteHTML(0,o.data.content),n.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+a).val(o.data.content),me(e("#wc-textarea-edit_"+a));e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[o.data],o.data,t),"error");else console.log(o);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wc_save_edited_comment",function(){var t=e(this),a=$(t),o=X(a),n=e("#wpd-comm-"+a+" #wpdiscuz-edit-form");if(ee(n,"#wpd-editor-edit_"+a),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()){var i=new FormData;i.append("action","wpdSaveEditedComment"),i.append("commentId",o),e(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&i.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),ue(v,!0,i).done(function(n){"object"==typeof n?(n.success?(U(a,n.data.message),n.data.lastEdited&&(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(n.data.lastEdited).insertAfter("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),n.data.twitterShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",n.data.twitterShareLink),n.data.whatsappShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",n.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+a)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error"),we(n,o)):console.log(n),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wc_cancel_edit",function(){var t=$(e(this));U(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){B(!0)},500):e(document).on("click",".wpd-load-comments",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),B(!0)})),e(document).on("click",".wpd-load-more-submit",function(){var t=e(this);t.hasClass("wpd-loaded")&&B(!1,t,"wpd-loaded","wpd-loading")});var W=!1;function V(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===W&&1==t&&(W=!0,B(!1,e(".wpd-load-more-submit"))))}function B(t,a,o,n){a&&(a.toggleClass(o),a.toggleClass(n));var s=new FormData;s.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&s.append("sorting",d),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),ue(v,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==i),W=!1,s.data.loadLastCommentId&&(r=s.data.loadLastCommentId),we(s),t&&Q(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))}).fail(function(t,i,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==i&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),we(t)}function Q(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){te(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-I},1e3,ae),t&&N(o)},500);else{var n=new FormData;n.append("action","wpdGetSingleComment"),n.append("commentId",o),ue(v,!0,n).done(function(a){if("object"==typeof a&&a.success){var n="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),we(a),te(),e("html, body").animate({scrollTop:e(n).offset().top-I},1e3,ae),t&&N(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function N(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function G(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)J((t=a[o]).comment_parent,t.comment_html)}function $(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function X(e){return e.substring(0,e.indexOf("_"))}function Y(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function J(t,a){if(0==t)oe(a);else{var o=$(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function Z(){var t=[];return e(".wpd-comment-right").each(function(){t.push(X($(e(this),0)))}),t.join(",")}function ee(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).prop("required",!1),0===e("input:checked",this).length?e("input",e(this)).prop("required",!0):e(".wpd-field-invalid",this).remove()})}function te(){e("html, body").css("scroll-behavior","unset")}function ae(){e("html").css("scroll-behavior",L),e("body").css("scroll-behavior",R)}function oe(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function ne(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==i||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),V(),e(window).scroll(function(){V()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=X($(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var n=new FormData;n.append("action","wpdVoteOnComment"),n.append("commentId",o),n.append("voteType",a),ue(v,!0,n).done(function(n){if(e(t).addClass("wpd_not_clicked"),"object"==typeof n){if(n.success){if("total"===n.data.buttonsStyle){var i=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=n.data.votes;i.text(n.data.votesHumanReadable),i.attr("title",s),i.removeClass("wpd-up wpd-down"),s>0&&i.addClass("wpd-up"),s<0&&i.addClass("wpd-down")}else{var d=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));d.text(n.data.likeCountHumanReadable),d.attr("title",n.data.likeCount),c.text(n.data.dislikeCountHumanReadable),c.attr("title",n.data.dislikeCount),parseInt(n.data.likeCount)>0?d.addClass("wpd-up"):d.removeClass("wpd-up"),parseInt(n.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),n.data.curUserReaction>0?p.addClass("wpd-up"):n.data.curUserReaction<0&&r.addClass("wpd-down")}else n.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error");we(n,o,a)}else console.log(n);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click","body",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var n=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",n||""),ue(v,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){Q(!1)},1!=m&&Q(!1),e(document).on("click",".wpdiscuz-readmore",function(){var t=$(e(this)),a=X(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),ue(v,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),we(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("change",".wpd-required-group",function(){0!==e("input:checked",this).length?e("input",e(this)).prop("required",!1):e("input",e(this)).prop("required",!0)}),e(document).on("click",".wpdiscuz-spoiler",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).on("click",".wpd-tools i",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]","#wpdcom").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).on("mouseleave",".wpd-comment-right",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).on("click",".wpd_stick_btn",function(){var t=X($(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),ue(v,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd_close_btn",function(){var t=X($(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),ue(v,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var n=e(".wpdiscuz-sort-button-active").attr("data-sorting");n&&o.append("sorting",n),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),ue(v,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),we(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),ue(v,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),we(a),te(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-I},1e3,ae))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),ue(v,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),we(a),te(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-I},1e3,ae))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpd-filter-view-all",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=X($(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),ue(v,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data.code],a.data.code,t),"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),ne(),e(document).on("keyup",".wc_email",function(){ne(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),C&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*k)},1e3*C),"content_left"===O)if(e(".entry-content").length){var ie=(se=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?se:25;e("#wpd-bubble-wrapper").css({left:ie+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){ie=(se=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?se:25;e("#wpd-bubble-wrapper").css({left:ie+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var se;ie=(se=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?se:25;e("#wpd-bubble-wrapper").css({left:ie+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e(document).on("click","#wpd-bubble-add-message-close",function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e(document).on("click","#wpd-bubble",function(){te(),e("#tab-title-reviews").length&&e("#tab-title-reviews a").trigger("click"),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-(I+28)},1e3,function(){ae(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").trigger("focus")})}),e(document).on("click","#wpd-bubble-comment-close",function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e(document).on("click","#wpd-bubble-comment-reply-link a",function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),Q(!0);var a=t.match(/#comment\-(\d+)/);F=F.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(F.length),0==F.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e(document).on("click","#wpd-bubble-count",function(){if(F.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",F.join()),ue(v,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),G(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),F=[],e(".wpd-new-loaded-comment").length&&(te(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-(I+28)},1e3,ae)),we(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&x||d)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:l,visibleCommentIds:Z()}}).done(function(a){if(!E)if("object"==typeof a){if(a.commentIDsToRemove.forEach(function(t){e("[id^=wpd-comm-"+t+"]").remove()}),a.ids.length){d&&((i=new FormData).append("action","wpdUpdateAutomatically"),i.append("loadLastCommentId",r),i.append("visibleCommentIds",Z()),ue(v,!1,i).done(function(t){E||"object"==typeof t&&t.success&&(G(t),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e(".wpd-thread-info").html(t.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(t.data.wc_all_comments_count_bubble_html),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),F=F.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var n=parseInt(e(".wpd-new-comments-count").text());n+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(n),e("#wpd-bubble-count").addClass("wpd-new-comments")}a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").replaceWith(a.all_comments_count_bubble_html),e(".wpd-thread-info").html(a.all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.all_comments_count)}else console.log(a);var i;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var de=new FormData;de.append("action","wpdGetInlineCommentForm"),ue(v,!1,de).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),le()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data]),t.data,"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function ce(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function pe(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function re(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),le(t.siblings(".wpd-inline-form-wrapper"))))})}function le(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function me(t){var a,o=0;if(t.parents(".wpd_main_comm_form").length)o=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents(".wpd_main_comm_form");else if(t.parents(".wpd-secondary-form-wrapper").length)o=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),a=t.parents(".wpd-secondary-form-wrapper");else if(t.parents("#wpdiscuz-edit-form").length){var n=$(t);o=parseInt(n.substring(n.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents("#wpdiscuz-edit-form")}if(o&&a){var i=t.val().length,s=e(".wpd-editor-char-counter",a),d=o-i;s.html(d),d<=10?s.addClass("error"):s.removeClass("error")}}function we(t,a,o,n){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function ue(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var n=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](o,t,a))});var i=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:i,data:o,contentType:!1,processData:!1})}e(document).on("click","body",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){pe();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&a.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),le(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var n=new FormData;n.append("action","wpdAddInlineComment"),n.append("inline_form_id",ce(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&n.append(e(a).attr("name"),e(a).val()):n.append(e(a).attr("name"),e(a).val())}),ue(v,!0,n).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),pe();var n=parseInt(t.data.newCount),i=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");i.text(n),n?i.addClass("wpd-has-comments"):i.removeClass("wpd-has-comments"),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e(".wpd-thread-info").html(t.data.allCommentsCountBeforeThreadsHtml),e(".wpd-thread-info").attr("data-comments-count",t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").replaceWith(t.data.allCommentsCountBubbleHtml),t.data.message&&oe(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data,a),"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("keydown",".wpd-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).on("keydown","#wpdiscuz-edit-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).on("keydown",".wpd-inline-comment-content",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",ce(t)),ue(v,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-view-all-inline-comments",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),te(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-I},1e3,ae)}),e(document).on("click",".wpd-feedback-content-link",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");te(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-(I+6)},1e3,function(){ae(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(re(),e(window).on("scroll",re)),e(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),ue(v,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data),"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){t.preventDefault();var a,o,i=e(this);if(i[0].checkValidity()&&(a=i,o=!0,"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",i).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),ue(v,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wpd-unsubscribe",function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),ue(v,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=ue});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
7
  /* Colorbox */
8
  !function(t,e,i){var o,n,r,h,a,s,l,c,d,g,f,u,p,m,w,v,y,x,b,T,C,H,k,W,E,I,M,L,R,S,K,P,B,O={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),o=t(this).data("cbox-iframe-attrs");return"object"==typeof o&&t.each(o,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},_="colorbox",j="cbox",D=j+"Element",F=j+"_open",N=j+"_load",z=j+"_complete",A=j+"_cleanup",q=j+"_closed",U=j+"_purge",$=t("<a/>"),G="div",Q=0,J={};function V(i,o,n){var r=e.createElement(i);return o&&(r.id=j+o),n&&(r.style.cssText=n),t(r)}function X(){return i.innerHeight?i.innerHeight:t(i).height()}function Y(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var o;return void 0===this.cache[e]&&(void 0!==(o=t(this.el).attr("data-cbox-"+e))?this.cache[e]=o:void 0!==i[e]?this.cache[e]=i[e]:void 0!==O[e]&&(this.cache[e]=O[e])),this.cache[e]},this.get=function(t){var e=this.value(t);return"function"==typeof e?e.call(this.el,this):e}}function Z(t){var e=d.length,i=(I+t)%e;return i<0?e+i:i}function tt(t,e){return Math.round((/%/.test(t)?("x"===e?g.width():X())/100:1)*parseInt(t,10))}function et(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function it(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function ot(t){"contains"in n[0]&&!n[0].contains(t.target)&&t.target!==o[0]&&(t.stopPropagation(),n.trigger("focus"))}function nt(t){nt.str!==t&&(n.add(o).removeClass(nt.str).addClass(t),nt.str=t)}function rt(i){t(e).trigger(i),$.triggerHandler(i)}var ht=function(){var t,e,i=j+"Slideshow_",o="click."+j;function r(){clearTimeout(e)}function h(){(C.get("loop")||d[I+1])&&(r(),e=setTimeout(P.next,C.get("slideshowSpeed")))}function a(){v.html(C.get("slideshowStop")).off(o).one(o,s),$.on(z,h).on(N,r),n.removeClass(i+"off").addClass(i+"on")}function s(){r(),$.off(z,h).off(N,r),v.html(C.get("slideshowStart")).off(o).one(o,function(){P.next(),a()}),n.removeClass(i+"on").addClass(i+"off")}function l(){t=!1,v.hide(),r(),$.off(z,h).off(N,r),n.removeClass(i+"off "+i+"on")}return function(){t?C.get("slideshow")||($.off(A,l),l()):C.get("slideshow")&&d[1]&&(t=!0,$.one(A,l),C.get("slideshowAuto")?a():s(),v.show())}}();function at(r){var g,w;if(!S){if(g=t(r).data(_),C=new Y(r,g),w=C.get("rel"),I=0,w&&!1!==w&&"nofollow"!==w?(d=t("."+D).filter(function(){return new Y(this,t.data(this,_)).get("rel")===w}),-1===(I=d.index(C.el))&&(d=d.add(C.el),I=d.length-1)):d=t(C.el),!L){L=R=!0,nt(C.get("className")),n.css({visibility:"hidden",display:"block",opacity:""}),f=V(G,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),h.css({width:"",height:""}).append(f),H=a.height()+c.height()+h.outerHeight(!0)-h.height(),k=s.width()+l.width()+h.outerWidth(!0)-h.width(),W=f.outerHeight(!0),E=f.outerWidth(!0);var v=tt(C.get("initialWidth"),"x"),y=tt(C.get("initialHeight"),"y"),x=C.get("maxWidth"),B=C.get("maxHeight");C.w=Math.max((!1!==x?Math.min(v,tt(x,"x")):v)-E-k,0),C.h=Math.max((!1!==B?Math.min(y,tt(B,"y")):y)-W-H,0),f.css({width:"",height:C.h}),P.position(),rt(F),C.get("onOpen"),T.add(m).hide(),n.trigger("focus"),C.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",ot,!0),$.one(q,function(){e.removeEventListener("focus",ot,!0)})),C.get("returnFocus")&&$.one(q,function(){t(C.el).trigger("focus")})}var O=parseFloat(C.get("opacity"));o.css({opacity:O==O?O:"",cursor:C.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),C.get("closeButton")?b.html(C.get("close")).appendTo(h):b.appendTo("<div/>"),function(){var e,o,n,r=P.prep,h=++Q;R=!0,M=!1,rt(U),rt(N),C.get("onLoad"),C.h=C.get("height")?tt(C.get("height"),"y")-W-H:C.get("innerHeight")&&tt(C.get("innerHeight"),"y"),C.w=C.get("width")?tt(C.get("width"),"x")-E-k:C.get("innerWidth")&&tt(C.get("innerWidth"),"x"),C.mw=C.w,C.mh=C.h,C.get("maxWidth")&&(C.mw=tt(C.get("maxWidth"),"x")-E-k,C.mw=C.w&&C.w<C.mw?C.w:C.mw);C.get("maxHeight")&&(C.mh=tt(C.get("maxHeight"),"y")-W-H,C.mh=C.h&&C.h<C.mh?C.h:C.mh);if(e=C.get("href"),K=setTimeout(function(){p.show()},100),C.get("inline")){var a=t(e).eq(0);n=t("<div>").hide().insertBefore(a),$.one(U,function(){n.replaceWith(a)}),r(a)}else C.get("iframe")?r(" "):C.get("html")?r(C.get("html")):et(C,e)?(e=it(C,e),M=C.get("createImg"),t(M).addClass(j+"Photo").on("error."+j,function(){r(V(G,"Error").html(C.get("imgError")))}).one("load",function(){h===Q&&setTimeout(function(){var e;C.get("retinaImage")&&i.devicePixelRatio>1&&(M.height=M.height/i.devicePixelRatio,M.width=M.width/i.devicePixelRatio),C.get("scalePhotos")&&(o=function(){M.height-=M.height*e,M.width-=M.width*e},C.mw&&M.width>C.mw&&(e=(M.width-C.mw)/M.width,o()),C.mh&&M.height>C.mh&&(e=(M.height-C.mh)/M.height,o())),C.h&&(M.style.marginTop=Math.max(C.mh-M.height,0)/2+"px"),d[1]&&(C.get("loop")||d[I+1])&&(M.style.cursor="pointer",t(M).on("click."+j,function(){P.next()})),M.style.width=M.width+"px",M.style.height=M.height+"px",r(M)},1)}),M.src=e):e&&u.load(e,C.get("data"),function(e,i){h===Q&&r("error"===i?V(G,"Error").html(C.get("xhrError")):t(this).contents())})}()}}function st(){n||(B=!1,g=t(i),n=V(G).attr({id:_,class:!1===t.support.opacity?j+"IE":"",role:"dialog",tabindex:"-1"}).hide(),o=V(G,"Overlay").hide(),p=t([V(G,"LoadingOverlay")[0],V(G,"LoadingGraphic")[0]]),r=V(G,"Wrapper"),h=V(G,"Content").append(m=V(G,"Title"),w=V(G,"Current"),x=t('<button type="button"/>').attr({id:j+"Previous"}),y=t('<button type="button"/>').attr({id:j+"Next"}),v=t('<button type="button"/>').attr({id:j+"Slideshow"}),p),b=t('<button type="button"/>').attr({id:j+"Close"}),r.append(V(G).append(V(G,"TopLeft"),a=V(G,"TopCenter"),V(G,"TopRight")),V(G,!1,"clear:left").append(s=V(G,"MiddleLeft"),h,l=V(G,"MiddleRight")),V(G,!1,"clear:left").append(V(G,"BottomLeft"),c=V(G,"BottomCenter"),V(G,"BottomRight"))).find("div div").css({float:"left"}),u=V(G,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),T=y.add(x).add(w).add(v)),e.body&&!n.parent().length&&t(e.body).append(o,n.append(r,u))}function lt(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),at(this))}return!!n&&(B||(B=!0,y.on("click",function(){P.next()}),x.on("click",function(){P.prev()}),b.on("click",function(){P.close()}),o.on("click",function(){C.get("overlayClose")&&P.close()}),t(e).on("keydown."+j,function(t){var e=t.keyCode;L&&C.get("escKey")&&27===e&&(t.preventDefault(),P.close()),L&&C.get("arrowKey")&&d[1]&&!t.altKey&&(37===e?(t.preventDefault(),x.trigger("click")):39===e&&(t.preventDefault(),y.trigger("click")))}),"function"==typeof t.fn.on?t(e).on("click."+j,"."+D,i):t("."+D).live("click."+j,i)),!0)}t[_]||(t(st),(P=t.fn[_]=t[_]=function(e,i){var o=this;return e=e||{},"function"==typeof o&&(o=t("<a/>"),e.open=!0),o[0]?(st(),lt()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,_)||{};t.data(this,_,t.extend(i,e))}).addClass(D),new Y(o[0],e).get("open")&&at(o[0])),o):o}).position=function(e,i){var o,d,f,u=0,p=0,m=n.offset();function w(){a[0].style.width=c[0].style.width=h[0].style.width=parseInt(n[0].style.width,10)-k+"px",h[0].style.height=s[0].style.height=l[0].style.height=parseInt(n[0].style.height,10)-H+"px"}if(g.off("resize."+j),n.css({top:-9e4,left:-9e4}),d=g.scrollTop(),f=g.scrollLeft(),C.get("fixed")?(m.top-=d,m.left-=f,n.css({position:"fixed"})):(u=d,p=f,n.css({position:"absolute"})),!1!==C.get("right")?p+=Math.max(g.width()-C.w-E-k-tt(C.get("right"),"x"),0):!1!==C.get("left")?p+=tt(C.get("left"),"x"):p+=Math.round(Math.max(g.width()-C.w-E-k,0)/2),!1!==C.get("bottom")?u+=Math.max(X()-C.h-W-H-tt(C.get("bottom"),"y"),0):!1!==C.get("top")?u+=tt(C.get("top"),"y"):u+=Math.round(Math.max(X()-C.h-W-H,0)/2),n.css({top:m.top,left:m.left,visibility:"visible"}),r[0].style.width=r[0].style.height="9999px",o={width:C.w+E+k,height:C.h+W+H,top:u,left:p},e){var v=0;t.each(o,function(t){o[t]===J[t]||(v=e)}),e=v}J=o,e||n.css(o),n.dequeue().animate(o,{duration:e||0,complete:function(){w(),R=!1,r[0].style.width=C.w+E+k+"px",r[0].style.height=C.h+W+H+"px",C.get("reposition")&&setTimeout(function(){g.on("resize."+j,P.position)},1),"function"==typeof i&&i()},step:w})},P.resize=function(t){var e;L&&((t=t||{}).width&&(C.w=tt(t.width,"x")-E-k),t.innerWidth&&(C.w=tt(t.innerWidth,"x")),f.css({width:C.w}),t.height&&(C.h=tt(t.height,"y")-W-H),t.innerHeight&&(C.h=tt(t.innerHeight,"y")),t.innerHeight||t.height||(e=f.scrollTop(),f.css({height:"auto"}),C.h=f.height()),f.css({height:C.h}),e&&f.scrollTop(e),P.position("none"===C.get("transition")?0:C.get("speed")))},P.prep=function(i){if(L){var o,r="none"===C.get("transition")?0:C.get("speed");f.remove(),(f=V(G,"LoadedContent").append(i)).hide().appendTo(u.show()).css({width:(C.w=C.w||f.width(),C.w=C.mw&&C.mw<C.w?C.mw:C.w,C.w),overflow:C.get("scrolling")?"auto":"hidden"}).css({height:(C.h=C.h||f.height(),C.h=C.mh&&C.mh<C.h?C.mh:C.h,C.h)}).prependTo(h),u.hide(),t(M).css({float:"none"}),nt(C.get("className")),o=function(){var i,o,h=d.length;function a(){!1===t.support.opacity&&n[0].style.removeAttribute("filter")}L&&(o=function(){clearTimeout(K),p.hide(),rt(z),C.get("onComplete")},m.html(C.get("title")).show(),f.show(),h>1?("string"==typeof C.get("current")&&w.html(C.get("current").replace("{current}",I+1).replace("{total}",h)).show(),y[C.get("loop")||I<h-1?"show":"hide"]().html(C.get("next")),x[C.get("loop")||I?"show":"hide"]().html(C.get("previous")),ht(),C.get("preloading")&&t.each([Z(-1),Z(1)],function(){var i=d[this],o=new Y(i,t.data(i,_)),n=o.get("href");n&&et(o,n)&&(n=it(o,n),e.createElement("img").src=n)})):T.hide(),C.get("iframe")?(i=C.get("createIframe"),C.get("scrolling")||(i.scrolling="no"),t(i).attr({src:C.get("href"),class:j+"Iframe"}).one("load",o).appendTo(f),$.one(U,function(){i.src="//about:blank"}),C.get("fastIframe")&&t(i).trigger("load")):o(),"fade"===C.get("transition")?n.fadeTo(r,1,a):a())},"fade"===C.get("transition")?n.fadeTo(r,0,function(){P.position(0,o)}):P.position(r,o)}},P.next=function(){!R&&d[1]&&(C.get("loop")||d[I+1])&&(I=Z(1),at(d[I]))},P.prev=function(){!R&&d[1]&&(C.get("loop")||I)&&(I=Z(-1),at(d[I]))},P.close=function(){L&&!S&&(S=!0,L=!1,rt(A),C.get("onCleanup"),g.off("."+j),o.fadeTo(C.get("fadeOut")||0,0),n.stop().fadeTo(C.get("fadeOut")||0,0,function(){n.hide(),o.hide(),rt(U),f.remove(),setTimeout(function(){S=!1,rt(q),C.get("onClosed")},1)}))},P.remove=function(){n&&(n.stop(),t[_].close(),n.stop(!1,!0).remove(),o.remove(),S=!1,n=null,t("."+D).removeData(_).removeClass(D),t(e).off("click."+j).off("keydown."+j))},P.element=function(){return t(C.el)},P.settings=O)}(jQuery,document,window);
9
  /* Media Uploader */
3
  /* Autogrow */
4
  jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
5
  /* wpDiscuz */
6
+ var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?o="wpdiscuz-message-success":"warning"===t[n]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(a instanceof Array?a[n]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(e,t,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(o){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]]&&(e=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]](e,t,a))}),e},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,n=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,i=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),d=wpdiscuzAjaxObj.wpdiscuz_nonce,c=parseInt(wpdiscuzAjaxObj.commentListUpdateType),p=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),r=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),l=wpdiscuzAjaxObj.loadLastCommentId,m=l,w=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var u,f=parseInt(wpdiscuzAjaxObj.wordpressIsPaginate),h=wpdiscuzAjaxObj.storeCommenterData,b=parseInt(wpdiscuzAjaxObj.wmuEnabled),_=wpdiscuzAjaxObj.isCookiesEnabled,g=!0,z=wpdiscuzAjaxObj.cookiehash,v=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),j=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,x=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),C=parseInt(wpdiscuzAjaxObj.enableBubble),k=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),y=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),O=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,A=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),I=wpdiscuzAjaxObj.bubbleLocation,T=wpdiscuzAjaxObj.inlineFeedbackAttractionType,D=(D=parseInt(wpdiscuzAjaxObj.scrollSize))||32,F=[],E=[],M=[],L=!1,R=1,S=e("html").css("scroll-behavior"),P=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(t){var a=e(".wpd-form").not(":hidden");if(a.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<a.length;o++)if("\n"!==wpDiscuzEditor.createEditor(e(a[o]).find(".ql-container").attr("id")).getText())return t.preventDefault(),void(t.returnValue="")}else for(o=0;o<a.length;o++)if(e(a[o]).find(".wc_comment").val())return t.preventDefault(),void(t.returnValue="")}),wpdiscuzLoadRichEditor||(e(document).delegate("textarea.wc_comment","input",function(){ue(e(this))}),e.each(e("textarea.wc_comment"),function(){ue(e(this))})),e(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(j)}),e(document).on("focus","#wpdcom textarea",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||W({comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).on("click","#wpd-insert-source-code",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).on("click",".wpd-reply-button",function(){var i=Y(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+i).focus()},j):setTimeout(function(){e("#wc-textarea-"+i).trigger("focus")},j),e("#wpd-secondary-form-wrapper-"+i).slideToggle(j)):function(a){var o=Y(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var n=e("#wpd-secondary-form-wrapper-"+o);if(!t){var i={comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)};W(i)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},j):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},j);n.slideToggle(j,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===n){var i=J(t);setTimeout(function(){if(!E[i])try{E[i]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(i)}),e(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.trigger("select"),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),e(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=Y(e(this),0),o=e(this),n=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&v?function(t,a){var o=J(t),n=new FormData;n.append("action","wpdShowReplies"),n.append("commentId",o),he(x,!0,n).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),fe(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,n){console.log(n),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(n.removeClass("fa-chevron-up"),n.addClass("fa-chevron-down"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(n.removeClass("fa-chevron-down"),n.addClass("fa-chevron-up"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).on("mouseenter",".wpd-new-loaded-comment",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).on("click",".wpd-sbs-toggle",function(){e(".wpdiscuz-subscribe-bar").slideToggle(j)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&e("#wpdiscuz-subscribe-form").length&&("2.0"===n?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===n&&e(document).on("click","#wpdiscuz_subscription_button",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===n){var q=e(window).width(),H=e("#wpdcom").width();H>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),H>=940&&H<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),H>=810&&H<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),H>=730&&H<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),H>=610&&H<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),q>650&&(H>=510&&H<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H>=470&&H<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function U(t,a,o){he(x||b,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(j),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e(".wpd-thread-info").html(a.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(a.data.wc_all_comments_count_bubble_html);var n=j;a.data.is_main?ie(a.data.message):(n=j+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),he(x,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),he(x,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),_&&g?function(t){var a=t.comment_author_email,o=t.comment_author,n=t.comment_author_url;null==h?(Cookies.set("comment_author_email_"+z,a),Cookies.set("comment_author_"+z,o),n.length&&Cookies.set("comment_author_url_"+z,n)):(h=parseInt(h),Cookies.set("comment_author_email_"+z,a,{expires:h,path:"/"}),Cookies.set("comment_author_"+z,o,{expires:h,path:"/"}),n.length&&Cookies.set("comment_author_url_"+z,n,{expires:h,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").prop("checked",!0)}(a.data):g||e(".wpd-cookies-checkbox").prop("checked",!1),t.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]):ue(t.find(".wc_comment")),W(a.data),e(".wmu-preview-wrap",t).remove(),F.length&&(F.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),F=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-D},1e3,ne)},n),fe(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"),fe(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,n){console.log(n),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function W(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function V(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var i=e(this),s=1,d=e(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(s=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===Z(t,!1)&&(o=Z(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),ae(d,"#wpd-editor-"+e(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==e(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(p=d,r=!0,"2.0"===n&&e("input[name=wc_captcha]",p).length&&!e("input[name=wc_captcha]",p).val().length?(r=!1,e(".wpdiscuz-recaptcha",p).css("border","1px solid red")):"2.0"===n&&e("input[name=wc_captcha]",p).length&&e(".wpdiscuz-recaptcha",p).css("border","none"),r)){L=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&_&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+z,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){F.push(e(this))}))})}(d),e(i).removeClass("wpd_not_clicked");var c=new FormData;if(c.append("action","wpdAddComment"),e(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&c.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&c.append(this.name+"",e(this).val())}),c.append("wpd_comment_depth",s),wpdiscuzAjaxObj.wpdiscuz_zs&&c.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",d).length?e(".wpd-cookies-checkbox",d).prop("checked")||(g=!1):t&&(g=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===n&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){c.append("g-recaptcha-response",e),U(d,c,i)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else U(d,c,i)}var p,r;!function(e){if((a||o)&&"2.0"===n){var t=J(e);grecaptcha.reset(E[t])}}(e(".wpdiscuz_unique_id",d).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),e(document).on("click",".wpd_editable_comment",function(){u&&e(".wpdiscuz-edit-form-wrap").length&&V(Y(e(".wpdiscuz-edit-form-wrap"),0),u);var t=e(this),a=Y(t,0),o=J(a),n=new FormData;n.append("action","wpdEditComment"),n.append("commentId",o),u=e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),he(x,!0,n).done(function(o){if("object"==typeof o)if(o.success){if(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(o.data.html),wpdiscuzLoadRichEditor){var n=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a);n.clipboard.dangerouslyPasteHTML(0,o.data.content),n.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+a).val(o.data.content),ue(e("#wc-textarea-edit_"+a));e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[o.data],o.data,t),"error");else console.log(o);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wc_save_edited_comment",function(){var t=e(this),a=Y(t),o=J(a),n=e("#wpd-comm-"+a+" #wpdiscuz-edit-form");if(ae(n,"#wpd-editor-edit_"+a),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()){var i=new FormData;i.append("action","wpdSaveEditedComment"),i.append("commentId",o),e(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&i.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),he(x,!0,i).done(function(n){"object"==typeof n?(n.success?(V(a,n.data.message),n.data.lastEdited&&(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(n.data.lastEdited).insertAfter("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),n.data.twitterShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",n.data.twitterShareLink),n.data.whatsappShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",n.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+a)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error"),fe(n,o)):console.log(n),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wc_cancel_edit",function(){var t=Y(e(this));V(t,u),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!f&&w&&(R=0,1==w?setTimeout(function(){Q(!0)},500):e(document).on("click",".wpd-load-comments",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),Q(!0)})),e(document).on("click",".wpd-load-more-submit",function(){var t=e(this);t.hasClass("wpd-loaded")&&Q(!1,t,"wpd-loaded","wpd-loading")});var B=!1;function K(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===B&&1==t&&(B=!0,Q(!1,e(".wpd-load-more-submit"))))}function Q(t,a,o,n){a&&(a.toggleClass(o),a.toggleClass(n));var s=new FormData;s.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&s.append("sorting",d),s.append("offset",R),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),he(x,!t||1!=w,s).done(function(s){"object"==typeof s&&s.success&&(R++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),N(s,t&&2!==i),B=!1,s.data.loadLastCommentId&&(l=s.data.loadLastCommentId),fe(s),t&&G(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))}).fail(function(t,i,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))})}function N(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==i&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),fe(t)}function G(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-D},1e3,ne),t&&$(o)},500);else{var n=new FormData;n.append("action","wpdGetSingleComment"),n.append("commentId",o),he(x,!0,n).done(function(a){if("object"==typeof a&&a.success){var n="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e(n).offset().top-D},1e3,ne),t&&$(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function $(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function X(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)ee((t=a[o]).comment_parent,t.comment_html)}function Y(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function J(e){return e.substring(0,e.indexOf("_"))}function Z(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function ee(t,a){if(0==t)ie(a);else{var o=Y(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function te(){var t=[];return e(".wpd-comment-right").each(function(){t.push(J(Y(e(this),0)))}),t.join(",")}function ae(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).prop("required",!1),0===e("input:checked",this).length?e("input",e(this)).prop("required",!0):e(".wpd-field-invalid",this).remove()})}function oe(){e("html, body").css("scroll-behavior","unset")}function ne(){e("html").css("scroll-behavior",S),e("body").css("scroll-behavior",P)}function ie(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function se(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==i||f||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),K(),e(window).scroll(function(){K()})),wpdiscuzAjaxObj.setLoadMoreVisibility=N,e(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=J(Y(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var n=new FormData;n.append("action","wpdVoteOnComment"),n.append("commentId",o),n.append("voteType",a),he(x,!0,n).done(function(n){if(e(t).addClass("wpd_not_clicked"),"object"==typeof n){if(n.success){if("total"===n.data.buttonsStyle){var i=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=n.data.votes;i.text(n.data.votesHumanReadable),i.attr("title",s),i.removeClass("wpd-up wpd-down"),s>0&&i.addClass("wpd-up"),s<0&&i.addClass("wpd-down")}else{var d=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));d.text(n.data.likeCountHumanReadable),d.attr("title",n.data.likeCount),c.text(n.data.dislikeCountHumanReadable),c.attr("title",n.data.dislikeCount),parseInt(n.data.likeCount)>0?d.addClass("wpd-up"):d.removeClass("wpd-up"),parseInt(n.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),n.data.curUserReaction>0?p.addClass("wpd-up"):n.data.curUserReaction<0&&r.addClass("wpd-down")}else n.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error");fe(n,o,a)}else console.log(n);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click","body",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var n=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",n||""),he(x,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),N(t,!1),R=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){G(!1)},1!=w&&G(!1),e(document).on("click",".wpdiscuz-readmore",function(){var t=Y(e(this)),a=J(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),he(x,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),fe(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("change",".wpd-required-group",function(){0!==e("input:checked",this).length?e("input",e(this)).prop("required",!1):e("input",e(this)).prop("required",!0)}),e(document).on("click",".wpdiscuz-spoiler",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).on("click",".wpd-tools i",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]","#wpdcom").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).on("mouseleave",".wpd-comment-right",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).on("click",".wpd_stick_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd_close_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var n=e(".wpdiscuz-sort-button-active").attr("data-sorting");n&&o.append("sorting",n),o.append("lastParentId",0),o.append("offset",0),R=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),he(x,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),N(a),l=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),fe(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpd-filter-view-all",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=J(Y(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),he(x,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data.code],a.data.code,t),"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),se(),e(document).on("keyup",".wc_email",function(){se(e(this))}),C&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),y&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*O)},1e3*y),"content_left"===I)if(e(".entry-content").length){var de=(ce=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ce=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ce;de=(ce=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===I?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===I&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e(document).on("click","#wpd-bubble-add-message-close",function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e(document).on("click","#wpd-bubble",function(){oe(),e("#tab-title-reviews").length&&e("#tab-title-reviews a").trigger("click"),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-(D+28)},1e3,function(){ne(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").trigger("focus")})}),e(document).on("click","#wpd-bubble-comment-close",function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e(document).on("click","#wpd-bubble-comment-reply-link a",function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),G(!0);var a=t.match(/#comment\-(\d+)/);M=M.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(M.length),0==M.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e(document).on("click","#wpd-bubble-count",function(){if(M.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",M.join()),he(x,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),X(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),M=[],e(".wpd-new-loaded-comment").length&&(oe(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-(D+28)},1e3,ne)),fe(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((C&&k||c)&&(t||!t&&r)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:m,visibleCommentIds:te()}}).done(function(a){if(!L)if("object"==typeof a){if(a.commentIDsToRemove.forEach(function(t){e("[id^=wpd-comm-"+t+"]").remove()}),a.ids.length){c&&((i=new FormData).append("action","wpdUpdateAutomatically"),i.append("loadLastCommentId",l),i.append("visibleCommentIds",te()),he(x,!1,i).done(function(t){L||"object"==typeof t&&t.success&&(X(t),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e(".wpd-thread-info").html(t.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(t.data.wc_all_comments_count_bubble_html),l=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;m=parseInt(a.ids[a.ids.length-1]),M=M.concat(a.ids),A&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var n=parseInt(e(".wpd-new-comments-count").text());n+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(n),e("#wpd-bubble-count").addClass("wpd-new-comments")}a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").replaceWith(a.all_comments_count_bubble_html),e(".wpd-thread-info").html(a.all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.all_comments_count)}else console.log(a);var i;setTimeout(t,p)}).fail(function(e,a,o){console.log(o),setTimeout(t,p)})},p),e(".wpd-inline-form-wrapper").length){var pe=new FormData;pe.append("action","wpdGetInlineCommentForm"),he(x,!1,pe).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),we()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data]),t.data,"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function re(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function le(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function me(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&a>0&&a<300&&("blink"===T?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),we(t.siblings(".wpd-inline-form-wrapper"))))})}function we(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ue(t){var a,o=0;if(t.parents(".wpd_main_comm_form").length)o=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents(".wpd_main_comm_form");else if(t.parents(".wpd-secondary-form-wrapper").length)o=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),a=t.parents(".wpd-secondary-form-wrapper");else if(t.parents("#wpdiscuz-edit-form").length){var n=Y(t);o=parseInt(n.substring(n.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents("#wpdiscuz-edit-form")}if(o&&a){var i=t.val().length,s=e(".wpd-editor-char-counter",a),d=o-i;s.html(d),d<=10?s.addClass("error"):s.removeClass("error")}}function fe(t,a,o,n){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function he(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s),o.append("wpdiscuz_nonce",d);var n=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](o,t,a))});var i=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:i,data:o,contentType:!1,processData:!1})}e(document).on("click","body",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){le();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&a.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),we(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var n=new FormData;n.append("action","wpdAddInlineComment"),n.append("inline_form_id",re(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&n.append(e(a).attr("name"),e(a).val()):n.append(e(a).attr("name"),e(a).val())}),he(x,!0,n).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),le();var n=parseInt(t.data.newCount),i=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");i.text(n),n?i.addClass("wpd-has-comments"):i.removeClass("wpd-has-comments"),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e(".wpd-thread-info").html(t.data.allCommentsCountBeforeThreadsHtml),e(".wpd-thread-info").attr("data-comments-count",t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").replaceWith(t.data.allCommentsCountBubbleHtml),t.data.message&&ie(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data,a),"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("keydown",".wpd-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).on("keydown","#wpdiscuz-edit-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).on("keydown",".wpd-inline-comment-content",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",re(t)),he(x,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-view-all-inline-comments",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),oe(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-D},1e3,ne)}),e(document).on("click",".wpd-feedback-content-link",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");oe(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-(D+6)},1e3,function(){ne(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==T&&"blink"!==T||(me(),e(window).on("scroll",me)),e(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),he(x,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data),"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){t.preventDefault();var a,o,i=e(this);if(i[0].checkValidity()&&(a=i,o=!0,"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",i).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),he(x,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wpd-unsubscribe",function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),he(x,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=he});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
7
  /* Colorbox */
8
  !function(t,e,i){var o,n,r,h,a,s,l,c,d,g,f,u,p,m,w,v,y,x,b,T,C,H,k,W,E,I,M,L,R,S,K,P,B,O={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),o=t(this).data("cbox-iframe-attrs");return"object"==typeof o&&t.each(o,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},_="colorbox",j="cbox",D=j+"Element",F=j+"_open",N=j+"_load",z=j+"_complete",A=j+"_cleanup",q=j+"_closed",U=j+"_purge",$=t("<a/>"),G="div",Q=0,J={};function V(i,o,n){var r=e.createElement(i);return o&&(r.id=j+o),n&&(r.style.cssText=n),t(r)}function X(){return i.innerHeight?i.innerHeight:t(i).height()}function Y(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var o;return void 0===this.cache[e]&&(void 0!==(o=t(this.el).attr("data-cbox-"+e))?this.cache[e]=o:void 0!==i[e]?this.cache[e]=i[e]:void 0!==O[e]&&(this.cache[e]=O[e])),this.cache[e]},this.get=function(t){var e=this.value(t);return"function"==typeof e?e.call(this.el,this):e}}function Z(t){var e=d.length,i=(I+t)%e;return i<0?e+i:i}function tt(t,e){return Math.round((/%/.test(t)?("x"===e?g.width():X())/100:1)*parseInt(t,10))}function et(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function it(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function ot(t){"contains"in n[0]&&!n[0].contains(t.target)&&t.target!==o[0]&&(t.stopPropagation(),n.trigger("focus"))}function nt(t){nt.str!==t&&(n.add(o).removeClass(nt.str).addClass(t),nt.str=t)}function rt(i){t(e).trigger(i),$.triggerHandler(i)}var ht=function(){var t,e,i=j+"Slideshow_",o="click."+j;function r(){clearTimeout(e)}function h(){(C.get("loop")||d[I+1])&&(r(),e=setTimeout(P.next,C.get("slideshowSpeed")))}function a(){v.html(C.get("slideshowStop")).off(o).one(o,s),$.on(z,h).on(N,r),n.removeClass(i+"off").addClass(i+"on")}function s(){r(),$.off(z,h).off(N,r),v.html(C.get("slideshowStart")).off(o).one(o,function(){P.next(),a()}),n.removeClass(i+"on").addClass(i+"off")}function l(){t=!1,v.hide(),r(),$.off(z,h).off(N,r),n.removeClass(i+"off "+i+"on")}return function(){t?C.get("slideshow")||($.off(A,l),l()):C.get("slideshow")&&d[1]&&(t=!0,$.one(A,l),C.get("slideshowAuto")?a():s(),v.show())}}();function at(r){var g,w;if(!S){if(g=t(r).data(_),C=new Y(r,g),w=C.get("rel"),I=0,w&&!1!==w&&"nofollow"!==w?(d=t("."+D).filter(function(){return new Y(this,t.data(this,_)).get("rel")===w}),-1===(I=d.index(C.el))&&(d=d.add(C.el),I=d.length-1)):d=t(C.el),!L){L=R=!0,nt(C.get("className")),n.css({visibility:"hidden",display:"block",opacity:""}),f=V(G,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),h.css({width:"",height:""}).append(f),H=a.height()+c.height()+h.outerHeight(!0)-h.height(),k=s.width()+l.width()+h.outerWidth(!0)-h.width(),W=f.outerHeight(!0),E=f.outerWidth(!0);var v=tt(C.get("initialWidth"),"x"),y=tt(C.get("initialHeight"),"y"),x=C.get("maxWidth"),B=C.get("maxHeight");C.w=Math.max((!1!==x?Math.min(v,tt(x,"x")):v)-E-k,0),C.h=Math.max((!1!==B?Math.min(y,tt(B,"y")):y)-W-H,0),f.css({width:"",height:C.h}),P.position(),rt(F),C.get("onOpen"),T.add(m).hide(),n.trigger("focus"),C.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",ot,!0),$.one(q,function(){e.removeEventListener("focus",ot,!0)})),C.get("returnFocus")&&$.one(q,function(){t(C.el).trigger("focus")})}var O=parseFloat(C.get("opacity"));o.css({opacity:O==O?O:"",cursor:C.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),C.get("closeButton")?b.html(C.get("close")).appendTo(h):b.appendTo("<div/>"),function(){var e,o,n,r=P.prep,h=++Q;R=!0,M=!1,rt(U),rt(N),C.get("onLoad"),C.h=C.get("height")?tt(C.get("height"),"y")-W-H:C.get("innerHeight")&&tt(C.get("innerHeight"),"y"),C.w=C.get("width")?tt(C.get("width"),"x")-E-k:C.get("innerWidth")&&tt(C.get("innerWidth"),"x"),C.mw=C.w,C.mh=C.h,C.get("maxWidth")&&(C.mw=tt(C.get("maxWidth"),"x")-E-k,C.mw=C.w&&C.w<C.mw?C.w:C.mw);C.get("maxHeight")&&(C.mh=tt(C.get("maxHeight"),"y")-W-H,C.mh=C.h&&C.h<C.mh?C.h:C.mh);if(e=C.get("href"),K=setTimeout(function(){p.show()},100),C.get("inline")){var a=t(e).eq(0);n=t("<div>").hide().insertBefore(a),$.one(U,function(){n.replaceWith(a)}),r(a)}else C.get("iframe")?r(" "):C.get("html")?r(C.get("html")):et(C,e)?(e=it(C,e),M=C.get("createImg"),t(M).addClass(j+"Photo").on("error."+j,function(){r(V(G,"Error").html(C.get("imgError")))}).one("load",function(){h===Q&&setTimeout(function(){var e;C.get("retinaImage")&&i.devicePixelRatio>1&&(M.height=M.height/i.devicePixelRatio,M.width=M.width/i.devicePixelRatio),C.get("scalePhotos")&&(o=function(){M.height-=M.height*e,M.width-=M.width*e},C.mw&&M.width>C.mw&&(e=(M.width-C.mw)/M.width,o()),C.mh&&M.height>C.mh&&(e=(M.height-C.mh)/M.height,o())),C.h&&(M.style.marginTop=Math.max(C.mh-M.height,0)/2+"px"),d[1]&&(C.get("loop")||d[I+1])&&(M.style.cursor="pointer",t(M).on("click."+j,function(){P.next()})),M.style.width=M.width+"px",M.style.height=M.height+"px",r(M)},1)}),M.src=e):e&&u.load(e,C.get("data"),function(e,i){h===Q&&r("error"===i?V(G,"Error").html(C.get("xhrError")):t(this).contents())})}()}}function st(){n||(B=!1,g=t(i),n=V(G).attr({id:_,class:!1===t.support.opacity?j+"IE":"",role:"dialog",tabindex:"-1"}).hide(),o=V(G,"Overlay").hide(),p=t([V(G,"LoadingOverlay")[0],V(G,"LoadingGraphic")[0]]),r=V(G,"Wrapper"),h=V(G,"Content").append(m=V(G,"Title"),w=V(G,"Current"),x=t('<button type="button"/>').attr({id:j+"Previous"}),y=t('<button type="button"/>').attr({id:j+"Next"}),v=t('<button type="button"/>').attr({id:j+"Slideshow"}),p),b=t('<button type="button"/>').attr({id:j+"Close"}),r.append(V(G).append(V(G,"TopLeft"),a=V(G,"TopCenter"),V(G,"TopRight")),V(G,!1,"clear:left").append(s=V(G,"MiddleLeft"),h,l=V(G,"MiddleRight")),V(G,!1,"clear:left").append(V(G,"BottomLeft"),c=V(G,"BottomCenter"),V(G,"BottomRight"))).find("div div").css({float:"left"}),u=V(G,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),T=y.add(x).add(w).add(v)),e.body&&!n.parent().length&&t(e.body).append(o,n.append(r,u))}function lt(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),at(this))}return!!n&&(B||(B=!0,y.on("click",function(){P.next()}),x.on("click",function(){P.prev()}),b.on("click",function(){P.close()}),o.on("click",function(){C.get("overlayClose")&&P.close()}),t(e).on("keydown."+j,function(t){var e=t.keyCode;L&&C.get("escKey")&&27===e&&(t.preventDefault(),P.close()),L&&C.get("arrowKey")&&d[1]&&!t.altKey&&(37===e?(t.preventDefault(),x.trigger("click")):39===e&&(t.preventDefault(),y.trigger("click")))}),"function"==typeof t.fn.on?t(e).on("click."+j,"."+D,i):t("."+D).live("click."+j,i)),!0)}t[_]||(t(st),(P=t.fn[_]=t[_]=function(e,i){var o=this;return e=e||{},"function"==typeof o&&(o=t("<a/>"),e.open=!0),o[0]?(st(),lt()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,_)||{};t.data(this,_,t.extend(i,e))}).addClass(D),new Y(o[0],e).get("open")&&at(o[0])),o):o}).position=function(e,i){var o,d,f,u=0,p=0,m=n.offset();function w(){a[0].style.width=c[0].style.width=h[0].style.width=parseInt(n[0].style.width,10)-k+"px",h[0].style.height=s[0].style.height=l[0].style.height=parseInt(n[0].style.height,10)-H+"px"}if(g.off("resize."+j),n.css({top:-9e4,left:-9e4}),d=g.scrollTop(),f=g.scrollLeft(),C.get("fixed")?(m.top-=d,m.left-=f,n.css({position:"fixed"})):(u=d,p=f,n.css({position:"absolute"})),!1!==C.get("right")?p+=Math.max(g.width()-C.w-E-k-tt(C.get("right"),"x"),0):!1!==C.get("left")?p+=tt(C.get("left"),"x"):p+=Math.round(Math.max(g.width()-C.w-E-k,0)/2),!1!==C.get("bottom")?u+=Math.max(X()-C.h-W-H-tt(C.get("bottom"),"y"),0):!1!==C.get("top")?u+=tt(C.get("top"),"y"):u+=Math.round(Math.max(X()-C.h-W-H,0)/2),n.css({top:m.top,left:m.left,visibility:"visible"}),r[0].style.width=r[0].style.height="9999px",o={width:C.w+E+k,height:C.h+W+H,top:u,left:p},e){var v=0;t.each(o,function(t){o[t]===J[t]||(v=e)}),e=v}J=o,e||n.css(o),n.dequeue().animate(o,{duration:e||0,complete:function(){w(),R=!1,r[0].style.width=C.w+E+k+"px",r[0].style.height=C.h+W+H+"px",C.get("reposition")&&setTimeout(function(){g.on("resize."+j,P.position)},1),"function"==typeof i&&i()},step:w})},P.resize=function(t){var e;L&&((t=t||{}).width&&(C.w=tt(t.width,"x")-E-k),t.innerWidth&&(C.w=tt(t.innerWidth,"x")),f.css({width:C.w}),t.height&&(C.h=tt(t.height,"y")-W-H),t.innerHeight&&(C.h=tt(t.innerHeight,"y")),t.innerHeight||t.height||(e=f.scrollTop(),f.css({height:"auto"}),C.h=f.height()),f.css({height:C.h}),e&&f.scrollTop(e),P.position("none"===C.get("transition")?0:C.get("speed")))},P.prep=function(i){if(L){var o,r="none"===C.get("transition")?0:C.get("speed");f.remove(),(f=V(G,"LoadedContent").append(i)).hide().appendTo(u.show()).css({width:(C.w=C.w||f.width(),C.w=C.mw&&C.mw<C.w?C.mw:C.w,C.w),overflow:C.get("scrolling")?"auto":"hidden"}).css({height:(C.h=C.h||f.height(),C.h=C.mh&&C.mh<C.h?C.mh:C.h,C.h)}).prependTo(h),u.hide(),t(M).css({float:"none"}),nt(C.get("className")),o=function(){var i,o,h=d.length;function a(){!1===t.support.opacity&&n[0].style.removeAttribute("filter")}L&&(o=function(){clearTimeout(K),p.hide(),rt(z),C.get("onComplete")},m.html(C.get("title")).show(),f.show(),h>1?("string"==typeof C.get("current")&&w.html(C.get("current").replace("{current}",I+1).replace("{total}",h)).show(),y[C.get("loop")||I<h-1?"show":"hide"]().html(C.get("next")),x[C.get("loop")||I?"show":"hide"]().html(C.get("previous")),ht(),C.get("preloading")&&t.each([Z(-1),Z(1)],function(){var i=d[this],o=new Y(i,t.data(i,_)),n=o.get("href");n&&et(o,n)&&(n=it(o,n),e.createElement("img").src=n)})):T.hide(),C.get("iframe")?(i=C.get("createIframe"),C.get("scrolling")||(i.scrolling="no"),t(i).attr({src:C.get("href"),class:j+"Iframe"}).one("load",o).appendTo(f),$.one(U,function(){i.src="//about:blank"}),C.get("fastIframe")&&t(i).trigger("load")):o(),"fade"===C.get("transition")?n.fadeTo(r,1,a):a())},"fade"===C.get("transition")?n.fadeTo(r,0,function(){P.position(0,o)}):P.position(r,o)}},P.next=function(){!R&&d[1]&&(C.get("loop")||d[I+1])&&(I=Z(1),at(d[I]))},P.prev=function(){!R&&d[1]&&(C.get("loop")||I)&&(I=Z(-1),at(d[I]))},P.close=function(){L&&!S&&(S=!0,L=!1,rt(A),C.get("onCleanup"),g.off("."+j),o.fadeTo(C.get("fadeOut")||0,0),n.stop().fadeTo(C.get("fadeOut")||0,0,function(){n.hide(),o.hide(),rt(U),f.remove(),setTimeout(function(){S=!1,rt(q),C.get("onClosed")},1)}))},P.remove=function(){n&&(n.stop(),t[_].close(),n.stop(!1,!0).remove(),o.remove(),S=!1,n=null,t("."+D).removeData(_).removeClass(D),t(e).off("click."+j).off("keydown."+j))},P.element=function(){return t(C.el)},P.settings=O)}(jQuery,document,window);
9
  /* Media Uploader */
assets/js/wpdiscuz-combo.min.js CHANGED
@@ -7,7 +7,7 @@
7
  /* Autogrow */
8
  jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
9
  /* wpDiscuz */
10
- var wpDiscuzEditor,wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzLoadRichEditor&&(wpDiscuzEditor=new WpdEditor),wpdiscuzAjaxObj.setCommentMessage=function(e,t,o){var a="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?a="wpdiscuz-message-success":"warning"===t[n]&&(a="wpdiscuz-message-warning"):"success"===t?a="wpdiscuz-message-success":"warning"===t&&(a="wpdiscuz-message-warning"),jQuery("<div/>").addClass(a).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(o instanceof Array?o[n]:o||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?a="wpdiscuz-message-success":"warning"===t&&(a="wpdiscuz-message-warning"),jQuery("<div/>").addClass(a).html(e).prependTo("#wpdiscuz-comment-message").delay(o||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(t,o,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[e]]&&(t=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[e]](t,o,a))}),t},jQuery(document).ready(function(c){c("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var i=wpdiscuzAjaxObj.is_user_logged_in,p=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!i,r=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&i,l=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,s=parseInt(wpdiscuzAjaxObj.commentListLoadType),d=parseInt(wpdiscuzAjaxObj.wc_post_id),n=parseInt(wpdiscuzAjaxObj.commentListUpdateType),m=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),e=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),w=wpdiscuzAjaxObj.loadLastCommentId,u=w,f=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var t,o,h,a=parseInt(wpdiscuzAjaxObj.wordpressIsPaginate),b=wpdiscuzAjaxObj.storeCommenterData,_=parseInt(wpdiscuzAjaxObj.wmuEnabled),g=wpdiscuzAjaxObj.isCookiesEnabled,z=!0,j=wpdiscuzAjaxObj.cookiehash,v=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),C=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,x=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),k=parseInt(wpdiscuzAjaxObj.enableBubble),y=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),O=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),A=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,I=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),T=wpdiscuzAjaxObj.bubbleLocation,D=wpdiscuzAjaxObj.inlineFeedbackAttractionType,E=(E=parseInt(wpdiscuzAjaxObj.scrollSize))||32,F=[],M=[],L=[],R=!1,S=1,P=c("html").css("scroll-behavior"),q=c("body").css("scroll-behavior");function H(d,e,s){we(x||_,!1,e).done(function(e){var t,o,a,n;c(s).addClass("wpd_not_clicked"),"object"==typeof e?e.success?("collapsed"===wpdiscuzAjaxObj.commentFormView&&c(".wpd-form-foot",d).slideUp(C),e.data.wc_all_comments_count_new=parseInt(e.data.wc_all_comments_count_new),c(".wpd-thread-info").html(e.data.wc_all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.data.wc_all_comments_count_new),c("#wpd-bubble-all-comments-count").replaceWith(e.data.wc_all_comments_count_bubble_html),t=C,e.data.is_main?de(e.data.message):(t=700+C,c("#wpd-secondary-form-wrapper-"+e.data.uniqueid).slideToggle(700),(1==e.data.is_in_same_container?c("#wpd-secondary-form-wrapper-"+e.data.uniqueid):c("#wpd-comm-"+e.data.uniqueid)).after(e.data.message)),(a=e).data.held_moderate||((o=new FormData).append("action","wpdCheckNotificationType"),o.append("comment_id",a.data.new_comment_id),o.append("email",a.data.comment_author_email),o.append("isParent",a.data.is_main),we(x,!0,o)),0<(a=e).data.redirect&&a.data.new_comment_id&&((n=new FormData).append("action","wpdRedirect"),n.append("commentId",a.data.new_comment_id),we(x,!0,n).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,o){console.log(o)})),g&&z?(o=e.data,a=o.comment_author_email,n=o.comment_author,o=o.comment_author_url,null==b?(Cookies.set("comment_author_email_"+j,a),Cookies.set("comment_author_"+j,n),o.length&&Cookies.set("comment_author_url_"+j,o)):(b=parseInt(b),Cookies.set("comment_author_email_"+j,a,{expires:b,path:"/"}),Cookies.set("comment_author_"+j,n,{expires:b,path:"/"}),o.length&&Cookies.set("comment_author_url_"+j,o,{expires:b,path:"/"})),c(".wpd-cookies-checkbox").length&&c(".wpd-cookies-checkbox").prop("checked",!0)):z||c(".wpd-cookies-checkbox").prop("checked",!1),d.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+c(".wpdiscuz_unique_id",d).val()).setContents([{insert:"\n"}]):le(d.find(".wc_comment")),U(e.data),c(".wmu-preview-wrap",d).remove(),F.length&&(F.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),F=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.new_comment_id).offset().top-E},1e3,ne)},t),me(e,d)):e.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,d),"error"),me(e,d)):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c(s).addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})}function U(e){c(".wpd_comm_form .wc_name").val(e.comment_author),e.comment_author_email&&e.comment_author_email.indexOf("@example.com")<0&&c(".wpd_comm_form .wc_email").val(e.comment_author_email),e.comment_author_url&&c(".wpd_comm_form .wc_website").val(e.comment_author_url)}function W(e,t){c("#wpd-comm-"+e+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),c("#wpd-comm-"+e+" .wpdiscuz-edit-form-wrap").replaceWith(t),c("#wpd-comm-"+e+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}c(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?c(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .the_champ_login_container").length?c(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .social_connect_form").length?c(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&c(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&c("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(e){var t=c(".wpd-form").not(":hidden");if(t.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<t.length;o++)if("\n"!==wpDiscuzEditor.createEditor(c(t[o]).find(".ql-container").attr("id")).getText())return e.preventDefault(),void(e.returnValue="")}else for(o=0;o<t.length;o++)if(c(t[o]).find(".wc_comment").val())return e.preventDefault(),void(e.returnValue="")}),wpdiscuzLoadRichEditor||(c(document).delegate("textarea.wc_comment","input",function(){le(c(this))}),c.each(c("textarea.wc_comment"),function(){le(c(this))})),c(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){c(".wpd-form-foot",c(this).parents(".wpd_comm_form")).slideDown(C)}),c(document).on("focus","#wpdcom textarea",function(){c(this).next(".autogrow-textarea-mirror").length||c(this).autoGrow()}),i||U({comment_author:Cookies.get("comment_author_"+j),comment_author_email:Cookies.get("comment_author_email_"+j),comment_author_url:Cookies.get("comment_author_url_"+j)}),c(".wpd-vote-down.wpd-dislike-hidden").remove(),c(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),c(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){c(this).hide(),c("#wpd-editor-source-code-wrapper").hide(),c("#wpd-editor-uid").val(""),c("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&c(document).on("click","#wpd-insert-source-code",function(){var e=wpDiscuzEditor.createEditor("#"+c("#wpd-editor-uid").val());e.deleteText(0,e.getLength(),Quill.sources.USER);var t=c("#wpd-editor-source-code").val();t.length&&e.clipboard.dangerouslyPasteHTML(0,t,Quill.sources.USER),e.update(),c("#wpd-editor-source-code-wrapper-bg").hide(),c("#wpd-editor-source-code-wrapper").hide(),c("#wpd-editor-uid").val(""),c("#wpd-editor-source-code").val("")}),c(document).on("click",".wpd-reply-button",function(){var t,e,o=J(c(this),0);c(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},C):setTimeout(function(){c("#wc-textarea-"+o).trigger("focus")},C),c("#wpd-secondary-form-wrapper-"+o).slideToggle(C)):function(e){var t=J(e,0);c("#wpdiscuz_form_anchor-"+t).before(function(e){return c("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,e)}(t));var o=c("#wpd-secondary-form-wrapper-"+t);i||U({comment_author:Cookies.get("comment_author_"+j),comment_author_email:Cookies.get("comment_author_email_"+j),comment_author_url:Cookies.get("comment_author_url_"+j)}),wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+t).focus()},C):setTimeout(function(){c("#wc-textarea-"+t).trigger("focus")},C),o.slideToggle(C,function(){e.addClass("wpdiscuz-clonned")})}(c(this)),t=o,(p||r)&&"2.0"===l&&(e=Z(t),setTimeout(function(){if(!M[e])try{M[e]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){c("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){c("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3))}),c(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var e=c(this).data("comment-url"),t=c("<input/>");t.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(e),t.trigger("select"),document.execCommand("copy"),t.remove(),wpdiscuzAjaxObj.setCommentMessage(e+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),c(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),c(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var e=c(this);e.removeClass("wpd_not_clicked");var t,a,o,n,d=J(c(this),0),s=c(this),i=c(".fas",s);!s.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&v?(a=e,o=Z(t=d),(n=new FormData).append("action","wpdShowReplies"),n.append("commentId",o),we(x,!0,n).done(function(e){a.addClass("wpd_not_clicked"),"object"==typeof e&&e.success&&(c("#wpd-comm-"+t).replaceWith(e.data.comment_list),c("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),c("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),c("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),a.addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})):c("#wpd-comm-"+d+"> .wpd-reply").slideToggle(700,function(){c(this).is(":hidden")?(i.removeClass("fa-chevron-up"),i.addClass("fa-chevron-down"),s.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),s.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(i.removeClass("fa-chevron-down"),i.addClass("fa-chevron-up"),s.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),s.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),e.addClass("wpd_not_clicked")})}),c(document).on("mouseenter",".wpd-new-loaded-comment",function(){c(this).removeClass("wpd-new-loaded-comment")}),c(document).on("click",".wpd-sbs-toggle",function(){c(".wpdiscuz-subscribe-bar").slideToggle(C)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!i&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&c("#wpdiscuz-subscribe-form").length&&("2.0"===l?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){c("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){c("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),c(document).on("submit","#wpdiscuz-subscribe-form",function(e){c("#wpdiscuz-recaptcha-field-subscribe-form").val()?c(".wpdiscuz-recaptcha",c(this)).css("border","none"):(c(".wpdiscuz-recaptcha",c(this)).css("border","1px solid red"),e.preventDefault())})):"3.0"===l&&c(document).on("click","#wpdiscuz_subscription_button",function(e){var t=c(this).parents("#wpdiscuz-subscribe-form");e.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,t.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}})),(p||r)&&"2.0"===l&&(t=c(window).width(),1100<=(o=c("#wpdcom").width())&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),940<=o&&o<1100&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),810<=o&&o<940&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),730<=o&&o<810&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),610<=o&&o<730&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),650<t&&(510<=o&&o<610&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),470<=o&&o<510&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),o<470&&(c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),c("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),c("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))),c(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var o,e,t,a=c(this),n=1,d=c(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(t=(t=c(this).parents(".wpd-comment")).attr("class").split(" "),o="",c.each(t,function(e,t){"wpd_comment_level"===ee(t,!1)&&(o=ee(t,!0))}),n=parseInt(o)+1),oe(d,"#wpd-editor-"+c(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==c(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(e=d,t=!0,"2.0"===l&&c("input[name=wc_captcha]",e).length&&!c("input[name=wc_captcha]",e).val().length?(t=!1,c(".wpdiscuz-recaptcha",e).css("border","1px solid red")):"2.0"===l&&c("input[name=wc_captcha]",e).length&&c(".wpdiscuz-recaptcha",e).css("border","none"),t)){R=!0,c(".wpd-agreement-checkbox",d).each(function(){c(this).hasClass("wpd_agreement_hide")&&g&&c(this).prop("checked")&&(Cookies.set(c(this).attr("name")+"_"+j,1,{expires:30,path:"/"}),c("input[name="+c(this).attr("name")+"]").each(function(){F.push(c(this))}))}),c(a).removeClass("wpd_not_clicked");var s=new FormData;if(s.append("action","wpdAddComment"),c(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",c(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||c(this).is(":checked")&&s.append(this.name+"",c(this).val())}),s.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&s.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),c(".wpd-cookies-checkbox",d).length?c(".wpd-cookies-checkbox",d).prop("checked")||(z=!1):i&&(z=!1),c("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===l&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){s.append("g-recaptcha-response",e),H(d,s,a)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error"),c("#wpdiscuz-loading-bar").fadeOut(250)}else H(d,s,a)}n=c(".wpdiscuz_unique_id",d).val(),(p||r)&&"2.0"===l&&(n=Z(n),grecaptcha.reset(M[n])),c(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),c(document).on("click",".wpd_editable_comment",function(){h&&c(".wpdiscuz-edit-form-wrap").length&&W(J(c(".wpdiscuz-edit-form-wrap"),0),h);var o=c(this),a=J(o,0),e=Z(a),t=new FormData;t.append("action","wpdEditComment"),t.append("commentId",e),h=c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),we(x,!0,t).done(function(e){var t;"object"==typeof e?e.success?(c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(e.data.html),wpdiscuzLoadRichEditor?((t=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a)).clipboard.dangerouslyPasteHTML(0,e.data.content),t.update(),c(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")):(c("#wc-textarea-edit_"+a).val(e.data.content),le(c("#wc-textarea-edit_"+a))),c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,o),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wc_save_edited_comment",function(){var e,t=c(this),o=J(t),a=Z(o),n=c("#wpd-comm-"+o+" #wpdiscuz-edit-form");oe(n,"#wpd-editor-edit_"+o),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()&&((e=new FormData).append("action","wpdSaveEditedComment"),e.append("commentId",a),c(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&e.append(this.name+"",c(this).val()),"checkbox"!==this.type&&"radio"!==this.type||c(this).is(":checked")&&e.append(this.name+"",c(this).val())}),we(x,!0,e).done(function(e){"object"==typeof e?(e.success?(W(o,e.data.message),e.data.lastEdited&&(c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),c(e.data.lastEdited).insertAfter("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),e.data.twitterShareLink&&c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",e.data.twitterShareLink),e.data.whatsappShareLink&&c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",e.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+o)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,t),"error"),me(e,a)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("click",".wc_cancel_edit",function(){var e=J(c(this));W(e,h),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+e)}),!a&&f&&(S=0,1==f?setTimeout(function(){N(!0)},500):c(document).on("click",".wpd-load-comments",function(){c(this).parent(".wpd-load-more-submit-wrap").remove(),N(!0)})),c(document).on("click",".wpd-load-more-submit",function(){var e=c(this),t="wpd-loaded";e.hasClass(t)&&N(!1,e,t,"wpd-loading")});var V,B,K=!1;function Q(){var e=c("#wpdiscuzHasMoreComments").val(),t=c(document).height(),o=c(window).height()+c(window).scrollTop();t&&o&&80<=100*o/t&&!1===K&&1==e&&N(!(K=!0),c(".wpd-load-more-submit"))}function N(t,a,n,d){a&&(a.toggleClass(n),a.toggleClass(d));var e=new FormData;e.append("action","wpdLoadMoreComments");var o=c(".wpdiscuz-sort-button-active").attr("data-sorting");o&&e.append("sorting",o),e.append("offset",S),e.append("lastParentId",c(".wpd-load-more-submit").attr("data-lastparentid")),e.append("isFirstLoad",t?1:0);o=c(".wpdf-active").attr("data-filter-type");e.append("wpdType",o||""),we(x,!t||1!=f,e).done(function(e){"object"==typeof e&&e.success&&(S++,t&&c(".wpd-comment").remove(),c(".wpdiscuz_single").remove(),c(".wpdiscuz-comment-pagination").before(e.data.comment_list),G(e,t&&2!==s),K=!1,e.data.loadLastCommentId&&(w=e.data.loadLastCommentId),me(e),t&&$(!1)),c("#wpdiscuz-loading-bar").fadeOut(250),c(".wpd-load-more-submit").blur(),a&&(a.toggleClass(n),a.toggleClass(d))}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250),c(".wpd-load-more-submit").blur(),a&&(a.toggleClass(n),a.toggleClass(d))})}function G(e,t){var o;0==e.data.is_show_load_more?(c("#wpdiscuzHasMoreComments").val(0),c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=e.data.last_parent_id,c(".wpd-load-more-submit").attr("data-lastparentid",o),2!==s&&c(".wpdiscuz-comment-pagination").show(),c("#wpdiscuzHasMoreComments").val(1),t&&c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),me(e)}function $(o){var a,e=location.href.match(/#comment\-(\d+)/);null!==e&&(a=e[1],c("#comment-"+a).length?setTimeout(function(){ae(),c("html, body").animate({scrollTop:c("#comment-"+a).parents("[id^=wpd-comm-]").offset().top-E},1e3,ne),o&&X(a)},500):((e=new FormData).append("action","wpdGetSingleComment"),e.append("commentId",a),we(x,!0,e).done(function(e){var t;"object"==typeof e&&e.success&&(t="#comment-"+a,c("#comment-"+e.data.parentCommentID).length?c("#comment-"+e.data.parentCommentID).parents("[id^=wpd-comm-"+e.data.parentCommentID+"]").replaceWith(e.data.message):c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c(t).offset().top-E},1e3,ne),o&&X(a)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})))}function X(e){setTimeout(function(){c("#comment-"+e).siblings(".wpd-secondary-form-wrapper").is(":visible")||c("#comment-"+e).find(".wpd-reply-button").trigger("click")},1100)}function Y(e){if(void 0!==e.data.message)for(var t=e.data.message,o=0;o<t.length;o++)n=t[o],a=n.comment_parent,n=n.comment_html,0==a?de(n):(a=J(c("#comment-"+a),0),c("#wpdiscuz_form_anchor-"+a).after(n));var a,n}function J(e,t){var o="";return(o=(t?e.parents(".wpd-main-form-wrapper"):e.parents(".wpd-comment")).attr("id")).substring(o.lastIndexOf("-")+1)}function Z(e){return e.substring(0,e.indexOf("_"))}function ee(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function te(){var e=[];return c(".wpd-comment-right").each(function(){e.push(Z(J(c(this),0)))}),e.join(",")}function oe(e,t){var o=e.find(".wpd-required-group");wpdiscuzLoadRichEditor&&e.find(".wc_comment").val(c(t+">.ql-editor").html()),t=(t=(t=(t=(t=(e=(t=e).find(".wc_comment")).val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n")).replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),e.val(t),c.each(o,function(){c("input",this).prop("required",!1),0===c("input:checked",this).length?c("input",c(this)).prop("required",!0):c(".wpd-field-invalid",this).remove()})}function ae(){c("html, body").css("scroll-behavior","unset")}function ne(){c("html").css("scroll-behavior",P),c("body").css("scroll-behavior",q)}function de(e){c(".wpd-sticky-comment").last()[0]?c(e).insertAfter(c(".wpd-sticky-comment").last()[0]):c(".wpd-thread-list").prepend(e)}function se(e){e?e.prop("required")||(e.val()?e.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):e.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):c.each(c(".wc_email"),function(e,t){t=c(t);t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}function ie(e){return(e=(c(e).hasClass("wpd-inline-shortcode")?c(e):c(e).parents(".wpd-inline-shortcode")).attr("id")).substring(e.lastIndexOf("-")+1)}function ce(){c(".wpd-inline-form-wrapper").hide(),c(".wpd-inline-shortcode").removeClass("wpd-active"),c(".wpd-inline-icon").removeClass("wpd-open")}function pe(){c.each(c(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var e=c(this),t=e.offset().top-window.pageYOffset;e.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&0<t&&t<300&&("blink"===D?(e.addClass("wpd-blink"),setTimeout(function(){e.removeClass("wpd-blink")},3e3)):(e.parents(".wpd-inline-shortcode").addClass("wpd-active"),e.siblings(".wpd-inline-form-wrapper").show(),e.addClass("wpd-open"),re(e.siblings(".wpd-inline-form-wrapper"))))})}function re(e){var t;e?e.offset().left<=10?(e.css("left",Math.ceil(parseInt(e.css("left"))-e.offset().left+10)),(t=Math.ceil(e.siblings(".wpd-inline-icon.wpd-open").offset().left-e.offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")):e.offset().left+e.width()>document.body.clientWidth-10&&(e.css("left",Math.ceil(parseInt(e.css("left"))+(document.body.clientWidth-(e.offset().left+e.width()))-10)),(t=Math.ceil(e.siblings(".wpd-inline-icon.wpd-open").offset().left-e.offset().left+2))>e.width()-3&&(t=e.width()-3),document.styleSheets[0].addRule("#"+e.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")):c.each(c(".wpd-inline-form-wrapper:visible"),function(){var e;c(this).offset().left<=10?(c(this).css("left",Math.ceil(parseInt(c(this).css("left"))-c(this).offset().left+10)),(e=Math.ceil(c(this).siblings(".wpd-inline-icon.wpd-open").offset().left-c(this).offset().left+2))<3&&(e=3),document.styleSheets[0].addRule("#"+c(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+e+"px;")):c(this).offset().left+c(this).width()>document.body.clientWidth-10&&(c(this).css("left",Math.ceil(parseInt(c(this).css("left"))+(document.body.clientWidth-(c(this).offset().left+c(this).width()))-10)),(e=Math.ceil(c(this).siblings(".wpd-inline-icon.wpd-open").offset().left-c(this).offset().left+2))>c(this).width()-3&&(e=c(this).width()-3),document.styleSheets[0].addRule("#"+c(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+e+"px;"))})}function le(e){var t,o,a=0;e.parents(".wpd_main_comm_form").length?(a=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),o=e.parents(".wpd_main_comm_form")):e.parents(".wpd-secondary-form-wrapper").length?(a=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),o=e.parents(".wpd-secondary-form-wrapper")):e.parents("#wpdiscuz-edit-form").length&&(t=J(e),a=parseInt(t.substring(t.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),o=e.parents("#wpdiscuz-edit-form")),a&&o&&(e=a-e.val().length,(o=c(".wpd-editor-char-counter",o)).html(e),e<=10?o.addClass("error"):o.removeClass("error"))}function me(t,o,a,n){t.data.callbackFunctions&&c.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,o,a,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function we(t,o,a){o&&c("#wpdiscuz-loading-bar").show(),a.append("postId",d);var n=a.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&c.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(a=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](a,t,o))});var e=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return c.ajax({type:"POST",url:e,data:a,contentType:!1,processData:!1})}2!==s||a||(c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),Q(),c(window).scroll(function(){Q()})),wpdiscuzAjaxObj.setLoadMoreVisibility=G,c(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var d=c(this);c(d).removeClass("wpd_not_clicked");var s=Z(J(d)),i=c(this).hasClass("wpd-vote-up")?1:-1,e=new FormData;e.append("action","wpdVoteOnComment"),e.append("commentId",s),e.append("voteType",i),we(x,!0,e).done(function(e){var t,o,a,n;c(d).addClass("wpd_not_clicked"),"object"==typeof e?(e.success?("total"===e.data.buttonsStyle?(t=c(".wpd-comment-footer .wpd-vote-result",c("#comment-"+s)),o=e.data.votes,t.text(e.data.votesHumanReadable),t.attr("title",o),t.removeClass("wpd-up wpd-down"),0<o&&t.addClass("wpd-up"),o<0&&t.addClass("wpd-down")):(a=c(".wpd-comment-footer .wpd-vote-result-like",c("#comment-"+s)),n=c(".wpd-comment-footer .wpd-vote-result-dislike",c("#comment-"+s)),a.text(e.data.likeCountHumanReadable),a.attr("title",e.data.likeCount),n.text(e.data.dislikeCountHumanReadable),n.attr("title",e.data.dislikeCount),0<parseInt(e.data.likeCount)?a.addClass("wpd-up"):a.removeClass("wpd-up"),parseInt(e.data.dislikeCount)<0?n.addClass("wpd-down"):n.removeClass("wpd-down")),a=c(".wpd-comment-footer .wpd-vote-up",c("#comment-"+s)),n=c(".wpd-comment-footer .wpd-vote-down",c("#comment-"+s)),a.removeClass("wpd-up"),n.removeClass("wpd-down"),0<e.data.curUserReaction?a.addClass("wpd-up"):e.data.curUserReaction<0&&n.addClass("wpd-down")):e.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,d),"error"),me(e,s,i)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c(d).addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click","body",function(e){var t=c(".wpdiscuz-sort-buttons");c(e.target).hasClass("wpdf-sorting")||c(e.target).parent().hasClass("wpdf-sorting")?t.css({display:t.is(":visible")?"none":"flex"}):t.hide()}),c(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var e=c(this),t=c(this).attr("data-sorting");t&&(c(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),e.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting"),(e=new FormData).append("action","wpdSorting"),e.append("sorting",t),t=c(".wpdf-active").attr("data-filter-type"),e.append("wpdType",t||""),we(x,!0,e).done(function(e){"object"==typeof e&&e.success&&(c("#wpdcom .wpd-comment").remove(),c("#wpdcom .wpd-thread-list").prepend(e.data.message),G(e,!1),S=1),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),window.onhashchange=function(){$(!1)},1!=f&&$(!1),c(document).on("click",".wpdiscuz-readmore",function(){var t=J(c(this)),o=Z(t),e=new FormData;e.append("action","wpdReadMore"),e.append("commentId",o),we(x,!0,e).done(function(e){"object"==typeof e?(e.success?(c("#comment-"+o+" .wpd-comment-text").replaceWith(" "+e.data.message),c("#wpdiscuz-readmore-"+t).remove()):console.log(e.data),me(e)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("change",".wpd-required-group",function(){0!==c("input:checked",this).length?c("input",c(this)).prop("required",!1):c("input",c(this)).prop("required",!0)}),c(document).on("click",".wpdiscuz-spoiler",function(){c(this).next().slideToggle(),c(this).hasClass("wpdiscuz-spoiler-closed")?c(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):c(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),c(this).toggleClass("wpdiscuz-spoiler-closed")}),c(document).on("click",".wpd-tools i",function(){var e=c(this).siblings(".wpd-tools-actions");e.is(":visible")||c(this).parents(".wpd-comment-right").attr("id")!==c("[id^=comment-]","#wpdcom").last().attr("id")||c("#comments").css({paddingBottom:"160px"}),e.css({display:e.is(":visible")?"none":"flex"})}),c(document).on("mouseleave",".wpd-comment-right",function(){c(this).find(".wpd-tools-actions").hide(),c("#comments").css({paddingBottom:"0"})}),c(document).on("click",".wpd_stick_btn",function(){var e=Z(J(c(this),0)),t=new FormData;t.append("action","wpdStickComment"),t.append("commentId",e),we(x,!0,t).done(function(e){"object"==typeof e&&e.success&&location.reload(!0),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd_close_btn",function(){var e=Z(J(c(this),0)),t=new FormData;t.append("action","wpdCloseThread"),t.append("commentId",e),we(x,!0,t).done(function(e){"object"==typeof e&&e.success&&location.reload(!0),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=c(this),e=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+e),t.removeClass("wpd_not_clicked"),c(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var a=c(".wpdiscuz-sort-button-active").attr("data-sorting");a&&o.append("sorting",a),o.append("lastParentId",0),o.append("offset",0),S=1,o.append("wpdType",t.hasClass("wpdf-active")?"":e),o.append("isFirstLoad",1),!c(this).hasClass("wpdf-inline")||c(this).hasClass("wpdf-active")?c(".wpd-comment-info-bar").hide():c(".wpd-comment-info-bar").css("display","flex"),we(x,!1,o).done(function(e){t.addClass("wpd_not_clicked"),c(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(t.toggleClass("wpdf-active"),c(".wpd-load-comments").remove(),c(".wpd-comment").remove(),c(".wpd-thread-list").prepend(e.data.comment_list),G(e),w=e.data.loadLastCommentId,c(".wpd-load-more-submit").blur(),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=new FormData;e.append("action","wpdMostReactedComment"),we(x,!1,e).done(function(e){a.addClass("wpd_not_clicked"),c(".fas",a).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(c("#comment-"+e.data.parentCommentID).length?c("#comment-"+e.data.parentCommentID).parents("[id^=wpd-comm-"+e.data.parentCommentID+"]").replaceWith(e.data.message):c("#comment-"+e.data.commentId).length||c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.commentId).offset().top-E},1e3,ne))}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner")})}),c(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=new FormData;e.append("action","wpdHottestThread"),we(x,!1,e).done(function(e){a.addClass("wpd_not_clicked"),c(".fas",a).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(c("#comment-"+e.data.commentId).length?c("#comment-"+e.data.commentId).parents("[id^=wpd-comm-"+e.data.commentId+"]").replaceWith(e.data.message):c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.commentId).offset().top-E},1e3,ne))}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner")})}),c(document).on("click",".wpd-filter-view-all",function(){c(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),c(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=Z(J(a,0)),t=new FormData;t.append("action","wpdFollowUser"),t.append("commentId",e),we(x,!0,t).done(function(e){a.addClass("wpd_not_clicked"),"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data.code],e.data.code,a),"success"),a.removeClass("wpd-follow-active"),e.data.followTip&&a.attr("wpd-tooltip",e.data.followTip),e.data.followClass&&a.addClass(e.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,a),"error"):console.log(e),c(".fas",a).removeClass("fa-pulse fa-spinner"),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner"),c("#wpdiscuz-loading-bar").fadeOut(250)})}),se(),c(document).on("keyup",".wc_email",function(){se(c(this))}),k&&c("#wpdcom").length&&(c("#wpd-bubble-wrapper").hover(function(){c(this).addClass("wpd-bubble-hover")},function(){c(this).removeClass("wpd-bubble-hover")}),O&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){c("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*A)},1e3*O),"content_left"===T?c(".entry-content").length?(B=25<(V=Math.min(c(".entry-content").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):c(".post-entry").length?(B=25<(V=Math.min(c(".post-entry").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):c(".container").length?(B=25<(V=Math.min(c(".container").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):(c("#wpd-bubble-wrapper").css({left:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"left_corner"===T?(c("#wpd-bubble-wrapper").css({left:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===T&&(c("#wpd-bubble-wrapper").css({right:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-right-corner")),c("#wpd-bubble-wrapper").show(),c(document).on("click","#wpd-bubble-add-message-close",function(e){e.preventDefault(),e.stopPropagation(),c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),c(document).on("click","#wpd-bubble",function(){ae(),c("#tab-title-reviews").length&&c("#tab-title-reviews a").trigger("click"),c("html, body").animate({scrollTop:c("#wpdcom").offset().top-(E+28)},1e3,function(){ne(),c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?c("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():c("#wc-textarea-0_0").length&&c("#wc-textarea-0_0").trigger("focus")})}),c(document).on("click","#wpd-bubble-comment-close",function(e){e.preventDefault(),c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),c(document).on("click","#wpd-bubble-comment-reply-link a",function(){var e=c(this).attr("href");setTimeout(function(){c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),$(!0);var t=e.match(/#comment\-(\d+)/);L=L.filter(function(e){return e!=t[1]}),c("#wpd-bubble-count .wpd-new-comments-count").text(L.length),0==L.length&&c("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),c(document).on("click","#wpd-bubble-count",function(){var e;L.length&&((e=new FormData).append("action","wpdBubbleUpdate"),e.append("newCommentIds",L.join()),we(x,!0,e).done(function(e){"object"==typeof e&&e.success&&(e.data.message=e.data.message.filter(function(e){if(!c("#comment-"+e.comment_id).length)return e}),Y(e),c("#wpd-bubble-count").removeClass("wpd-new-comments"),c("#wpd-bubble-count .wpd-new-comments-count").text("0"),L=[],c(".wpd-new-loaded-comment").length&&(ae(),c("html, body").animate({scrollTop:c(c(".wpd-new-loaded-comment")[0]).offset().top-(E+28)},1e3,ne)),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o)}))})),(k&&y||n)&&(i||!i&&e)&&setTimeout(function a(){c.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:d,lastId:u,visibleCommentIds:te()}}).done(function(e){var t,o;R||("object"==typeof e?(e.commentIDsToRemove.forEach(function(e){c("[id^=wpd-comm-"+e+"]").remove()}),e.ids.length&&(n&&((o=new FormData).append("action","wpdUpdateAutomatically"),o.append("loadLastCommentId",w),o.append("visibleCommentIds",te()),we(x,!1,o).done(function(e){R||"object"==typeof e&&e.success&&(Y(e),e.data.wc_all_comments_count_new=parseInt(e.data.wc_all_comments_count_new),c(".wpd-thread-info").html(e.data.wc_all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.data.wc_all_comments_count_new),c("#wpd-bubble-all-comments-count").replaceWith(e.data.wc_all_comments_count_bubble_html),w=e.data.loadLastCommentId)}).fail(function(e,t,o){console.log(o)})),e.ids=e.ids.filter(function(e){if(!c("#comment-"+e).length)return e}),t=5e3,u=parseInt(e.ids[e.ids.length-1]),L=L.concat(e.ids),I&&e.commentText&&(c("#wpd-bubble-author-avatar").html(e.avatar),c("#wpd-bubble-author-name").html(e.authorName),c("#wpd-bubble-comment-date span").html(e.commentDate),c("#wpd-bubble-comment-text").html(e.commentText),c("#wpd-bubble-comment-reply-link a").attr("href",e.commentLink),c("#wpd-bubble-notification-message").show(),t=1e4),o=parseInt(c(".wpd-new-comments-count").text()),o+=e.ids.length,c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),c("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},t),c(".wpd-new-comments-count").text(o),c("#wpd-bubble-count").addClass("wpd-new-comments")),e.all_comments_count=parseInt(e.all_comments_count),c("#wpd-bubble-all-comments-count").replaceWith(e.all_comments_count_bubble_html),c(".wpd-thread-info").html(e.all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.all_comments_count)):console.log(e)),setTimeout(a,m)}).fail(function(e,t,o){console.log(o),setTimeout(a,m)})},m),c(".wpd-inline-form-wrapper").length&&((e=new FormData).append("action","wpdGetInlineCommentForm"),we(x,!1,e).done(function(e){"object"==typeof e?e.success?(c(".wpd-inline-form-wrapper").append(e.data),c.each(c("[name=_wpd_inline_nonce]"),function(){var e=c(this).attr("id"),t=c(this).parents(".wpd-inline-shortcode").attr("id");c(this).attr("id",e+"-"+t.substring(t.lastIndexOf("-")+1))}),c(".wpd-inline-opened").addClass("wpd-active"),c(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),c(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),c(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),re()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data]),e.data,"error"):console.log(e)}).fail(function(e,t,o){console.log(o)})),c(document).on("click","body",function(e){var t;c(e.target).hasClass("wpd-inline-form-close")||c(e.target).parents(".wpd-inline-form-close").length?(e.preventDefault(),c(e.target).parents(".wpd-inline-form-wrapper").hide(),c(e.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),c(e.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open")):c(e.target).hasClass("wpd-inline-form-wrapper")||c(e.target).parents(".wpd-inline-form-wrapper").length||(ce(),t="",c(e.target).hasClass("wpd-inline-icon")?t=c(e.target):c(e.target).parents(".wpd-inline-icon").length&&(t=c(e.target).parents(".wpd-inline-icon")),t.length&&t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),t.removeClass("wpd-ignored"),re(t.siblings(".wpd-inline-form-wrapper")))),(!c(e.target).hasClass("wpd-last-inline-comments-wrapper")&&!c(e.target).parents(".wpd-last-inline-comments-wrapper").length||c(e.target).parents(".wpd-last-inline-comments-wrapper").length&&c(e.target).hasClass("wpd-load-inline-comment"))&&c(".wpd-last-inline-comments-wrapper").remove()}),c(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(e){e.preventDefault();var o,a=c(this),n=c(this).parents(".wpd_inline_comm_form");n[0].checkValidity()&&(c(this).removeClass("wpd_not_clicked"),(o=new FormData).append("action","wpdAddInlineComment"),o.append("inline_form_id",ie(n)),c.each(c("input, textarea",n),function(e,t){("checkbox"!==this.type||c(this).is(":checked"))&&o.append(c(t).attr("name"),c(t).val())}),we(x,!0,o).done(function(e){var t,o;a.addClass("wpd_not_clicked"),"object"==typeof e?e.success?(n[0].reset(),ce(),t=parseInt(e.data.newCount),(o=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count")).text(t),t?o.addClass("wpd-has-comments"):o.removeClass("wpd-has-comments"),e.data.allCommentsCountNew=parseInt(e.data.allCommentsCountNew),c(".wpd-thread-info").html(e.data.allCommentsCountBeforeThreadsHtml),c(".wpd-thread-info").attr("data-comments-count",e.data.allCommentsCountNew),c("#wpd-bubble-all-comments-count").replaceWith(e.data.allCommentsCountBubbleHtml),e.data.message&&de(e.data.message),wpdiscuzAjaxObj.setCommentMessage(e.data.notification,"success")):e.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,a),"error"):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("keydown",".wpd-form",function(e){e.ctrlKey&&13==e.keyCode&&c(this).find(".wc_comm_submit").trigger("click")}),c(document).on("keydown","#wpdiscuz-edit-form",function(e){e.ctrlKey&&13==e.keyCode&&c(this).find(".wc_save_edited_comment").trigger("click")}),c(document).on("keydown",".wpd-inline-comment-content",function(e){e.ctrlKey&&13==e.keyCode&&c(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),c(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=c(this),e=new FormData;e.append("action","wpdGetLastInlineComments"),e.append("inline_form_id",ie(t)),we(x,!0,e).done(function(e){"object"==typeof e?e.success?c(e.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,t),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd-view-all-inline-comments",function(e){e.preventDefault(),c(this).parents(".wpd-last-inline-comments-wrapper").remove(),c(".wpdf-inline").hasClass("wpdf-active")||c(".wpdf-inline").trigger("click"),ae(),c("html, body").animate({scrollTop:c(".wpdf-inline").offset().top-E},1e3,ne)}),c(document).on("click",".wpd-feedback-content-link",function(e){e.preventDefault();var t=c(this).data("feedback-content-id");ae(),c("html, body").animate({scrollTop:c("#wpd-inline-"+t).offset().top-(E+6)},1e3,function(){ne(),c("#wpd-inline-"+t).addClass("wpd-active")})}),"scroll_open"!==D&&"blink"!==D||(pe(),c(window).on("scroll",pe)),c(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var e=new FormData,t=c(this).index();0<=t&&t<5&&(e.append("action","wpdUserRate"),e.append("rating",t+1),we(x,!0,e).done(function(e){"object"==typeof e?e.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("submit","#wpdiscuz-subscribe-form",function(e){e.preventDefault();var t,o,a=c(this);a[0].checkValidity()&&(o=a,e=!0,"2.0"===l&&c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).length&&!c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).val().length?(e=!1,c(".wpdiscuz-recaptcha",o).css("border","1px solid red")):"2.0"===l&&c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).length&&c(".wpdiscuz-recaptcha",o).css("border","none"),e)&&((t=new FormData).append("action","wpdAddSubscription"),c("*",a).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&t.append(this.name+"",c(this).val()),"checkbox"!=this.type&&"radio"!=this.type||c(this).is(":checked")&&t.append(this.name+"",c(this).val())}),we(x,!0,t).done(function(e){"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(e.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(e.data,"error"):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("click",".wpd-unsubscribe",function(e){e.preventDefault();e=new FormData;e.append("action","wpdUnsubscribe"),e.append("sid",c(this).data("sid")),e.append("skey",c(this).data("skey")),we(x,!0,e).done(function(e){"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(e.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(e.data,"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(e){c(".wpd-filter.wpdf-active"+(e?":not("+e+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=we});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
11
  /* Colorbox */
12
  !function(t,e,i){var o,n,r,h,a,s,l,c,d,g,f,u,p,m,w,v,y,x,b,T,C,H,k,W,E,I,M,L,R,S,K,P,B,O={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),o=t(this).data("cbox-iframe-attrs");return"object"==typeof o&&t.each(o,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},_="colorbox",j="cbox",D=j+"Element",F=j+"_open",N=j+"_load",z=j+"_complete",A=j+"_cleanup",q=j+"_closed",U=j+"_purge",$=t("<a/>"),G="div",Q=0,J={};function V(i,o,n){var r=e.createElement(i);return o&&(r.id=j+o),n&&(r.style.cssText=n),t(r)}function X(){return i.innerHeight?i.innerHeight:t(i).height()}function Y(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var o;return void 0===this.cache[e]&&(void 0!==(o=t(this.el).attr("data-cbox-"+e))?this.cache[e]=o:void 0!==i[e]?this.cache[e]=i[e]:void 0!==O[e]&&(this.cache[e]=O[e])),this.cache[e]},this.get=function(t){var e=this.value(t);return"function"==typeof e?e.call(this.el,this):e}}function Z(t){var e=d.length,i=(I+t)%e;return i<0?e+i:i}function tt(t,e){return Math.round((/%/.test(t)?("x"===e?g.width():X())/100:1)*parseInt(t,10))}function et(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function it(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function ot(t){"contains"in n[0]&&!n[0].contains(t.target)&&t.target!==o[0]&&(t.stopPropagation(),n.trigger("focus"))}function nt(t){nt.str!==t&&(n.add(o).removeClass(nt.str).addClass(t),nt.str=t)}function rt(i){t(e).trigger(i),$.triggerHandler(i)}var ht=function(){var t,e,i=j+"Slideshow_",o="click."+j;function r(){clearTimeout(e)}function h(){(C.get("loop")||d[I+1])&&(r(),e=setTimeout(P.next,C.get("slideshowSpeed")))}function a(){v.html(C.get("slideshowStop")).off(o).one(o,s),$.on(z,h).on(N,r),n.removeClass(i+"off").addClass(i+"on")}function s(){r(),$.off(z,h).off(N,r),v.html(C.get("slideshowStart")).off(o).one(o,function(){P.next(),a()}),n.removeClass(i+"on").addClass(i+"off")}function l(){t=!1,v.hide(),r(),$.off(z,h).off(N,r),n.removeClass(i+"off "+i+"on")}return function(){t?C.get("slideshow")||($.off(A,l),l()):C.get("slideshow")&&d[1]&&(t=!0,$.one(A,l),C.get("slideshowAuto")?a():s(),v.show())}}();function at(r){var g,w;if(!S){if(g=t(r).data(_),C=new Y(r,g),w=C.get("rel"),I=0,w&&!1!==w&&"nofollow"!==w?(d=t("."+D).filter(function(){return new Y(this,t.data(this,_)).get("rel")===w}),-1===(I=d.index(C.el))&&(d=d.add(C.el),I=d.length-1)):d=t(C.el),!L){L=R=!0,nt(C.get("className")),n.css({visibility:"hidden",display:"block",opacity:""}),f=V(G,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),h.css({width:"",height:""}).append(f),H=a.height()+c.height()+h.outerHeight(!0)-h.height(),k=s.width()+l.width()+h.outerWidth(!0)-h.width(),W=f.outerHeight(!0),E=f.outerWidth(!0);var v=tt(C.get("initialWidth"),"x"),y=tt(C.get("initialHeight"),"y"),x=C.get("maxWidth"),B=C.get("maxHeight");C.w=Math.max((!1!==x?Math.min(v,tt(x,"x")):v)-E-k,0),C.h=Math.max((!1!==B?Math.min(y,tt(B,"y")):y)-W-H,0),f.css({width:"",height:C.h}),P.position(),rt(F),C.get("onOpen"),T.add(m).hide(),n.trigger("focus"),C.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",ot,!0),$.one(q,function(){e.removeEventListener("focus",ot,!0)})),C.get("returnFocus")&&$.one(q,function(){t(C.el).trigger("focus")})}var O=parseFloat(C.get("opacity"));o.css({opacity:O==O?O:"",cursor:C.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),C.get("closeButton")?b.html(C.get("close")).appendTo(h):b.appendTo("<div/>"),function(){var e,o,n,r=P.prep,h=++Q;R=!0,M=!1,rt(U),rt(N),C.get("onLoad"),C.h=C.get("height")?tt(C.get("height"),"y")-W-H:C.get("innerHeight")&&tt(C.get("innerHeight"),"y"),C.w=C.get("width")?tt(C.get("width"),"x")-E-k:C.get("innerWidth")&&tt(C.get("innerWidth"),"x"),C.mw=C.w,C.mh=C.h,C.get("maxWidth")&&(C.mw=tt(C.get("maxWidth"),"x")-E-k,C.mw=C.w&&C.w<C.mw?C.w:C.mw);C.get("maxHeight")&&(C.mh=tt(C.get("maxHeight"),"y")-W-H,C.mh=C.h&&C.h<C.mh?C.h:C.mh);if(e=C.get("href"),K=setTimeout(function(){p.show()},100),C.get("inline")){var a=t(e).eq(0);n=t("<div>").hide().insertBefore(a),$.one(U,function(){n.replaceWith(a)}),r(a)}else C.get("iframe")?r(" "):C.get("html")?r(C.get("html")):et(C,e)?(e=it(C,e),M=C.get("createImg"),t(M).addClass(j+"Photo").on("error."+j,function(){r(V(G,"Error").html(C.get("imgError")))}).one("load",function(){h===Q&&setTimeout(function(){var e;C.get("retinaImage")&&i.devicePixelRatio>1&&(M.height=M.height/i.devicePixelRatio,M.width=M.width/i.devicePixelRatio),C.get("scalePhotos")&&(o=function(){M.height-=M.height*e,M.width-=M.width*e},C.mw&&M.width>C.mw&&(e=(M.width-C.mw)/M.width,o()),C.mh&&M.height>C.mh&&(e=(M.height-C.mh)/M.height,o())),C.h&&(M.style.marginTop=Math.max(C.mh-M.height,0)/2+"px"),d[1]&&(C.get("loop")||d[I+1])&&(M.style.cursor="pointer",t(M).on("click."+j,function(){P.next()})),M.style.width=M.width+"px",M.style.height=M.height+"px",r(M)},1)}),M.src=e):e&&u.load(e,C.get("data"),function(e,i){h===Q&&r("error"===i?V(G,"Error").html(C.get("xhrError")):t(this).contents())})}()}}function st(){n||(B=!1,g=t(i),n=V(G).attr({id:_,class:!1===t.support.opacity?j+"IE":"",role:"dialog",tabindex:"-1"}).hide(),o=V(G,"Overlay").hide(),p=t([V(G,"LoadingOverlay")[0],V(G,"LoadingGraphic")[0]]),r=V(G,"Wrapper"),h=V(G,"Content").append(m=V(G,"Title"),w=V(G,"Current"),x=t('<button type="button"/>').attr({id:j+"Previous"}),y=t('<button type="button"/>').attr({id:j+"Next"}),v=t('<button type="button"/>').attr({id:j+"Slideshow"}),p),b=t('<button type="button"/>').attr({id:j+"Close"}),r.append(V(G).append(V(G,"TopLeft"),a=V(G,"TopCenter"),V(G,"TopRight")),V(G,!1,"clear:left").append(s=V(G,"MiddleLeft"),h,l=V(G,"MiddleRight")),V(G,!1,"clear:left").append(V(G,"BottomLeft"),c=V(G,"BottomCenter"),V(G,"BottomRight"))).find("div div").css({float:"left"}),u=V(G,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),T=y.add(x).add(w).add(v)),e.body&&!n.parent().length&&t(e.body).append(o,n.append(r,u))}function lt(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),at(this))}return!!n&&(B||(B=!0,y.on("click",function(){P.next()}),x.on("click",function(){P.prev()}),b.on("click",function(){P.close()}),o.on("click",function(){C.get("overlayClose")&&P.close()}),t(e).on("keydown."+j,function(t){var e=t.keyCode;L&&C.get("escKey")&&27===e&&(t.preventDefault(),P.close()),L&&C.get("arrowKey")&&d[1]&&!t.altKey&&(37===e?(t.preventDefault(),x.trigger("click")):39===e&&(t.preventDefault(),y.trigger("click")))}),"function"==typeof t.fn.on?t(e).on("click."+j,"."+D,i):t("."+D).live("click."+j,i)),!0)}t[_]||(t(st),(P=t.fn[_]=t[_]=function(e,i){var o=this;return e=e||{},"function"==typeof o&&(o=t("<a/>"),e.open=!0),o[0]?(st(),lt()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,_)||{};t.data(this,_,t.extend(i,e))}).addClass(D),new Y(o[0],e).get("open")&&at(o[0])),o):o}).position=function(e,i){var o,d,f,u=0,p=0,m=n.offset();function w(){a[0].style.width=c[0].style.width=h[0].style.width=parseInt(n[0].style.width,10)-k+"px",h[0].style.height=s[0].style.height=l[0].style.height=parseInt(n[0].style.height,10)-H+"px"}if(g.off("resize."+j),n.css({top:-9e4,left:-9e4}),d=g.scrollTop(),f=g.scrollLeft(),C.get("fixed")?(m.top-=d,m.left-=f,n.css({position:"fixed"})):(u=d,p=f,n.css({position:"absolute"})),!1!==C.get("right")?p+=Math.max(g.width()-C.w-E-k-tt(C.get("right"),"x"),0):!1!==C.get("left")?p+=tt(C.get("left"),"x"):p+=Math.round(Math.max(g.width()-C.w-E-k,0)/2),!1!==C.get("bottom")?u+=Math.max(X()-C.h-W-H-tt(C.get("bottom"),"y"),0):!1!==C.get("top")?u+=tt(C.get("top"),"y"):u+=Math.round(Math.max(X()-C.h-W-H,0)/2),n.css({top:m.top,left:m.left,visibility:"visible"}),r[0].style.width=r[0].style.height="9999px",o={width:C.w+E+k,height:C.h+W+H,top:u,left:p},e){var v=0;t.each(o,function(t){o[t]===J[t]||(v=e)}),e=v}J=o,e||n.css(o),n.dequeue().animate(o,{duration:e||0,complete:function(){w(),R=!1,r[0].style.width=C.w+E+k+"px",r[0].style.height=C.h+W+H+"px",C.get("reposition")&&setTimeout(function(){g.on("resize."+j,P.position)},1),"function"==typeof i&&i()},step:w})},P.resize=function(t){var e;L&&((t=t||{}).width&&(C.w=tt(t.width,"x")-E-k),t.innerWidth&&(C.w=tt(t.innerWidth,"x")),f.css({width:C.w}),t.height&&(C.h=tt(t.height,"y")-W-H),t.innerHeight&&(C.h=tt(t.innerHeight,"y")),t.innerHeight||t.height||(e=f.scrollTop(),f.css({height:"auto"}),C.h=f.height()),f.css({height:C.h}),e&&f.scrollTop(e),P.position("none"===C.get("transition")?0:C.get("speed")))},P.prep=function(i){if(L){var o,r="none"===C.get("transition")?0:C.get("speed");f.remove(),(f=V(G,"LoadedContent").append(i)).hide().appendTo(u.show()).css({width:(C.w=C.w||f.width(),C.w=C.mw&&C.mw<C.w?C.mw:C.w,C.w),overflow:C.get("scrolling")?"auto":"hidden"}).css({height:(C.h=C.h||f.height(),C.h=C.mh&&C.mh<C.h?C.mh:C.h,C.h)}).prependTo(h),u.hide(),t(M).css({float:"none"}),nt(C.get("className")),o=function(){var i,o,h=d.length;function a(){!1===t.support.opacity&&n[0].style.removeAttribute("filter")}L&&(o=function(){clearTimeout(K),p.hide(),rt(z),C.get("onComplete")},m.html(C.get("title")).show(),f.show(),h>1?("string"==typeof C.get("current")&&w.html(C.get("current").replace("{current}",I+1).replace("{total}",h)).show(),y[C.get("loop")||I<h-1?"show":"hide"]().html(C.get("next")),x[C.get("loop")||I?"show":"hide"]().html(C.get("previous")),ht(),C.get("preloading")&&t.each([Z(-1),Z(1)],function(){var i=d[this],o=new Y(i,t.data(i,_)),n=o.get("href");n&&et(o,n)&&(n=it(o,n),e.createElement("img").src=n)})):T.hide(),C.get("iframe")?(i=C.get("createIframe"),C.get("scrolling")||(i.scrolling="no"),t(i).attr({src:C.get("href"),class:j+"Iframe"}).one("load",o).appendTo(f),$.one(U,function(){i.src="//about:blank"}),C.get("fastIframe")&&t(i).trigger("load")):o(),"fade"===C.get("transition")?n.fadeTo(r,1,a):a())},"fade"===C.get("transition")?n.fadeTo(r,0,function(){P.position(0,o)}):P.position(r,o)}},P.next=function(){!R&&d[1]&&(C.get("loop")||d[I+1])&&(I=Z(1),at(d[I]))},P.prev=function(){!R&&d[1]&&(C.get("loop")||I)&&(I=Z(-1),at(d[I]))},P.close=function(){L&&!S&&(S=!0,L=!1,rt(A),C.get("onCleanup"),g.off("."+j),o.fadeTo(C.get("fadeOut")||0,0),n.stop().fadeTo(C.get("fadeOut")||0,0,function(){n.hide(),o.hide(),rt(U),f.remove(),setTimeout(function(){S=!1,rt(q),C.get("onClosed")},1)}))},P.remove=function(){n&&(n.stop(),t[_].close(),n.stop(!1,!0).remove(),o.remove(),S=!1,n=null,t("."+D).removeData(_).removeClass(D),t(e).off("click."+j).off("keydown."+j))},P.element=function(){return t(C.el)},P.settings=O)}(jQuery,document,window);
13
  /* Media Uploader */
@@ -15,6 +15,6 @@ jQuery(document).ready(function(e){if(e(document).on("click","#wpdcom .wmu-uploa
15
  /* Lity */
16
  !function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
17
  /* My Content and Settings */
18
- jQuery(document).ready(function(e){var n=0,t=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),a=parseInt(wpdiscuzUCObj.additionalTab);e(document).on("click",".wpd-info,.wpd-page-link,.wpd-delete-content,.wpd-user-email-delete-links",function(e){e.preventDefault()}),e(document).on("click",".wpd-info.wpd-not-clicked",function(n){var d=e(this);d.removeClass("wpd-not-clicked");var i=new FormData;return i.append("action","wpdGetInfo"),function(n,d){var i=e(".fas",n),o=i.attr("class");i.removeClass(),i.addClass("fas fa-pulse fa-spinner"),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,d).done(function(t){n.addClass("wpd-not-clicked"),i.removeClass(),i.addClass(o),t&&(e("#wpdUserContentInfo").html(t),e("#wpdUserContentInfo ul.wpd-list .wpd-list-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo div.wpd-content .wpd-content-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo").is(":visible")||e("#wpdUserContentInfoAnchor").trigger("click"))})}(d,i),!1}),e(document).on("click",".wpd-list-item",function(){var n=e("input.wpd-rel",this).val();e("#wpdUserContentInfo .wpd-list-item").removeClass("wpd-active"),e("#wpdUserContentInfo .wpd-content-item").removeClass("wpd-active");var d=e(this);if(e("#wpdUserContentInfo #"+n).text().length)d.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).addClass("wpd-active");else{var i=new FormData;i.append("action",d.attr("data-action")),i.append("page",0),e("#wpdUserContentInfo #"+n).addClass("wpd-active"),e("#wpdUserContentInfo #"+n).css("text-align","center"),wpdiscuzAjaxObj.getAjaxObj(t||a,!0,i).done(function(t){t&&(e("#wpdUserContentInfo #"+n).css("text-align",""),d.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).html(t)),e("#wpdiscuz-loading-bar").hide()})}}),e(document).on("click",".wpd-page-link.wpd-not-clicked",function(n){var d=e(this);d.removeClass("wpd-not-clicked");var i=d.data("wpd-page"),o=e(".wpd-active .wpd-pagination .wpd-action").val(),c=new FormData;c.append("action",o),c.append("page",i),wpdiscuzAjaxObj.getAjaxObj(t||a,!0,c).done(function(n){d.addClass("wpd-not-clicked"),n&&e(".wpd-content-item.wpd-active").html(n),e("#wpdiscuz-loading-bar").hide()})}),e(document).on("click",".wpd-delete-content.wpd-not-clicked",function(){var d=e(this),i=parseInt(d.data("wpd-content-id"));if(!isNaN(i)){var o=d.data("wpd-delete-action");if("wpdDeleteComment"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmDeleteComment,"wc_confirm_comment_delete",d)))return!1;if("wpdCancelSubscription"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelSubscription,"wc_confirm_cancel_subscription",d)))return!1;if("wpdCancelFollow"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelFollow,"wc_confirm_cancel_follow",d)))return!1;var c=e("i",d),s=c.attr("class"),p=e(".wpd-wrapper .wpd-page-number").val(),l=e(".wpd-content-item.wpd-active").children(".wpd-item").length;d.removeClass("wpd-not-clicked"),c.removeClass().addClass("fas fa-pulse fa-spinner"),1===l&&p>0&&(p-=1);var r=new FormData;r.append("id",i),r.append("page",p),r.append("action",o),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,r).done(function(t){d.addClass("wpd-not-clicked"),c.removeClass().addClass(s),e(".wpd-content-item.wpd-active").html(t),n=1})}}),e(document).on("click","[data-lity-close]",function(t){e(t.target).is("[data-lity-close]")&&n&&window.location.reload(!0)}),e(document).on("click",".wpd-user-email-delete-links.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked"),e(".wpd-loading",n).addClass("wpd-show");var d=new FormData;d.append("action","wpdEmailDeleteLinks"),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,d).done(function(t){n.addClass("wpd-not-clicked"),e("[data-lity-close]",window.parent.document).trigger("click")})}),e(document).on("click",".wpd-user-settings-button.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked");var d=n.data("wpd-delete-action");if("deleteCookies"!==d){n.find(".wpd-loading").addClass("wpd-show");var i=new FormData;i.append("action","wpdGuestAction"),i.append("guestAction",d),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,i).done(function(t){n.addClass("wpd-not-clicked"),n.find(".wpd-loading").removeClass("wpd-show");try{var a=e.parseJSON(t);n.after(a.message);var d=n.next(".wpd-guest-action-message");d.fadeIn(100).fadeOut(7e3,function(){d.remove(),1===parseInt(a.code)&&(n.parent().remove(),e(".wpd-delete-all-comments").length||e(".wpd-delete-all-subscriptions").length||e(".wpd-delete-all-cookies").parent().addClass("wpd-show"))})}catch(e){console.log(e)}})}else!function(){for(var e=document.cookie.split(";"),n=0;n<e.length;n++){var t=e[n],a=t.indexOf("="),d=a>-1?t.substr(0,a):t;Cookies.remove(d.trim())}location.reload(!0)}()})});
19
  /* Social */
20
  function wpcShareCommentFB(e,s){FB.ui({method:"share",href:e,quote:s},function(e){})}(!parseInt(wpdiscuzAjaxObj.fbUseOAuth2)&&parseInt(wpdiscuzAjaxObj.enableFbLogin)||parseInt(wpdiscuzAjaxObj.enableFbShare))&&wpdiscuzAjaxObj.facebookAppID&&(!function(e,s,n){var o,a=e.getElementsByTagName(s)[0];e.getElementById(n)||((o=e.createElement(s)).id=n,o.src="//connect.facebook.net/en_US/sdk.js",a.parentNode.insertBefore(o,a))}(document,"script","facebook-jssdk"),window.fbAsyncInit=function(){FB.init({appId:wpdiscuzAjaxObj.facebookAppID,cookie:!0,xfbml:!0,version:"v7.0"})}),jQuery(document).ready(function(e){var s;(s=Cookies.get("wpdiscuz_social_login_message"))&&"undefined"!==s&&(Cookies.remove("wpdiscuz_social_login_message"),wpdiscuzAjaxObj.setCommentMessage(decodeURIComponent(s.replace(/\+/g,"%20")),"error")),Cookies.get("wpdiscuz_scroll_to_comments")&&(Cookies.remove("wpdiscuz_scroll_to_comments",{path:"/"}),e("html, body").animate({scrollTop:e("#comments").offset().top-32},1e3)),e(document).on("click",".wpd-comment-share .fa-facebook-f",function(){if(1==wpdiscuzAjaxObj.enableFbShare){var s=e(this).parents(".wpd-comment").find(".wpd-comment-right").attr("id"),n=window.location.href;-1!==n.indexOf("#")&&(n=n.substring(0,n.indexOf("#"))),wpcShareCommentFB(n+="#"+s,e(this).parents(".wpd-comment-right").find(".wpd-comment-text").text())}});var n="";function o(e,s){var n,o="";t(s,1),Cookies.set("wpdiscuz_scroll_to_comments",1,{path:"/"}),"facebook"===e&&0==wpdiscuzAjaxObj.facebookUseOAuth2?FB.getLoginStatus(function(t){"connected"===t.status?(n=t.authResponse.accessToken,o=t.authResponse.userID,a(e,n,o,s)):FB.login(function(t){"connected"===t.status&&(n=t.authResponse.accessToken,o=t.authResponse.userID,a(e,n,o,s))},{scope:"public_profile,email"})}):a(e,n,o,s)}function a(s,n,o,a){return e.ajax({type:"POST",url:wpdiscuzAjaxObj.url,data:{action:"wpd_social_login",provider:s,token:n,userID:o,postID:wpdiscuzAjaxObj.wc_post_id}}).done(function(s){!function(s,n){try{var o=e.parseJSON(s),a=o.code,i=o.message,c=o.url;200===parseInt(a)?location.assign(c):wpdiscuzAjaxObj.setCommentMessage(i,"error")}catch(e){console.log(e)}t(n,0)}(s,a)}),""}function t(e,s){1===s?e.find(".wpdiscuz-social-login-spinner").show():e.find(".wpdiscuz-social-login-spinner").hide()}e(document).on("click","#wpdcom .wpd-social-login .wpdiscuz-login-button",function(){var s=e(this).parents(".wpd-social-login");!function(e,s){1!=parseInt(wpdiscuzAjaxObj.socialLoginAgreementCheckbox)||1==Cookies.get("socialLoginAgreementConfirmed")?o(e,s):s.parents(".wpd-form-wrap, .wpd-form").find(".wpd-social-login-agreement").first().slideDown(700)}(n=function(e){var s="";e.hasClass("wpdsn-fb")&&(s="facebook");e.hasClass("wpdsn-insta")&&(s="instagram");e.hasClass("wpdsn-gg")&&(s="google");e.hasClass("wpdsn-ds")&&(s="disqus");e.hasClass("wpdsn-wp")&&(s="wordpress");e.hasClass("wpdsn-tw")&&(s="twitter");e.hasClass("wpdsn-vk")&&(s="vk");e.hasClass("wpdsn-ok")&&(s="ok");e.hasClass("wpdsn-linked")&&(s="linkedin");e.hasClass("wpdsn-yandex")&&(s="yandex");e.hasClass("wpdsn-mailru")&&(s="mailru");e.hasClass("wpdsn-weixin")&&(s="wechat");e.hasClass("wpdsn-weibo")&&(s="weibo");e.hasClass("wpdsn-qq")&&(s="qq");e.hasClass("wpdsn-baidu")&&(s="baidu");return s}(e(this)),s)}),e(document).on("click","#wpdcom .wpd-agreement-buttons-right .wpd-agreement-button",function(){var s=e(this).parents(".wpd-form-wrap, .wpd-form").find(".wpd-social-login-agreement").slideUp(700);e(this).hasClass("wpd-agreement-button-agree")&&(wpdiscuzAjaxObj.isCookiesEnabled&&Cookies.set("socialLoginAgreementConfirmed",1,{expires:30,path:"/"}),o(n,s))})});
7
  /* Autogrow */
8
  jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
9
  /* wpDiscuz */
10
+ var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?o="wpdiscuz-message-success":"warning"===t[n]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(a instanceof Array?a[n]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(e,t,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(o){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]]&&(e=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]](e,t,a))}),e},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,n=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,i=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),d=wpdiscuzAjaxObj.wpdiscuz_nonce,c=parseInt(wpdiscuzAjaxObj.commentListUpdateType),p=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),r=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),l=wpdiscuzAjaxObj.loadLastCommentId,m=l,w=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var u,f=parseInt(wpdiscuzAjaxObj.wordpressIsPaginate),h=wpdiscuzAjaxObj.storeCommenterData,b=parseInt(wpdiscuzAjaxObj.wmuEnabled),_=wpdiscuzAjaxObj.isCookiesEnabled,g=!0,z=wpdiscuzAjaxObj.cookiehash,v=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),j=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,x=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),C=parseInt(wpdiscuzAjaxObj.enableBubble),k=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),y=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),O=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,A=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),I=wpdiscuzAjaxObj.bubbleLocation,T=wpdiscuzAjaxObj.inlineFeedbackAttractionType,D=(D=parseInt(wpdiscuzAjaxObj.scrollSize))||32,F=[],E=[],M=[],L=!1,R=1,S=e("html").css("scroll-behavior"),P=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(t){var a=e(".wpd-form").not(":hidden");if(a.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<a.length;o++)if("\n"!==wpDiscuzEditor.createEditor(e(a[o]).find(".ql-container").attr("id")).getText())return t.preventDefault(),void(t.returnValue="")}else for(o=0;o<a.length;o++)if(e(a[o]).find(".wc_comment").val())return t.preventDefault(),void(t.returnValue="")}),wpdiscuzLoadRichEditor||(e(document).delegate("textarea.wc_comment","input",function(){ue(e(this))}),e.each(e("textarea.wc_comment"),function(){ue(e(this))})),e(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(j)}),e(document).on("focus","#wpdcom textarea",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||W({comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).on("click","#wpd-insert-source-code",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).on("click",".wpd-reply-button",function(){var i=Y(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+i).focus()},j):setTimeout(function(){e("#wc-textarea-"+i).trigger("focus")},j),e("#wpd-secondary-form-wrapper-"+i).slideToggle(j)):function(a){var o=Y(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var n=e("#wpd-secondary-form-wrapper-"+o);if(!t){var i={comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)};W(i)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},j):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},j);n.slideToggle(j,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===n){var i=J(t);setTimeout(function(){if(!E[i])try{E[i]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(i)}),e(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.trigger("select"),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),e(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=Y(e(this),0),o=e(this),n=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&v?function(t,a){var o=J(t),n=new FormData;n.append("action","wpdShowReplies"),n.append("commentId",o),he(x,!0,n).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),fe(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,n){console.log(n),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(n.removeClass("fa-chevron-up"),n.addClass("fa-chevron-down"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(n.removeClass("fa-chevron-down"),n.addClass("fa-chevron-up"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).on("mouseenter",".wpd-new-loaded-comment",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).on("click",".wpd-sbs-toggle",function(){e(".wpdiscuz-subscribe-bar").slideToggle(j)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&e("#wpdiscuz-subscribe-form").length&&("2.0"===n?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===n&&e(document).on("click","#wpdiscuz_subscription_button",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===n){var q=e(window).width(),H=e("#wpdcom").width();H>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),H>=940&&H<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),H>=810&&H<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),H>=730&&H<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),H>=610&&H<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),q>650&&(H>=510&&H<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H>=470&&H<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function U(t,a,o){he(x||b,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(j),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e(".wpd-thread-info").html(a.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(a.data.wc_all_comments_count_bubble_html);var n=j;a.data.is_main?ie(a.data.message):(n=j+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),he(x,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),he(x,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),_&&g?function(t){var a=t.comment_author_email,o=t.comment_author,n=t.comment_author_url;null==h?(Cookies.set("comment_author_email_"+z,a),Cookies.set("comment_author_"+z,o),n.length&&Cookies.set("comment_author_url_"+z,n)):(h=parseInt(h),Cookies.set("comment_author_email_"+z,a,{expires:h,path:"/"}),Cookies.set("comment_author_"+z,o,{expires:h,path:"/"}),n.length&&Cookies.set("comment_author_url_"+z,n,{expires:h,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").prop("checked",!0)}(a.data):g||e(".wpd-cookies-checkbox").prop("checked",!1),t.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]):ue(t.find(".wc_comment")),W(a.data),e(".wmu-preview-wrap",t).remove(),F.length&&(F.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),F=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-D},1e3,ne)},n),fe(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"),fe(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,n){console.log(n),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function W(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function V(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var i=e(this),s=1,d=e(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(s=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===Z(t,!1)&&(o=Z(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),ae(d,"#wpd-editor-"+e(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==e(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(p=d,r=!0,"2.0"===n&&e("input[name=wc_captcha]",p).length&&!e("input[name=wc_captcha]",p).val().length?(r=!1,e(".wpdiscuz-recaptcha",p).css("border","1px solid red")):"2.0"===n&&e("input[name=wc_captcha]",p).length&&e(".wpdiscuz-recaptcha",p).css("border","none"),r)){L=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&_&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+z,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){F.push(e(this))}))})}(d),e(i).removeClass("wpd_not_clicked");var c=new FormData;if(c.append("action","wpdAddComment"),e(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&c.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&c.append(this.name+"",e(this).val())}),c.append("wpd_comment_depth",s),wpdiscuzAjaxObj.wpdiscuz_zs&&c.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",d).length?e(".wpd-cookies-checkbox",d).prop("checked")||(g=!1):t&&(g=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===n&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){c.append("g-recaptcha-response",e),U(d,c,i)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else U(d,c,i)}var p,r;!function(e){if((a||o)&&"2.0"===n){var t=J(e);grecaptcha.reset(E[t])}}(e(".wpdiscuz_unique_id",d).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),e(document).on("click",".wpd_editable_comment",function(){u&&e(".wpdiscuz-edit-form-wrap").length&&V(Y(e(".wpdiscuz-edit-form-wrap"),0),u);var t=e(this),a=Y(t,0),o=J(a),n=new FormData;n.append("action","wpdEditComment"),n.append("commentId",o),u=e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),he(x,!0,n).done(function(o){if("object"==typeof o)if(o.success){if(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(o.data.html),wpdiscuzLoadRichEditor){var n=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a);n.clipboard.dangerouslyPasteHTML(0,o.data.content),n.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+a).val(o.data.content),ue(e("#wc-textarea-edit_"+a));e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[o.data],o.data,t),"error");else console.log(o);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wc_save_edited_comment",function(){var t=e(this),a=Y(t),o=J(a),n=e("#wpd-comm-"+a+" #wpdiscuz-edit-form");if(ae(n,"#wpd-editor-edit_"+a),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()){var i=new FormData;i.append("action","wpdSaveEditedComment"),i.append("commentId",o),e(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&i.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),he(x,!0,i).done(function(n){"object"==typeof n?(n.success?(V(a,n.data.message),n.data.lastEdited&&(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(n.data.lastEdited).insertAfter("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),n.data.twitterShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",n.data.twitterShareLink),n.data.whatsappShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",n.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+a)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error"),fe(n,o)):console.log(n),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wc_cancel_edit",function(){var t=Y(e(this));V(t,u),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!f&&w&&(R=0,1==w?setTimeout(function(){Q(!0)},500):e(document).on("click",".wpd-load-comments",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),Q(!0)})),e(document).on("click",".wpd-load-more-submit",function(){var t=e(this);t.hasClass("wpd-loaded")&&Q(!1,t,"wpd-loaded","wpd-loading")});var B=!1;function K(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===B&&1==t&&(B=!0,Q(!1,e(".wpd-load-more-submit"))))}function Q(t,a,o,n){a&&(a.toggleClass(o),a.toggleClass(n));var s=new FormData;s.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&s.append("sorting",d),s.append("offset",R),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),he(x,!t||1!=w,s).done(function(s){"object"==typeof s&&s.success&&(R++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),N(s,t&&2!==i),B=!1,s.data.loadLastCommentId&&(l=s.data.loadLastCommentId),fe(s),t&&G(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))}).fail(function(t,i,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))})}function N(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==i&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),fe(t)}function G(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-D},1e3,ne),t&&$(o)},500);else{var n=new FormData;n.append("action","wpdGetSingleComment"),n.append("commentId",o),he(x,!0,n).done(function(a){if("object"==typeof a&&a.success){var n="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e(n).offset().top-D},1e3,ne),t&&$(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function $(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function X(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)ee((t=a[o]).comment_parent,t.comment_html)}function Y(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function J(e){return e.substring(0,e.indexOf("_"))}function Z(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function ee(t,a){if(0==t)ie(a);else{var o=Y(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function te(){var t=[];return e(".wpd-comment-right").each(function(){t.push(J(Y(e(this),0)))}),t.join(",")}function ae(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).prop("required",!1),0===e("input:checked",this).length?e("input",e(this)).prop("required",!0):e(".wpd-field-invalid",this).remove()})}function oe(){e("html, body").css("scroll-behavior","unset")}function ne(){e("html").css("scroll-behavior",S),e("body").css("scroll-behavior",P)}function ie(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function se(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==i||f||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),K(),e(window).scroll(function(){K()})),wpdiscuzAjaxObj.setLoadMoreVisibility=N,e(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=J(Y(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var n=new FormData;n.append("action","wpdVoteOnComment"),n.append("commentId",o),n.append("voteType",a),he(x,!0,n).done(function(n){if(e(t).addClass("wpd_not_clicked"),"object"==typeof n){if(n.success){if("total"===n.data.buttonsStyle){var i=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=n.data.votes;i.text(n.data.votesHumanReadable),i.attr("title",s),i.removeClass("wpd-up wpd-down"),s>0&&i.addClass("wpd-up"),s<0&&i.addClass("wpd-down")}else{var d=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));d.text(n.data.likeCountHumanReadable),d.attr("title",n.data.likeCount),c.text(n.data.dislikeCountHumanReadable),c.attr("title",n.data.dislikeCount),parseInt(n.data.likeCount)>0?d.addClass("wpd-up"):d.removeClass("wpd-up"),parseInt(n.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),n.data.curUserReaction>0?p.addClass("wpd-up"):n.data.curUserReaction<0&&r.addClass("wpd-down")}else n.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error");fe(n,o,a)}else console.log(n);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click","body",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var n=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",n||""),he(x,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),N(t,!1),R=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){G(!1)},1!=w&&G(!1),e(document).on("click",".wpdiscuz-readmore",function(){var t=Y(e(this)),a=J(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),he(x,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),fe(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("change",".wpd-required-group",function(){0!==e("input:checked",this).length?e("input",e(this)).prop("required",!1):e("input",e(this)).prop("required",!0)}),e(document).on("click",".wpdiscuz-spoiler",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).on("click",".wpd-tools i",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]","#wpdcom").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).on("mouseleave",".wpd-comment-right",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).on("click",".wpd_stick_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd_close_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var n=e(".wpdiscuz-sort-button-active").attr("data-sorting");n&&o.append("sorting",n),o.append("lastParentId",0),o.append("offset",0),R=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),he(x,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),N(a),l=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),fe(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpd-filter-view-all",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=J(Y(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),he(x,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data.code],a.data.code,t),"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),se(),e(document).on("keyup",".wc_email",function(){se(e(this))}),C&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),y&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*O)},1e3*y),"content_left"===I)if(e(".entry-content").length){var de=(ce=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ce=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ce;de=(ce=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===I?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===I&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e(document).on("click","#wpd-bubble-add-message-close",function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e(document).on("click","#wpd-bubble",function(){oe(),e("#tab-title-reviews").length&&e("#tab-title-reviews a").trigger("click"),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-(D+28)},1e3,function(){ne(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").trigger("focus")})}),e(document).on("click","#wpd-bubble-comment-close",function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e(document).on("click","#wpd-bubble-comment-reply-link a",function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),G(!0);var a=t.match(/#comment\-(\d+)/);M=M.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(M.length),0==M.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e(document).on("click","#wpd-bubble-count",function(){if(M.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",M.join()),he(x,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),X(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),M=[],e(".wpd-new-loaded-comment").length&&(oe(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-(D+28)},1e3,ne)),fe(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((C&&k||c)&&(t||!t&&r)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:m,visibleCommentIds:te()}}).done(function(a){if(!L)if("object"==typeof a){if(a.commentIDsToRemove.forEach(function(t){e("[id^=wpd-comm-"+t+"]").remove()}),a.ids.length){c&&((i=new FormData).append("action","wpdUpdateAutomatically"),i.append("loadLastCommentId",l),i.append("visibleCommentIds",te()),he(x,!1,i).done(function(t){L||"object"==typeof t&&t.success&&(X(t),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e(".wpd-thread-info").html(t.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(t.data.wc_all_comments_count_bubble_html),l=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;m=parseInt(a.ids[a.ids.length-1]),M=M.concat(a.ids),A&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var n=parseInt(e(".wpd-new-comments-count").text());n+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(n),e("#wpd-bubble-count").addClass("wpd-new-comments")}a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").replaceWith(a.all_comments_count_bubble_html),e(".wpd-thread-info").html(a.all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.all_comments_count)}else console.log(a);var i;setTimeout(t,p)}).fail(function(e,a,o){console.log(o),setTimeout(t,p)})},p),e(".wpd-inline-form-wrapper").length){var pe=new FormData;pe.append("action","wpdGetInlineCommentForm"),he(x,!1,pe).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),we()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data]),t.data,"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function re(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function le(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function me(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&a>0&&a<300&&("blink"===T?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),we(t.siblings(".wpd-inline-form-wrapper"))))})}function we(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ue(t){var a,o=0;if(t.parents(".wpd_main_comm_form").length)o=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents(".wpd_main_comm_form");else if(t.parents(".wpd-secondary-form-wrapper").length)o=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),a=t.parents(".wpd-secondary-form-wrapper");else if(t.parents("#wpdiscuz-edit-form").length){var n=Y(t);o=parseInt(n.substring(n.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents("#wpdiscuz-edit-form")}if(o&&a){var i=t.val().length,s=e(".wpd-editor-char-counter",a),d=o-i;s.html(d),d<=10?s.addClass("error"):s.removeClass("error")}}function fe(t,a,o,n){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function he(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s),o.append("wpdiscuz_nonce",d);var n=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](o,t,a))});var i=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:i,data:o,contentType:!1,processData:!1})}e(document).on("click","body",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){le();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&a.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),we(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var n=new FormData;n.append("action","wpdAddInlineComment"),n.append("inline_form_id",re(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&n.append(e(a).attr("name"),e(a).val()):n.append(e(a).attr("name"),e(a).val())}),he(x,!0,n).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),le();var n=parseInt(t.data.newCount),i=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");i.text(n),n?i.addClass("wpd-has-comments"):i.removeClass("wpd-has-comments"),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e(".wpd-thread-info").html(t.data.allCommentsCountBeforeThreadsHtml),e(".wpd-thread-info").attr("data-comments-count",t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").replaceWith(t.data.allCommentsCountBubbleHtml),t.data.message&&ie(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data,a),"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("keydown",".wpd-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).on("keydown","#wpdiscuz-edit-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).on("keydown",".wpd-inline-comment-content",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",re(t)),he(x,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-view-all-inline-comments",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),oe(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-D},1e3,ne)}),e(document).on("click",".wpd-feedback-content-link",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");oe(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-(D+6)},1e3,function(){ne(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==T&&"blink"!==T||(me(),e(window).on("scroll",me)),e(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),he(x,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data),"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){t.preventDefault();var a,o,i=e(this);if(i[0].checkValidity()&&(a=i,o=!0,"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",i).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),he(x,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wpd-unsubscribe",function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),he(x,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=he});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
11
  /* Colorbox */
12
  !function(t,e,i){var o,n,r,h,a,s,l,c,d,g,f,u,p,m,w,v,y,x,b,T,C,H,k,W,E,I,M,L,R,S,K,P,B,O={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),o=t(this).data("cbox-iframe-attrs");return"object"==typeof o&&t.each(o,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},_="colorbox",j="cbox",D=j+"Element",F=j+"_open",N=j+"_load",z=j+"_complete",A=j+"_cleanup",q=j+"_closed",U=j+"_purge",$=t("<a/>"),G="div",Q=0,J={};function V(i,o,n){var r=e.createElement(i);return o&&(r.id=j+o),n&&(r.style.cssText=n),t(r)}function X(){return i.innerHeight?i.innerHeight:t(i).height()}function Y(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var o;return void 0===this.cache[e]&&(void 0!==(o=t(this.el).attr("data-cbox-"+e))?this.cache[e]=o:void 0!==i[e]?this.cache[e]=i[e]:void 0!==O[e]&&(this.cache[e]=O[e])),this.cache[e]},this.get=function(t){var e=this.value(t);return"function"==typeof e?e.call(this.el,this):e}}function Z(t){var e=d.length,i=(I+t)%e;return i<0?e+i:i}function tt(t,e){return Math.round((/%/.test(t)?("x"===e?g.width():X())/100:1)*parseInt(t,10))}function et(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function it(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function ot(t){"contains"in n[0]&&!n[0].contains(t.target)&&t.target!==o[0]&&(t.stopPropagation(),n.trigger("focus"))}function nt(t){nt.str!==t&&(n.add(o).removeClass(nt.str).addClass(t),nt.str=t)}function rt(i){t(e).trigger(i),$.triggerHandler(i)}var ht=function(){var t,e,i=j+"Slideshow_",o="click."+j;function r(){clearTimeout(e)}function h(){(C.get("loop")||d[I+1])&&(r(),e=setTimeout(P.next,C.get("slideshowSpeed")))}function a(){v.html(C.get("slideshowStop")).off(o).one(o,s),$.on(z,h).on(N,r),n.removeClass(i+"off").addClass(i+"on")}function s(){r(),$.off(z,h).off(N,r),v.html(C.get("slideshowStart")).off(o).one(o,function(){P.next(),a()}),n.removeClass(i+"on").addClass(i+"off")}function l(){t=!1,v.hide(),r(),$.off(z,h).off(N,r),n.removeClass(i+"off "+i+"on")}return function(){t?C.get("slideshow")||($.off(A,l),l()):C.get("slideshow")&&d[1]&&(t=!0,$.one(A,l),C.get("slideshowAuto")?a():s(),v.show())}}();function at(r){var g,w;if(!S){if(g=t(r).data(_),C=new Y(r,g),w=C.get("rel"),I=0,w&&!1!==w&&"nofollow"!==w?(d=t("."+D).filter(function(){return new Y(this,t.data(this,_)).get("rel")===w}),-1===(I=d.index(C.el))&&(d=d.add(C.el),I=d.length-1)):d=t(C.el),!L){L=R=!0,nt(C.get("className")),n.css({visibility:"hidden",display:"block",opacity:""}),f=V(G,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),h.css({width:"",height:""}).append(f),H=a.height()+c.height()+h.outerHeight(!0)-h.height(),k=s.width()+l.width()+h.outerWidth(!0)-h.width(),W=f.outerHeight(!0),E=f.outerWidth(!0);var v=tt(C.get("initialWidth"),"x"),y=tt(C.get("initialHeight"),"y"),x=C.get("maxWidth"),B=C.get("maxHeight");C.w=Math.max((!1!==x?Math.min(v,tt(x,"x")):v)-E-k,0),C.h=Math.max((!1!==B?Math.min(y,tt(B,"y")):y)-W-H,0),f.css({width:"",height:C.h}),P.position(),rt(F),C.get("onOpen"),T.add(m).hide(),n.trigger("focus"),C.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",ot,!0),$.one(q,function(){e.removeEventListener("focus",ot,!0)})),C.get("returnFocus")&&$.one(q,function(){t(C.el).trigger("focus")})}var O=parseFloat(C.get("opacity"));o.css({opacity:O==O?O:"",cursor:C.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),C.get("closeButton")?b.html(C.get("close")).appendTo(h):b.appendTo("<div/>"),function(){var e,o,n,r=P.prep,h=++Q;R=!0,M=!1,rt(U),rt(N),C.get("onLoad"),C.h=C.get("height")?tt(C.get("height"),"y")-W-H:C.get("innerHeight")&&tt(C.get("innerHeight"),"y"),C.w=C.get("width")?tt(C.get("width"),"x")-E-k:C.get("innerWidth")&&tt(C.get("innerWidth"),"x"),C.mw=C.w,C.mh=C.h,C.get("maxWidth")&&(C.mw=tt(C.get("maxWidth"),"x")-E-k,C.mw=C.w&&C.w<C.mw?C.w:C.mw);C.get("maxHeight")&&(C.mh=tt(C.get("maxHeight"),"y")-W-H,C.mh=C.h&&C.h<C.mh?C.h:C.mh);if(e=C.get("href"),K=setTimeout(function(){p.show()},100),C.get("inline")){var a=t(e).eq(0);n=t("<div>").hide().insertBefore(a),$.one(U,function(){n.replaceWith(a)}),r(a)}else C.get("iframe")?r(" "):C.get("html")?r(C.get("html")):et(C,e)?(e=it(C,e),M=C.get("createImg"),t(M).addClass(j+"Photo").on("error."+j,function(){r(V(G,"Error").html(C.get("imgError")))}).one("load",function(){h===Q&&setTimeout(function(){var e;C.get("retinaImage")&&i.devicePixelRatio>1&&(M.height=M.height/i.devicePixelRatio,M.width=M.width/i.devicePixelRatio),C.get("scalePhotos")&&(o=function(){M.height-=M.height*e,M.width-=M.width*e},C.mw&&M.width>C.mw&&(e=(M.width-C.mw)/M.width,o()),C.mh&&M.height>C.mh&&(e=(M.height-C.mh)/M.height,o())),C.h&&(M.style.marginTop=Math.max(C.mh-M.height,0)/2+"px"),d[1]&&(C.get("loop")||d[I+1])&&(M.style.cursor="pointer",t(M).on("click."+j,function(){P.next()})),M.style.width=M.width+"px",M.style.height=M.height+"px",r(M)},1)}),M.src=e):e&&u.load(e,C.get("data"),function(e,i){h===Q&&r("error"===i?V(G,"Error").html(C.get("xhrError")):t(this).contents())})}()}}function st(){n||(B=!1,g=t(i),n=V(G).attr({id:_,class:!1===t.support.opacity?j+"IE":"",role:"dialog",tabindex:"-1"}).hide(),o=V(G,"Overlay").hide(),p=t([V(G,"LoadingOverlay")[0],V(G,"LoadingGraphic")[0]]),r=V(G,"Wrapper"),h=V(G,"Content").append(m=V(G,"Title"),w=V(G,"Current"),x=t('<button type="button"/>').attr({id:j+"Previous"}),y=t('<button type="button"/>').attr({id:j+"Next"}),v=t('<button type="button"/>').attr({id:j+"Slideshow"}),p),b=t('<button type="button"/>').attr({id:j+"Close"}),r.append(V(G).append(V(G,"TopLeft"),a=V(G,"TopCenter"),V(G,"TopRight")),V(G,!1,"clear:left").append(s=V(G,"MiddleLeft"),h,l=V(G,"MiddleRight")),V(G,!1,"clear:left").append(V(G,"BottomLeft"),c=V(G,"BottomCenter"),V(G,"BottomRight"))).find("div div").css({float:"left"}),u=V(G,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),T=y.add(x).add(w).add(v)),e.body&&!n.parent().length&&t(e.body).append(o,n.append(r,u))}function lt(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),at(this))}return!!n&&(B||(B=!0,y.on("click",function(){P.next()}),x.on("click",function(){P.prev()}),b.on("click",function(){P.close()}),o.on("click",function(){C.get("overlayClose")&&P.close()}),t(e).on("keydown."+j,function(t){var e=t.keyCode;L&&C.get("escKey")&&27===e&&(t.preventDefault(),P.close()),L&&C.get("arrowKey")&&d[1]&&!t.altKey&&(37===e?(t.preventDefault(),x.trigger("click")):39===e&&(t.preventDefault(),y.trigger("click")))}),"function"==typeof t.fn.on?t(e).on("click."+j,"."+D,i):t("."+D).live("click."+j,i)),!0)}t[_]||(t(st),(P=t.fn[_]=t[_]=function(e,i){var o=this;return e=e||{},"function"==typeof o&&(o=t("<a/>"),e.open=!0),o[0]?(st(),lt()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,_)||{};t.data(this,_,t.extend(i,e))}).addClass(D),new Y(o[0],e).get("open")&&at(o[0])),o):o}).position=function(e,i){var o,d,f,u=0,p=0,m=n.offset();function w(){a[0].style.width=c[0].style.width=h[0].style.width=parseInt(n[0].style.width,10)-k+"px",h[0].style.height=s[0].style.height=l[0].style.height=parseInt(n[0].style.height,10)-H+"px"}if(g.off("resize."+j),n.css({top:-9e4,left:-9e4}),d=g.scrollTop(),f=g.scrollLeft(),C.get("fixed")?(m.top-=d,m.left-=f,n.css({position:"fixed"})):(u=d,p=f,n.css({position:"absolute"})),!1!==C.get("right")?p+=Math.max(g.width()-C.w-E-k-tt(C.get("right"),"x"),0):!1!==C.get("left")?p+=tt(C.get("left"),"x"):p+=Math.round(Math.max(g.width()-C.w-E-k,0)/2),!1!==C.get("bottom")?u+=Math.max(X()-C.h-W-H-tt(C.get("bottom"),"y"),0):!1!==C.get("top")?u+=tt(C.get("top"),"y"):u+=Math.round(Math.max(X()-C.h-W-H,0)/2),n.css({top:m.top,left:m.left,visibility:"visible"}),r[0].style.width=r[0].style.height="9999px",o={width:C.w+E+k,height:C.h+W+H,top:u,left:p},e){var v=0;t.each(o,function(t){o[t]===J[t]||(v=e)}),e=v}J=o,e||n.css(o),n.dequeue().animate(o,{duration:e||0,complete:function(){w(),R=!1,r[0].style.width=C.w+E+k+"px",r[0].style.height=C.h+W+H+"px",C.get("reposition")&&setTimeout(function(){g.on("resize."+j,P.position)},1),"function"==typeof i&&i()},step:w})},P.resize=function(t){var e;L&&((t=t||{}).width&&(C.w=tt(t.width,"x")-E-k),t.innerWidth&&(C.w=tt(t.innerWidth,"x")),f.css({width:C.w}),t.height&&(C.h=tt(t.height,"y")-W-H),t.innerHeight&&(C.h=tt(t.innerHeight,"y")),t.innerHeight||t.height||(e=f.scrollTop(),f.css({height:"auto"}),C.h=f.height()),f.css({height:C.h}),e&&f.scrollTop(e),P.position("none"===C.get("transition")?0:C.get("speed")))},P.prep=function(i){if(L){var o,r="none"===C.get("transition")?0:C.get("speed");f.remove(),(f=V(G,"LoadedContent").append(i)).hide().appendTo(u.show()).css({width:(C.w=C.w||f.width(),C.w=C.mw&&C.mw<C.w?C.mw:C.w,C.w),overflow:C.get("scrolling")?"auto":"hidden"}).css({height:(C.h=C.h||f.height(),C.h=C.mh&&C.mh<C.h?C.mh:C.h,C.h)}).prependTo(h),u.hide(),t(M).css({float:"none"}),nt(C.get("className")),o=function(){var i,o,h=d.length;function a(){!1===t.support.opacity&&n[0].style.removeAttribute("filter")}L&&(o=function(){clearTimeout(K),p.hide(),rt(z),C.get("onComplete")},m.html(C.get("title")).show(),f.show(),h>1?("string"==typeof C.get("current")&&w.html(C.get("current").replace("{current}",I+1).replace("{total}",h)).show(),y[C.get("loop")||I<h-1?"show":"hide"]().html(C.get("next")),x[C.get("loop")||I?"show":"hide"]().html(C.get("previous")),ht(),C.get("preloading")&&t.each([Z(-1),Z(1)],function(){var i=d[this],o=new Y(i,t.data(i,_)),n=o.get("href");n&&et(o,n)&&(n=it(o,n),e.createElement("img").src=n)})):T.hide(),C.get("iframe")?(i=C.get("createIframe"),C.get("scrolling")||(i.scrolling="no"),t(i).attr({src:C.get("href"),class:j+"Iframe"}).one("load",o).appendTo(f),$.one(U,function(){i.src="//about:blank"}),C.get("fastIframe")&&t(i).trigger("load")):o(),"fade"===C.get("transition")?n.fadeTo(r,1,a):a())},"fade"===C.get("transition")?n.fadeTo(r,0,function(){P.position(0,o)}):P.position(r,o)}},P.next=function(){!R&&d[1]&&(C.get("loop")||d[I+1])&&(I=Z(1),at(d[I]))},P.prev=function(){!R&&d[1]&&(C.get("loop")||I)&&(I=Z(-1),at(d[I]))},P.close=function(){L&&!S&&(S=!0,L=!1,rt(A),C.get("onCleanup"),g.off("."+j),o.fadeTo(C.get("fadeOut")||0,0),n.stop().fadeTo(C.get("fadeOut")||0,0,function(){n.hide(),o.hide(),rt(U),f.remove(),setTimeout(function(){S=!1,rt(q),C.get("onClosed")},1)}))},P.remove=function(){n&&(n.stop(),t[_].close(),n.stop(!1,!0).remove(),o.remove(),S=!1,n=null,t("."+D).removeData(_).removeClass(D),t(e).off("click."+j).off("keydown."+j))},P.element=function(){return t(C.el)},P.settings=O)}(jQuery,document,window);
13
  /* Media Uploader */
15
  /* Lity */
16
  !function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
17
  /* My Content and Settings */
18
+ jQuery(document).ready(function(e){var n=0,d=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),t=parseInt(wpdiscuzUCObj.additionalTab);e(document).on("click",".wpd-info,.wpd-page-link,.wpd-delete-content,.wpd-user-email-delete-links",function(e){e.preventDefault()}),e(document).on("click",".wpd-info.wpd-not-clicked",function(n){var a=e(this);a.removeClass("wpd-not-clicked");var i=new FormData;return i.append("action","wpdGetInfo"),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),function(n,a){var i=e(".fas",n),c=i.attr("class");i.removeClass(),i.addClass("fas fa-pulse fa-spinner"),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,a).done(function(d){n.addClass("wpd-not-clicked"),i.removeClass(),i.addClass(c),d&&(e("#wpdUserContentInfo").html(d),e("#wpdUserContentInfo ul.wpd-list .wpd-list-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo div.wpd-content .wpd-content-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo").is(":visible")||e("#wpdUserContentInfoAnchor").trigger("click"))})}(a,i),!1}),e(document).on("click",".wpd-list-item",function(){var n=e("input.wpd-rel",this).val();e("#wpdUserContentInfo .wpd-list-item").removeClass("wpd-active"),e("#wpdUserContentInfo .wpd-content-item").removeClass("wpd-active");var a=e(this);if(e("#wpdUserContentInfo #"+n).text().length)a.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).addClass("wpd-active");else{var i=new FormData;i.append("action",a.attr("data-action")),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),i.append("page",0),e("#wpdUserContentInfo #"+n).addClass("wpd-active"),e("#wpdUserContentInfo #"+n).css("text-align","center"),wpdiscuzAjaxObj.getAjaxObj(d||t,!0,i).done(function(d){d&&(e("#wpdUserContentInfo #"+n).css("text-align",""),a.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).html(d)),e("#wpdiscuz-loading-bar").hide()})}}),e(document).on("click",".wpd-page-link.wpd-not-clicked",function(n){var a=e(this);a.removeClass("wpd-not-clicked");var i=a.data("wpd-page"),c=e(".wpd-active .wpd-pagination .wpd-action").val(),o=new FormData;o.append("action",c),o.append("page",i),o.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!0,o).done(function(n){a.addClass("wpd-not-clicked"),n&&e(".wpd-content-item.wpd-active").html(n),e("#wpdiscuz-loading-bar").hide()})}),e(document).on("click",".wpd-delete-content.wpd-not-clicked",function(){var a=e(this),i=parseInt(a.data("wpd-content-id"));if(!isNaN(i)){var c=a.data("wpd-delete-action");if("wpdDeleteComment"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmDeleteComment,"wc_confirm_comment_delete",a)))return!1;if("wpdCancelSubscription"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelSubscription,"wc_confirm_cancel_subscription",a)))return!1;if("wpdCancelFollow"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelFollow,"wc_confirm_cancel_follow",a)))return!1;var o=e("i",a),s=o.attr("class"),p=e(".wpd-wrapper .wpd-page-number").val(),l=e(".wpd-content-item.wpd-active").children(".wpd-item").length;a.removeClass("wpd-not-clicked"),o.removeClass().addClass("fas fa-pulse fa-spinner"),1===l&&p>0&&(p-=1);var w=new FormData;w.append("id",i),w.append("page",p),w.append("action",c),w.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,w).done(function(d){a.addClass("wpd-not-clicked"),o.removeClass().addClass(s),e(".wpd-content-item.wpd-active").html(d),n=1})}}),e(document).on("click","[data-lity-close]",function(d){e(d.target).is("[data-lity-close]")&&n&&window.location.reload(!0)}),e(document).on("click",".wpd-user-email-delete-links.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked"),e(".wpd-loading",n).addClass("wpd-show");var a=new FormData;a.append("action","wpdEmailDeleteLinks"),a.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,a).done(function(d){n.addClass("wpd-not-clicked"),e("[data-lity-close]",window.parent.document).trigger("click")})}),e(document).on("click",".wpd-user-settings-button.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked");var a=n.data("wpd-delete-action");if("deleteCookies"!==a){n.find(".wpd-loading").addClass("wpd-show");var i=new FormData;i.append("action","wpdGuestAction"),i.append("guestAction",a),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,i).done(function(d){n.addClass("wpd-not-clicked"),n.find(".wpd-loading").removeClass("wpd-show");try{var t=e.parseJSON(d);n.after(t.message);var a=n.next(".wpd-guest-action-message");a.fadeIn(100).fadeOut(7e3,function(){a.remove(),1===parseInt(t.code)&&(n.parent().remove(),e(".wpd-delete-all-comments").length||e(".wpd-delete-all-subscriptions").length||e(".wpd-delete-all-cookies").parent().addClass("wpd-show"))})}catch(e){console.log(e)}})}else!function(){for(var e=document.cookie.split(";"),n=0;n<e.length;n++){var d=e[n],t=d.indexOf("="),a=t>-1?d.substr(0,t):d;Cookies.remove(a.trim())}location.reload(!0)}()})});
19
  /* Social */
20
  function wpcShareCommentFB(e,s){FB.ui({method:"share",href:e,quote:s},function(e){})}(!parseInt(wpdiscuzAjaxObj.fbUseOAuth2)&&parseInt(wpdiscuzAjaxObj.enableFbLogin)||parseInt(wpdiscuzAjaxObj.enableFbShare))&&wpdiscuzAjaxObj.facebookAppID&&(!function(e,s,n){var o,a=e.getElementsByTagName(s)[0];e.getElementById(n)||((o=e.createElement(s)).id=n,o.src="//connect.facebook.net/en_US/sdk.js",a.parentNode.insertBefore(o,a))}(document,"script","facebook-jssdk"),window.fbAsyncInit=function(){FB.init({appId:wpdiscuzAjaxObj.facebookAppID,cookie:!0,xfbml:!0,version:"v7.0"})}),jQuery(document).ready(function(e){var s;(s=Cookies.get("wpdiscuz_social_login_message"))&&"undefined"!==s&&(Cookies.remove("wpdiscuz_social_login_message"),wpdiscuzAjaxObj.setCommentMessage(decodeURIComponent(s.replace(/\+/g,"%20")),"error")),Cookies.get("wpdiscuz_scroll_to_comments")&&(Cookies.remove("wpdiscuz_scroll_to_comments",{path:"/"}),e("html, body").animate({scrollTop:e("#comments").offset().top-32},1e3)),e(document).on("click",".wpd-comment-share .fa-facebook-f",function(){if(1==wpdiscuzAjaxObj.enableFbShare){var s=e(this).parents(".wpd-comment").find(".wpd-comment-right").attr("id"),n=window.location.href;-1!==n.indexOf("#")&&(n=n.substring(0,n.indexOf("#"))),wpcShareCommentFB(n+="#"+s,e(this).parents(".wpd-comment-right").find(".wpd-comment-text").text())}});var n="";function o(e,s){var n,o="";t(s,1),Cookies.set("wpdiscuz_scroll_to_comments",1,{path:"/"}),"facebook"===e&&0==wpdiscuzAjaxObj.facebookUseOAuth2?FB.getLoginStatus(function(t){"connected"===t.status?(n=t.authResponse.accessToken,o=t.authResponse.userID,a(e,n,o,s)):FB.login(function(t){"connected"===t.status&&(n=t.authResponse.accessToken,o=t.authResponse.userID,a(e,n,o,s))},{scope:"public_profile,email"})}):a(e,n,o,s)}function a(s,n,o,a){return e.ajax({type:"POST",url:wpdiscuzAjaxObj.url,data:{action:"wpd_social_login",provider:s,token:n,userID:o,postID:wpdiscuzAjaxObj.wc_post_id}}).done(function(s){!function(s,n){try{var o=e.parseJSON(s),a=o.code,i=o.message,c=o.url;200===parseInt(a)?location.assign(c):wpdiscuzAjaxObj.setCommentMessage(i,"error")}catch(e){console.log(e)}t(n,0)}(s,a)}),""}function t(e,s){1===s?e.find(".wpdiscuz-social-login-spinner").show():e.find(".wpdiscuz-social-login-spinner").hide()}e(document).on("click","#wpdcom .wpd-social-login .wpdiscuz-login-button",function(){var s=e(this).parents(".wpd-social-login");!function(e,s){1!=parseInt(wpdiscuzAjaxObj.socialLoginAgreementCheckbox)||1==Cookies.get("socialLoginAgreementConfirmed")?o(e,s):s.parents(".wpd-form-wrap, .wpd-form").find(".wpd-social-login-agreement").first().slideDown(700)}(n=function(e){var s="";e.hasClass("wpdsn-fb")&&(s="facebook");e.hasClass("wpdsn-insta")&&(s="instagram");e.hasClass("wpdsn-gg")&&(s="google");e.hasClass("wpdsn-ds")&&(s="disqus");e.hasClass("wpdsn-wp")&&(s="wordpress");e.hasClass("wpdsn-tw")&&(s="twitter");e.hasClass("wpdsn-vk")&&(s="vk");e.hasClass("wpdsn-ok")&&(s="ok");e.hasClass("wpdsn-linked")&&(s="linkedin");e.hasClass("wpdsn-yandex")&&(s="yandex");e.hasClass("wpdsn-mailru")&&(s="mailru");e.hasClass("wpdsn-weixin")&&(s="wechat");e.hasClass("wpdsn-weibo")&&(s="weibo");e.hasClass("wpdsn-qq")&&(s="qq");e.hasClass("wpdsn-baidu")&&(s="baidu");return s}(e(this)),s)}),e(document).on("click","#wpdcom .wpd-agreement-buttons-right .wpd-agreement-button",function(){var s=e(this).parents(".wpd-form-wrap, .wpd-form").find(".wpd-social-login-agreement").slideUp(700);e(this).hasClass("wpd-agreement-button-agree")&&(wpdiscuzAjaxObj.isCookiesEnabled&&Cookies.set("socialLoginAgreementConfirmed",1,{expires:30,path:"/"}),o(n,s))})});
assets/js/wpdiscuz-options.js CHANGED
@@ -53,6 +53,7 @@ jQuery(document).ready(function ($) {
53
  data.append('action', 'wpdStickComment');
54
  data.append('commentId', commentId);
55
  data.append('postId', postId);
 
56
  $.ajax({
57
  type: 'POST',
58
  url: ajaxurl,
@@ -87,6 +88,7 @@ jQuery(document).ready(function ($) {
87
  data.append('action', 'wpdCloseThread');
88
  data.append('commentId', commentId);
89
  data.append('postId', postId);
 
90
  $.ajax({
91
  type: 'POST',
92
  url: ajaxurl,
@@ -125,7 +127,7 @@ jQuery(document).ready(function ($) {
125
  $.ajax({
126
  type: 'POST',
127
  url: ajaxurl,
128
- data: {stcrData: data, 'action': 'wpdImportSTCR'}
129
  }).done(function (response) {
130
  try {
131
  var resp = JSON.parse(response);
@@ -172,7 +174,7 @@ jQuery(document).ready(function ($) {
172
  $.ajax({
173
  type: 'POST',
174
  url: ajaxurl,
175
- data: {lstcData: data, 'action': 'wpdImportLSTC'}
176
  }).done(function (response) {
177
  try {
178
  var resp = JSON.parse(response);
@@ -223,7 +225,7 @@ jQuery(document).ready(function ($) {
223
  $.ajax({
224
  type: 'POST',
225
  url: ajaxurl,
226
- data: {voteRegenerateData: data, action: 'wpdRegenerateVoteMetas'}
227
  }).done(function (response) {
228
  try {
229
  var resp = JSON.parse(response);
@@ -277,7 +279,7 @@ jQuery(document).ready(function ($) {
277
  $.ajax({
278
  type: 'POST',
279
  url: ajaxurl,
280
- data: {closedRegenerateData: data, action: 'wpdRegenerateClosedComments'}
281
  }).done(function (response) {
282
  try {
283
  var resp = JSON.parse(response);
@@ -331,7 +333,7 @@ jQuery(document).ready(function ($) {
331
  $.ajax({
332
  type: 'POST',
333
  url: ajaxurl,
334
- data: {regenerateVoteData: data, action: 'wpdRegenerateVoteData'}
335
  }).done(function (response) {
336
  try {
337
  var resp = JSON.parse(response);
@@ -381,7 +383,7 @@ jQuery(document).ready(function ($) {
381
  $.ajax({
382
  type: 'POST',
383
  url: ajaxurl,
384
- data: {syncCommenterData: data, action: 'wpdSyncCommenterData'}
385
  }).done(function (r) {
386
  if (typeof r === 'object') {
387
  if (r.success) {
@@ -420,7 +422,7 @@ jQuery(document).ready(function ($) {
420
  $.ajax({
421
  type: 'POST',
422
  url: ajaxurl,
423
- data: {rebuildRatings: data, action: 'wpdRebuildRatings'}
424
  }).done(function (response) {
425
  try {
426
  var resp = JSON.parse(response);
@@ -469,7 +471,7 @@ jQuery(document).ready(function ($) {
469
  $.ajax({
470
  type: 'POST',
471
  url: ajaxurl,
472
- data: {fixTables: data, action: 'wpdFixTables'}
473
  }).done(function (r) {
474
  if (typeof r === 'object') {
475
  if (r.success) {
@@ -744,7 +746,8 @@ jQuery(document).ready(function ($) {
744
  url: ajaxurl,
745
  data: {
746
  action: 'searchOption',
747
- s: s
 
748
  }
749
  });
750
  searchAjax.done(function (r) {
@@ -870,7 +873,8 @@ function wpd_stat_brief() {
870
  type: 'POST',
871
  url: ajaxurl,
872
  data: {
873
- action: 'wpd_stat_brief'
 
874
  }
875
  }).done(function (r) {
876
  if (r.success) {
@@ -893,7 +897,8 @@ function wpd_stat_subs(el, body) {
893
  type: 'POST',
894
  url: ajaxurl,
895
  data: {
896
- action: 'wpd_stat_subs'
 
897
  }
898
  }).done(function (r) {
899
  body.html(r);
@@ -917,7 +922,8 @@ function wpd_stat_graph(el, body) {
917
  url: ajaxurl,
918
  data: {
919
  action: 'wpd_stat_graph',
920
- interval: interval
 
921
  }
922
  }).done(function (r) {
923
  if (r.success) {
@@ -972,6 +978,7 @@ function wpd_stat_graph(el, body) {
972
  });
973
  }
974
 
 
975
  function wpd_stat_user(el, body) {
976
  body.html(wpdSpinner);
977
  jQuery('.wpd-stat-user .wpd-box-toggle .dashicons-arrow-left, .wpd-stat-user .wpd-box-toggle .dashicons-arrow-right').removeClass('wpd_not_clicked');
@@ -990,7 +997,8 @@ function wpd_stat_user(el, body) {
990
  action: 'wpd_stat_user',
991
  orderby: orderby,
992
  order: order,
993
- page: wpdStatUserPage
 
994
  }
995
  }).done(function (r) {
996
  if (r.success) {
53
  data.append('action', 'wpdStickComment');
54
  data.append('commentId', commentId);
55
  data.append('postId', postId);
56
+ data.append('wpdiscuz_nonce',wpdiscuzObj.wpdiscuz_nonce);
57
  $.ajax({
58
  type: 'POST',
59
  url: ajaxurl,
88
  data.append('action', 'wpdCloseThread');
89
  data.append('commentId', commentId);
90
  data.append('postId', postId);
91
+ data.append('wpdiscuz_nonce',wpdiscuzObj.wpdiscuz_nonce);
92
  $.ajax({
93
  type: 'POST',
94
  url: ajaxurl,
127
  $.ajax({
128
  type: 'POST',
129
  url: ajaxurl,
130
+ data: {stcrData: data, 'action': 'wpdImportSTCR' , wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
131
  }).done(function (response) {
132
  try {
133
  var resp = JSON.parse(response);
174
  $.ajax({
175
  type: 'POST',
176
  url: ajaxurl,
177
+ data: {lstcData: data, 'action': 'wpdImportLSTC', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
178
  }).done(function (response) {
179
  try {
180
  var resp = JSON.parse(response);
225
  $.ajax({
226
  type: 'POST',
227
  url: ajaxurl,
228
+ data: {voteRegenerateData: data, action: 'wpdRegenerateVoteMetas', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
229
  }).done(function (response) {
230
  try {
231
  var resp = JSON.parse(response);
279
  $.ajax({
280
  type: 'POST',
281
  url: ajaxurl,
282
+ data: {closedRegenerateData: data, action: 'wpdRegenerateClosedComments', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
283
  }).done(function (response) {
284
  try {
285
  var resp = JSON.parse(response);
333
  $.ajax({
334
  type: 'POST',
335
  url: ajaxurl,
336
+ data: {regenerateVoteData: data, action: 'wpdRegenerateVoteData', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
337
  }).done(function (response) {
338
  try {
339
  var resp = JSON.parse(response);
383
  $.ajax({
384
  type: 'POST',
385
  url: ajaxurl,
386
+ data: {syncCommenterData: data, action: 'wpdSyncCommenterData', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
387
  }).done(function (r) {
388
  if (typeof r === 'object') {
389
  if (r.success) {
422
  $.ajax({
423
  type: 'POST',
424
  url: ajaxurl,
425
+ data: {rebuildRatings: data, action: 'wpdRebuildRatings', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
426
  }).done(function (response) {
427
  try {
428
  var resp = JSON.parse(response);
471
  $.ajax({
472
  type: 'POST',
473
  url: ajaxurl,
474
+ data: {fixTables: data, action: 'wpdFixTables', wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce}
475
  }).done(function (r) {
476
  if (typeof r === 'object') {
477
  if (r.success) {
746
  url: ajaxurl,
747
  data: {
748
  action: 'searchOption',
749
+ s: s,
750
+ wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce
751
  }
752
  });
753
  searchAjax.done(function (r) {
873
  type: 'POST',
874
  url: ajaxurl,
875
  data: {
876
+ action: 'wpd_stat_brief',
877
+ wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce
878
  }
879
  }).done(function (r) {
880
  if (r.success) {
897
  type: 'POST',
898
  url: ajaxurl,
899
  data: {
900
+ action: 'wpd_stat_subs',
901
+ wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce
902
  }
903
  }).done(function (r) {
904
  body.html(r);
922
  url: ajaxurl,
923
  data: {
924
  action: 'wpd_stat_graph',
925
+ interval: interval,
926
+ wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce
927
  }
928
  }).done(function (r) {
929
  if (r.success) {
978
  });
979
  }
980
 
981
+
982
  function wpd_stat_user(el, body) {
983
  body.html(wpdSpinner);
984
  jQuery('.wpd-stat-user .wpd-box-toggle .dashicons-arrow-left, .wpd-stat-user .wpd-box-toggle .dashicons-arrow-right').removeClass('wpd_not_clicked');
997
  action: 'wpd_stat_user',
998
  orderby: orderby,
999
  order: order,
1000
+ page: wpdStatUserPage,
1001
+ wpdiscuz_nonce: wpdiscuzObj.wpdiscuz_nonce
1002
  }
1003
  }).done(function (r) {
1004
  if (r.success) {
assets/js/wpdiscuz-user-content.js CHANGED
@@ -16,6 +16,8 @@ jQuery(document).ready(function ($) {
16
  btn.removeClass('wpd-not-clicked');
17
  var data = new FormData();
18
  data.append('action', 'wpdGetInfo');
 
 
19
  wpdFullInfo(btn, data);
20
  return false;
21
  });
@@ -50,6 +52,7 @@ jQuery(document).ready(function ($) {
50
  if (!$('#wpdUserContentInfo #' + relValue).text().length) {
51
  var data = new FormData();
52
  data.append('action', $this.attr('data-action'));
 
53
  data.append('page', 0);
54
  $('#wpdUserContentInfo #' + relValue).addClass('wpd-active');
55
  $('#wpdUserContentInfo #' + relValue).css('text-align', 'center');
@@ -77,6 +80,7 @@ jQuery(document).ready(function ($) {
77
  var data = new FormData();
78
  data.append('action', action);
79
  data.append('page', goToPage);
 
80
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, true, data)
81
  .done(function (response) {
82
  btn.addClass('wpd-not-clicked');
@@ -113,6 +117,7 @@ jQuery(document).ready(function ($) {
113
  data.append('id', id);
114
  data.append('page', goToPage);
115
  data.append('action', action);
 
116
 
117
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
118
  .done(function (response) {
@@ -139,6 +144,7 @@ jQuery(document).ready(function ($) {
139
  $('.wpd-loading', btn).addClass('wpd-show');
140
  var data = new FormData();
141
  data.append('action', 'wpdEmailDeleteLinks');
 
142
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
143
  .done(function (response) {
144
  btn.addClass('wpd-not-clicked');
@@ -155,6 +161,8 @@ jQuery(document).ready(function ($) {
155
  var data = new FormData();
156
  data.append('action', 'wpdGuestAction');
157
  data.append('guestAction', guestAction);
 
 
158
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
159
  .done(function (response) {
160
  btn.addClass('wpd-not-clicked');
16
  btn.removeClass('wpd-not-clicked');
17
  var data = new FormData();
18
  data.append('action', 'wpdGetInfo');
19
+ data.append('wpdiscuz_nonce', wpdiscuzAjaxObj.wpdiscuz_nonce);
20
+
21
  wpdFullInfo(btn, data);
22
  return false;
23
  });
52
  if (!$('#wpdUserContentInfo #' + relValue).text().length) {
53
  var data = new FormData();
54
  data.append('action', $this.attr('data-action'));
55
+ data.append('wpdiscuz_nonce',wpdiscuzAjaxObj.wpdiscuz_nonce);
56
  data.append('page', 0);
57
  $('#wpdUserContentInfo #' + relValue).addClass('wpd-active');
58
  $('#wpdUserContentInfo #' + relValue).css('text-align', 'center');
80
  var data = new FormData();
81
  data.append('action', action);
82
  data.append('page', goToPage);
83
+ data.append('wpdiscuz_nonce',wpdiscuzAjaxObj.wpdiscuz_nonce);
84
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, true, data)
85
  .done(function (response) {
86
  btn.addClass('wpd-not-clicked');
117
  data.append('id', id);
118
  data.append('page', goToPage);
119
  data.append('action', action);
120
+ data.append('wpdiscuz_nonce',wpdiscuzAjaxObj.wpdiscuz_nonce);
121
 
122
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
123
  .done(function (response) {
144
  $('.wpd-loading', btn).addClass('wpd-show');
145
  var data = new FormData();
146
  data.append('action', 'wpdEmailDeleteLinks');
147
+ data.append('wpdiscuz_nonce',wpdiscuzAjaxObj.wpdiscuz_nonce);
148
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
149
  .done(function (response) {
150
  btn.addClass('wpd-not-clicked');
161
  var data = new FormData();
162
  data.append('action', 'wpdGuestAction');
163
  data.append('guestAction', guestAction);
164
+ data.append('wpdiscuz_nonce',wpdiscuzAjaxObj.wpdiscuz_nonce);
165
+
166
  wpdiscuzAjaxObj.getAjaxObj(isNativeAjaxEnabled || additionalTab, false, data)
167
  .done(function (response) {
168
  btn.addClass('wpd-not-clicked');
assets/js/wpdiscuz-user-content.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){var n=0,t=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),a=parseInt(wpdiscuzUCObj.additionalTab);e(document).on("click",".wpd-info,.wpd-page-link,.wpd-delete-content,.wpd-user-email-delete-links",function(e){e.preventDefault()}),e(document).on("click",".wpd-info.wpd-not-clicked",function(n){var d=e(this);d.removeClass("wpd-not-clicked");var i=new FormData;return i.append("action","wpdGetInfo"),function(n,d){var i=e(".fas",n),o=i.attr("class");i.removeClass(),i.addClass("fas fa-pulse fa-spinner"),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,d).done(function(t){n.addClass("wpd-not-clicked"),i.removeClass(),i.addClass(o),t&&(e("#wpdUserContentInfo").html(t),e("#wpdUserContentInfo ul.wpd-list .wpd-list-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo div.wpd-content .wpd-content-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo").is(":visible")||e("#wpdUserContentInfoAnchor").trigger("click"))})}(d,i),!1}),e(document).on("click",".wpd-list-item",function(){var n=e("input.wpd-rel",this).val();e("#wpdUserContentInfo .wpd-list-item").removeClass("wpd-active"),e("#wpdUserContentInfo .wpd-content-item").removeClass("wpd-active");var d=e(this);if(e("#wpdUserContentInfo #"+n).text().length)d.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).addClass("wpd-active");else{var i=new FormData;i.append("action",d.attr("data-action")),i.append("page",0),e("#wpdUserContentInfo #"+n).addClass("wpd-active"),e("#wpdUserContentInfo #"+n).css("text-align","center"),wpdiscuzAjaxObj.getAjaxObj(t||a,!0,i).done(function(t){t&&(e("#wpdUserContentInfo #"+n).css("text-align",""),d.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).html(t)),e("#wpdiscuz-loading-bar").hide()})}}),e(document).on("click",".wpd-page-link.wpd-not-clicked",function(n){var d=e(this);d.removeClass("wpd-not-clicked");var i=d.data("wpd-page"),o=e(".wpd-active .wpd-pagination .wpd-action").val(),c=new FormData;c.append("action",o),c.append("page",i),wpdiscuzAjaxObj.getAjaxObj(t||a,!0,c).done(function(n){d.addClass("wpd-not-clicked"),n&&e(".wpd-content-item.wpd-active").html(n),e("#wpdiscuz-loading-bar").hide()})}),e(document).on("click",".wpd-delete-content.wpd-not-clicked",function(){var d=e(this),i=parseInt(d.data("wpd-content-id"));if(!isNaN(i)){var o=d.data("wpd-delete-action");if("wpdDeleteComment"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmDeleteComment,"wc_confirm_comment_delete",d)))return!1;if("wpdCancelSubscription"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelSubscription,"wc_confirm_cancel_subscription",d)))return!1;if("wpdCancelFollow"===o&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelFollow,"wc_confirm_cancel_follow",d)))return!1;var c=e("i",d),s=c.attr("class"),p=e(".wpd-wrapper .wpd-page-number").val(),l=e(".wpd-content-item.wpd-active").children(".wpd-item").length;d.removeClass("wpd-not-clicked"),c.removeClass().addClass("fas fa-pulse fa-spinner"),1===l&&p>0&&(p-=1);var r=new FormData;r.append("id",i),r.append("page",p),r.append("action",o),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,r).done(function(t){d.addClass("wpd-not-clicked"),c.removeClass().addClass(s),e(".wpd-content-item.wpd-active").html(t),n=1})}}),e(document).on("click","[data-lity-close]",function(t){e(t.target).is("[data-lity-close]")&&n&&window.location.reload(!0)}),e(document).on("click",".wpd-user-email-delete-links.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked"),e(".wpd-loading",n).addClass("wpd-show");var d=new FormData;d.append("action","wpdEmailDeleteLinks"),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,d).done(function(t){n.addClass("wpd-not-clicked"),e("[data-lity-close]",window.parent.document).trigger("click")})}),e(document).on("click",".wpd-user-settings-button.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked");var d=n.data("wpd-delete-action");if("deleteCookies"!==d){n.find(".wpd-loading").addClass("wpd-show");var i=new FormData;i.append("action","wpdGuestAction"),i.append("guestAction",d),wpdiscuzAjaxObj.getAjaxObj(t||a,!1,i).done(function(t){n.addClass("wpd-not-clicked"),n.find(".wpd-loading").removeClass("wpd-show");try{var a=e.parseJSON(t);n.after(a.message);var d=n.next(".wpd-guest-action-message");d.fadeIn(100).fadeOut(7e3,function(){d.remove(),1===parseInt(a.code)&&(n.parent().remove(),e(".wpd-delete-all-comments").length||e(".wpd-delete-all-subscriptions").length||e(".wpd-delete-all-cookies").parent().addClass("wpd-show"))})}catch(e){console.log(e)}})}else!function(){for(var e=document.cookie.split(";"),n=0;n<e.length;n++){var t=e[n],a=t.indexOf("="),d=a>-1?t.substr(0,a):t;Cookies.remove(d.trim())}location.reload(!0)}()})});
1
+ jQuery(document).ready(function(e){var n=0,d=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),t=parseInt(wpdiscuzUCObj.additionalTab);e(document).on("click",".wpd-info,.wpd-page-link,.wpd-delete-content,.wpd-user-email-delete-links",function(e){e.preventDefault()}),e(document).on("click",".wpd-info.wpd-not-clicked",function(n){var a=e(this);a.removeClass("wpd-not-clicked");var i=new FormData;return i.append("action","wpdGetInfo"),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),function(n,a){var i=e(".fas",n),c=i.attr("class");i.removeClass(),i.addClass("fas fa-pulse fa-spinner"),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,a).done(function(d){n.addClass("wpd-not-clicked"),i.removeClass(),i.addClass(c),d&&(e("#wpdUserContentInfo").html(d),e("#wpdUserContentInfo ul.wpd-list .wpd-list-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo div.wpd-content .wpd-content-item:first-child").addClass("wpd-active"),e("#wpdUserContentInfo").is(":visible")||e("#wpdUserContentInfoAnchor").trigger("click"))})}(a,i),!1}),e(document).on("click",".wpd-list-item",function(){var n=e("input.wpd-rel",this).val();e("#wpdUserContentInfo .wpd-list-item").removeClass("wpd-active"),e("#wpdUserContentInfo .wpd-content-item").removeClass("wpd-active");var a=e(this);if(e("#wpdUserContentInfo #"+n).text().length)a.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).addClass("wpd-active");else{var i=new FormData;i.append("action",a.attr("data-action")),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),i.append("page",0),e("#wpdUserContentInfo #"+n).addClass("wpd-active"),e("#wpdUserContentInfo #"+n).css("text-align","center"),wpdiscuzAjaxObj.getAjaxObj(d||t,!0,i).done(function(d){d&&(e("#wpdUserContentInfo #"+n).css("text-align",""),a.addClass("wpd-active"),e("#wpdUserContentInfo #"+n).html(d)),e("#wpdiscuz-loading-bar").hide()})}}),e(document).on("click",".wpd-page-link.wpd-not-clicked",function(n){var a=e(this);a.removeClass("wpd-not-clicked");var i=a.data("wpd-page"),c=e(".wpd-active .wpd-pagination .wpd-action").val(),o=new FormData;o.append("action",c),o.append("page",i),o.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!0,o).done(function(n){a.addClass("wpd-not-clicked"),n&&e(".wpd-content-item.wpd-active").html(n),e("#wpdiscuz-loading-bar").hide()})}),e(document).on("click",".wpd-delete-content.wpd-not-clicked",function(){var a=e(this),i=parseInt(a.data("wpd-content-id"));if(!isNaN(i)){var c=a.data("wpd-delete-action");if("wpdDeleteComment"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmDeleteComment,"wc_confirm_comment_delete",a)))return!1;if("wpdCancelSubscription"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelSubscription,"wc_confirm_cancel_subscription",a)))return!1;if("wpdCancelFollow"===c&&!confirm(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzUCObj.msgConfirmCancelFollow,"wc_confirm_cancel_follow",a)))return!1;var o=e("i",a),s=o.attr("class"),p=e(".wpd-wrapper .wpd-page-number").val(),l=e(".wpd-content-item.wpd-active").children(".wpd-item").length;a.removeClass("wpd-not-clicked"),o.removeClass().addClass("fas fa-pulse fa-spinner"),1===l&&p>0&&(p-=1);var w=new FormData;w.append("id",i),w.append("page",p),w.append("action",c),w.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,w).done(function(d){a.addClass("wpd-not-clicked"),o.removeClass().addClass(s),e(".wpd-content-item.wpd-active").html(d),n=1})}}),e(document).on("click","[data-lity-close]",function(d){e(d.target).is("[data-lity-close]")&&n&&window.location.reload(!0)}),e(document).on("click",".wpd-user-email-delete-links.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked"),e(".wpd-loading",n).addClass("wpd-show");var a=new FormData;a.append("action","wpdEmailDeleteLinks"),a.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,a).done(function(d){n.addClass("wpd-not-clicked"),e("[data-lity-close]",window.parent.document).trigger("click")})}),e(document).on("click",".wpd-user-settings-button.wpd-not-clicked",function(){var n=e(this);n.removeClass("wpd-not-clicked");var a=n.data("wpd-delete-action");if("deleteCookies"!==a){n.find(".wpd-loading").addClass("wpd-show");var i=new FormData;i.append("action","wpdGuestAction"),i.append("guestAction",a),i.append("wpdiscuz_nonce",wpdiscuzAjaxObj.wpdiscuz_nonce),wpdiscuzAjaxObj.getAjaxObj(d||t,!1,i).done(function(d){n.addClass("wpd-not-clicked"),n.find(".wpd-loading").removeClass("wpd-show");try{var t=e.parseJSON(d);n.after(t.message);var a=n.next(".wpd-guest-action-message");a.fadeIn(100).fadeOut(7e3,function(){a.remove(),1===parseInt(t.code)&&(n.parent().remove(),e(".wpd-delete-all-comments").length||e(".wpd-delete-all-subscriptions").length||e(".wpd-delete-all-cookies").parent().addClass("wpd-show"))})}catch(e){console.log(e)}})}else!function(){for(var e=document.cookie.split(";"),n=0;n<e.length;n++){var d=e[n],t=d.indexOf("="),a=t>-1?d.substr(0,t):d;Cookies.remove(a.trim())}location.reload(!0)}()})});
assets/js/wpdiscuz.js CHANGED
@@ -81,6 +81,7 @@ jQuery(document).ready(function($) {
81
  var wpdiscuzRecaptchaVersion = wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion;
82
  var commentListLoadType = parseInt(wpdiscuzAjaxObj.commentListLoadType);
83
  var wpdiscuzPostId = parseInt(wpdiscuzAjaxObj.wc_post_id);
 
84
  var commentListUpdateType = parseInt(wpdiscuzAjaxObj.commentListUpdateType);
85
  var commentListUpdateTimer = parseInt(wpdiscuzAjaxObj.commentListUpdateTimer) * 1000;
86
  var enableGuestsLiveUpdate = parseInt(wpdiscuzAjaxObj.liveUpdateGuests);
@@ -2277,6 +2278,7 @@ jQuery(document).ready(function($) {
2277
  $('#wpdiscuz-loading-bar').show();
2278
  }
2279
  data.append('postId', wpdiscuzPostId);
 
2280
  var action = data.get('action');
2281
  if (wpdiscuzAjaxObj.dataFilterCallbacks && wpdiscuzAjaxObj.dataFilterCallbacks[action]) {
2282
  $.each(wpdiscuzAjaxObj.dataFilterCallbacks[action], function(i) {
81
  var wpdiscuzRecaptchaVersion = wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion;
82
  var commentListLoadType = parseInt(wpdiscuzAjaxObj.commentListLoadType);
83
  var wpdiscuzPostId = parseInt(wpdiscuzAjaxObj.wc_post_id);
84
+ var wpdiscuzNonce = wpdiscuzAjaxObj.wpdiscuz_nonce;
85
  var commentListUpdateType = parseInt(wpdiscuzAjaxObj.commentListUpdateType);
86
  var commentListUpdateTimer = parseInt(wpdiscuzAjaxObj.commentListUpdateTimer) * 1000;
87
  var enableGuestsLiveUpdate = parseInt(wpdiscuzAjaxObj.liveUpdateGuests);
2278
  $('#wpdiscuz-loading-bar').show();
2279
  }
2280
  data.append('postId', wpdiscuzPostId);
2281
+ data.append('wpdiscuz_nonce', wpdiscuzNonce);
2282
  var action = data.get('action');
2283
  if (wpdiscuzAjaxObj.dataFilterCallbacks && wpdiscuzAjaxObj.dataFilterCallbacks[action]) {
2284
  $.each(wpdiscuzAjaxObj.dataFilterCallbacks[action], function(i) {
assets/js/wpdiscuz.min.js CHANGED
@@ -1 +1 @@
1
- var wpDiscuzEditor,wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzLoadRichEditor&&(wpDiscuzEditor=new WpdEditor),wpdiscuzAjaxObj.setCommentMessage=function(e,t,o){var a="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?a="wpdiscuz-message-success":"warning"===t[n]&&(a="wpdiscuz-message-warning"):"success"===t?a="wpdiscuz-message-success":"warning"===t&&(a="wpdiscuz-message-warning"),jQuery("<div/>").addClass(a).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(o instanceof Array?o[n]:o||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?a="wpdiscuz-message-success":"warning"===t&&(a="wpdiscuz-message-warning"),jQuery("<div/>").addClass(a).html(e).prependTo("#wpdiscuz-comment-message").delay(o||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(t,o,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[e]]&&(t=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[e]](t,o,a))}),t},jQuery(document).ready(function(c){c("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var i=wpdiscuzAjaxObj.is_user_logged_in,p=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!i,r=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&i,l=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,s=parseInt(wpdiscuzAjaxObj.commentListLoadType),d=parseInt(wpdiscuzAjaxObj.wc_post_id),n=parseInt(wpdiscuzAjaxObj.commentListUpdateType),m=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),e=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),w=wpdiscuzAjaxObj.loadLastCommentId,u=w,f=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var t,o,h,a=parseInt(wpdiscuzAjaxObj.wordpressIsPaginate),b=wpdiscuzAjaxObj.storeCommenterData,_=parseInt(wpdiscuzAjaxObj.wmuEnabled),g=wpdiscuzAjaxObj.isCookiesEnabled,z=!0,j=wpdiscuzAjaxObj.cookiehash,v=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),C=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,x=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),k=parseInt(wpdiscuzAjaxObj.enableBubble),y=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),O=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),A=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,I=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),T=wpdiscuzAjaxObj.bubbleLocation,D=wpdiscuzAjaxObj.inlineFeedbackAttractionType,E=(E=parseInt(wpdiscuzAjaxObj.scrollSize))||32,F=[],M=[],L=[],R=!1,S=1,P=c("html").css("scroll-behavior"),q=c("body").css("scroll-behavior");function H(d,e,s){we(x||_,!1,e).done(function(e){var t,o,a,n;c(s).addClass("wpd_not_clicked"),"object"==typeof e?e.success?("collapsed"===wpdiscuzAjaxObj.commentFormView&&c(".wpd-form-foot",d).slideUp(C),e.data.wc_all_comments_count_new=parseInt(e.data.wc_all_comments_count_new),c(".wpd-thread-info").html(e.data.wc_all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.data.wc_all_comments_count_new),c("#wpd-bubble-all-comments-count").replaceWith(e.data.wc_all_comments_count_bubble_html),t=C,e.data.is_main?de(e.data.message):(t=700+C,c("#wpd-secondary-form-wrapper-"+e.data.uniqueid).slideToggle(700),(1==e.data.is_in_same_container?c("#wpd-secondary-form-wrapper-"+e.data.uniqueid):c("#wpd-comm-"+e.data.uniqueid)).after(e.data.message)),(a=e).data.held_moderate||((o=new FormData).append("action","wpdCheckNotificationType"),o.append("comment_id",a.data.new_comment_id),o.append("email",a.data.comment_author_email),o.append("isParent",a.data.is_main),we(x,!0,o)),0<(a=e).data.redirect&&a.data.new_comment_id&&((n=new FormData).append("action","wpdRedirect"),n.append("commentId",a.data.new_comment_id),we(x,!0,n).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,o){console.log(o)})),g&&z?(o=e.data,a=o.comment_author_email,n=o.comment_author,o=o.comment_author_url,null==b?(Cookies.set("comment_author_email_"+j,a),Cookies.set("comment_author_"+j,n),o.length&&Cookies.set("comment_author_url_"+j,o)):(b=parseInt(b),Cookies.set("comment_author_email_"+j,a,{expires:b,path:"/"}),Cookies.set("comment_author_"+j,n,{expires:b,path:"/"}),o.length&&Cookies.set("comment_author_url_"+j,o,{expires:b,path:"/"})),c(".wpd-cookies-checkbox").length&&c(".wpd-cookies-checkbox").prop("checked",!0)):z||c(".wpd-cookies-checkbox").prop("checked",!1),d.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+c(".wpdiscuz_unique_id",d).val()).setContents([{insert:"\n"}]):le(d.find(".wc_comment")),U(e.data),c(".wmu-preview-wrap",d).remove(),F.length&&(F.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),F=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.new_comment_id).offset().top-E},1e3,ne)},t),me(e,d)):e.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,d),"error"),me(e,d)):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c(s).addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})}function U(e){c(".wpd_comm_form .wc_name").val(e.comment_author),e.comment_author_email&&e.comment_author_email.indexOf("@example.com")<0&&c(".wpd_comm_form .wc_email").val(e.comment_author_email),e.comment_author_url&&c(".wpd_comm_form .wc_website").val(e.comment_author_url)}function W(e,t){c("#wpd-comm-"+e+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),c("#wpd-comm-"+e+" .wpdiscuz-edit-form-wrap").replaceWith(t),c("#wpd-comm-"+e+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}c(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?c(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .the_champ_login_container").length?c(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .social_connect_form").length?c(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):c(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&c(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&c("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(e){var t=c(".wpd-form").not(":hidden");if(t.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<t.length;o++)if("\n"!==wpDiscuzEditor.createEditor(c(t[o]).find(".ql-container").attr("id")).getText())return e.preventDefault(),void(e.returnValue="")}else for(o=0;o<t.length;o++)if(c(t[o]).find(".wc_comment").val())return e.preventDefault(),void(e.returnValue="")}),wpdiscuzLoadRichEditor||(c(document).delegate("textarea.wc_comment","input",function(){le(c(this))}),c.each(c("textarea.wc_comment"),function(){le(c(this))})),c(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){c(".wpd-form-foot",c(this).parents(".wpd_comm_form")).slideDown(C)}),c(document).on("focus","#wpdcom textarea",function(){c(this).next(".autogrow-textarea-mirror").length||c(this).autoGrow()}),i||U({comment_author:Cookies.get("comment_author_"+j),comment_author_email:Cookies.get("comment_author_email_"+j),comment_author_url:Cookies.get("comment_author_url_"+j)}),c(".wpd-vote-down.wpd-dislike-hidden").remove(),c(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),c(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){c(this).hide(),c("#wpd-editor-source-code-wrapper").hide(),c("#wpd-editor-uid").val(""),c("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&c(document).on("click","#wpd-insert-source-code",function(){var e=wpDiscuzEditor.createEditor("#"+c("#wpd-editor-uid").val());e.deleteText(0,e.getLength(),Quill.sources.USER);var t=c("#wpd-editor-source-code").val();t.length&&e.clipboard.dangerouslyPasteHTML(0,t,Quill.sources.USER),e.update(),c("#wpd-editor-source-code-wrapper-bg").hide(),c("#wpd-editor-source-code-wrapper").hide(),c("#wpd-editor-uid").val(""),c("#wpd-editor-source-code").val("")}),c(document).on("click",".wpd-reply-button",function(){var t,e,o=J(c(this),0);c(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},C):setTimeout(function(){c("#wc-textarea-"+o).trigger("focus")},C),c("#wpd-secondary-form-wrapper-"+o).slideToggle(C)):function(e){var t=J(e,0);c("#wpdiscuz_form_anchor-"+t).before(function(e){return c("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,e)}(t));var o=c("#wpd-secondary-form-wrapper-"+t);i||U({comment_author:Cookies.get("comment_author_"+j),comment_author_email:Cookies.get("comment_author_email_"+j),comment_author_url:Cookies.get("comment_author_url_"+j)}),wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+t).focus()},C):setTimeout(function(){c("#wc-textarea-"+t).trigger("focus")},C),o.slideToggle(C,function(){e.addClass("wpdiscuz-clonned")})}(c(this)),t=o,(p||r)&&"2.0"===l&&(e=Z(t),setTimeout(function(){if(!M[e])try{M[e]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){c("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){c("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3))}),c(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var e=c(this).data("comment-url"),t=c("<input/>");t.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(e),t.trigger("select"),document.execCommand("copy"),t.remove(),wpdiscuzAjaxObj.setCommentMessage(e+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),c(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),c(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var e=c(this);e.removeClass("wpd_not_clicked");var t,a,o,n,d=J(c(this),0),s=c(this),i=c(".fas",s);!s.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&v?(a=e,o=Z(t=d),(n=new FormData).append("action","wpdShowReplies"),n.append("commentId",o),we(x,!0,n).done(function(e){a.addClass("wpd_not_clicked"),"object"==typeof e&&e.success&&(c("#wpd-comm-"+t).replaceWith(e.data.comment_list),c("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),c("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),c("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),a.addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})):c("#wpd-comm-"+d+"> .wpd-reply").slideToggle(700,function(){c(this).is(":hidden")?(i.removeClass("fa-chevron-up"),i.addClass("fa-chevron-down"),s.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),s.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(i.removeClass("fa-chevron-down"),i.addClass("fa-chevron-up"),s.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),s.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),e.addClass("wpd_not_clicked")})}),c(document).on("mouseenter",".wpd-new-loaded-comment",function(){c(this).removeClass("wpd-new-loaded-comment")}),c(document).on("click",".wpd-sbs-toggle",function(){c(".wpdiscuz-subscribe-bar").slideToggle(C)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!i&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&c("#wpdiscuz-subscribe-form").length&&("2.0"===l?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){c("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){c("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),c(document).on("submit","#wpdiscuz-subscribe-form",function(e){c("#wpdiscuz-recaptcha-field-subscribe-form").val()?c(".wpdiscuz-recaptcha",c(this)).css("border","none"):(c(".wpdiscuz-recaptcha",c(this)).css("border","1px solid red"),e.preventDefault())})):"3.0"===l&&c(document).on("click","#wpdiscuz_subscription_button",function(e){var t=c(this).parents("#wpdiscuz-subscribe-form");e.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,t.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}})),(p||r)&&"2.0"===l&&(t=c(window).width(),1100<=(o=c("#wpdcom").width())&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),940<=o&&o<1100&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),810<=o&&o<940&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),730<=o&&o<810&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),610<=o&&o<730&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),650<t&&(510<=o&&o<610&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),470<=o&&o<510&&(c("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),c("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),o<470&&(c("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),c("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),c("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),c("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))),c(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var o,e,t,a=c(this),n=1,d=c(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(t=(t=c(this).parents(".wpd-comment")).attr("class").split(" "),o="",c.each(t,function(e,t){"wpd_comment_level"===ee(t,!1)&&(o=ee(t,!0))}),n=parseInt(o)+1),oe(d,"#wpd-editor-"+c(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==c(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(e=d,t=!0,"2.0"===l&&c("input[name=wc_captcha]",e).length&&!c("input[name=wc_captcha]",e).val().length?(t=!1,c(".wpdiscuz-recaptcha",e).css("border","1px solid red")):"2.0"===l&&c("input[name=wc_captcha]",e).length&&c(".wpdiscuz-recaptcha",e).css("border","none"),t)){R=!0,c(".wpd-agreement-checkbox",d).each(function(){c(this).hasClass("wpd_agreement_hide")&&g&&c(this).prop("checked")&&(Cookies.set(c(this).attr("name")+"_"+j,1,{expires:30,path:"/"}),c("input[name="+c(this).attr("name")+"]").each(function(){F.push(c(this))}))}),c(a).removeClass("wpd_not_clicked");var s=new FormData;if(s.append("action","wpdAddComment"),c(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",c(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||c(this).is(":checked")&&s.append(this.name+"",c(this).val())}),s.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&s.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),c(".wpd-cookies-checkbox",d).length?c(".wpd-cookies-checkbox",d).prop("checked")||(z=!1):i&&(z=!1),c("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===l&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){s.append("g-recaptcha-response",e),H(d,s,a)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error"),c("#wpdiscuz-loading-bar").fadeOut(250)}else H(d,s,a)}n=c(".wpdiscuz_unique_id",d).val(),(p||r)&&"2.0"===l&&(n=Z(n),grecaptcha.reset(M[n])),c(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),c(document).on("click",".wpd_editable_comment",function(){h&&c(".wpdiscuz-edit-form-wrap").length&&W(J(c(".wpdiscuz-edit-form-wrap"),0),h);var o=c(this),a=J(o,0),e=Z(a),t=new FormData;t.append("action","wpdEditComment"),t.append("commentId",e),h=c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),we(x,!0,t).done(function(e){var t;"object"==typeof e?e.success?(c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(e.data.html),wpdiscuzLoadRichEditor?((t=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a)).clipboard.dangerouslyPasteHTML(0,e.data.content),t.update(),c(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")):(c("#wc-textarea-edit_"+a).val(e.data.content),le(c("#wc-textarea-edit_"+a))),c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),c("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,o),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wc_save_edited_comment",function(){var e,t=c(this),o=J(t),a=Z(o),n=c("#wpd-comm-"+o+" #wpdiscuz-edit-form");oe(n,"#wpd-editor-edit_"+o),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()&&((e=new FormData).append("action","wpdSaveEditedComment"),e.append("commentId",a),c(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&e.append(this.name+"",c(this).val()),"checkbox"!==this.type&&"radio"!==this.type||c(this).is(":checked")&&e.append(this.name+"",c(this).val())}),we(x,!0,e).done(function(e){"object"==typeof e?(e.success?(W(o,e.data.message),e.data.lastEdited&&(c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),c(e.data.lastEdited).insertAfter("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),e.data.twitterShareLink&&c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",e.data.twitterShareLink),e.data.whatsappShareLink&&c("#wpd-comm-"+o+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",e.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+o)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,t),"error"),me(e,a)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("click",".wc_cancel_edit",function(){var e=J(c(this));W(e,h),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+e)}),!a&&f&&(S=0,1==f?setTimeout(function(){N(!0)},500):c(document).on("click",".wpd-load-comments",function(){c(this).parent(".wpd-load-more-submit-wrap").remove(),N(!0)})),c(document).on("click",".wpd-load-more-submit",function(){var e=c(this),t="wpd-loaded";e.hasClass(t)&&N(!1,e,t,"wpd-loading")});var V,B,K=!1;function Q(){var e=c("#wpdiscuzHasMoreComments").val(),t=c(document).height(),o=c(window).height()+c(window).scrollTop();t&&o&&80<=100*o/t&&!1===K&&1==e&&N(!(K=!0),c(".wpd-load-more-submit"))}function N(t,a,n,d){a&&(a.toggleClass(n),a.toggleClass(d));var e=new FormData;e.append("action","wpdLoadMoreComments");var o=c(".wpdiscuz-sort-button-active").attr("data-sorting");o&&e.append("sorting",o),e.append("offset",S),e.append("lastParentId",c(".wpd-load-more-submit").attr("data-lastparentid")),e.append("isFirstLoad",t?1:0);o=c(".wpdf-active").attr("data-filter-type");e.append("wpdType",o||""),we(x,!t||1!=f,e).done(function(e){"object"==typeof e&&e.success&&(S++,t&&c(".wpd-comment").remove(),c(".wpdiscuz_single").remove(),c(".wpdiscuz-comment-pagination").before(e.data.comment_list),G(e,t&&2!==s),K=!1,e.data.loadLastCommentId&&(w=e.data.loadLastCommentId),me(e),t&&$(!1)),c("#wpdiscuz-loading-bar").fadeOut(250),c(".wpd-load-more-submit").blur(),a&&(a.toggleClass(n),a.toggleClass(d))}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250),c(".wpd-load-more-submit").blur(),a&&(a.toggleClass(n),a.toggleClass(d))})}function G(e,t){var o;0==e.data.is_show_load_more?(c("#wpdiscuzHasMoreComments").val(0),c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=e.data.last_parent_id,c(".wpd-load-more-submit").attr("data-lastparentid",o),2!==s&&c(".wpdiscuz-comment-pagination").show(),c("#wpdiscuzHasMoreComments").val(1),t&&c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),me(e)}function $(o){var a,e=location.href.match(/#comment\-(\d+)/);null!==e&&(a=e[1],c("#comment-"+a).length?setTimeout(function(){ae(),c("html, body").animate({scrollTop:c("#comment-"+a).parents("[id^=wpd-comm-]").offset().top-E},1e3,ne),o&&X(a)},500):((e=new FormData).append("action","wpdGetSingleComment"),e.append("commentId",a),we(x,!0,e).done(function(e){var t;"object"==typeof e&&e.success&&(t="#comment-"+a,c("#comment-"+e.data.parentCommentID).length?c("#comment-"+e.data.parentCommentID).parents("[id^=wpd-comm-"+e.data.parentCommentID+"]").replaceWith(e.data.message):c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c(t).offset().top-E},1e3,ne),o&&X(a)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})))}function X(e){setTimeout(function(){c("#comment-"+e).siblings(".wpd-secondary-form-wrapper").is(":visible")||c("#comment-"+e).find(".wpd-reply-button").trigger("click")},1100)}function Y(e){if(void 0!==e.data.message)for(var t=e.data.message,o=0;o<t.length;o++)n=t[o],a=n.comment_parent,n=n.comment_html,0==a?de(n):(a=J(c("#comment-"+a),0),c("#wpdiscuz_form_anchor-"+a).after(n));var a,n}function J(e,t){var o="";return(o=(t?e.parents(".wpd-main-form-wrapper"):e.parents(".wpd-comment")).attr("id")).substring(o.lastIndexOf("-")+1)}function Z(e){return e.substring(0,e.indexOf("_"))}function ee(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function te(){var e=[];return c(".wpd-comment-right").each(function(){e.push(Z(J(c(this),0)))}),e.join(",")}function oe(e,t){var o=e.find(".wpd-required-group");wpdiscuzLoadRichEditor&&e.find(".wc_comment").val(c(t+">.ql-editor").html()),t=(t=(t=(t=(t=(e=(t=e).find(".wc_comment")).val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n")).replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),e.val(t),c.each(o,function(){c("input",this).prop("required",!1),0===c("input:checked",this).length?c("input",c(this)).prop("required",!0):c(".wpd-field-invalid",this).remove()})}function ae(){c("html, body").css("scroll-behavior","unset")}function ne(){c("html").css("scroll-behavior",P),c("body").css("scroll-behavior",q)}function de(e){c(".wpd-sticky-comment").last()[0]?c(e).insertAfter(c(".wpd-sticky-comment").last()[0]):c(".wpd-thread-list").prepend(e)}function se(e){e?e.prop("required")||(e.val()?e.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):e.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):c.each(c(".wc_email"),function(e,t){t=c(t);t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}function ie(e){return(e=(c(e).hasClass("wpd-inline-shortcode")?c(e):c(e).parents(".wpd-inline-shortcode")).attr("id")).substring(e.lastIndexOf("-")+1)}function ce(){c(".wpd-inline-form-wrapper").hide(),c(".wpd-inline-shortcode").removeClass("wpd-active"),c(".wpd-inline-icon").removeClass("wpd-open")}function pe(){c.each(c(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var e=c(this),t=e.offset().top-window.pageYOffset;e.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&0<t&&t<300&&("blink"===D?(e.addClass("wpd-blink"),setTimeout(function(){e.removeClass("wpd-blink")},3e3)):(e.parents(".wpd-inline-shortcode").addClass("wpd-active"),e.siblings(".wpd-inline-form-wrapper").show(),e.addClass("wpd-open"),re(e.siblings(".wpd-inline-form-wrapper"))))})}function re(e){var t;e?e.offset().left<=10?(e.css("left",Math.ceil(parseInt(e.css("left"))-e.offset().left+10)),(t=Math.ceil(e.siblings(".wpd-inline-icon.wpd-open").offset().left-e.offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")):e.offset().left+e.width()>document.body.clientWidth-10&&(e.css("left",Math.ceil(parseInt(e.css("left"))+(document.body.clientWidth-(e.offset().left+e.width()))-10)),(t=Math.ceil(e.siblings(".wpd-inline-icon.wpd-open").offset().left-e.offset().left+2))>e.width()-3&&(t=e.width()-3),document.styleSheets[0].addRule("#"+e.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")):c.each(c(".wpd-inline-form-wrapper:visible"),function(){var e;c(this).offset().left<=10?(c(this).css("left",Math.ceil(parseInt(c(this).css("left"))-c(this).offset().left+10)),(e=Math.ceil(c(this).siblings(".wpd-inline-icon.wpd-open").offset().left-c(this).offset().left+2))<3&&(e=3),document.styleSheets[0].addRule("#"+c(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+e+"px;")):c(this).offset().left+c(this).width()>document.body.clientWidth-10&&(c(this).css("left",Math.ceil(parseInt(c(this).css("left"))+(document.body.clientWidth-(c(this).offset().left+c(this).width()))-10)),(e=Math.ceil(c(this).siblings(".wpd-inline-icon.wpd-open").offset().left-c(this).offset().left+2))>c(this).width()-3&&(e=c(this).width()-3),document.styleSheets[0].addRule("#"+c(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+e+"px;"))})}function le(e){var t,o,a=0;e.parents(".wpd_main_comm_form").length?(a=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),o=e.parents(".wpd_main_comm_form")):e.parents(".wpd-secondary-form-wrapper").length?(a=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),o=e.parents(".wpd-secondary-form-wrapper")):e.parents("#wpdiscuz-edit-form").length&&(t=J(e),a=parseInt(t.substring(t.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),o=e.parents("#wpdiscuz-edit-form")),a&&o&&(e=a-e.val().length,(o=c(".wpd-editor-char-counter",o)).html(e),e<=10?o.addClass("error"):o.removeClass("error"))}function me(t,o,a,n){t.data.callbackFunctions&&c.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,o,a,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function we(t,o,a){o&&c("#wpdiscuz-loading-bar").show(),a.append("postId",d);var n=a.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&c.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(a=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](a,t,o))});var e=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return c.ajax({type:"POST",url:e,data:a,contentType:!1,processData:!1})}2!==s||a||(c(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),Q(),c(window).scroll(function(){Q()})),wpdiscuzAjaxObj.setLoadMoreVisibility=G,c(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var d=c(this);c(d).removeClass("wpd_not_clicked");var s=Z(J(d)),i=c(this).hasClass("wpd-vote-up")?1:-1,e=new FormData;e.append("action","wpdVoteOnComment"),e.append("commentId",s),e.append("voteType",i),we(x,!0,e).done(function(e){var t,o,a,n;c(d).addClass("wpd_not_clicked"),"object"==typeof e?(e.success?("total"===e.data.buttonsStyle?(t=c(".wpd-comment-footer .wpd-vote-result",c("#comment-"+s)),o=e.data.votes,t.text(e.data.votesHumanReadable),t.attr("title",o),t.removeClass("wpd-up wpd-down"),0<o&&t.addClass("wpd-up"),o<0&&t.addClass("wpd-down")):(a=c(".wpd-comment-footer .wpd-vote-result-like",c("#comment-"+s)),n=c(".wpd-comment-footer .wpd-vote-result-dislike",c("#comment-"+s)),a.text(e.data.likeCountHumanReadable),a.attr("title",e.data.likeCount),n.text(e.data.dislikeCountHumanReadable),n.attr("title",e.data.dislikeCount),0<parseInt(e.data.likeCount)?a.addClass("wpd-up"):a.removeClass("wpd-up"),parseInt(e.data.dislikeCount)<0?n.addClass("wpd-down"):n.removeClass("wpd-down")),a=c(".wpd-comment-footer .wpd-vote-up",c("#comment-"+s)),n=c(".wpd-comment-footer .wpd-vote-down",c("#comment-"+s)),a.removeClass("wpd-up"),n.removeClass("wpd-down"),0<e.data.curUserReaction?a.addClass("wpd-up"):e.data.curUserReaction<0&&n.addClass("wpd-down")):e.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,d),"error"),me(e,s,i)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c(d).addClass("wpd_not_clicked"),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click","body",function(e){var t=c(".wpdiscuz-sort-buttons");c(e.target).hasClass("wpdf-sorting")||c(e.target).parent().hasClass("wpdf-sorting")?t.css({display:t.is(":visible")?"none":"flex"}):t.hide()}),c(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var e=c(this),t=c(this).attr("data-sorting");t&&(c(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),e.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting"),(e=new FormData).append("action","wpdSorting"),e.append("sorting",t),t=c(".wpdf-active").attr("data-filter-type"),e.append("wpdType",t||""),we(x,!0,e).done(function(e){"object"==typeof e&&e.success&&(c("#wpdcom .wpd-comment").remove(),c("#wpdcom .wpd-thread-list").prepend(e.data.message),G(e,!1),S=1),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),window.onhashchange=function(){$(!1)},1!=f&&$(!1),c(document).on("click",".wpdiscuz-readmore",function(){var t=J(c(this)),o=Z(t),e=new FormData;e.append("action","wpdReadMore"),e.append("commentId",o),we(x,!0,e).done(function(e){"object"==typeof e?(e.success?(c("#comment-"+o+" .wpd-comment-text").replaceWith(" "+e.data.message),c("#wpdiscuz-readmore-"+t).remove()):console.log(e.data),me(e)):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("change",".wpd-required-group",function(){0!==c("input:checked",this).length?c("input",c(this)).prop("required",!1):c("input",c(this)).prop("required",!0)}),c(document).on("click",".wpdiscuz-spoiler",function(){c(this).next().slideToggle(),c(this).hasClass("wpdiscuz-spoiler-closed")?c(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):c(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),c(this).toggleClass("wpdiscuz-spoiler-closed")}),c(document).on("click",".wpd-tools i",function(){var e=c(this).siblings(".wpd-tools-actions");e.is(":visible")||c(this).parents(".wpd-comment-right").attr("id")!==c("[id^=comment-]","#wpdcom").last().attr("id")||c("#comments").css({paddingBottom:"160px"}),e.css({display:e.is(":visible")?"none":"flex"})}),c(document).on("mouseleave",".wpd-comment-right",function(){c(this).find(".wpd-tools-actions").hide(),c("#comments").css({paddingBottom:"0"})}),c(document).on("click",".wpd_stick_btn",function(){var e=Z(J(c(this),0)),t=new FormData;t.append("action","wpdStickComment"),t.append("commentId",e),we(x,!0,t).done(function(e){"object"==typeof e&&e.success&&location.reload(!0),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd_close_btn",function(){var e=Z(J(c(this),0)),t=new FormData;t.append("action","wpdCloseThread"),t.append("commentId",e),we(x,!0,t).done(function(e){"object"==typeof e&&e.success&&location.reload(!0),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=c(this),e=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+e),t.removeClass("wpd_not_clicked"),c(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var a=c(".wpdiscuz-sort-button-active").attr("data-sorting");a&&o.append("sorting",a),o.append("lastParentId",0),o.append("offset",0),S=1,o.append("wpdType",t.hasClass("wpdf-active")?"":e),o.append("isFirstLoad",1),!c(this).hasClass("wpdf-inline")||c(this).hasClass("wpdf-active")?c(".wpd-comment-info-bar").hide():c(".wpd-comment-info-bar").css("display","flex"),we(x,!1,o).done(function(e){t.addClass("wpd_not_clicked"),c(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(t.toggleClass("wpdf-active"),c(".wpd-load-comments").remove(),c(".wpd-comment").remove(),c(".wpd-thread-list").prepend(e.data.comment_list),G(e),w=e.data.loadLastCommentId,c(".wpd-load-more-submit").blur(),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=new FormData;e.append("action","wpdMostReactedComment"),we(x,!1,e).done(function(e){a.addClass("wpd_not_clicked"),c(".fas",a).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(c("#comment-"+e.data.parentCommentID).length?c("#comment-"+e.data.parentCommentID).parents("[id^=wpd-comm-"+e.data.parentCommentID+"]").replaceWith(e.data.message):c("#comment-"+e.data.commentId).length||c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.commentId).offset().top-E},1e3,ne))}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner")})}),c(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=new FormData;e.append("action","wpdHottestThread"),we(x,!1,e).done(function(e){a.addClass("wpd_not_clicked"),c(".fas",a).removeClass("fa-pulse fa-spinner"),"object"==typeof e&&e.success&&(c("#comment-"+e.data.commentId).length?c("#comment-"+e.data.commentId).parents("[id^=wpd-comm-"+e.data.commentId+"]").replaceWith(e.data.message):c(".wpd-thread-list").prepend(e.data.message),me(e),ae(),c("html, body").animate({scrollTop:c("#comment-"+e.data.commentId).offset().top-E},1e3,ne))}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner")})}),c(document).on("click",".wpd-filter-view-all",function(){c(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),c(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var a=c(this);a.removeClass("wpd_not_clicked"),c(".fas",a).addClass("fa-pulse fa-spinner");var e=Z(J(a,0)),t=new FormData;t.append("action","wpdFollowUser"),t.append("commentId",e),we(x,!0,t).done(function(e){a.addClass("wpd_not_clicked"),"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data.code],e.data.code,a),"success"),a.removeClass("wpd-follow-active"),e.data.followTip&&a.attr("wpd-tooltip",e.data.followTip),e.data.followClass&&a.addClass(e.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,a),"error"):console.log(e),c(".fas",a).removeClass("fa-pulse fa-spinner"),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c(".fas",a).removeClass("fa-pulse fa-spinner"),c("#wpdiscuz-loading-bar").fadeOut(250)})}),se(),c(document).on("keyup",".wc_email",function(){se(c(this))}),k&&c("#wpdcom").length&&(c("#wpd-bubble-wrapper").hover(function(){c(this).addClass("wpd-bubble-hover")},function(){c(this).removeClass("wpd-bubble-hover")}),O&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){c("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*A)},1e3*O),"content_left"===T?c(".entry-content").length?(B=25<(V=Math.min(c(".entry-content").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):c(".post-entry").length?(B=25<(V=Math.min(c(".post-entry").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):c(".container").length?(B=25<(V=Math.min(c(".container").offset().left,c("#wpdcom").offset().left)-120)?V:25,c("#wpd-bubble-wrapper").css({left:B+"px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-content")):(c("#wpd-bubble-wrapper").css({left:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"left_corner"===T?(c("#wpd-bubble-wrapper").css({left:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===T&&(c("#wpd-bubble-wrapper").css({right:"25px"}),c("#wpd-bubble-wrapper").addClass("wpd-right-corner")),c("#wpd-bubble-wrapper").show(),c(document).on("click","#wpd-bubble-add-message-close",function(e){e.preventDefault(),e.stopPropagation(),c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),c(document).on("click","#wpd-bubble",function(){ae(),c("#tab-title-reviews").length&&c("#tab-title-reviews a").trigger("click"),c("html, body").animate({scrollTop:c("#wpdcom").offset().top-(E+28)},1e3,function(){ne(),c("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?c("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():c("#wc-textarea-0_0").length&&c("#wc-textarea-0_0").trigger("focus")})}),c(document).on("click","#wpd-bubble-comment-close",function(e){e.preventDefault(),c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),c(document).on("click","#wpd-bubble-comment-reply-link a",function(){var e=c(this).attr("href");setTimeout(function(){c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),$(!0);var t=e.match(/#comment\-(\d+)/);L=L.filter(function(e){return e!=t[1]}),c("#wpd-bubble-count .wpd-new-comments-count").text(L.length),0==L.length&&c("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),c(document).on("click","#wpd-bubble-count",function(){var e;L.length&&((e=new FormData).append("action","wpdBubbleUpdate"),e.append("newCommentIds",L.join()),we(x,!0,e).done(function(e){"object"==typeof e&&e.success&&(e.data.message=e.data.message.filter(function(e){if(!c("#comment-"+e.comment_id).length)return e}),Y(e),c("#wpd-bubble-count").removeClass("wpd-new-comments"),c("#wpd-bubble-count .wpd-new-comments-count").text("0"),L=[],c(".wpd-new-loaded-comment").length&&(ae(),c("html, body").animate({scrollTop:c(c(".wpd-new-loaded-comment")[0]).offset().top-(E+28)},1e3,ne)),me(e)),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o)}))})),(k&&y||n)&&(i||!i&&e)&&setTimeout(function a(){c.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:d,lastId:u,visibleCommentIds:te()}}).done(function(e){var t,o;R||("object"==typeof e?(e.commentIDsToRemove.forEach(function(e){c("[id^=wpd-comm-"+e+"]").remove()}),e.ids.length&&(n&&((o=new FormData).append("action","wpdUpdateAutomatically"),o.append("loadLastCommentId",w),o.append("visibleCommentIds",te()),we(x,!1,o).done(function(e){R||"object"==typeof e&&e.success&&(Y(e),e.data.wc_all_comments_count_new=parseInt(e.data.wc_all_comments_count_new),c(".wpd-thread-info").html(e.data.wc_all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.data.wc_all_comments_count_new),c("#wpd-bubble-all-comments-count").replaceWith(e.data.wc_all_comments_count_bubble_html),w=e.data.loadLastCommentId)}).fail(function(e,t,o){console.log(o)})),e.ids=e.ids.filter(function(e){if(!c("#comment-"+e).length)return e}),t=5e3,u=parseInt(e.ids[e.ids.length-1]),L=L.concat(e.ids),I&&e.commentText&&(c("#wpd-bubble-author-avatar").html(e.avatar),c("#wpd-bubble-author-name").html(e.authorName),c("#wpd-bubble-comment-date span").html(e.commentDate),c("#wpd-bubble-comment-text").html(e.commentText),c("#wpd-bubble-comment-reply-link a").attr("href",e.commentLink),c("#wpd-bubble-notification-message").show(),t=1e4),o=parseInt(c(".wpd-new-comments-count").text()),o+=e.ids.length,c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),c("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){c("#wpd-bubble-notification-message").hide(),c("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},t),c(".wpd-new-comments-count").text(o),c("#wpd-bubble-count").addClass("wpd-new-comments")),e.all_comments_count=parseInt(e.all_comments_count),c("#wpd-bubble-all-comments-count").replaceWith(e.all_comments_count_bubble_html),c(".wpd-thread-info").html(e.all_comments_count_before_threads_html),c(".wpd-thread-info").attr("data-comments-count",e.all_comments_count)):console.log(e)),setTimeout(a,m)}).fail(function(e,t,o){console.log(o),setTimeout(a,m)})},m),c(".wpd-inline-form-wrapper").length&&((e=new FormData).append("action","wpdGetInlineCommentForm"),we(x,!1,e).done(function(e){"object"==typeof e?e.success?(c(".wpd-inline-form-wrapper").append(e.data),c.each(c("[name=_wpd_inline_nonce]"),function(){var e=c(this).attr("id"),t=c(this).parents(".wpd-inline-shortcode").attr("id");c(this).attr("id",e+"-"+t.substring(t.lastIndexOf("-")+1))}),c(".wpd-inline-opened").addClass("wpd-active"),c(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),c(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),c(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),re()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data]),e.data,"error"):console.log(e)}).fail(function(e,t,o){console.log(o)})),c(document).on("click","body",function(e){var t;c(e.target).hasClass("wpd-inline-form-close")||c(e.target).parents(".wpd-inline-form-close").length?(e.preventDefault(),c(e.target).parents(".wpd-inline-form-wrapper").hide(),c(e.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),c(e.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open")):c(e.target).hasClass("wpd-inline-form-wrapper")||c(e.target).parents(".wpd-inline-form-wrapper").length||(ce(),t="",c(e.target).hasClass("wpd-inline-icon")?t=c(e.target):c(e.target).parents(".wpd-inline-icon").length&&(t=c(e.target).parents(".wpd-inline-icon")),t.length&&t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),t.removeClass("wpd-ignored"),re(t.siblings(".wpd-inline-form-wrapper")))),(!c(e.target).hasClass("wpd-last-inline-comments-wrapper")&&!c(e.target).parents(".wpd-last-inline-comments-wrapper").length||c(e.target).parents(".wpd-last-inline-comments-wrapper").length&&c(e.target).hasClass("wpd-load-inline-comment"))&&c(".wpd-last-inline-comments-wrapper").remove()}),c(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(e){e.preventDefault();var o,a=c(this),n=c(this).parents(".wpd_inline_comm_form");n[0].checkValidity()&&(c(this).removeClass("wpd_not_clicked"),(o=new FormData).append("action","wpdAddInlineComment"),o.append("inline_form_id",ie(n)),c.each(c("input, textarea",n),function(e,t){("checkbox"!==this.type||c(this).is(":checked"))&&o.append(c(t).attr("name"),c(t).val())}),we(x,!0,o).done(function(e){var t,o;a.addClass("wpd_not_clicked"),"object"==typeof e?e.success?(n[0].reset(),ce(),t=parseInt(e.data.newCount),(o=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count")).text(t),t?o.addClass("wpd-has-comments"):o.removeClass("wpd-has-comments"),e.data.allCommentsCountNew=parseInt(e.data.allCommentsCountNew),c(".wpd-thread-info").html(e.data.allCommentsCountBeforeThreadsHtml),c(".wpd-thread-info").attr("data-comments-count",e.data.allCommentsCountNew),c("#wpd-bubble-all-comments-count").replaceWith(e.data.allCommentsCountBubbleHtml),e.data.message&&de(e.data.message),wpdiscuzAjaxObj.setCommentMessage(e.data.notification,"success")):e.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,a),"error"):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("keydown",".wpd-form",function(e){e.ctrlKey&&13==e.keyCode&&c(this).find(".wc_comm_submit").trigger("click")}),c(document).on("keydown","#wpdiscuz-edit-form",function(e){e.ctrlKey&&13==e.keyCode&&c(this).find(".wc_save_edited_comment").trigger("click")}),c(document).on("keydown",".wpd-inline-comment-content",function(e){e.ctrlKey&&13==e.keyCode&&c(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),c(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=c(this),e=new FormData;e.append("action","wpdGetLastInlineComments"),e.append("inline_form_id",ie(t)),we(x,!0,e).done(function(e){"object"==typeof e?e.success?c(e.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data,t),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),c(document).on("click",".wpd-view-all-inline-comments",function(e){e.preventDefault(),c(this).parents(".wpd-last-inline-comments-wrapper").remove(),c(".wpdf-inline").hasClass("wpdf-active")||c(".wpdf-inline").trigger("click"),ae(),c("html, body").animate({scrollTop:c(".wpdf-inline").offset().top-E},1e3,ne)}),c(document).on("click",".wpd-feedback-content-link",function(e){e.preventDefault();var t=c(this).data("feedback-content-id");ae(),c("html, body").animate({scrollTop:c("#wpd-inline-"+t).offset().top-(E+6)},1e3,function(){ne(),c("#wpd-inline-"+t).addClass("wpd-active")})}),"scroll_open"!==D&&"blink"!==D||(pe(),c(window).on("scroll",pe)),c(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var e=new FormData,t=c(this).index();0<=t&&t<5&&(e.append("action","wpdUserRate"),e.append("rating",t+1),we(x,!0,e).done(function(e){"object"==typeof e?e.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[e.data],e.data),"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("submit","#wpdiscuz-subscribe-form",function(e){e.preventDefault();var t,o,a=c(this);a[0].checkValidity()&&(o=a,e=!0,"2.0"===l&&c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).length&&!c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).val().length?(e=!1,c(".wpdiscuz-recaptcha",o).css("border","1px solid red")):"2.0"===l&&c("input[name=wpdiscuz_recaptcha_subscribe_form]",o).length&&c(".wpdiscuz-recaptcha",o).css("border","none"),e)&&((t=new FormData).append("action","wpdAddSubscription"),c("*",a).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&t.append(this.name+"",c(this).val()),"checkbox"!=this.type&&"radio"!=this.type||c(this).is(":checked")&&t.append(this.name+"",c(this).val())}),we(x,!0,t).done(function(e){"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(e.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(e.data,"error"):wpdiscuzAjaxObj.setCommentMessage(e,"error"),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)}))}),c(document).on("click",".wpd-unsubscribe",function(e){e.preventDefault();e=new FormData;e.append("action","wpdUnsubscribe"),e.append("sid",c(this).data("sid")),e.append("skey",c(this).data("skey")),we(x,!0,e).done(function(e){"object"==typeof e?e.success?(wpdiscuzAjaxObj.setCommentMessage(e.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(e.data,"error"):console.log(e),c("#wpdiscuz-loading-bar").fadeOut(250),R=!1}).fail(function(e,t,o){console.log(o),c("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(e){c(".wpd-filter.wpdf-active"+(e?":not("+e+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=we});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
1
+ var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if(e instanceof Array)for(var n in e)t instanceof Array?"success"===t[n]?o="wpdiscuz-message-success":"warning"===t[n]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[n]).prependTo("#wpdiscuz-comment-message").delay(a instanceof Array?a[n]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},wpdiscuzAjaxObj.applyFilterOnPhrase=function(e,t,a){return wpdiscuzAjaxObj.phraseFilters&&jQuery.each(wpdiscuzAjaxObj.phraseFilters,function(o){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]]&&(e=wpdiscuzAjaxObj[wpdiscuzAjaxObj.phraseFilters[o]](e,t,a))}),e},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,n=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,i=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),d=wpdiscuzAjaxObj.wpdiscuz_nonce,c=parseInt(wpdiscuzAjaxObj.commentListUpdateType),p=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),r=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),l=wpdiscuzAjaxObj.loadLastCommentId,m=l,w=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var u,f=parseInt(wpdiscuzAjaxObj.wordpressIsPaginate),h=wpdiscuzAjaxObj.storeCommenterData,b=parseInt(wpdiscuzAjaxObj.wmuEnabled),_=wpdiscuzAjaxObj.isCookiesEnabled,g=!0,z=wpdiscuzAjaxObj.cookiehash,v=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),j=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,x=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),C=parseInt(wpdiscuzAjaxObj.enableBubble),k=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),y=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),O=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,A=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),I=wpdiscuzAjaxObj.bubbleLocation,T=wpdiscuzAjaxObj.inlineFeedbackAttractionType,D=(D=parseInt(wpdiscuzAjaxObj.scrollSize))||32,F=[],E=[],M=[],L=!1,R=1,S=e("html").css("scroll-behavior"),P=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),window.addEventListener("beforeunload",function(t){var a=e(".wpd-form").not(":hidden");if(a.length)if(wpdiscuzLoadRichEditor){for(var o=0;o<a.length;o++)if("\n"!==wpDiscuzEditor.createEditor(e(a[o]).find(".ql-container").attr("id")).getText())return t.preventDefault(),void(t.returnValue="")}else for(o=0;o<a.length;o++)if(e(a[o]).find(".wc_comment").val())return t.preventDefault(),void(t.returnValue="")}),wpdiscuzLoadRichEditor||(e(document).delegate("textarea.wc_comment","input",function(){ue(e(this))}),e.each(e("textarea.wc_comment"),function(){ue(e(this))})),e(document).on("focus","#wpdcom .ql-editor, #wpdcom .wc_comment",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(j)}),e(document).on("focus","#wpdcom textarea",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||W({comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).on("click","#wpd-editor-source-code-wrapper-bg",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).on("click","#wpd-insert-source-code",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).on("click",".wpd-reply-button",function(){var i=Y(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+i).focus()},j):setTimeout(function(){e("#wc-textarea-"+i).trigger("focus")},j),e("#wpd-secondary-form-wrapper-"+i).slideToggle(j)):function(a){var o=Y(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var n=e("#wpd-secondary-form-wrapper-"+o);if(!t){var i={comment_author:Cookies.get("comment_author_"+z),comment_author_email:Cookies.get("comment_author_email_"+z),comment_author_url:Cookies.get("comment_author_url_"+z)};W(i)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},j):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},j);n.slideToggle(j,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===n){var i=J(t);setTimeout(function(){if(!E[i])try{E[i]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(i)}),e(document).on("click","#wpdcom .wpd-comment-link [data-comment-url]",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.trigger("select"),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).on("click",".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit",function(e){e.preventDefault()}),e(document).on("click",".wpd-toggle.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=Y(e(this),0),o=e(this),n=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&v?function(t,a){var o=J(t),n=new FormData;n.append("action","wpdShowReplies"),n.append("commentId",o),he(x,!0,n).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies .wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),fe(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,n){console.log(n),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(n.removeClass("fa-chevron-up"),n.addClass("fa-chevron-down"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_show_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(n.removeClass("fa-chevron-down"),n.addClass("fa-chevron-up"),o.find(".wpd-view-replies-text").text(wpdiscuzAjaxObj.wc_hide_replies_text),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).on("mouseenter",".wpd-new-loaded-comment",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).on("click",".wpd-sbs-toggle",function(){e(".wpdiscuz-subscribe-bar").slideToggle(j)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&e("#wpdiscuz-subscribe-form").length&&("2.0"===n?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===n&&e(document).on("click","#wpdiscuz_subscription_button",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.trigger("submit")},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===n){var q=e(window).width(),H=e("#wpdcom").width();H>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),H>=940&&H<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),H>=810&&H<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),H>=730&&H<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),H>=610&&H<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),q>650&&(H>=510&&H<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H>=470&&H<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),H<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function U(t,a,o){he(x||b,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(j),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e(".wpd-thread-info").html(a.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(a.data.wc_all_comments_count_bubble_html);var n=j;a.data.is_main?ie(a.data.message):(n=j+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),he(x,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),he(x,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),_&&g?function(t){var a=t.comment_author_email,o=t.comment_author,n=t.comment_author_url;null==h?(Cookies.set("comment_author_email_"+z,a),Cookies.set("comment_author_"+z,o),n.length&&Cookies.set("comment_author_url_"+z,n)):(h=parseInt(h),Cookies.set("comment_author_email_"+z,a,{expires:h,path:"/"}),Cookies.set("comment_author_"+z,o,{expires:h,path:"/"}),n.length&&Cookies.set("comment_author_url_"+z,n,{expires:h,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").prop("checked",!0)}(a.data):g||e(".wpd-cookies-checkbox").prop("checked",!1),t.get(0).reset(),wpdiscuzLoadRichEditor?wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]):ue(t.find(".wc_comment")),W(a.data),e(".wmu-preview-wrap",t).remove(),F.length&&(F.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),F=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-D},1e3,ne)},n),fe(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"),fe(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,n){console.log(n),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function W(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function V(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).on("click",".wc_comm_submit.wpd_not_clicked",function(){var i=e(this),s=1,d=e(this).parents("form");if(d.hasClass("wpd_main_comm_form")||(s=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===Z(t,!1)&&(o=Z(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),ae(d,"#wpd-editor-"+e(".wpdiscuz_unique_id",d).val()),d.on("submit",function(e){e.preventDefault()}),""!==e(".wc_comment",d).val().trim()){if(d[0].checkValidity()&&(p=d,r=!0,"2.0"===n&&e("input[name=wc_captcha]",p).length&&!e("input[name=wc_captcha]",p).val().length?(r=!1,e(".wpdiscuz-recaptcha",p).css("border","1px solid red")):"2.0"===n&&e("input[name=wc_captcha]",p).length&&e(".wpdiscuz-recaptcha",p).css("border","none"),r)){L=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&_&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+z,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){F.push(e(this))}))})}(d),e(i).removeClass("wpd_not_clicked");var c=new FormData;if(c.append("action","wpdAddComment"),e(":input",d).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&c.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&c.append(this.name+"",e(this).val())}),c.append("wpd_comment_depth",s),wpdiscuzAjaxObj.wpdiscuz_zs&&c.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",d).length?e(".wpd-cookies-checkbox",d).prop("checked")||(g=!1):t&&(g=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===n&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){c.append("g-recaptcha-response",e),U(d,c,i)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else U(d,c,i)}var p,r;!function(e){if((a||o)&&"2.0"===n){var t=J(e);grecaptcha.reset(E[t])}}(e(".wpdiscuz_unique_id",d).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj.wc_msg_required_fields,"wc_msg_required_fields",d),"error")}),e(document).on("click",".wpd_editable_comment",function(){u&&e(".wpdiscuz-edit-form-wrap").length&&V(Y(e(".wpdiscuz-edit-form-wrap"),0),u);var t=e(this),a=Y(t,0),o=J(a),n=new FormData;n.append("action","wpdEditComment"),n.append("commentId",o),u=e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-text").get(0),he(x,!0,n).done(function(o){if("object"==typeof o)if(o.success){if(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(o.data.html),wpdiscuzLoadRichEditor){var n=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+a);n.clipboard.dangerouslyPasteHTML(0,o.data.content),n.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+a).val(o.data.content),ue(e("#wc-textarea-edit_"+a));e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[o.data],o.data,t),"error");else console.log(o);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wc_save_edited_comment",function(){var t=e(this),a=Y(t),o=J(a),n=e("#wpd-comm-"+a+" #wpdiscuz-edit-form");if(ae(n,"#wpd-editor-edit_"+a),n.on("submit",function(e){e.preventDefault()}),n[0].checkValidity()){var i=new FormData;i.append("action","wpdSaveEditedComment"),i.append("commentId",o),e(":input",n).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&i.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),he(x,!0,i).done(function(n){"object"==typeof n?(n.success?(V(a,n.data.message),n.data.lastEdited&&(e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(n.data.lastEdited).insertAfter("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),n.data.twitterShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",n.data.twitterShareLink),n.data.whatsappShareLink&&e("#wpd-comm-"+a+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",n.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+a)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error"),fe(n,o)):console.log(n),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wc_cancel_edit",function(){var t=Y(e(this));V(t,u),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!f&&w&&(R=0,1==w?setTimeout(function(){Q(!0)},500):e(document).on("click",".wpd-load-comments",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),Q(!0)})),e(document).on("click",".wpd-load-more-submit",function(){var t=e(this);t.hasClass("wpd-loaded")&&Q(!1,t,"wpd-loaded","wpd-loading")});var B=!1;function K(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===B&&1==t&&(B=!0,Q(!1,e(".wpd-load-more-submit"))))}function Q(t,a,o,n){a&&(a.toggleClass(o),a.toggleClass(n));var s=new FormData;s.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&s.append("sorting",d),s.append("offset",R),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),he(x,!t||1!=w,s).done(function(s){"object"==typeof s&&s.success&&(R++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),N(s,t&&2!==i),B=!1,s.data.loadLastCommentId&&(l=s.data.loadLastCommentId),fe(s),t&&G(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))}).fail(function(t,i,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(n))})}function N(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==i&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),fe(t)}function G(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){oe(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-D},1e3,ne),t&&$(o)},500);else{var n=new FormData;n.append("action","wpdGetSingleComment"),n.append("commentId",o),he(x,!0,n).done(function(a){if("object"==typeof a&&a.success){var n="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e(n).offset().top-D},1e3,ne),t&&$(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function $(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function X(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)ee((t=a[o]).comment_parent,t.comment_html)}function Y(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function J(e){return e.substring(0,e.indexOf("_"))}function Z(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function ee(t,a){if(0==t)ie(a);else{var o=Y(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function te(){var t=[];return e(".wpd-comment-right").each(function(){t.push(J(Y(e(this),0)))}),t.join(",")}function ae(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).prop("required",!1),0===e("input:checked",this).length?e("input",e(this)).prop("required",!0):e(".wpd-field-invalid",this).remove()})}function oe(){e("html, body").css("scroll-behavior","unset")}function ne(){e("html").css("scroll-behavior",S),e("body").css("scroll-behavior",P)}function ie(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function se(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==i||f||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),K(),e(window).scroll(function(){K()})),wpdiscuzAjaxObj.setLoadMoreVisibility=N,e(document).on("click",".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=J(Y(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var n=new FormData;n.append("action","wpdVoteOnComment"),n.append("commentId",o),n.append("voteType",a),he(x,!0,n).done(function(n){if(e(t).addClass("wpd_not_clicked"),"object"==typeof n){if(n.success){if("total"===n.data.buttonsStyle){var i=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=n.data.votes;i.text(n.data.votesHumanReadable),i.attr("title",s),i.removeClass("wpd-up wpd-down"),s>0&&i.addClass("wpd-up"),s<0&&i.addClass("wpd-down")}else{var d=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));d.text(n.data.likeCountHumanReadable),d.attr("title",n.data.likeCount),c.text(n.data.dislikeCountHumanReadable),c.attr("title",n.data.dislikeCount),parseInt(n.data.likeCount)>0?d.addClass("wpd-up"):d.removeClass("wpd-up"),parseInt(n.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),n.data.curUserReaction>0?p.addClass("wpd-up"):n.data.curUserReaction<0&&r.addClass("wpd-down")}else n.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[n.data],n.data,t),"error");fe(n,o,a)}else console.log(n);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click","body",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).on("click",".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var n=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",n||""),he(x,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),N(t,!1),R=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){G(!1)},1!=w&&G(!1),e(document).on("click",".wpdiscuz-readmore",function(){var t=Y(e(this)),a=J(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),he(x,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),fe(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("change",".wpd-required-group",function(){0!==e("input:checked",this).length?e("input",e(this)).prop("required",!1):e("input",e(this)).prop("required",!0)}),e(document).on("click",".wpdiscuz-spoiler",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).on("click",".wpd-tools i",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]","#wpdcom").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).on("mouseleave",".wpd-comment-right",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).on("click",".wpd_stick_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd_close_btn",function(){var t=J(Y(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),he(x,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-filter.wpd_not_clicked[data-filter-type]",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var n=e(".wpdiscuz-sort-button-active").attr("data-sorting");n&&o.append("sorting",n),o.append("lastParentId",0),o.append("offset",0),R=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),he(x,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),N(a),l=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),fe(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpdf-reacted.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpdf-hottest.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),he(x,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),fe(a),oe(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-D},1e3,ne))}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).on("click",".wpd-filter-view-all",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-follow-link.wpd_not_clicked",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=J(Y(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),he(x,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data.code],a.data.code,t),"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,n){console.log(n),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),se(),e(document).on("keyup",".wc_email",function(){se(e(this))}),C&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),y&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*O)},1e3*y),"content_left"===I)if(e(".entry-content").length){var de=(ce=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ce=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ce;de=(ce=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ce:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===I?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===I&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e(document).on("click","#wpd-bubble-add-message-close",function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e(document).on("click","#wpd-bubble",function(){oe(),e("#tab-title-reviews").length&&e("#tab-title-reviews a").trigger("click"),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-(D+28)},1e3,function(){ne(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").trigger("focus")})}),e(document).on("click","#wpd-bubble-comment-close",function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e(document).on("click","#wpd-bubble-comment-reply-link a",function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),G(!0);var a=t.match(/#comment\-(\d+)/);M=M.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(M.length),0==M.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e(document).on("click","#wpd-bubble-count",function(){if(M.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",M.join()),he(x,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),X(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),M=[],e(".wpd-new-loaded-comment").length&&(oe(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-(D+28)},1e3,ne)),fe(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((C&&k||c)&&(t||!t&&r)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:m,visibleCommentIds:te()}}).done(function(a){if(!L)if("object"==typeof a){if(a.commentIDsToRemove.forEach(function(t){e("[id^=wpd-comm-"+t+"]").remove()}),a.ids.length){c&&((i=new FormData).append("action","wpdUpdateAutomatically"),i.append("loadLastCommentId",l),i.append("visibleCommentIds",te()),he(x,!1,i).done(function(t){L||"object"==typeof t&&t.success&&(X(t),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e(".wpd-thread-info").html(t.data.wc_all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").replaceWith(t.data.wc_all_comments_count_bubble_html),l=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;m=parseInt(a.ids[a.ids.length-1]),M=M.concat(a.ids),A&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var n=parseInt(e(".wpd-new-comments-count").text());n+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(n),e("#wpd-bubble-count").addClass("wpd-new-comments")}a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").replaceWith(a.all_comments_count_bubble_html),e(".wpd-thread-info").html(a.all_comments_count_before_threads_html),e(".wpd-thread-info").attr("data-comments-count",a.all_comments_count)}else console.log(a);var i;setTimeout(t,p)}).fail(function(e,a,o){console.log(o),setTimeout(t,p)})},p),e(".wpd-inline-form-wrapper").length){var pe=new FormData;pe.append("action","wpdGetInlineCommentForm"),he(x,!1,pe).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),we()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data]),t.data,"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function re(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function le(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function me(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;t.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&a>0&&a<300&&("blink"===T?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),we(t.siblings(".wpd-inline-form-wrapper"))))})}function we(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ue(t){var a,o=0;if(t.parents(".wpd_main_comm_form").length)o=parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents(".wpd_main_comm_form");else if(t.parents(".wpd-secondary-form-wrapper").length)o=parseInt(wpdiscuzAjaxObj.replyTextMaxLength),a=t.parents(".wpd-secondary-form-wrapper");else if(t.parents("#wpdiscuz-edit-form").length){var n=Y(t);o=parseInt(n.substring(n.lastIndexOf("_")+1))?parseInt(wpdiscuzAjaxObj.replyTextMaxLength):parseInt(wpdiscuzAjaxObj.commentTextMaxLength),a=t.parents("#wpdiscuz-edit-form")}if(o&&a){var i=t.val().length,s=e(".wpd-editor-char-counter",a),d=o-i;s.html(d),d<=10?s.addClass("error"):s.removeClass("error")}}function fe(t,a,o,n){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,n):console.log(t.data.callbackFunctions[e]+" is not a function")})}function he(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s),o.append("wpdiscuz_nonce",d);var n=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[n]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[n],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[n][e]](o,t,a))});var i=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:i,data:o,contentType:!1,processData:!1})}e(document).on("click","body",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){le();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&a.parents(".wpd-inline-shortcode").find(".wpd-inline-form").length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),we(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).on("click",".wpd-inline-submit.wpd_not_clicked",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var n=new FormData;n.append("action","wpdAddInlineComment"),n.append("inline_form_id",re(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&n.append(e(a).attr("name"),e(a).val()):n.append(e(a).attr("name"),e(a).val())}),he(x,!0,n).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),le();var n=parseInt(t.data.newCount),i=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");i.text(n),n?i.addClass("wpd-has-comments"):i.removeClass("wpd-has-comments"),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e(".wpd-thread-info").html(t.data.allCommentsCountBeforeThreadsHtml),e(".wpd-thread-info").attr("data-comments-count",t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").replaceWith(t.data.allCommentsCountBubbleHtml),t.data.message&&ie(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data,a),"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("keydown",".wpd-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).on("keydown","#wpdiscuz-edit-form",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).on("keydown",".wpd-inline-comment-content",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).on("click",".wpd-inline-icon-count.wpd-has-comments",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",re(t)),he(x,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[a.data],a.data,t),"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).on("click",".wpd-view-all-inline-comments",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),oe(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-D},1e3,ne)}),e(document).on("click",".wpd-feedback-content-link",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");oe(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-(D+6)},1e3,function(){ne(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==T&&"blink"!==T||(me(),e(window).on("scroll",me)),e(document).on("click","#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),he(x,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.applyFilterOnPhrase(wpdiscuzAjaxObj[t.data],t.data),"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e(document).on("submit","#wpdiscuz-subscribe-form",function(t){t.preventDefault();var a,o,i=e(this);if(i[0].checkValidity()&&(a=i,o=!0,"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===n&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",i).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),he(x,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).on("click",".wpd-unsubscribe",function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),he(x,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),L=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=he});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
class.WpdiscuzCore.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: wpDiscuz
4
  * Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
5
- * Version: 7.3.3
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
  * Plugin URI: https://wpdiscuz.com/
@@ -11,7 +11,7 @@
11
  * wpDiscuz Update: auto
12
  */
13
  if (!defined("ABSPATH")) {
14
- exit();
15
  }
16
 
17
  define("WPDISCUZ_DIR_PATH", dirname(__FILE__));
@@ -32,300 +32,299 @@ include_once WPDISCUZ_DIR_PATH . "/includes/class.WpdiscuzRest.php";
32
 
33
  class WpdiscuzCore implements WpDiscuzConstants {
34
 
35
- public $dbManager;
36
- public $helper;
37
- public $helperAjax;
38
- public $helperEmail;
39
- public $helperOptimization;
40
- public $helperUpload;
41
- public $wpdiscuzOptionsJs;
42
- public $options;
43
- public $commentsArgs;
44
- private $version;
45
- public $wpdiscuzForm;
46
- public $form;
47
- private $cache;
48
- public $subscriptionData;
49
- public $isWpdiscuzLoaded;
50
- private $requestUri;
51
- public static $DEFAULT_COMMENT_TYPE;
52
- private static $_instance = null;
53
-
54
- private function __construct() {
55
- add_option(self::OPTION_SLUG_VERSION, "1.0.0");
56
- $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
57
- wp_cookie_constants();
58
- self::$DEFAULT_COMMENT_TYPE = version_compare(get_bloginfo("version"), "5.5", ">=") ? "comment" : "";
59
- $this->dbManager = new WpdiscuzDBManager();
60
- $this->options = new WpdiscuzOptions($this->dbManager);
61
- $this->wpdiscuzForm = new wpDiscuzForm($this->options, $this->version);
62
- $this->helper = new WpdiscuzHelper($this->options, $this->dbManager, $this->wpdiscuzForm);
63
- $this->helperEmail = new WpdiscuzHelperEmail($this->options, $this->dbManager, $this->helper);
64
- $this->helperOptimization = new WpdiscuzHelperOptimization($this->options, $this->dbManager, $this->helperEmail, $this->helper);
65
- $this->helperAjax = new WpdiscuzHelperAjax($this->options, $this->dbManager, $this->helper, $this->helperEmail, $this->wpdiscuzForm);
66
- $this->helperUpload = new WpdiscuzHelperUpload($this->options, $this->dbManager, $this->wpdiscuzForm, $this->helper);
67
- $this->cache = new WpdiscuzCache($this->options, $this->helper);
68
- $this->requestUri = !empty($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
69
-
70
- if ($this->options->thread_display["isLoadOnlyParentComments"]) {
71
- add_action("wp_ajax_wpdShowReplies", [&$this, "showReplies"]);
72
- add_action("wp_ajax_nopriv_wpdShowReplies", [&$this, "showReplies"]);
73
- }
74
-
75
- register_activation_hook(__FILE__, [&$this, "pluginActivation"]);
76
-
77
- /* CRON JOBS */
78
- register_activation_hook(__FILE__, [&$this, "registerJobs"]);
79
- register_deactivation_hook(__FILE__, [&$this, "deregisterJobs"]);
80
- add_filter("cron_schedules", [&$this, "setIntervals"]);
81
- /* /CRON JOBS */
82
- add_action("wp_insert_site", [&$this, "addNewBlog"]);
83
- add_action("delete_blog", [&$this, "deleteBlog"]);
84
- add_action("wp_head", [&$this, "initCurrentPostType"]);
85
-
86
- add_action("admin_init", [&$this, "uninstall"], 1);
87
- add_action("init", [&$this, "wpdiscuzTextDomain"]);
88
- add_action("admin_init", [&$this, "pluginNewVersion"], 1);
89
- add_action("admin_enqueue_scripts", [&$this, "backendFiles"], 100);
90
- add_action("wp_enqueue_scripts", [&$this, "frontendFiles"]);
91
- add_action("admin_menu", [&$this, "addPluginOptionsPage"], 1);
92
-
93
- add_action("wp_ajax_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
94
- add_action("wp_ajax_nopriv_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
95
- add_action("wp_ajax_wpdSorting", [&$this, "sorting"]);
96
- add_action("wp_ajax_nopriv_wpdSorting", [&$this, "sorting"]);
97
- add_action("wp_ajax_wpdAddComment", [&$this, "addComment"]);
98
- add_action("wp_ajax_nopriv_wpdAddComment", [&$this, "addComment"]);
99
- add_action("wp_ajax_wpdGetSingleComment", [&$this, "getSingleComment"]);
100
- add_action("wp_ajax_nopriv_wpdGetSingleComment", [&$this, "getSingleComment"]);
101
- add_action("wp_ajax_wpdMostReactedComment", [&$this, "mostReactedComment"]);
102
- add_action("wp_ajax_nopriv_wpdMostReactedComment", [&$this, "mostReactedComment"]);
103
- add_action("wp_ajax_wpdHottestThread", [&$this, "hottestThread"]);
104
- add_action("wp_ajax_nopriv_wpdHottestThread", [&$this, "hottestThread"]);
105
-
106
- $plugin = plugin_basename(__FILE__);
107
- add_filter("plugin_action_links_$plugin", [&$this, "addPluginSettingsLink"]);
108
- add_filter("comments_clauses", [&$this, "commentsClauses"]);
109
-
110
- add_action("wp_ajax_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
111
- add_action("wp_ajax_nopriv_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
112
-
113
- if ($this->options->live["commentListUpdateType"]) {
114
- add_action("wp_ajax_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
115
- add_action("wp_ajax_nopriv_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
116
- }
117
-
118
- add_action("wp_loaded", [&$this, "addNewRoles"]);
119
- add_filter("comments_template_query_args", [&$this, "commentsTemplateQueryArgs"]);
120
- add_action("pre_get_comments", [&$this, "preGetComments"]);
121
- add_filter("found_comments_query", [&$this, "foundCommentsQuery"], 10, 2);
122
-
123
- if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
124
- add_action("rest_api_init", [&$this, "registerRestRoutes"], 10);
125
- }
126
- if ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"]) {
127
- add_action("wp_ajax_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
128
- add_action("wp_ajax_nopriv_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
129
- }
130
-
131
- add_action("admin_footer", [&$this, "feedbackDialog"]);
132
- add_filter("mce_buttons", [&$this, "mceButton"]);
133
- add_filter("mce_external_plugins", [&$this, "mceExternalPlugin"]);
134
- add_shortcode(self::WPDISCUZ_FEEDBACK_SHORTCODE, [&$this, "feedbackShortcode"]);
135
- add_action("wp_ajax_wpdAddInlineComment", [&$this, "addInlineComment"]);
136
- add_action("wp_ajax_nopriv_wpdAddInlineComment", [&$this, "addInlineComment"]);
137
- add_action("wp_footer", [&$this, "footerContents"]);
138
- add_action("enqueue_block_editor_assets", [&$this, "gutenbergButton"]);
139
-
140
- add_filter("extra_plugin_headers", [&$this, "extraPluginHeaders"]);
141
- add_filter("auto_update_plugin", [&$this, "shouldUpdate"], 10, 2);
142
-
143
- add_filter("preprocess_comment", [&$this, "validateRecaptcha"], 10, 2);
144
-
145
- add_action("admin_bar_menu", [&$this, "addToolbarItems"], 300);
146
- }
147
-
148
- public static function getInstance() {
149
- if (is_null(self::$_instance)) {
150
- self::$_instance = new self();
151
- }
152
-
153
- return self::$_instance;
154
- }
155
-
156
- public function extraPluginHeaders($headers) {
157
- $headers[] = "wpDiscuz Update";
158
-
159
- return $headers;
160
- }
161
-
162
- public function shouldUpdate($shouldUpdate, $plugin) {
163
- if (!isset($plugin->plugin, $plugin->new_version)) {
164
- return $shouldUpdate;
165
- }
166
-
167
- if ("wpdiscuz/class.WpdiscuzCore.php" !== $plugin->plugin) {
168
- return $shouldUpdate;
169
- }
170
-
171
- $pluginData = get_plugin_data(__FILE__);
172
-
173
- if (isset($pluginData["wpDiscuz Update"]) && $pluginData["wpDiscuz Update"] === "manual") {
174
- return false;
175
- }
176
-
177
- return $shouldUpdate;
178
- }
179
-
180
- public function pluginActivation($networkwide) {
181
- if (function_exists("is_multisite") && is_multisite() && $networkwide) {
182
- $oldBlogID = $this->dbManager->getBlogID();
183
- $oldSitePluginVersion = $this->version;
184
- $blogIDs = $this->dbManager->getBlogIDs();
185
- foreach ($blogIDs as $blogID) {
186
- switch_to_blog($blogID);
187
- $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
188
- $this->activateWpDiscuz();
189
- }
190
- switch_to_blog($oldBlogID);
191
- $this->version = $oldSitePluginVersion;
192
-
193
- return;
194
- }
195
- $this->activateWpDiscuz();
196
- }
197
-
198
- public function addNewBlog($new_site) {
199
- if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
200
- $oldBlogID = $this->dbManager->getBlogID();
201
- $oldSitePluginVersion = $this->version;
202
- switch_to_blog($new_site->blogID);
203
- $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
204
- $this->activateWpDiscuz();
205
- switch_to_blog($oldBlogID);
206
- $this->version = $oldSitePluginVersion;
207
- }
208
- }
209
-
210
- public function deleteBlog($blogID) {
211
- if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
212
- $oldBlogID = $this->dbManager->getBlogID();
213
- switch_to_blog($blogID);
214
- $this->dbManager->dropTables();
215
- switch_to_blog($oldBlogID);
216
- }
217
- }
218
-
219
- private function activateWpDiscuz() {
220
- $this->dbManager->dbCreateTables();
221
- $this->pluginNewVersion();
222
- }
223
-
224
- public function wpdiscuzTextDomain() {
225
- load_plugin_textdomain("wpdiscuz", false, dirname(plugin_basename(__FILE__)) . "/languages/");
226
- }
227
-
228
- public function registerJobs() {
229
- if (!wp_next_scheduled(self::DELETE_UNATTACHED_FILES_ACTION)) {
230
- wp_schedule_event(current_time("timestamp"), self::DELETE_UNATTACHED_FILES_KEY_RECURRENCE, self::DELETE_UNATTACHED_FILES_ACTION);
231
- }
232
- }
233
-
234
- public function deregisterJobs() {
235
- if (wp_next_scheduled(self::DELETE_UNATTACHED_FILES_ACTION)) {
236
- wp_clear_scheduled_hook(self::DELETE_UNATTACHED_FILES_ACTION);
237
- }
238
- }
239
-
240
- public function setIntervals($schedules) {
241
- $schedules[self::DELETE_UNATTACHED_FILES_KEY_RECURRENCE] = [
242
- "interval" => self::DELETE_UNATTACHED_FILES_RECURRENCE * HOUR_IN_SECONDS,
243
- "display" => esc_html__("Every 48 hours", "wpdiscuz")
244
- ];
245
- return $schedules;
246
- }
247
-
248
- public function updateAutomatically() {
249
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
250
- $loadLastCommentId = WpdiscuzHelper::sanitize(INPUT_POST, "loadLastCommentId", FILTER_SANITIZE_NUMBER_INT, 0);
251
- if ($postId) {
252
- $this->isWpdiscuzLoaded = true;
253
- $visibleCommentIds = rtrim(WpdiscuzHelper::sanitize(INPUT_POST, "visibleCommentIds", FILTER_SANITIZE_STRING, ""), ",");
254
- $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
255
- $commentListArgs = $this->getCommentListArgs($postId);
256
- if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
257
- $lastCommentId = $this->dbManager->getLastCommentId($this->commentsArgs);
258
- if ($lastCommentId > $loadLastCommentId) {
259
- $response = [];
260
- $response["loadLastCommentId"] = $lastCommentId;
261
- $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
262
- $sentEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? trim($_COOKIE["comment_author_email_" . COOKIEHASH]) : "";
263
- $email = !empty($commentListArgs["current_user"]->ID) ? $commentListArgs["current_user"]->user_email : $sentEmail;
264
- $newCommentIds = $this->dbManager->getNewCommentIds($this->commentsArgs, $loadLastCommentId, $email, $visibleCommentIds);
265
- $newCommentIds = apply_filters("wpdiscuz_live_update_new_comment_ids", $newCommentIds, $postId, $commentListArgs["current_user"]);
266
- $response["message"] = [];
267
- foreach ($newCommentIds as $newCommentId) {
268
- $comment = get_comment($newCommentId);
269
- if (($comment->comment_parent && (in_array($comment->comment_parent, explode(",", $visibleCommentIds)) || in_array($comment->comment_parent, $newCommentIds))) || !$comment->comment_parent) {
270
- $commentHtml = wp_list_comments($commentListArgs, [$comment]);
271
- $commentObject = [
272
- "comment_parent" => $comment->comment_parent,
273
- "comment_html" => $commentHtml
274
- ];
275
- if ($comment->comment_parent) {
276
- array_push($response["message"], $commentObject);
277
- } else {
278
- array_unshift($response["message"], $commentObject);
279
- }
280
- }
281
- }
282
- $response["wc_all_comments_count_new"] = get_comments_number($postId);
283
- $response["wc_all_comments_count_before_threads_html"] = "<span class='wpdtc' title='" . esc_attr($response["wc_all_comments_count_new"]) . "'>" . esc_html($this->helper->getNumber($response["wc_all_comments_count_new"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["wc_all_comments_count_new"] ? $this->form->getHeaderTextSingle() : $this->form->getHeaderTextPlural()), $response["wc_all_comments_count_new"]));
284
- $response["wc_all_comments_count_bubble_html"] = "<span id='wpd-bubble-all-comments-count'" . ($response["wc_all_comments_count_new"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["wc_all_comments_count_new"]) . "'>" . esc_html($this->helper->getNumber($response["wc_all_comments_count_new"])) . "</span>";
285
- wp_send_json_success($response);
286
- }
287
- }
288
- }
289
- }
290
-
291
- public function bubbleUpdate() {
292
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
293
- $newCommentIds = WpdiscuzHelper::sanitize(INPUT_POST, "newCommentIds", FILTER_SANITIZE_STRING, "");
294
- if ($postId && $newCommentIds) {
295
- $this->isWpdiscuzLoaded = true;
296
- $commentListArgs = $this->getCommentListArgs($postId);
297
- if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
298
- $newCommentIds = explode(",", trim($newCommentIds, ","));
299
- $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
300
- $response = ["message" => []];
301
- foreach ($newCommentIds as $newCommentId) {
302
- $comment = get_comment($newCommentId);
303
- $commentHtml = wp_list_comments($commentListArgs, [$comment]);
304
- $response["message"][] = [
305
- "comment_id" => $comment->comment_ID,
306
- "comment_parent" => $comment->comment_parent,
307
- "comment_html" => $commentHtml
308
- ];
309
- }
310
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
311
- wp_send_json_success($response);
312
- }
313
- }
314
- }
315
-
316
- public function addComment() {
317
- $isAnonymous = false;
318
- $uniqueId = trim(WpdiscuzHelper::sanitize(INPUT_POST, "wpdiscuz_unique_id", FILTER_SANITIZE_STRING, ""));
319
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
320
- $comment_content = isset($_POST["wc_comment"]) ? $_POST["wc_comment"] : "";
321
-
322
-
323
- if ($uniqueId && $postId && $comment_content) {
324
- $this->isWpdiscuzLoaded = true;
325
- $this->form = $this->wpdiscuzForm->getForm($postId);
326
- $this->form->initFormFields();
327
- $currentUser = WpdiscuzHelper::getCurrentUser();
328
- if ($this->form->isUserCanSeeComments($currentUser, $postId)) {
329
  do_action("wpdiscuz_before_comment_post");
330
  if (!comments_open($postId)) {
331
  wp_die(esc_html($this->options->getPhrase("wc_commenting_is_closed")));
@@ -370,20 +369,20 @@ class WpdiscuzCore implements WpDiscuzConstants {
370
  wp_send_json_error("wc_msg_required_fields");
371
  }
372
 
373
- $uid_data = $this->helper->getUIDData($uniqueId);
374
- $comment_parent = intval($uid_data[0]);
375
- $parentComment = $comment_parent ? get_comment($comment_parent) : null;
376
- $comment_parent = isset($parentComment->comment_ID) ? $parentComment->comment_ID : 0;
377
- if ($parentComment && intval(get_comment_meta($comment_parent, self::META_KEY_CLOSED, true))) {
378
- wp_die(esc_html($this->options->getPhrase("wc_closed_comment_thread", ["comment" => $parentComment])));
379
- }
380
- $isReply = $wooExists && !$replyForWoo ? 0 : $comment_parent;
381
  if ($isReply) {
382
  $commentMinLength = intval($this->options->content["replyTextMinLength"]);
383
  $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
384
  } else {
385
- $commentMinLength = intval($this->options->content["commentTextMinLength"]);
386
- $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
387
  }
388
  $contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($comment_content)) : strlen(strip_tags($comment_content));
389
  if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
@@ -397,7 +396,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
397
  if ($name && $email && $comment_content) {
398
  $website_url = $website_url ? urldecode($website_url) : "";
399
  $stickyComment = WpdiscuzHelper::sanitize(INPUT_POST, "wc_sticky_comment", FILTER_SANITIZE_NUMBER_INT, "");
400
- $closedComment = absint(WpdiscuzHelper::sanitize(INPUT_POST, "wc_sticky_comment", FILTER_SANITIZE_NUMBER_INT, 0));
401
 
402
  $this->helper->restrictCommentingPerUser($email, $comment_parent, $postId);
403
  $wc_user_agent = isset($_SERVER["HTTP_USER_AGENT"]) ? sanitize_text_field($_SERVER["HTTP_USER_AGENT"]) : "";
@@ -475,142 +474,143 @@ class WpdiscuzCore implements WpDiscuzConstants {
475
  } else {
476
  wp_send_json_error("wc_invalid_field");
477
  }
478
- } else {
479
- wp_send_json_error("wc_msg_required_fields");
480
  }
481
- } else {
482
- wp_send_json_error("wc_msg_required_fields");
483
- }
484
- }
485
-
486
- /**
487
- * save edited comment via ajax
488
- */
489
- public function saveEditedComment() {
490
- $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
491
- $trimmedContent = isset($_POST["wc_comment"]) ? trim($_POST["wc_comment"]) : "";
492
- if (!$trimmedContent || !strip_tags($trimmedContent)) {
493
- wp_send_json_error("wc_msg_required_fields");
494
- }
495
- $trimmedContent = ($this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop")) && !$this->options->showEditorToolbar() ? html_entity_decode($trimmedContent) : $trimmedContent;
496
- if ($commentId) {
497
- $this->isWpdiscuzLoaded = true;
498
- $comment = get_comment($commentId);
499
- $currentUser = WpdiscuzHelper::getCurrentUser();
500
- $uniqueId = $comment->comment_ID . "_" . $comment->comment_parent;
501
- $highLevelUser = current_user_can("moderate_comments");
502
- $isCurrentUserCanEdit = $this->helper->isCommentEditable($comment) && $this->helper->canUserEditComment($comment, $currentUser);
503
- $this->form = $this->wpdiscuzForm->getForm($comment->comment_post_ID);
504
- $this->form->initFormFields();
505
- $this->form->validateFields($currentUser);
506
- if (!intval(get_comment_meta($comment->comment_ID, self::META_KEY_CLOSED, true)) && ($highLevelUser || $isCurrentUserCanEdit) && $this->form->isUserCanSeeComments($currentUser, $comment->comment_post_ID)) {
507
- $isInRange = $this->helper->isContentInRange($trimmedContent, $comment->comment_parent);
508
-
509
- if (!$isInRange && !$highLevelUser) {
510
- if ($comment->comment_parent) {
511
- $commentMinLength = intval($this->options->content["replyTextMinLength"]);
512
- $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
513
- } else {
 
514
  $commentMinLength = intval($this->options->content["commentTextMinLength"]);
515
  $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
516
  }
517
- $contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($trimmedContent)) : strlen(strip_tags($trimmedContent));
518
- if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
519
- wp_send_json_error("wc_msg_input_min_length");
520
- }
521
-
522
- if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
523
- wp_send_json_error("wc_msg_input_max_length");
524
- }
525
- }
526
-
527
- if ($isInRange || $highLevelUser) {
528
- $response = [];
529
- if ($trimmedContent !== $comment->comment_content) {
530
- $trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
531
- $commentContent = $this->helper->filterCommentText($trimmedContent);
532
- $userAgent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
533
- $commentarr = [
534
- "comment_ID" => $commentId,
535
- "comment_content" => $commentContent,
536
- "comment_agent" => $userAgent,
537
- "comment_approved" => $comment->comment_approved
538
- ];
539
- wp_update_comment(wp_slash($commentarr));
540
- $lastEditedAt = current_time("mysql", 1);
541
- update_comment_meta($commentId, self::META_KEY_LAST_EDITED_AT, $lastEditedAt);
542
- update_comment_meta($commentId, self::META_KEY_LAST_EDITED_BY, !empty($currentUser->ID) ? $currentUser->ID : $comment->comment_author_email);
543
- if ($this->options->moderation["displayEditingInfo"]) {
544
- if (!empty($currentUser->ID)) {
545
- $lastEditedBy = get_user_by("id", $currentUser->ID);
546
- } else {
547
- $lastEditedBy = get_user_by("email", $currentUser->comment_author_email);
548
- }
549
- $username = $lastEditedBy ? $lastEditedBy->display_name : $comment->comment_author;
550
- $response["lastEdited"] = "<div class='wpd-comment-last-edited'><i class='far fa-edit'></i>" . esc_html(sprintf($this->options->getPhrase("wc_last_edited", ["comment" => $comment]), $this->helper->dateDiff($lastEditedAt), $username)) . "</div>";
551
- }
552
- do_action("wpdiscuz_clean_post_cache", $comment->comment_post_ID, "comment_edited");
553
- do_action("wpdiscuz_reset_comments_cache", $comment->comment_post_ID);
554
- }
555
-
556
- $this->form->saveCommentMeta($comment->comment_ID);
557
- $commentContent = isset($commentContent) ? $commentContent : $trimmedContent;
558
- if ($this->options->content["enableImageConversion"]) {
559
- $commentContent = $this->helper->makeClickable($commentContent);
560
- }
561
- $commentLink = get_comment_link($comment);
562
- $commentContent = apply_filters("comment_text", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
563
- $commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
564
- if (stripos($commentContent, "[/spoiler]") !== false) {
565
- $commentReadMoreLimit = 0;
566
- $commentContent = $this->helper->spoiler($commentContent);
567
- }
568
- if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($commentContent)) > $commentReadMoreLimit) {
569
- $commentContent = WpdiscuzHelper::getCommentExcerpt($commentContent, $uniqueId, $this->options);
570
- }
571
- $commentContent = apply_filters("wpdiscuz_after_read_more", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
572
- if ($this->options->social["enableTwitterShare"]) {
573
- $response["twitterShareLink"] = esc_url_raw("https://twitter.com/intent/tweet?text=" . $this->helper->getTwitterShareContent($commentContent, $commentLink) . "&url=" . urlencode($commentLink));
574
- }
575
- if ($this->options->social["enableWhatsappShare"]) {
576
- $response["whatsappShareLink"] = esc_url_raw((wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com") . "/send?text=" . $this->helper->getWhatsappShareContent($commentContent, $commentLink));
577
- }
578
-
579
- $components = $this->helper->getComponents($this->form->getTheme(), $this->form->getLayout());
580
- $inlineContent = "";
581
- if ($inlineFormID = intval(get_comment_meta($comment->comment_ID, self::META_KEY_FEEDBACK_FORM_ID, true))) {
582
- $feedbackForm = $this->dbManager->getFeedbackForm($inlineFormID);
583
- $inlineContent = "<div class='wpd-inline-feedback-wrapper'><span class='wpd-inline-feedback-info'>" . esc_html($this->options->getPhrase("wc_feedback_content_text")) . "</span> <i class='fas fa-quote-left'></i>" . wp_trim_words($feedbackForm->content, apply_filters("wpdiscuz_feedback_content_words_count", 20)) . "&quot; <a class='wpd-feedback-content-link' data-feedback-content-id='{$feedbackForm->id}' href='#wpd-inline-{$feedbackForm->id}'>" . esc_html($this->options->getPhrase("wc_read_more")) . "</a></div>";
584
- }
585
- $response["message"] = str_replace(["{TEXT_WRAPPER_CLASSES}", "{TEXT}"], [
586
- "wpd-comment-text",
587
- $inlineContent . $commentContent
588
- ], $components["text.html"]);
589
- $response["callbackFunctions"] = [];
590
- $response = apply_filters("wpdiscuz_comment_edit_save", $response);
591
- wp_send_json_success($response);
592
- } else {
593
- wp_send_json_error("wc_comment_edit_not_possible");
594
- }
595
- } else {
596
- wp_send_json_error("wc_comment_edit_not_possible");
597
- }
598
- }
599
- }
600
-
601
- /**
602
- * Gets single comment with its full thread and displays in comment list
603
- */
604
- public function getSingleComment() {
605
- $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
606
- $comment = get_comment($commentId);
607
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
608
- if ($commentId && $postId && $comment && $comment->comment_post_ID == $postId) {
609
- $commentListArgs = $this->getCommentListArgs($postId);
610
- $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
611
- if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
612
  $showUnapprovedComment = false;
613
- $includeUnapproved = null;
614
  if ($comment->comment_approved === "0") {
615
  if ($commentListArgs["high_level_user"]) {
616
  $showUnapprovedComment = true;
@@ -627,29 +627,29 @@ class WpdiscuzCore implements WpDiscuzConstants {
627
  }
628
  if ($comment->comment_approved === "1" || $showUnapprovedComment) {
629
  $this->isWpdiscuzLoaded = true;
630
- $commentStatusIn = ["1"];
631
  if ($this->commentsArgs["status"] === "all") {
632
  $commentStatusIn[] = "0";
633
  }
634
 
635
  if (!$this->options->wp["threadComments"]) {
636
- $comments = [$comment];
637
  $parentComment = $comment;
638
  } else if ($parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved)) {
639
  $args = [
640
- "format" => "flat",
641
- "status" => $this->commentsArgs["status"],
642
  "orderby" => $this->commentsArgs["orderby"],
643
  "post_id" => $this->commentsArgs["post_id"],
644
  ];
645
  if (!empty($this->commentsArgs["include_unapproved"])) {
646
  $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
647
  }
648
- $tree = $parentComment->get_children($args);
649
  $comments = array_merge([$parentComment], $tree);
650
  }
651
  if ($parentComment) {
652
- $commentListArgs["isSingle"] = true;
653
  $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
654
  if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
655
  if (!empty($commentListArgs['current_user']->ID)) {
@@ -658,24 +658,24 @@ class WpdiscuzCore implements WpDiscuzConstants {
658
  $commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
659
  }
660
  }
661
- $response = [];
662
- $response["message"] = wp_list_comments($commentListArgs, $comments);
663
- $response["parentCommentID"] = $parentComment->comment_ID;
664
  $response["callbackFunctions"] = [];
665
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
666
  wp_send_json_success($response);
667
  }
668
  }
669
- }
670
- }
671
- }
672
-
673
- public function loadMoreComments() {
674
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
675
- $lastParentId = WpdiscuzHelper::sanitize(INPUT_POST, "lastParentId", FILTER_SANITIZE_NUMBER_INT, 0);
676
- if ($lastParentId >= 0 && $postId) {
677
- $this->form = $this->wpdiscuzForm->getForm($postId);
678
- if ($this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $postId)) {
679
  $this->isWpdiscuzLoaded = true;
680
  $isFirstLoad = WpdiscuzHelper::sanitize(INPUT_POST, "isFirstLoad", FILTER_SANITIZE_NUMBER_INT, 1);
681
  // max value of php int for limit
@@ -703,375 +703,376 @@ class WpdiscuzCore implements WpDiscuzConstants {
703
  $args["post_id"] = $postId;
704
  $args = apply_filters("wpdiscuz_filter_args", $args);
705
  $commentData = $this->getWPComments($args);
706
- if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
707
- $commentData["loadLastCommentId"] = $this->dbManager->getLastCommentId($this->commentsArgs);
708
- }
709
  $commentData["callbackFunctions"] = [];
710
  $commentData = apply_filters("wpdiscuz_ajax_callbacks", $commentData);
711
  wp_send_json_success($commentData);
712
- }
713
- }
714
- }
715
-
716
- public function sorting() {
717
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
718
- $sorting = trim(WpdiscuzHelper::sanitize(INPUT_POST, "sorting", FILTER_SANITIZE_STRING, ""));
719
- if ($postId && $sorting) {
720
- $this->form = $this->wpdiscuzForm->getForm($postId);
721
- if ($this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $postId)) {
722
  $this->isWpdiscuzLoaded = true;
723
- $args = ["post_id" => $postId];
724
  if ($sorting === "newest") {
725
  $args["orderby"] = $this->options->thread_display["orderCommentsBy"];
726
- $args["order"] = "desc";
727
  } else if ($sorting === "oldest") {
728
  $args["orderby"] = $this->options->thread_display["orderCommentsBy"];
729
- $args["order"] = "asc";
730
  } else if ($sorting === "by_vote") {
731
  $args["orderby"] = "by_vote";
732
- $args["order"] = $this->options->wp["commentOrder"];
733
  }
734
  $args["first_load"] = 1;
735
- $args["wpdType"] = WpdiscuzHelper::sanitize(INPUT_POST, "wpdType", FILTER_SANITIZE_STRING, "");
736
- $args = apply_filters("wpdiscuz_filter_args", $args);
737
- $commentData = $this->getWPComments($args);
738
- $response = [
739
- "last_parent_id" => $commentData["last_parent_id"],
740
  "is_show_load_more" => $commentData["is_show_load_more"],
741
- "message" => $commentData["comment_list"],
742
  "callbackFunctions" => [],
743
  ];
744
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
745
  wp_send_json_success($response);
746
- }
747
- }
748
- }
749
-
750
- /**
751
- * get comments by comment type
752
- */
753
- public function getWPComments($args = []) {
754
- global $post;
755
- $postId = isset($args["post_id"]) ? $args["post_id"] : $post->ID;
756
- $defaults = $this->getDefaultCommentsArgs($postId);
757
- $this->commentsArgs = wp_parse_args($args, $defaults);
758
- $commentListArgs = $this->getCommentListArgs($postId);
759
- do_action("wpdiscuz_before_getcomments", $this->commentsArgs, $commentListArgs["current_user"], $args);
760
- $commentData = [];
761
-
762
- if ($commentCache = $this->cache->getCommentsCache($this->commentsArgs)) {
763
- $commentList = $commentCache["commentList"];
764
- $commentData = $commentCache["commentData"];
765
- if ($this->options->wp["isPaginate"]) {
766
- $commentListArgs["page"] = 0;
767
- $commentListArgs["per_page"] = 0;
768
  $commentListArgs["reverse_top_level"] = $this->options->wp["commentOrder"] === "desc";
769
  }
770
- if ($this->options->wp["threadComments"] && $this->options->thread_display["isLoadOnlyParentComments"] && $commentList) {
771
- $commentList = $this->getChildren($commentList, $commentListArgs);
772
- }
773
- } else {
774
- $commentList = $this->_getWPComments($commentListArgs, $commentData);
775
- $this->cache->setCommentsCache($this->commentsArgs, $commentList, $commentData);
776
- }
777
-
778
- if ($count = count($commentList)) {
779
- $commentListArgs["lastCommentIdInList"] = $commentList[$count - 1]->comment_ID;
780
- }
781
-
782
- $commentData["comment_list"] = wp_list_comments($commentListArgs, $commentList);
783
- $this->commentsArgs["caller"] = "";
784
-
785
- return $commentData;
786
- }
787
-
788
- public function _getWPComments(&$commentListArgs, &$commentData) {
789
- if ($this->options->wp["isPaginate"]) {// PAGINATION
790
- $page = get_query_var("cpage");
791
- $this->commentsArgs["number"] = $this->options->wp["commentPerPage"];
792
- $this->commentsArgs["order"] = "asc";
793
- $this->commentsArgs["caller"] = "";
794
- if ($this->options->wp["threadComments"]) {
795
- $this->commentsArgs["parent"] = 0;
796
- }
797
-
798
- if ($page) {
799
- $this->commentsArgs["offset"] = ($page - 1) * $this->options->wp["commentPerPage"];
800
- } else if ($this->options->wp["defaultCommentsPage"] === "oldest") {
801
- $this->commentsArgs["offset"] = 0;
802
- }
803
-
804
- $commentListArgs["page"] = 0;
805
- $commentListArgs["per_page"] = 0;
806
- $commentListArgs["reverse_top_level"] = $this->options->wp["commentOrder"] === "desc";
807
-
808
- $commentList = get_comments($this->commentsArgs);
809
- if ($this->options->wp["threadComments"] && $commentList) {
810
- $commentList = $this->getChildren($commentList, $commentListArgs);
811
- }
812
- $this->getStickyComments(true, $commentList, $commentListArgs);
813
- } else {
814
- $limitBefore = $this->commentsArgs["number"];
815
- if ($this->commentsArgs["number"]) {
816
- $this->commentsArgs["number"] += 1;
817
- }
818
- if ($this->commentsArgs["wpdType"] === "inline") {
819
- $this->commentsArgs["meta_query"] = [
820
- [
821
- "key" => self::META_KEY_FEEDBACK_FORM_ID,
822
- "value" => 0,
823
- "compare" => "!=",
824
- ],
825
- ];
826
- }
827
- $commentList = get_comments($this->commentsArgs);
828
- $commentListCount = count($commentList);
829
- if ($limitBefore && $commentListCount > $limitBefore) {
830
- unset($commentList[$commentListCount - 1]);
831
- $commentListCount --;
832
- $commentData["is_show_load_more"] = true;
833
- } else {
834
- $commentData["is_show_load_more"] = false;
835
- }
836
- if ($commentList) {
837
- $commentData["last_parent_id"] = $commentList[$commentListCount - 1]->comment_ID;
838
- if ($this->options->wp["threadComments"]) {
839
- $commentList = $this->getChildren($commentList, $commentListArgs);
840
- }
841
- } else {
842
- $commentData["last_parent_id"] = 0;
843
- }
844
- $this->getStickyComments(false, $commentList, $commentListArgs);
845
- $commentListArgs["page"] = 1;
846
- $commentListArgs["last_parent_id"] = $commentData["last_parent_id"];
847
- }
848
- if ($commentList && $this->options->thread_layouts["highlightVotingButtons"]) {
849
- if (!empty($commentListArgs["current_user"]->ID)) {
850
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($commentList, $commentListArgs['current_user']->ID);
851
- } else {
852
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($commentList, md5($this->helper->getRealIPAddr()));
853
- }
854
- }
855
-
856
- return apply_filters("comments_array", $commentList, $this->commentsArgs["post_id"]);
857
- }
858
-
859
- private function getChildren($commentList, &$commentListArgs) {
860
- $parentComments = [];
861
- $args = [
862
- "format" => "flat",
863
- "status" => $this->commentsArgs["status"],
864
- "orderby" => $this->commentsArgs["orderby"],
865
- "post_id" => $this->commentsArgs["post_id"],
866
  "update_comment_meta_cache" => false,
867
- "no_found_rows" => false,
868
  "update_comment_post_cache" => false,
869
- ];
870
- if (!empty($this->commentsArgs["include_unapproved"])) {
871
- $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
872
- }
873
- foreach ($commentList as $parentComment) {
874
- $parentComments[] = $parentComment;
875
- $children = $parentComment->get_children($args);
876
- if ($this->options->thread_display["isLoadOnlyParentComments"]) {
877
- $commentListArgs["wpdiscuz_child_count_" . $parentComment->comment_ID] = count($children);
878
- } else {
879
- $parentComments = array_merge($parentComments, $children);
880
- }
881
- }
882
-
883
- return $parentComments;
884
- }
885
-
886
- public function commentsTemplateQueryArgs($args) {
887
- global $post;
888
- if ($this->isWpdiscuzLoaded) {
889
- if ($this->options->wp["isPaginate"]) {
890
- $args["caller"] = "wpdiscuz";
891
- } else {
892
- $args["post__not_in"] = $post->ID;
893
- }
894
- }
895
-
896
- return $args;
897
- }
898
-
899
- public function preGetComments($queryObj) {
900
- if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz-") {
901
- $vars = $queryObj->query_vars;
902
- $vars["comment__in"] = "";
903
- $queryObj->query_vars = $vars;
904
- }
905
- }
906
-
907
- public function foundCommentsQuery($q, $qObj) {
908
- if ($this->options->wp["isPaginate"] && isset($qObj->query_vars["caller"]) && $qObj->query_vars["caller"] === "wpdiscuz" && empty($this->commentsArgs["sticky"])) {
909
- global $wpdb, $post;
910
- $where = "WHERE";
911
- if (!empty($qObj->query_vars["include_unapproved"][0])) {
912
- if (is_numeric($qObj->query_vars["include_unapproved"][0])) {
913
- $where .= " (comment_approved = '1' OR " . $wpdb->prepare("(user_id = %d AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
914
- } else {
915
- $where .= " (comment_approved = '1' OR " . $wpdb->prepare("(comment_author_email = %s AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
916
- }
917
- } else {
918
- $where .= " comment_approved = '1'";
919
- }
920
- $where .= " AND comment_post_ID = {$post->ID}";
921
- if ($this->options->wp["threadComments"]) {
922
- $where .= " AND comment_parent = 0";
923
- }
924
- $typesNotIn = apply_filters("wpdiscuz_found_comments_query", [self::WPDISCUZ_STICKY_COMMENT], $post->ID);
925
- foreach ($typesNotIn as &$type) {
926
- $type = esc_sql($type);
927
- }
928
- $where .= " AND comment_type NOT IN ('" . implode("','", $typesNotIn) . "')";
929
- $q = "SELECT COUNT(*) FROM {$wpdb->comments} $where";
930
- }
931
-
932
- return $q;
933
- }
934
-
935
- /**
936
- * add comments clauses
937
- * add new orderby clause when sort type is vote and wordpress comments order is older (ASC)
938
- */
939
- public function commentsClauses($args) {
940
- global $wpdb;
941
- if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz" && !$this->options->wp["isPaginate"]) {
942
- $orderby = "";
943
- $args["caller"] = $this->commentsArgs["caller"] = "wpdiscuz-";
944
- if ($this->options->thread_layouts["showVotingButtons"] && $this->commentsArgs["orderby"] === "by_vote") {
945
- $args["join"] .= " LEFT JOIN " . $wpdb->commentmeta . " AS `cm` ON " . $wpdb->comments . ".comment_ID = `cm`.comment_id AND (`cm`.meta_key = '" . self::META_KEY_VOTES . "')";
946
- $orderby = " IFNULL(`cm`.meta_value,0)+0 DESC, ";
947
- } else if ($this->commentsArgs["last_parent_id"] && empty($this->commentsArgs["sticky"])) {
948
- $args["where"] = $wpdb->comments . ".`comment_ID`" . ($this->commentsArgs["order"] === 'desc' ? " < " : " > ") . $this->commentsArgs["last_parent_id"] . ($args["where"] ? " AND " : "") . $args["where"];
949
- }
950
- $args["orderby"] = $orderby . $wpdb->comments . ".`{$this->options->thread_display["orderCommentsBy"]}` ";
951
- $args["orderby"] .= isset($args["order"]) ? "" : $this->commentsArgs["order"];
952
- }
953
-
954
- return $args;
955
- }
956
-
957
- public function getDefaultCommentsArgs($postId = 0) {
958
- global $user_ID;
959
- $commenter = wp_get_current_commenter();
960
- $args = [
961
- "caller" => "wpdiscuz",
962
- "post_id" => intval($postId),
963
- "last_parent_id" => 0,
964
- "orderby" => $this->options->thread_display["orderCommentsBy"],
965
- "order" => $this->options->wp["commentOrder"],
966
- // max value of php int for limit
967
- "number" => $this->options->thread_display["commentListLoadType"] == 3 ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"],
968
- "status" => !$this->options->wp["isPaginate"] && current_user_can("moderate_comments") ? "all" : "approve",
969
  "update_comment_meta_cache" => false,
970
- "no_found_rows" => false,
971
  "update_comment_post_cache" => false,
972
- "type__not_in" => [self::WPDISCUZ_STICKY_COMMENT],
973
- "wpdType" => "",
974
- "page" => 1,
975
- ];
976
- if ($this->options->wp["isPaginate"]) {
977
- $args["page"] = intval(get_query_var("cpage"));
978
- }
979
- if ($this->options->wp["threadComments"]) {
980
- $args["parent"] = 0;
981
- }
982
- if (!current_user_can("moderate_comments")) {
983
- if ($user_ID) {
984
- $args["include_unapproved"] = [$user_ID];
985
- } elseif (!empty($commenter["comment_author_email"])) {
986
- $args["include_unapproved"] = [$commenter["comment_author_email"]];
987
- }
988
- }
989
-
990
- return apply_filters("wpdiscuz_comments_args", $args);
991
- }
992
-
993
- /**
994
- * register options page for plugin
995
- */
996
- public function addPluginOptionsPage() {
997
- add_menu_page("wpDiscuz", "wpDiscuz", "manage_options", self::PAGE_WPDISCUZ, "", "dashicons-admin-comments", 26);
998
- add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Dashboard", "wpdiscuz"), "&raquo; " . esc_html__("Dashboard", "wpdiscuz"), "manage_options", self::PAGE_WPDISCUZ, [
999
- &$this->options,
1000
- "dashboard"
1001
- ]);
1002
- add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Settings", "wpdiscuz"), "&raquo; " . esc_html__("Settings", "wpdiscuz"), "manage_options", self::PAGE_SETTINGS, [
1003
- &$this->options,
1004
- "mainOptionsForm"
1005
- ]);
1006
- if (!$this->options->general["isUsePoMo"]) {
1007
- add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Phrases", "wpdiscuz"), "&raquo; " . esc_html__("Phrases", "wpdiscuz"), "manage_options", self::PAGE_PHRASES, [
1008
- &$this->options,
1009
- "phrasesOptionsForm"
1010
- ]);
1011
- }
1012
- add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Tools", "wpdiscuz"), "&raquo; " . esc_html__("Tools", "wpdiscuz"), "manage_options", self::PAGE_TOOLS, [
1013
- &$this->options,
1014
- "tools"
1015
- ]);
1016
- add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Addons", "wpdiscuz"), "&raquo; " . esc_html__("Addons", "wpdiscuz"), "manage_options", self::PAGE_ADDONS, [
1017
- &$this->options,
1018
- "addons"
1019
- ]);
1020
- }
1021
-
1022
- /**
1023
- * Scripts and styles registration on administration pages
1024
- */
1025
- public function backendFiles() {
1026
- global $typenow, $pagenow;
1027
- $wp_version = get_bloginfo("version");
1028
- $wpdiscuzWpPages = apply_filters("wpdiscuz_wp_admin_pages", ["edit-comments.php", "admin.php", "comment.php"]);
1029
- $wpdiscuzPages = apply_filters("wpdiscuz_admin_pages", [
1030
- self::PAGE_WPDISCUZ,
1031
- self::PAGE_SETTINGS,
1032
- self::PAGE_PHRASES,
1033
- self::PAGE_TOOLS,
1034
- self::PAGE_ADDONS
1035
- ]);
1036
- wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
1037
-
1038
- if ((isset($_GET["page"]) && in_array($_GET["page"], $wpdiscuzPages) && in_array($pagenow, $wpdiscuzWpPages)) || ($typenow === "wpdiscuz_form") || ($pagenow === self::PAGE_COMMENTS)) {
1039
- $nonceKey = ($key = get_home_url()) ? md5($key) : "wpdiscuz-media-uploader-nonce";
1040
- $args = [
1041
- "msgConfirmResetOptions" => esc_html__("Do you really want to reset all options?", "wpdiscuz"),
1042
- "msgConfirmResetTabOptions" => esc_html__("Do you really want to reset tab options?", "wpdiscuz"),
1043
- "msgConfirmRemoveVotes" => esc_html__("Do you really want to remove voting data?", "wpdiscuz"),
1044
- "msgConfirmResetPhrases" => esc_html__("Do you really want to reset phrases?", "wpdiscuz"),
1045
- "wmuMsgConfirmAttachmentDelete" => esc_html__("Do you really want to delet this attachment?", "wpdiscuz"),
1046
- "msgConfirmPurgeCache" => esc_html__("Do you really want to delete comments and users cache?", "wpdiscuz"),
1047
- "wmuSecurity" => wp_create_nonce($nonceKey),
1048
- ];
1049
- // Media Upload Lightbox
1050
- wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox.css"));
1051
- wp_enqueue_style("wmu-colorbox-css");
1052
- wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox.min.js"), ["jquery"]);
1053
- wp_enqueue_script("wmu-colorbox-js");
1054
-
1055
- wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-backend.css"));
1056
- wp_enqueue_style("wpdiscuz-mu-css");
1057
- wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-backend.js"), ["jquery"], $this->version, true);
1058
- wp_localize_script("wpdiscuz-mu-js", "wpdiscuzMUJsObj", $args);
1059
- wp_enqueue_script("wpdiscuz-mu-js");
1060
-
1061
- wp_enqueue_style("wpdiscuz-font-awesome");
1062
- wp_enqueue_style("wp-color-picker");
1063
- wp_enqueue_script("wp-color-picker");
1064
- wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
1065
- wp_enqueue_style("wpdiscuz-options-css");
1066
- wp_register_script("wpdiscuz-options-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-options.js"), ["jquery"], $this->version);
1067
- wp_enqueue_script("wpdiscuz-options-js");
1068
- wp_localize_script("wpdiscuz-options-js", "wpdiscuzObj", $args);
1069
- wp_enqueue_script("thickbox");
1070
- wp_register_script("wpdiscuz-contenthover", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/contenthover/jquery.contenthover.min.js"), ["jquery"], $this->version, true);
1071
- wp_enqueue_script("wpdiscuz-contenthover");
1072
-
1073
- if (isset($_GET["page"])) {
1074
- if ($_GET["page"] === self::PAGE_WPDISCUZ) {
 
1075
  wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
1076
  wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
1077
  wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
@@ -1081,689 +1082,691 @@ class WpdiscuzCore implements WpDiscuzConstants {
1081
  wp_register_script("wpdiscuz-chart-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/chart/chart.min.js"), [], $this->version, true);
1082
  wp_enqueue_script("wpdiscuz-chart-js");
1083
  } else if ($_GET["page"] === self::PAGE_PHRASES) {
1084
- wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
1085
- wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
1086
- wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
1087
- wp_enqueue_script("wpdiscuz-easy-responsive-tabs-js");
1088
- wp_register_script("wpdiscuz-jquery-cookie", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
1089
- wp_enqueue_script("wpdiscuz-jquery-cookie");
1090
  }
1091
- }
1092
- } else if ($pagenow === "comment.php") {
1093
- wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
1094
- wp_enqueue_style("wpdiscuz-options-css");
1095
- wp_enqueue_style("wpdiscuz-font-awesome");
1096
- }
1097
- if (version_compare($wp_version, "4.2.0", ">=")) {
1098
- wp_register_script("wpdiscuz-addon-notes", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-notes.js"), ["jquery"], $this->version, true);
1099
- wp_enqueue_script("wpdiscuz-addon-notes");
1100
- }
1101
-
1102
- if (!get_option(self::OPTION_SLUG_DEACTIVATION) && (strpos($this->requestUri, "/plugins.php") !== false)) {
1103
- $reasonArgs = [
1104
- "msgReasonRequired" => esc_html__("Please check one of reasons before sending feedback!", "wpdiscuz"),
1105
- "msgReasonDescRequired" => esc_html__("Please provide more information", "wpdiscuz"),
1106
- "adminUrl" => get_admin_url()
1107
- ];
1108
- wp_register_style("wpdiscuz-lity-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.css"), null, $this->version);
1109
- wp_enqueue_style("wpdiscuz-lity-css");
1110
- wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.js"), ["jquery"], $this->version);
1111
- wp_enqueue_script("wpdiscuz-lity-js");
1112
- wp_register_style("wpdiscuz-deactivation-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-deactivation.css"));
1113
- wp_enqueue_style("wpdiscuz-deactivation-css");
1114
- wp_register_script("wpdiscuz-deactivation-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-deactivation.js"), ["jquery"], $this->version);
1115
- wp_enqueue_script("wpdiscuz-deactivation-js");
1116
- wp_localize_script("wpdiscuz-deactivation-js", "deactivationObj", $reasonArgs);
1117
- }
1118
- wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", null);
1119
- wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js");
1120
- wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", "wpdObject", [
1121
- "ajaxUrl" => admin_url("admin-ajax.php"),
1122
- "shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
1123
- "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
1124
- "tooltip" => $this->options->getPhrase("wc_feedback_shortcode_tooltip"),
1125
- "popup_title" => $this->options->getPhrase("wc_feedback_popup_title"),
1126
- "leave_feebdack" => $this->options->getPhrase("wc_please_leave_feebdack"),
1127
- "no_text_selected" => esc_html__("No text is selected. Please select a part of text from post content.", "wpdiscuz")
1128
- ]);
1129
- }
1130
-
1131
- /**
1132
- * Styles and scripts registration to use on front page
1133
- */
1134
- public function frontendFiles() {
1135
- global $post;
1136
- $this->isWpdiscuzLoaded = $this->helper->isLoadWpdiscuz($post);
1137
- $suf = $this->options->general["loadMinVersion"] ? ".min" : "";
1138
- wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
1139
- wp_register_style("wpdiscuz-ratings", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings$suf.css"), null, $this->version);
1140
- wp_register_style("wpdiscuz-ratings-rtl", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings-rtl$suf.css"), null, $this->version);
1141
- if (!$this->isWpdiscuzLoaded && $this->options->rating["ratingCssOnNoneSingular"]) {
1142
- wp_enqueue_style("wpdiscuz-ratings");
1143
- if (is_rtl()) {
1144
- wp_enqueue_style("wpdiscuz-ratings-rtl");
1145
- }
1146
- }
1147
- if ($this->isWpdiscuzLoaded) {
1148
- $this->form = $this->wpdiscuzForm->getForm($post->ID);
1149
- $this->form->initFormMeta();
1150
- $this->wpdiscuzOptionsJs = $this->options->getOptionsForJs();
1151
- $this->wpdiscuzOptionsJs["version"] = $this->version;
1152
- $this->wpdiscuzOptionsJs["wc_post_id"] = $post->ID;
1153
- $this->wpdiscuzOptionsJs["isCookiesEnabled"] = has_action("set_comment_cookies");
1154
- $this->wpdiscuzOptionsJs["loadLastCommentId"] = 0;
1155
- if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
1156
- $cArgs = $this->getDefaultCommentsArgs($post->ID);
1157
- $this->wpdiscuzOptionsJs["loadLastCommentId"] = $this->dbManager->getLastCommentId($cArgs);
1158
- }
1159
- $this->wpdiscuzOptionsJs["dataFilterCallbacks"] = [];
1160
- $this->wpdiscuzOptionsJs["phraseFilters"] = [];
1161
- $this->wpdiscuzOptionsJs["scrollSize"] = 32;
1162
- $this->wpdiscuzOptionsJs = apply_filters("wpdiscuz_js_options", $this->wpdiscuzOptionsJs, $this->options);
1163
- $this->wpdiscuzOptionsJs["url"] = admin_url("admin-ajax.php");
1164
- $this->wpdiscuzOptionsJs["customAjaxUrl"] = plugins_url(WPDISCUZ_DIR_NAME . "/utils/ajax/wpdiscuz-ajax.php");
1165
- $this->wpdiscuzOptionsJs["bubbleUpdateUrl"] = rest_url("wpdiscuz/v1/update");
1166
- $this->wpdiscuzOptionsJs["restNonce"] = wp_create_nonce("wp_rest");
1167
- $loadQuill = $this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop");
1168
- $customCSSSlug = "wpdiscuz-frontend-custom-css";
1169
- $customFileName = "style-custom";
1170
- if (is_rtl()) {
1171
- $customCSSSlug = "wpdiscuz-frontend-custom-rtl-css";
1172
- $customFileName = "style-custom-rtl";
1173
- if ($this->options->thread_styles["theme"] === "wpd-minimal") {
1174
- $cssSlug = "wpdiscuz-frontend-minimal-rtl-css";
1175
- $fileName = "style-minimal-rtl";
1176
- } else {
1177
- $cssSlug = "wpdiscuz-frontend-rtl-css";
1178
- $fileName = "style-rtl";
1179
- }
1180
- } else if ($this->options->thread_styles["theme"] === "wpd-minimal") {
1181
- $cssSlug = "wpdiscuz-frontend-minimal-css";
1182
- $fileName = "style-minimal";
1183
- } else {
1184
- $cssSlug = "wpdiscuz-frontend-css";
1185
- $fileName = "style";
1186
- }
1187
- $this->helper->enqueueWpDiscuzStyle($cssSlug, $fileName, $this->version, $this->form);
1188
- $this->helper->enqueueWpDiscuzStyle($customCSSSlug, $customFileName, $this->version, $this->form);
1189
- wp_add_inline_style($cssSlug, $this->helper->initCustomCss());
1190
- $ucArgs = [
1191
- "msgConfirmDeleteComment" => esc_html($this->options->getPhrase("wc_confirm_comment_delete")),
1192
- "msgConfirmCancelSubscription" => esc_html($this->options->getPhrase("wc_confirm_cancel_subscription")),
1193
- "msgConfirmCancelFollow" => esc_html($this->options->getPhrase("wc_confirm_cancel_follow")),
1194
- "additionalTab" => (int) apply_filters("wpdiscuz_enable_content_modal", false),
1195
- ];
1196
- if ($this->options->thread_styles["enableFontAwesome"]) {
1197
- if ($this->form->hasIcon) {
1198
- wp_enqueue_style("wpdiscuz-font-awesome");
1199
- } else {
1200
- wp_register_style("wpdiscuz-fa", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fa.min.css"), null, $this->version);
1201
- wp_enqueue_style("wpdiscuz-fa");
1202
- }
1203
- }
1204
- if ($this->options->general["loadComboVersion"]) {
1205
- $combo_js = "";
1206
- $combo_css = "";
1207
- if (!$loadQuill) {
1208
- $combo_js = "-no_quill";
1209
- $combo_css = "-no_quill";
1210
- }
1211
- wp_register_style("wpdiscuz-combo-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-combo$combo_css.min.css"));
1212
- wp_enqueue_style("wpdiscuz-combo-css");
1213
- wp_register_script("wpdiscuz-combo-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-combo$combo_js.min.js"), ["jquery"], $this->version, true);
1214
- wp_enqueue_script("wpdiscuz-combo-js");
1215
- wp_localize_script("wpdiscuz-combo-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
1216
- wp_localize_script("wpdiscuz-combo-js", "wpdiscuzUCObj", $ucArgs);
1217
- if ($loadQuill) {
1218
- wp_add_inline_script("wpdiscuz-combo-js", $this->options->editorOptions(), "before");
1219
- }
1220
- } else {
1221
- wp_register_script("wpdiscuz-cookie-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
1222
- wp_enqueue_script("wpdiscuz-cookie-js");
1223
- //
1224
- if ($loadQuill) {
1225
- wp_register_style("quill-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/quill/quill.snow$suf.css"), null, "1.3.6");
1226
- wp_enqueue_style("quill-css");
1227
- wp_register_script("quill", plugins_url("/assets/third-party/quill/quill$suf.js", __FILE__), ["wpdiscuz-cookie-js"], "1.3.6", true);
1228
- wp_enqueue_script("quill");
1229
- wp_add_inline_script("quill", $this->options->editorOptions(), "before");
1230
- wp_register_script("wpd-editor", plugins_url("/assets/js/wpd-editor$suf.js", __FILE__), ["quill"], "1.3.6", true);
1231
- wp_enqueue_script("wpd-editor");
1232
- }
1233
- wp_register_script("autogrowtextarea-js", plugins_url("/assets/third-party/autogrow/jquery.autogrowtextarea.min.js", __FILE__), ["jquery"], "1.3.6", true);
1234
- wp_enqueue_script("autogrowtextarea-js");
1235
- wp_register_script("wpdiscuz-ajax-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz$suf.js"), [$loadQuill ? "wpd-editor" : "jquery"], $this->version, true);
1236
- wp_enqueue_script("wpdiscuz-ajax-js");
1237
- wp_localize_script("wpdiscuz-ajax-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
1238
- //
1239
- if ($this->options->content["wmuIsEnabled"]) {
1240
- // Media Upload Lightbox
1241
- if ($this->options->content["wmuIsLightbox"]) {
1242
- wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox$suf.css"));
1243
- wp_enqueue_style("wmu-colorbox-css");
1244
- wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox$suf.js"), ["jquery"], $this->version, true);
1245
- wp_enqueue_script("wmu-colorbox-js");
1246
- }
1247
- wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-frontend$suf.css"));
1248
- wp_enqueue_style("wpdiscuz-mu-css");
1249
- wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-frontend$suf.js"), ["wpdiscuz-ajax-js"], $this->version, true);
1250
- wp_enqueue_script("wpdiscuz-mu-js");
1251
- }
1252
- if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
1253
- wp_register_style("wpdiscuz-user-content-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-user-content$suf.css"), null, $this->version);
1254
- wp_enqueue_style("wpdiscuz-user-content-css");
1255
- wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity$suf.js"), ["jquery"], $this->version, true);
1256
- wp_enqueue_script("wpdiscuz-lity-js");
1257
- wp_register_script("wpdiscuz-user-content-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-user-content$suf.js"), ["wpdiscuz-lity-js"], $this->version, true);
1258
- wp_enqueue_script("wpdiscuz-user-content-js");
1259
- wp_localize_script("wpdiscuz-user-content-js", "wpdiscuzUCObj", $ucArgs);
1260
- }
1261
- }
1262
- if ($this->form->showRecaptcha() && apply_filters("wpdiscuz_recaptcha_site_key", $this->options->recaptcha["siteKey"]) && apply_filters("wpdiscuz_recaptcha_secret", $this->options->recaptcha["secretKey"])) {
1263
- wp_register_script("wpdiscuz-google-recaptcha", apply_filters("wpdiscuz_recaptcha_url", $this->options->recaptcha["reCaptchaUrl"]), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], "1.0.0", true);
1264
- wp_enqueue_script("wpdiscuz-google-recaptcha");
1265
- }
1266
- if (!$loadQuill && $this->options->form["enableQuickTags"]) {
1267
- wp_enqueue_script("quicktags");
1268
- wp_register_script("wpdiscuz-quicktags", plugins_url("/assets/third-party/quicktags/wpdiscuz-quictags.js", __FILE__), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], $this->version, true);
1269
- wp_enqueue_script("wpdiscuz-quicktags");
1270
- }
1271
- do_action("wpdiscuz_front_scripts", $this->options);
1272
- }
1273
- }
1274
-
1275
- public function uninstall() {
1276
- if (is_admin() && !empty($_GET["action"]) && $_GET["action"] === "wpdiscuz-uninstall") {
1277
- if (check_admin_referer("wpdiscuz_uninstall") && current_user_can("manage_options")) {
1278
- $this->dbManager->deleteCommentMeta(self::META_KEY_VOTES);
1279
- $this->dbManager->deleteCommentMeta(self::META_KEY_VOTES_SEPARATE);
1280
- $this->dbManager->deleteCommentMeta(self::META_KEY_CLOSED);
1281
- $this->dbManager->deleteCommentMeta(self::META_KEY_FEEDBACK_FORM_ID);
1282
- $this->dbManager->deleteCommentMeta(self::META_KEY_LAST_EDITED_AT);
1283
- $this->dbManager->deleteCommentMeta(self::META_KEY_LAST_EDITED_BY);
1284
-
1285
- $this->dbManager->makeStickyCommentsRegular();
1286
-
1287
- $this->dbManager->deleteStatisticCaches();
1288
- $this->dbManager->deletePostMeta(self::POSTMETA_RATING_COUNT);
1289
- $this->dbManager->deletePostMeta(self::POSTMETA_POST_RATING);
1290
- $this->dbManager->deletePostMeta(self::POSTMETA_POST_RATING_COUNT);
1291
- $this->dbManager->deleteFieldsRatingsPostMeta();
 
 
1292
  foreach (get_posts(["numberposts" => -1, "post_type" => "wpdiscuz_form"]) as $form) {
1293
- wp_delete_post($form->ID, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1294
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1295
 
1296
- $this->dbManager->deleteUserMeta(self::USERMETA_LAST_VISIT);
1297
-
1298
- delete_option(self::OPTION_SLUG_OPTIONS);
1299
- delete_option(self::OPTION_SLUG_VERSION);
1300
- delete_option(self::OPTION_SLUG_DEACTIVATION);
1301
- delete_option(self::OPTION_SLUG_SHOW_DEMO);
1302
- delete_option(self::OPTION_SLUG_HASH_KEY);
1303
- delete_option(self::OPTION_SLUG_SHOW_VOTE_REG_MESSAGE);
1304
- delete_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE);
1305
- delete_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE);
1306
- delete_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE);
1307
- delete_option(self::OPTION_SLUG_WIZARD_COMPLETED);
1308
- delete_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE);
1309
- delete_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG);
1310
- delete_option(self::OPTION_SLUG_SHOW_RATING_REBUIL_MSG);
1311
- delete_option("wpdiscuz_form_content_type_rel");
1312
- delete_option("wpdiscuz_form_post_rel");
1313
-
1314
- if (!class_exists("WP_Filesystem_Direct")) {
1315
- require_once ABSPATH . "wp-admin/includes/class-wp-filesystem-base.php";
1316
- require_once ABSPATH . "wp-admin/includes/class-wp-filesystem-direct.php";
1317
- }
1318
- $fs = new WP_Filesystem_Direct([]);
1319
- $path = wp_upload_dir();
1320
- $fs->rmdir($path["basedir"] . self::WPDISCUZ_CACHE_DIR, true);
1321
-
1322
- $this->dbManager->dropTables();
1323
-
1324
- deactivate_plugins(plugin_basename(__FILE__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1325
  }
1326
- wp_safe_redirect(admin_url("plugins.php"));
1327
- exit();
1328
- }
1329
- }
1330
-
1331
- public function pluginNewVersion() {
1332
- $pluginData = get_plugin_data(__FILE__);
1333
- if (version_compare($pluginData["Version"], $this->version, ">")) {
1334
- $this->dbManager->dbCreateTables();
1335
- $this->wpdiscuzForm->createDefaultForm($this->version);
1336
- $options = $this->changeOldOptions(get_option(self::OPTION_SLUG_OPTIONS), $pluginData);
1337
- if ($this->version === "5.3.2") {
1338
- $this->mergeOptions($options);
1339
- } else {
1340
- $this->addNewOptions($options);
1341
- }
1342
- $this->addNewPhrases();
1343
- update_option(self::OPTION_SLUG_VERSION, $pluginData["Version"]);
1344
-
1345
- if (version_compare($this->version, "2.1.2", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1346
- $this->dbManager->alterPhrasesTable();
1347
- }
1348
-
1349
- if (version_compare($this->version, "2.1.7", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1350
- $this->dbManager->alterVotingTable();
1351
- }
1352
-
1353
- if (version_compare($this->version, "5.0.5", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1354
- $this->dbManager->alterNotificationTable();
1355
- }
1356
-
1357
- if (version_compare($this->version, "5.1.2", "<=")) {
1358
- $this->dbManager->deleteOldStatisticCaches();
1359
- }
1360
-
1361
- if (version_compare($this->version, "7.0.0", "<")) {
1362
- $this->deactivateAddons();
1363
- if (version_compare($this->version, "1.0.0", "!=") && version_compare($this->version, "7.0.0-beta-1", "<")) {
1364
- $this->dbManager->alterVotingTableForDateAndPostId();
1365
- $this->options->replaceOldOptions($options);
1366
- }
1367
- $this->setRecaptchaOptions($options);
1368
- $showVoteRegenerate = intval($this->dbManager->showVoteRegenerate());
1369
- add_option(self::OPTION_SLUG_SHOW_VOTE_REG_MESSAGE, ($showVoteRegenerate ? "1" : "0"), "", "no");
1370
- $showClosedRegenerate = intval($this->dbManager->showClosedRegenerate());
1371
- add_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE, ($showClosedRegenerate ? "1" : "0"), "", "no");
1372
- $showVoteDataRegenerate = intval($this->dbManager->showVoteDataRegenerate());
1373
- add_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE, ($showVoteDataRegenerate ? "1" : "0"), "", "no");
1374
- add_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE, ($this->dbManager->usersHaveComments() ? "1" : "0"), "", "no");
1375
- add_option(self::OPTION_SLUG_WIZARD_COMPLETED, "0", "", "no");
1376
- add_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE, ($this->version === "1.0.0" ? "0" : "1"), "", "no");
1377
- $this->removeOldFiles();
1378
- $this->dbManager->deleteStatisticCaches();
1379
- if (($advancedNocaptcha = get_option("anr_admin_options")) && !empty($advancedNocaptcha["enabled_forms"]) && ($key = array_search("comment", $advancedNocaptcha["enabled_forms"]))) {
1380
- unset($advancedNocaptcha["enabled_forms"][$key]);
1381
- update_option("anr_admin_options", $advancedNocaptcha);
1382
- }
1383
- if (($invisibleRecaptcha = get_option("ic-wordpress-settings")) && !empty($invisibleRecaptcha["CF"])) {
1384
- unset($invisibleRecaptcha["CF"]);
1385
- update_option("ic-wordpress-settings", $invisibleRecaptcha);
1386
- }
1387
- }
1388
- if (version_compare($this->version, "7.0.3", "<") && version_compare($this->version, "1.0.0", "!=")) {
1389
- $this->dbManager->alterSubscriptionTable();
1390
- }
1391
- if (version_compare($this->version, "7.1.4", "<") && version_compare($this->version, "1.0.0", "!=")) {
1392
- $showRatingRebuildMsg = intval($this->dbManager->showRatingRebuildMsg());
1393
- add_option(self::OPTION_SLUG_SHOW_RATING_REBUIL_MSG, ($showRatingRebuildMsg ? "1" : "0"), "", "no");
1394
- }
1395
- if (version_compare($this->version, "7.3.0", "<") && version_compare($this->version, "1.0.0", "!=")) {
1396
- wp_clear_scheduled_hook("wpdiscuz_gravatars_cache_add");
1397
- wp_clear_scheduled_hook("wpdiscuz_gravatars_cache_delete");
1398
- $this->cache->deleteGravatarsFolder();
1399
- $this->dbManager->deleteGravatarsTable();
1400
- }
1401
- do_action("wpdiscuz_clean_all_caches", $pluginData["Version"], $this->version);
1402
- }
1403
- do_action("wpdiscuz_check_version");
1404
- }
1405
-
1406
- /**
1407
- * remove old captcha files
1408
- */
1409
- private function removeOldFiles() {
1410
- $wpUploadsDir = wp_upload_dir();
1411
- $captchaDir = $wpUploadsDir["basedir"] . "/wpdiscuz/captcha/";
1412
- if (file_exists($captchaDir)) {
1413
- $files = function_exists("scandir") ? scandir($captchaDir) : false;
1414
- if ($files && is_array($files)) {
1415
- foreach ($files as $file) {
1416
- if ($file !== "." && $file !== "..") {
1417
- $fileName = $captchaDir . $file;
1418
- if (is_file($fileName)) {
1419
- @unlink($fileName);
1420
- } else {
1421
- @rmdir($fileName);
1422
- }
1423
- }
1424
- }
1425
- }
1426
- @rmdir($captchaDir);
1427
- }
1428
- }
1429
-
1430
- private function deactivateAddons() {
1431
- $plugins = [];
1432
  if (is_plugin_active("wpdiscuz-buddypress-integration/wpDiscuzBPIntegration.php")) {
1433
  $plugins[] = "wpdiscuz-buddypress-integration/wpDiscuzBPIntegration.php";
1434
  }
1435
- if (is_plugin_active("wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php")) {
1436
- $plugins[] = "wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php";
1437
- }
1438
- if (is_plugin_active("wpdiscuz-advanced-likers/class.WpdiscuzVoters.php")) {
1439
- $plugins[] = "wpdiscuz-advanced-likers/class.WpdiscuzVoters.php";
1440
- }
1441
- if (is_plugin_active("wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php")) {
1442
- $plugins[] = "wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php";
1443
- }
1444
- if (is_plugin_active("wpdiscuz-comment-search/wpDiscuzCommentSearch.php")) {
1445
- $plugins[] = "wpdiscuz-comment-search/wpDiscuzCommentSearch.php";
1446
- }
1447
- if (is_plugin_active("wpdiscuz-comment-translation/wpdiscuz-translate.php")) {
1448
- $plugins[] = "wpdiscuz-comment-translation/wpdiscuz-translate.php";
1449
- }
1450
- if (is_plugin_active("wpdiscuz-emoticons/wpDiscuzSmile.php")) {
1451
- $plugins[] = "wpdiscuz-emoticons/wpDiscuzSmile.php";
1452
- }
1453
- if (is_plugin_active("wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php")) {
1454
- $plugins[] = "wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php";
1455
- }
1456
- if (is_plugin_active("wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php")) {
1457
- $plugins[] = "wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php";
1458
- }
1459
- if (is_plugin_active("wpdiscuz-mycred/wpdiscuz-mc.php")) {
1460
- $plugins[] = "wpdiscuz-mycred/wpdiscuz-mc.php";
1461
- }
1462
- if (is_plugin_active("wpdiscuz-online-users/wpdiscuz-ou.php")) {
1463
- $plugins[] = "wpdiscuz-online-users/wpdiscuz-ou.php";
1464
- }
1465
- if (is_plugin_active("wpdiscuz-recaptcha/wpDiscuzReCaptcha.php")) {
1466
- $plugins[] = "wpdiscuz-recaptcha/wpDiscuzReCaptcha.php";
1467
- }
1468
- if (is_plugin_active("wpdiscuz-report-flagging/wpDiscuzFlagComment.php")) {
1469
- $plugins[] = "wpdiscuz-report-flagging/wpDiscuzFlagComment.php";
1470
- }
1471
- if (is_plugin_active("wpdiscuz-subscribe-manager/wpdSubscribeManager.php")) {
1472
- $plugins[] = "wpdiscuz-subscribe-manager/wpdSubscribeManager.php";
1473
- }
1474
- if (is_plugin_active("wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php")) {
1475
- $plugins[] = "wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php";
1476
- }
1477
- if (is_plugin_active("wpdiscuz-widgets/wpDiscuzWidgets.php")) {
1478
- $plugins[] = "wpdiscuz-widgets/wpDiscuzWidgets.php";
1479
- }
1480
- if ($plugins) {
1481
- deactivate_plugins($plugins);
1482
- add_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG, "1", "", "no");
1483
- }
1484
- }
1485
-
1486
- /**
1487
- * set recaptcha options
1488
- */
1489
- private function setRecaptchaOptions($options) {
1490
- if (!$options[self::TAB_RECAPTCHA]["siteKey"] && ($recaptchaSettings = get_option("wpdiscuz_recaptcha"))) {
1491
- $options[self::TAB_RECAPTCHA]["siteKey"] = $recaptchaSettings["site_key"];
1492
- $options[self::TAB_RECAPTCHA]["secretKey"] = $recaptchaSettings["secret_key"];
1493
- $options[self::TAB_RECAPTCHA]["theme"] = $recaptchaSettings["theme"];
1494
- $options[self::TAB_RECAPTCHA]["lang"] = $recaptchaSettings["lang"];
1495
- $options[self::TAB_RECAPTCHA]["showForGuests"] = 1;
1496
- $options[self::TAB_RECAPTCHA]["requestMethod"] = $recaptchaSettings["request_method"];
1497
- $options[self::TAB_RECAPTCHA]["isShowOnSubscribeForm"] = $recaptchaSettings["isShowOnSubscribeForm"] === "on" ? 1 : 0;
1498
- $this->options->initOptions($options);
1499
- $this->options->updateOptions();
1500
- }
1501
- }
1502
-
1503
- /**
1504
- * merge old and new options
1505
- */
1506
- private function addNewOptions(&$options) {
1507
- $options = array_merge($this->options->getDefaultOptions(), $options);
1508
- $this->options->initOptions($options);
1509
- $this->options->updateOptions();
1510
- }
1511
-
1512
- /**
1513
- * merge old and new options recursively
1514
- */
1515
- private function mergeOptions(&$options) {
1516
- $newOptions = [];
1517
- $defaults = $this->options->getDefaultOptions();
1518
- foreach ($options as $key => $value) {
1519
- $newOptions[$key] = array_merge($defaults[$key], $value);
1520
- }
1521
- $options = $newOptions;
1522
- $this->options->initOptions($options);
1523
- $this->options->updateOptions();
1524
- }
1525
-
1526
- /**
1527
- * merge old and new phrases
1528
- */
1529
- private function addNewPhrases() {
1530
- if ($this->dbManager->isPhraseExists("wc_be_the_first_text")) {
1531
- $wc_saved_phrases = $this->dbManager->getPhrases();
1532
- $this->options->initPhrases();
1533
- $wc_phrases = $this->options->phrases;
1534
- $wc_new_phrases = array_merge($wc_phrases, $wc_saved_phrases);
1535
- $this->dbManager->updatePhrases($wc_new_phrases);
1536
- }
1537
- }
1538
-
1539
- /**
1540
- * change old options if needed
1541
- */
1542
- private function changeOldOptions($options, $pluginData) {
1543
- $oldOptions = maybe_unserialize($options);
1544
- if (isset($oldOptions["wc_comment_list_order"])) {
1545
- update_option("comment_order", $oldOptions["wc_comment_list_order"]);
1546
- }
1547
- if (isset($oldOptions["wc_comment_count"])) {
1548
- update_option("comments_per_page", $oldOptions["wc_comment_count"]);
1549
- }
1550
- if (isset($oldOptions["wc_load_all_comments"])) {
1551
- $this->options->commentListLoadType = 1;
1552
- }
1553
- if (isset($this->options->disableFontAwesome) && $this->options->disableFontAwesome && $pluginData["Version"] === "5.0.4") {
1554
- $this->options->disableFontAwesome = 0;
1555
- $oldOptions["disableFontAwesome"] = 0;
1556
- }
1557
-
1558
- if (version_compare($this->version, "5.2.1", "<=")) {
1559
- $oldOptions["isNativeAjaxEnabled"] = 1;
1560
- }
1561
- if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.2", "<")) {
1562
- $oldOptions[self::TAB_RATING]["enablePostRatingSchema"] = 0;
1563
- }
1564
- if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.4", "<")) {
1565
- $newMimeTypes = [];
1566
- foreach ($oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] as $exts => $type) {
1567
- foreach (explode('|', $exts) as $ext) {
1568
- $newMimeTypes[$ext] = $type;
1569
- }
1570
- }
1571
- $oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] = $newMimeTypes;
1572
- }
1573
-
1574
- return $oldOptions;
1575
- }
1576
-
1577
- // Add settings link on plugin page
1578
- public function addPluginSettingsLink($links) {
1579
- $links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)) . "'>" . esc_html__("Settings", "wpdiscuz") . "</a>";
1580
- $links[] = "<a href='" . esc_url_raw(wp_nonce_url(admin_url("plugins.php?action=wpdiscuz-uninstall"), "wpdiscuz_uninstall")) . "' style='color:#b32d2e;' onclick='return confirm(\"" . __("IMPORTANT! Uninstall is not a simple deactivation action. This action will permanently remove all data added by wpDiscuz (comment subscriptions, attachments, like/dislikes, and all other data that do not exist in the native comment system...) from database. Please backup database before this action. If you are sure that you want to delete all wpDiscuz data please confirm. If not, just cancel it, then you can deactivate this plugin.", "wpdiscuz") . "\")'>" . esc_html__("Uninstall", "wpdiscuz") . "</a>";
1581
- return $links;
1582
- }
1583
-
1584
- public function initCurrentPostType() {
1585
- global $post;
1586
- if ($this->isWpdiscuzLoaded) {
1587
- $this->form = $this->wpdiscuzForm->getForm($post->ID);
1588
- add_filter("comments_template", [&$this, "addCommentForm"], 9999999);
1589
- }
1590
- }
1591
-
1592
- public function addContentModal() {
1593
- echo "<a href='javascript:void(0);' id='wpdUserContentInfoAnchor' style='display:none;' rel='#wpdUserContentInfo' data-wpd-lity>wpDiscuz</a>";
1594
- echo "<div id='wpdUserContentInfo' style='overflow:auto;background:#FDFDF6;padding:20px;width:600px;max-width:100%;border-radius:6px;' class='lity-hide'></div>";
1595
- }
1596
-
1597
- public function saveLastVisit($post) {
1598
- $currentUser = WpdiscuzHelper::getCurrentUser();
1599
- if (!empty($currentUser->ID)) {
1600
- $lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true);
1601
- $lastVisit = is_array($lastVisit) ? $lastVisit : [];
1602
- $lastVisit[$post->ID] = current_time("timestamp");
1603
- update_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, $lastVisit);
1604
- }
1605
- }
1606
-
1607
- public function addCommentForm() {
1608
- return $this->helper->getCommentFormPath($this->form->getTheme());
1609
- }
1610
-
1611
- public function getCommentListArgs($postId) {
1612
- $post = get_post($postId);
1613
- $postsAuthors = $post->comment_count && $this->options->login["enableProfileURLs"] ? $this->dbManager->getPostsAuthors() : [];
1614
- $voteSvgs = [
1615
- "fa-plus|fa-minus" => [
1616
- "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='plus' class='svg-inline--fa fa-plus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
1617
- "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='minus' class='svg-inline--fa fa-minus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
1618
- ],
1619
- "fa-chevron-up|fa-chevron-down" => [
1620
- "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-up' class='svg-inline--fa fa-chevron-up fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z'></path></svg>",
1621
- "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-down' class='svg-inline--fa fa-chevron-down fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z'></path></svg>",
1622
- ],
1623
- "fa-thumbs-up|fa-thumbs-down" => [
1624
- "<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0V0z'/><path d='M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z'/></svg>",
1625
- "<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0z'/><path d='M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z'/></svg>",
1626
- ],
1627
- "fa-smile|fa-frown" => [
1628
- "<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='smile' class='svg-inline--fa fa-smile fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z'></path></svg>",
1629
- "<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='frown' class='svg-inline--fa fa-frown fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160-64c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-80 128c-40.2 0-78 17.7-103.8 48.6-8.5 10.2-7.1 25.3 3.1 33.8 10.2 8.4 25.3 7.1 33.8-3.1 16.6-19.9 41-31.4 66.9-31.4s50.3 11.4 66.9 31.4c8.1 9.7 23.1 11.9 33.8 3.1 10.2-8.5 11.5-23.6 3.1-33.8C326 321.7 288.2 304 248 304z'></path></svg>",
1630
- ],
1631
- ];
1632
- $currentUser = WpdiscuzHelper::getCurrentUser();
1633
- $currentUserEmail = "";
1634
- $isUserLoggedIn = false;
1635
- if (!empty($currentUser->ID)) {
1636
- $currentUserEmail = $currentUser->user_email;
1637
- $isUserLoggedIn = true;
1638
- } else if (!empty($_COOKIE["comment_author_email_" . COOKIEHASH])) {
1639
- $currentUserEmail = urldecode(trim($_COOKIE["comment_author_email_" . COOKIEHASH]));
1640
- }
1641
- $this->form = $this->wpdiscuzForm->getForm($postId);
1642
- $high_level_user = current_user_can("moderate_comments");
1643
- $can_stick_or_close = $post->post_author == $currentUser->ID;
1644
- $post_permalink = get_permalink($postId);
1645
- $theme = $this->form->getTheme();
1646
- $layout = $this->form->getLayout();
1647
- $replyForWoo = apply_filters("wpdiscuz_product_review_replies", true, $postId);
1648
- $isMobile = wp_is_mobile();
1649
- include_once $this->helper->getWalkerPath($theme);
1650
- $args = [
1651
- "style" => "div",
1652
- "echo" => false,
1653
- "isSingle" => false,
1654
- "reverse_top_level" => false,
1655
- "post_id" => $postId,
1656
- "reverse_children" => !$this->options->thread_display["reverseChildren"],
1657
- "post_author" => $post->post_author,
1658
- "posts_authors" => $postsAuthors,
1659
- "voting_icons" => $voteSvgs[$this->options->thread_layouts["votingButtonsIcon"]],
1660
- "high_level_user" => $high_level_user,
1661
- "avatar_trackback" => apply_filters("wpdiscuz_avatar_trackback", plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/trackback.png")),
1662
- "wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 64),
1663
- "can_stick_or_close" => $can_stick_or_close,
1664
- "user_follows" => $this->dbManager->getUserFollows($currentUserEmail),
1665
- "current_user" => $currentUser,
1666
- "current_user_email" => $currentUserEmail,
1667
- "is_share_enabled" => $this->options->isShareEnabled(),
1668
- "post_permalink" => $post_permalink,
1669
- "can_user_reply" => comments_open($post->ID) && $this->options->wp["threadComments"] && (($this->form ? $this->form->isUserCanComment($currentUser, $postId) : true) || $high_level_user) && !(class_exists("WooCommerce") && get_post_type($post) === "product" && !$replyForWoo),
1670
- "can_user_follow" => $this->options->subscription["isFollowActive"] && $isUserLoggedIn && !empty($currentUserEmail) && $this->helper->isUserCanFollowOrSubscribe($currentUserEmail),
1671
- "can_user_vote" => $currentUser->ID || $this->options->thread_layouts["isGuestCanVote"],
1672
- "wpd_stick_btn" => $this->options->moderation["enableStickButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_stick_btn wpd-cta-button'>%s</span>" : "",
1673
- "wpd_close_btn" => $this->options->moderation["enableCloseButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_close_btn wpd-cta-button'>%s</span>" : "",
1674
- "is_wpdiscuz_comment" => true,
1675
- "share_buttons" => "",
1676
- "feedback_content_words_count" => apply_filters("wpdiscuz_feedback_content_words_count", 20),
1677
- "user_votes" => [],
1678
- "last_visit" => $this->options->thread_display["highlightUnreadComments"] && ($lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true)) && !empty($lastVisit[$postId]) ? $lastVisit[$postId] : "",
1679
- "site_url" => get_site_url(),
1680
- "layout" => $layout,
1681
- "components" => $this->helper->getComponents($theme, $layout),
1682
- "follow_tooltip_position" => $layout ? (!is_rtl() ? ($isMobile ? 'left' : 'right') : ($isMobile ? 'right' : 'left')) : "top",
1683
- "walker" => new WpdiscuzWalker($this->helper, $this->helperOptimization, $this->dbManager, $this->options, $this->cache),
1684
- "commentsArgs" => $this->commentsArgs,
1685
- ];
1686
- if ($this->options->social["enableFbShare"] && $this->options->social["fbAppID"]) {
1687
- $args["share_buttons"] .= "<span class='wc_fb'><i class='fab fa-facebook-f wpf-cta' aria-hidden='true' title='" . esc_attr($this->options->getPhrase("wc_share_facebook")) . "'></i></span>";
1688
- }
1689
- if ($this->options->social["enableVkShare"]) {
1690
- $args["share_buttons"] .= "<a class='wc_vk' rel='noreferrer' target='_blank' href='https://vk.com/share.php?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->getPhrase("wc_share_vk")) . "'><i class='fab fa-vk wpf-cta' aria-hidden='true'></i></a>";
1691
- }
1692
- if ($this->options->social["enableOkShare"]) {
1693
- $args["share_buttons"] .= "<a class='wc_ok' rel='noreferrer' target='_blank' href='https://connect.ok.ru/offer?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->getPhrase("wc_share_ok")) . "'><i class='fab fa-odnoklassniki wpf-cta' aria-hidden='true'></i></a>";
1694
- }
1695
- if ($this->options->social["enableWhatsappShare"]) {
1696
- $args["whatsapp_url"] = $isMobile ? "https://api.whatsapp.com" : "https://web.whatsapp.com";
1697
- }
1698
- return apply_filters("wpdiscuz_comment_list_args", $args);
1699
- }
1700
-
1701
- public function addNewRoles() {
1702
- global $wp_roles;
1703
- $roles = apply_filters("editable_roles", $wp_roles->roles);
1704
- $newBlogRoles = [];
1705
- $newBlogRoleLabels = [];
1706
- $newRolePhrases = [];
1707
- foreach ($roles as $roleName => $roleInfo) {
1708
- $newBlogRoles[$roleName] = isset($this->options->labels["blogRoles"][$roleName]) ? $this->options->labels["blogRoles"][$roleName] : "#00B38F";
1709
- if ($roleName === "administrator") {
1710
- $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1711
- $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
1712
- } elseif ($roleName === "post_author") {
1713
- $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1714
- $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
1715
- } elseif ($roleName === "editor") {
1716
- $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1717
- $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
1718
- } else {
1719
- $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 0;
1720
- $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
1721
- }
1722
- }
1723
- $newBlogRoles["post_author"] = isset($this->options->labels["blogRoles"]["post_author"]) ? $this->options->labels["blogRoles"]["post_author"] : "#00B38F";
1724
- $newBlogRoleLabels["post_author"] = isset($this->options->labels["blogRoleLabels"]["post_author"]) ? $this->options->labels["blogRoleLabels"]["post_author"] : 1;
1725
- $newBlogRoles["guest"] = isset($this->options->labels["blogRoles"]["guest"]) ? $this->options->labels["blogRoles"]["guest"] : "#00B38F";
1726
- $newBlogRoleLabels["guest"] = isset($this->options->labels["blogRoleLabels"]["guest"]) ? $this->options->labels["blogRoleLabels"]["guest"] : 0;
1727
- $newRolePhrases["wc_blog_role_post_author"] = isset($this->options->phrases["wc_blog_role_post_author"]) ? $this->options->phrases["wc_blog_role_post_author"] : esc_html__("Author", "wpdiscuz");
1728
- $newRolePhrases["wc_blog_role_guest"] = isset($this->options->phrases["wc_blog_role_guest"]) ? $this->options->phrases["wc_blog_role_guest"] : esc_html__("Guest", "wpdiscuz");
1729
- foreach ($this->options->phrases as $key => $value) {
1730
- if (strpos("wc_blog_role_", $key) === 0) {
1731
- unset($this->options->phrases[$key]);
1732
- }
1733
- }
1734
- foreach ($newRolePhrases as $key => $value) {
1735
- $this->options->phrases[$key] = $value;
1736
- }
1737
- $this->options->labels["blogRoles"] = $newBlogRoles;
1738
- $this->options->labels["blogRoleLabels"] = $newBlogRoleLabels;
1739
- }
1740
-
1741
- public function showReplies() {
1742
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1743
- $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
1744
- if ($postId) {
1745
- $this->isWpdiscuzLoaded = true;
1746
- $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1747
- $commentListArgs = $this->getCommentListArgs($postId);
1748
- if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1749
- $this->commentsArgs["parent"] = $commentId;
1750
- $this->commentsArgs["number"] = null;
1751
- $comment = get_comment($commentId);
1752
- $args = [
1753
- "format" => "flat",
1754
- "status" => $this->commentsArgs["status"],
1755
- "orderby" => $this->commentsArgs["orderby"],
1756
- "post_id" => $this->commentsArgs["post_id"],
1757
- "update_comment_meta_cache" => false,
1758
- "no_found_rows" => false,
1759
- "update_comment_post_cache" => false,
1760
  ];
1761
  if (!empty($this->commentsArgs["include_unapproved"])) {
1762
  $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1763
  }
1764
- $children = $comment->get_children($args);
1765
  $commentListArgs["wpdiscuz_child_count_" . $comment->comment_ID] = count($children);
1766
- $comments = array_merge([$comment], $children);
1767
  if ($comments) {
1768
  $response = [];
1769
  if ($this->options->thread_layouts["highlightVotingButtons"]) {
@@ -1773,243 +1776,243 @@ class WpdiscuzCore implements WpDiscuzConstants {
1773
  $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1774
  }
1775
  }
1776
- $response["comment_list"] = wp_list_comments($commentListArgs, $comments);
1777
  $response["callbackFunctions"] = [];
1778
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1779
  wp_send_json_success($response);
1780
  }
1781
- }
1782
- }
1783
- }
1784
-
1785
- public function mostReactedComment() {
1786
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1787
- if ($postId) {
1788
- $this->isWpdiscuzLoaded = true;
1789
- $commentListArgs = $this->getCommentListArgs($postId);
1790
  if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1791
- $commentId = $this->dbManager->getMostReactedCommentId($postId);
1792
- $comment = get_comment($commentId);
1793
- if ($comment && $comment->comment_post_ID == $postId) {
1794
- $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1795
- $commentStatusIn = ["1"];
1796
- if ($this->commentsArgs["status"] === "all") {
1797
- $commentStatusIn[] = "0";
1798
- }
1799
- $args = [
1800
- "format" => "flat",
1801
- "status" => $this->commentsArgs["status"],
1802
- "orderby" => $this->commentsArgs["orderby"],
1803
- "post_id" => $this->commentsArgs["post_id"],
1804
- ];
1805
- $includeUnapproved = null;
1806
- if (!empty($this->commentsArgs["include_unapproved"])) {
1807
- $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1808
- $includeUnapproved = $this->commentsArgs["include_unapproved"];
1809
- }
1810
- $parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved);
1811
- $tree = $parentComment->get_children($args);
1812
- $comments = array_merge([$parentComment], $tree);
1813
- $commentListArgs["isSingle"] = true;
1814
- $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
1815
- $response = [];
1816
- if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
1817
- if (!empty($commentListArgs['current_user']->ID)) {
1818
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
1819
- } else {
1820
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1821
- }
1822
- }
1823
- $response["message"] = wp_list_comments($commentListArgs, $comments);
1824
- $response["commentId"] = $commentId;
1825
- $response["parentCommentID"] = $parentComment->comment_ID;
1826
- $response["callbackFunctions"] = [];
1827
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1828
- wp_send_json_success($response);
1829
- }
1830
- }
1831
- }
1832
- }
1833
-
1834
- public function hottestThread() {
1835
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1836
- if ($postId) {
1837
- $this->isWpdiscuzLoaded = true;
1838
- $commentListArgs = $this->getCommentListArgs($postId);
1839
- if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1840
- $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1841
- $commentStatusIn = ["1"];
1842
- if ($this->commentsArgs["status"] === "all") {
1843
- $commentStatusIn[] = "0";
1844
- }
1845
- $parentCommentIds = $this->dbManager->getParentCommentsHavingReplies($postId, $commentStatusIn);
1846
- $childCount = 0;
1847
- $hottestCommentId = 0;
1848
- $hottestChildren = [];
1849
- foreach ($parentCommentIds as $parentCommentId) {
1850
- $children = $this->dbManager->getHottestTree($parentCommentId);
1851
- $tmpCount = count($children);
1852
- if ($childCount < $tmpCount) {
1853
- $childCount = $tmpCount;
1854
- $hottestCommentId = $parentCommentId;
1855
- $hottestChildren = $children;
1856
- }
1857
- }
1858
-
1859
- if ($hottestCommentId && $hottestChildren) {
1860
- $args = [
1861
- "format" => "flat",
1862
- "status" => $this->commentsArgs["status"],
1863
- "orderby" => $this->commentsArgs["orderby"],
1864
- "post_id" => $this->commentsArgs["post_id"],
1865
- ];
1866
- $includeUnapproved = null;
1867
- if (!empty($this->commentsArgs["include_unapproved"])) {
1868
- $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1869
- $includeUnapproved = $this->commentsArgs["include_unapproved"];
1870
- }
1871
- $parentComment = $this->helperOptimization->getCommentRoot($hottestCommentId, $commentStatusIn, $includeUnapproved);
1872
- $tree = $parentComment->get_children($args);
1873
- $comments = array_merge([$parentComment], $tree);
1874
- $commentListArgs["isSingle"] = true;
1875
- $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
1876
- $response = [];
1877
- if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
1878
- if (!empty($commentListArgs['current_user']->ID)) {
1879
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
1880
- } else {
1881
- $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1882
- }
1883
- }
1884
- $response["message"] = wp_list_comments($commentListArgs, $comments);
1885
- $response["commentId"] = $hottestCommentId;
1886
- $response["callbackFunctions"] = [];
1887
- $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1888
- wp_send_json_success($response);
1889
- }
1890
- }
1891
- }
1892
- }
1893
-
1894
- private function getStickyComments($isPaginate, &$commentList, &$commentListArgs) {
1895
- if (!empty($this->commentsArgs["first_load"])) {
1896
- $this->commentsArgs["sticky"] = 1;
1897
- $this->commentsArgs["number"] = null;
1898
- if ($isPaginate) {
1899
- $this->commentsArgs["number"] = "";
1900
- $this->commentsArgs["offset"] = "";
1901
- $this->commentsArgs["parent"] = "";
1902
- }
1903
- $this->commentsArgs["caller"] = "wpdiscuz";
1904
- $this->commentsArgs["type__not_in"] = [];
1905
- $this->commentsArgs["type__in"] = [self::WPDISCUZ_STICKY_COMMENT];
1906
- $stickyComments = get_comments($this->commentsArgs);
1907
- if ($stickyComments) {
1908
- if ($this->options->wp["threadComments"]) {
1909
- $stickyComments = $this->getChildren($stickyComments, $commentListArgs);
1910
- }
1911
- $commentList = ($isPaginate && $this->options->wp["commentOrder"] === "desc") ? array_merge($commentList, $stickyComments) : array_merge($stickyComments, $commentList);
1912
- }
1913
- }
1914
- }
1915
-
1916
- public function footerContents() {
1917
- if ($this->isWpdiscuzLoaded) {
1918
- global $post;
1919
- if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
1920
- $this->addContentModal();
1921
- }
1922
- if ($this->options->live["enableBubble"]) {
1923
- $this->addBubble($post);
1924
- }
1925
- if ($this->options->thread_display["highlightUnreadComments"]) {
1926
- $this->saveLastVisit($post);
1927
- }
1928
- echo "<div id='wpd-editor-source-code-wrapper-bg'></div><div id='wpd-editor-source-code-wrapper'><textarea id='wpd-editor-source-code'></textarea><button id='wpd-insert-source-code'>Insert</button><input type='hidden' id='wpd-editor-uid' /></div>";
1929
- }
1930
- }
1931
-
1932
- public function addBubble($post) {
1933
- if (comments_open($post->ID)) {
1934
- echo "<div id='wpd-bubble-wrapper'>";
1935
- $commentsNumber = get_comments_number($post->ID);
1936
- echo "<span id='wpd-bubble-all-comments-count'" . ($commentsNumber ? "" : " style='display:none;'") . " title='" . esc_attr($commentsNumber) . "'>" . esc_html($this->helper->getNumber($commentsNumber)) . "</span>";
1937
- echo "<div id='wpd-bubble-count'>";
1938
- echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-count-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-count-second' d='M0 0h24v24H0z' /></svg>";
1939
- echo "<span class='wpd-new-comments-count'>0</span>";
1940
- echo "</div>";
1941
- echo "<div id='wpd-bubble'>";
1942
- echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-plus-first' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/><path class='wpd-bubble-plus-second' d='M0 0h24v24H0z' /></svg>";
1943
- echo "<div id='wpd-bubble-add-message'>" . esc_html($this->options->getPhrase("wc_bubble_invite_message")) . "<span id='wpd-bubble-add-message-close'><a href='#'>x</a></span></div>";
1944
- echo "</div>";
1945
- echo "<div id='wpd-bubble-notification'><svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-notification-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-notification-second' d='M0 0h24v24H0z' /></svg>";
1946
- if ($this->options->live["bubbleShowNewCommentMessage"]) {
1947
- echo "<div id='wpd-bubble-notification-message'>";
1948
- echo "<div id='wpd-bubble-author'>";
1949
- echo "<div>";
1950
- echo "<span id='wpd-bubble-author-avatar'></span>";
1951
- echo "<span id='wpd-bubble-author-name'></span>";
1952
- echo "<span id='wpd-bubble-comment-date'>(<span class='wpd-bubble-spans'></span>)</span>";
1953
- echo "</div>";
1954
- echo "<span id='wpd-bubble-comment-close'><a href='#'>x</a></span>";
1955
- echo "</div>";
1956
- echo "<div id='wpd-bubble-comment'>";
1957
- echo "<span id='wpd-bubble-comment-text'></span>";
1958
- echo "<span id='wpd-bubble-comment-reply-link'>| <a href='#'>Reply</a></span>";
1959
- echo "</div>";
1960
- echo "</div>";
1961
- }
1962
- echo "</div>";
1963
- echo "</div>";
1964
- }
1965
- }
1966
-
1967
- public function registerRestRoutes() {
1968
- $controller = new WpdiscuzRest($this->dbManager, $this->options, $this->helper, $this->wpdiscuzForm);
1969
- $controller->registerRoutes();
1970
- }
1971
-
1972
- public function mceButton($buttons) {
1973
- global $post;
1974
- if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1975
- array_push($buttons, "|", "wpDiscuz");
1976
- }
1977
-
1978
- return $buttons;
1979
- }
1980
-
1981
- public function mceExternalPlugin($plugin_array) {
1982
- global $post;
1983
- if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1984
- $plugin_array["wpDiscuz"] = esc_url_raw(plugins_url("assets/js/wpdiscuz-shortcode-tinymce.js", __FILE__));
1985
- }
1986
-
1987
- return $plugin_array;
1988
- }
1989
-
1990
- public function gutenbergButton() {
1991
- global $post;
1992
- if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1993
- wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-shortcode-gutenberg.js"), [
1994
- "wp-blocks",
1995
- "wp-editor",
1996
- "wp-components"
1997
- ]);
1998
- wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js");
1999
- wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", "wpdObject", [
2000
- "shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
2001
- "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
2002
- "tooltip" => $this->options->getPhrase("wc_feedback_shortcode_tooltip"),
2003
- "popup_title" => $this->options->getPhrase("wc_feedback_popup_title"),
2004
- "leave_feebdack" => $this->options->getPhrase("wc_please_leave_feebdack")
2005
- ]);
2006
- }
2007
- }
2008
-
2009
- public function feedbackDialog() {
2010
- global $post;
2011
- if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
2012
- ?>
2013
  <style type="text/css">
2014
  #TB_title {
2015
  background: #E9E9E9 !important;
@@ -2115,7 +2118,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
2115
  <div class="wpd-inline-type">
2116
  <label>
2117
  <input type="radio" name="wpd-inline-type" value="0" checked="checked"/>
2118
- <?php esc_html_e("CLOSED", "wpdiscuz") ?>
2119
  </label>
2120
  </div>
2121
  <img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-closed.png")) ?>"
@@ -2125,7 +2128,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
2125
  <div class="wpd-inline-type">
2126
  <label>
2127
  <input type="radio" name="wpd-inline-type" value="1"/>
2128
- <?php esc_html_e("OPENED", "wpdiscuz") ?>
2129
  </label>
2130
  </div>
2131
  <img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-opened.png")) ?>"
@@ -2139,77 +2142,77 @@ class WpdiscuzCore implements WpDiscuzConstants {
2139
  id="wpd-put-shortcode"><?php esc_html_e("Add Inline Feedback Button", "wpdiscuz"); ?></button>
2140
  </div>
2141
  </div>
2142
- <?php
2143
- }
2144
- }
2145
-
2146
- public function feedbackShortcode($atts, $content = "") {
2147
- global $post;
2148
- if ($this->isWpdiscuzLoaded && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && $this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $post->ID)) {
2149
- $atts = shortcode_atts([
2150
- "id" => "",
2151
- "question" => "",
2152
- "opened" => 0
2153
- ], $atts, self::WPDISCUZ_FEEDBACK_SHORTCODE);
2154
- if ($atts["id"] && $atts["question"] && ($inline_form = $this->dbManager->getFeedbackFormByUid($post->ID, $atts["id"]))) {
2155
- $content = "<div class='wpd-inline-shortcode wpd-inline-" . ($inline_form->opened && $this->form->isUserCanComment(WpdiscuzHelper::getCurrentUser(), $post->ID) ? "opened" : "closed") . "' id='wpd-inline-" . $inline_form->id . "'>" . html_entity_decode($content);
2156
- $content .= "<div class='wpd-inline-icon-wrapper'>";
2157
- $content .= "<svg class='wpd-inline-icon" . ($this->options->inline["inlineFeedbackAttractionType"] === "blink" ? " wpd-ignored" : "") . "' xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-inline-icon-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-inline-icon-second' d='M0 0h24v24H0z' /></svg>";
2158
- $args = [
2159
- "count" => true,
2160
- "meta_query" => [
2161
- [
2162
- "key" => self::META_KEY_FEEDBACK_FORM_ID,
2163
- "value" => $inline_form->id,
2164
- "compare" => "=",
2165
- ],
2166
- ],
2167
- ];
2168
- $count = get_comments($args);
2169
- $content .= "<div class='wpd-inline-icon-count" . esc_attr($count ? " wpd-has-comments" : "") . "'>" . esc_html($count) . "</div>";
2170
- $content .= "<div class='wpd-inline-form-wrapper'>";
2171
- $content .= "<div class='wpd-inline-form-question'>" . esc_html($inline_form->question);
2172
- $content .= "<span class='wpd-inline-form-close'><a href='#'>x</a></span>";
2173
- $content .= "</div>";
2174
- $content .= "</div>";
2175
- $content .= "</div>";
2176
- $content .= "</div>";
2177
- }
2178
- }
2179
-
2180
- return $content;
2181
- }
2182
-
2183
- public function addInlineComment() {
2184
- $inline_form_id = WpdiscuzHelper::sanitize(INPUT_POST, "inline_form_id", FILTER_SANITIZE_NUMBER_INT, 0);
2185
- if ($inline_form_id && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($inline_form = $this->dbManager->getFeedbackForm($inline_form_id))) {
2186
- if (wp_verify_nonce(WpdiscuzHelper::sanitize(INPUT_POST, "_wpd_inline_nonce", FILTER_SANITIZE_STRING, ""), "wpd_inline_nonce_" . $inline_form->post_id)) {
2187
- if (!comments_open($inline_form->post_id)) {
2188
- wp_die(esc_html($this->options->getPhrase("wc_commenting_is_closed")));
2189
- }
2190
- $this->isWpdiscuzLoaded = true;
2191
- $currentUser = WpdiscuzHelper::getCurrentUser();
2192
- $this->form = $this->wpdiscuzForm->getForm($inline_form->post_id);
2193
- if ($this->form->isUserCanSeeComments($currentUser, $inline_form->post_id)) {
2194
  $isAnonymous = false;
2195
  if (!empty($currentUser->ID)) {
2196
  $user_id = $currentUser->ID;
2197
- $name = $this->helper->getCurrentUserDisplayName($currentUser);
2198
- $email = $currentUser->user_email;
2199
  } else {
2200
  $user_id = 0;
2201
- $name = urldecode(trim(sanitize_text_field($_POST["wpd_inline_name"])));
2202
  if (!empty($_POST["wpd_inline_email"]) && ($email = sanitize_email(trim($_POST["wpd_inline_email"])))) {
2203
  if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
2204
  wp_send_json_error("wc_error_email_text");
2205
  }
2206
  } else {
2207
- $email = uniqid() . "@example.com";
2208
  $isAnonymous = true;
2209
  }
2210
  $email = urldecode($email);
2211
  }
2212
- $email = apply_filters("wpdiscuz_feedback_commenter_email", $email);
2213
 
2214
  $comment_content = !empty($_POST["wpd_inline_comment"]) ? stripslashes(trim($_POST["wpd_inline_comment"])) : "";
2215
  $comment_content = $this->helper->filterCommentText($comment_content);
@@ -2218,7 +2221,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
2218
  }
2219
  $commentMinLength = intval($this->options->content["commentTextMinLength"]);
2220
  $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
2221
- $contentLength = function_exists("mb_strlen") ? mb_strlen($comment_content) : strlen($comment_content);
2222
  if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
2223
  wp_send_json_error("wc_msg_input_min_length");
2224
  }
@@ -2227,27 +2230,27 @@ class WpdiscuzCore implements WpDiscuzConstants {
2227
  }
2228
 
2229
  if ($name && $email && $comment_content) {
2230
- $wc_user_agent = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
2231
- $new_commentdata = [
2232
- "user_id" => $user_id,
2233
- "comment_post_ID" => $inline_form->post_id,
2234
- "comment_parent" => 0,
2235
- "comment_author" => $name,
2236
  "comment_author_email" => $email,
2237
- "comment_author_url" => "",
2238
- "comment_content" => $comment_content,
2239
- "comment_agent" => $wc_user_agent,
2240
- "comment_type" => self::$DEFAULT_COMMENT_TYPE,
2241
  ];
2242
  $this->helper->restrictCommentingPerUser($email, 0, $inline_form->post_id);
2243
  $new_comment_id = wp_new_comment(wp_slash($new_commentdata));
2244
  add_comment_meta($new_comment_id, self::META_KEY_FEEDBACK_FORM_ID, $inline_form->id);
2245
- $args = [
2246
- "count" => true,
2247
  "meta_query" => [
2248
  [
2249
- "key" => self::META_KEY_FEEDBACK_FORM_ID,
2250
- "value" => $inline_form->id,
2251
  "compare" => "=",
2252
  ],
2253
  ],
@@ -2275,126 +2278,126 @@ class WpdiscuzCore implements WpDiscuzConstants {
2275
  if ($newComment->comment_approved === "spam" || $newComment->comment_approved === "trash") {
2276
  wp_send_json_error();
2277
  }
2278
- $response = [];
2279
- $commentListArgs = $this->getCommentListArgs($inline_form->post_id);
2280
- $response["message"] = wp_list_comments($commentListArgs, [$newComment]);
2281
- $response["newCount"] = esc_html(get_comments($args));
2282
- $response["new_comment_id"] = $new_comment_id;
2283
- $response["notification"] = esc_html($this->options->getPhrase("wc_feedback_comment_success"));
2284
- $response["allCommentsCountNew"] = get_comments_number($inline_form->post_id);
2285
  $response["allCommentsCountBeforeThreadsHtml"] = "<span class='wpdtc' title='" . esc_attr($response["allCommentsCountNew"]) . "'>" . esc_html($this->helper->getNumber($response["allCommentsCountNew"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["allCommentsCountNew"] ? $this->form->getHeaderTextSingle() : $this->form->getHeaderTextPlural()), $response["allCommentsCountNew"]));
2286
  $response["allCommentsCountBubbleHtml"] = "<span id='wpd-bubble-all-comments-count'" . ($response["allCommentsCountNew"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["allCommentsCountNew"]) . "'>" . esc_html($this->helper->getNumber($response["allCommentsCountNew"])) . "</span>";
2287
  do_action("wpdiscuz_clean_post_cache", $inline_form->post_id, "inline_comment_posted");
2288
- do_action("wpdiscuz_clean_post_cache", $inline_form->post_id, "comment_posted");
2289
- do_action("wpdiscuz_reset_comments_cache", $inline_form->post_id);
2290
  wp_send_json_success($response);
2291
  } else {
2292
  wp_send_json_error("wc_invalid_field");
2293
  }
2294
  }
2295
  }
2296
- }
2297
- wp_send_json_error("wc_msg_required_fields");
2298
- }
2299
-
2300
- public function validateRecaptcha($commentdata) {
2301
- if (!current_user_can("moderate_comments")) {
2302
- $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, "");
2303
- if (!$postId) {
2304
- global $post;
2305
- if (!empty($post->ID)) {
2306
- $postId = $post->ID;
2307
- } else if (!empty($commentdata["comment_post_ID"])) {
2308
- $postId = $commentdata["comment_post_ID"];
2309
- }
2310
- }
2311
- if ($postId && ($post = get_post($postId))) {
2312
- $form = $this->wpdiscuzForm->getForm($postId);
2313
- if ($form->getFormID()) {
2314
- $currentUser = WpdiscuzHelper::getCurrentUser();
2315
- if (empty($currentUser->ID) || (!empty($currentUser->ID) && $currentUser->ID != $post->post_author)) {
2316
- $inlineVerified = wp_verify_nonce(WpdiscuzHelper::sanitize(INPUT_POST, "_wpd_inline_nonce", FILTER_SANITIZE_STRING, ""), "wpd_inline_nonce_" . $postId);
2317
- if (!$inlineVerified) {
2318
- if (apply_filters("wpdiscuz_verify_recaptcha", true, $commentdata)) {
2319
- $typesExclude = ["pingback", "trackback"];
2320
- if (!empty($commentdata["comment_type"]) && in_array($commentdata["comment_type"], $typesExclude)) {
2321
- return $commentdata;
2322
- }
2323
- $form->initFormFields();
2324
- $form->validateDefaultCaptcha($currentUser);
2325
- }
2326
- }
2327
- }
2328
- }
2329
- }
2330
- }
2331
- return $commentdata;
2332
- }
2333
-
2334
- public function addToolbarItems($admin_bar) {
2335
- if ($this->isWpdiscuzLoaded && current_user_can("manage_options")) {
2336
  $admin_bar->add_menu([
2337
- "id" => self::PAGE_WPDISCUZ,
2338
  "title" => "wpDiscuz",
2339
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)),
2340
- "meta" => [
2341
  "title" => "wpDiscuz",
2342
- "target" => "_blank",
2343
  ],
2344
  ]);
2345
  $admin_bar->add_menu([
2346
- "id" => self::PAGE_WPDISCUZ . "-child",
2347
  "parent" => self::PAGE_WPDISCUZ,
2348
  "title" => esc_html__("Dashboard", "wpdiscuz"),
2349
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)),
2350
- "meta" => [
2351
  "title" => esc_html__("Dashboard", "wpdiscuz"),
2352
  "target" => "_blank",
2353
  ],
2354
  ]);
2355
  $admin_bar->add_menu([
2356
- "id" => self::PAGE_SETTINGS,
2357
  "parent" => self::PAGE_WPDISCUZ,
2358
  "title" => esc_html__("Settings", "wpdiscuz"),
2359
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)),
2360
- "meta" => [
2361
  "title" => esc_html__("Settings", "wpdiscuz"),
2362
  "target" => "_blank",
2363
  ],
2364
  ]);
2365
- if (!$this->options->general["isUsePoMo"]) {
2366
- $admin_bar->add_menu([
2367
- "id" => self::PAGE_PHRASES,
2368
- "parent" => self::PAGE_WPDISCUZ,
2369
- "title" => esc_html__("Phrases", "wpdiscuz"),
2370
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_PHRASES)),
2371
- "meta" => [
2372
- "title" => esc_html__("Phrases", "wpdiscuz"),
2373
- "target" => "_blank",
2374
- ],
2375
- ]);
2376
- }
2377
- $admin_bar->add_menu([
2378
- "id" => self::PAGE_TOOLS,
2379
- "parent" => self::PAGE_WPDISCUZ,
2380
- "title" => esc_html__("Tools", "wpdiscuz"),
2381
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_TOOLS)),
2382
- "meta" => [
2383
- "title" => esc_html__("Tools", "wpdiscuz"),
2384
- "target" => "_blank",
2385
- ],
2386
- ]);
2387
- $admin_bar->add_menu([
2388
- "id" => self::PAGE_ADDONS,
2389
- "parent" => self::PAGE_WPDISCUZ,
2390
- "title" => esc_html__("Addons", "wpdiscuz"),
2391
- "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_ADDONS)),
2392
- "meta" => [
2393
- "title" => esc_html__("Addons", "wpdiscuz"),
2394
- "target" => "_blank",
2395
- ],
2396
- ]);
2397
- if ($this->options->general["isCacheEnabled"]) {
2398
  $admin_bar->add_menu([
2399
  "id" => "purgeAllCaches",
2400
  "parent" => self::PAGE_WPDISCUZ,
@@ -2415,10 +2418,10 @@ class WpdiscuzCore implements WpDiscuzConstants {
2415
  "title" => esc_html__("Purge All Caches", "wpdiscuz"),
2416
  ],
2417
  ]);
2418
- }
2419
- }
2420
- }
2421
- }
2422
 
2423
  }
2424
 
2
  /*
3
  * Plugin Name: wpDiscuz
4
  * Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
5
+ * Version: 7.3.4
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
  * Plugin URI: https://wpdiscuz.com/
11
  * wpDiscuz Update: auto
12
  */
13
  if (!defined("ABSPATH")) {
14
+ exit();
15
  }
16
 
17
  define("WPDISCUZ_DIR_PATH", dirname(__FILE__));
32
 
33
  class WpdiscuzCore implements WpDiscuzConstants {
34
 
35
+ public $dbManager;
36
+ public $helper;
37
+ public $helperAjax;
38
+ public $helperEmail;
39
+ public $helperOptimization;
40
+ public $helperUpload;
41
+ public $wpdiscuzOptionsJs;
42
+ public $options;
43
+ public $commentsArgs;
44
+ private $version;
45
+ public $wpdiscuzForm;
46
+ public $form;
47
+ private $cache;
48
+ public $subscriptionData;
49
+ public $isWpdiscuzLoaded;
50
+ private $requestUri;
51
+ public static $DEFAULT_COMMENT_TYPE;
52
+ private static $_instance = null;
53
+
54
+ private function __construct() {
55
+ add_option(self::OPTION_SLUG_VERSION, "1.0.0");
56
+ $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
57
+ wp_cookie_constants();
58
+ self::$DEFAULT_COMMENT_TYPE = version_compare(get_bloginfo("version"), "5.5", ">=") ? "comment" : "";
59
+ $this->dbManager = new WpdiscuzDBManager();
60
+ $this->options = new WpdiscuzOptions($this->dbManager);
61
+ $this->wpdiscuzForm = new wpDiscuzForm($this->options, $this->version);
62
+ $this->helper = new WpdiscuzHelper($this->options, $this->dbManager, $this->wpdiscuzForm);
63
+ $this->helperEmail = new WpdiscuzHelperEmail($this->options, $this->dbManager, $this->helper);
64
+ $this->helperOptimization = new WpdiscuzHelperOptimization($this->options, $this->dbManager, $this->helperEmail, $this->helper);
65
+ $this->helperAjax = new WpdiscuzHelperAjax($this->options, $this->dbManager, $this->helper, $this->helperEmail, $this->wpdiscuzForm);
66
+ $this->helperUpload = new WpdiscuzHelperUpload($this->options, $this->dbManager, $this->wpdiscuzForm, $this->helper);
67
+ $this->cache = new WpdiscuzCache($this->options, $this->helper);
68
+ $this->requestUri = !empty($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
69
+
70
+ if ($this->options->thread_display["isLoadOnlyParentComments"]) {
71
+ add_action("wp_ajax_wpdShowReplies", [&$this, "showReplies"]);
72
+ add_action("wp_ajax_nopriv_wpdShowReplies", [&$this, "showReplies"]);
73
+ }
74
+
75
+ register_activation_hook(__FILE__, [&$this, "pluginActivation"]);
76
+
77
+ /* CRON JOBS */
78
+ register_activation_hook(__FILE__, [&$this, "registerJobs"]);
79
+ register_deactivation_hook(__FILE__, [&$this, "deregisterJobs"]);
80
+ add_filter("cron_schedules", [&$this, "setIntervals"]);
81
+ /* /CRON JOBS */
82
+ add_action("wp_insert_site", [&$this, "addNewBlog"]);
83
+ add_action("delete_blog", [&$this, "deleteBlog"]);
84
+ add_action("wp_head", [&$this, "initCurrentPostType"]);
85
+
86
+ add_action("admin_init", [&$this, "uninstall"], 1);
87
+ add_action("init", [&$this, "wpdiscuzTextDomain"]);
88
+ add_action("admin_init", [&$this, "pluginNewVersion"], 1);
89
+ add_action("admin_enqueue_scripts", [&$this, "backendFiles"], 100);
90
+ add_action("wp_enqueue_scripts", [&$this, "frontendFiles"]);
91
+ add_action("admin_menu", [&$this, "addPluginOptionsPage"], 1);
92
+
93
+ add_action("wp_ajax_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
94
+ add_action("wp_ajax_nopriv_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
95
+ add_action("wp_ajax_wpdSorting", [&$this, "sorting"]);
96
+ add_action("wp_ajax_nopriv_wpdSorting", [&$this, "sorting"]);
97
+ add_action("wp_ajax_wpdAddComment", [&$this, "addComment"]);
98
+ add_action("wp_ajax_nopriv_wpdAddComment", [&$this, "addComment"]);
99
+ add_action("wp_ajax_wpdGetSingleComment", [&$this, "getSingleComment"]);
100
+ add_action("wp_ajax_nopriv_wpdGetSingleComment", [&$this, "getSingleComment"]);
101
+ add_action("wp_ajax_wpdMostReactedComment", [&$this, "mostReactedComment"]);
102
+ add_action("wp_ajax_nopriv_wpdMostReactedComment", [&$this, "mostReactedComment"]);
103
+ add_action("wp_ajax_wpdHottestThread", [&$this, "hottestThread"]);
104
+ add_action("wp_ajax_nopriv_wpdHottestThread", [&$this, "hottestThread"]);
105
+
106
+ $plugin = plugin_basename(__FILE__);
107
+ add_filter("plugin_action_links_$plugin", [&$this, "addPluginSettingsLink"]);
108
+ add_filter("comments_clauses", [&$this, "commentsClauses"]);
109
+
110
+ add_action("wp_ajax_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
111
+ add_action("wp_ajax_nopriv_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
112
+
113
+ if ($this->options->live["commentListUpdateType"]) {
114
+ add_action("wp_ajax_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
115
+ add_action("wp_ajax_nopriv_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
116
+ }
117
+
118
+ add_action("wp_loaded", [&$this, "addNewRoles"]);
119
+ add_filter("comments_template_query_args", [&$this, "commentsTemplateQueryArgs"]);
120
+ add_action("pre_get_comments", [&$this, "preGetComments"]);
121
+ add_filter("found_comments_query", [&$this, "foundCommentsQuery"], 10, 2);
122
+
123
+ add_action("rest_api_init", [&$this, "registerRestRoutes"], 10);
124
+
125
+ if ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"]) {
126
+ add_action("wp_ajax_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
127
+ add_action("wp_ajax_nopriv_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
128
+ }
129
+
130
+ add_action("admin_footer", [&$this, "feedbackDialog"]);
131
+ add_filter("mce_buttons", [&$this, "mceButton"]);
132
+ add_filter("mce_external_plugins", [&$this, "mceExternalPlugin"]);
133
+ add_shortcode(self::WPDISCUZ_FEEDBACK_SHORTCODE, [&$this, "feedbackShortcode"]);
134
+ add_action("wp_ajax_wpdAddInlineComment", [&$this, "addInlineComment"]);
135
+ add_action("wp_ajax_nopriv_wpdAddInlineComment", [&$this, "addInlineComment"]);
136
+ add_action("wp_footer", [&$this, "footerContents"]);
137
+ add_action("enqueue_block_editor_assets", [&$this, "gutenbergButton"]);
138
+
139
+ add_filter("extra_plugin_headers", [&$this, "extraPluginHeaders"]);
140
+ add_filter("auto_update_plugin", [&$this, "shouldUpdate"], 10, 2);
141
+
142
+ add_filter("preprocess_comment", [&$this, "validateRecaptcha"], 10, 2);
143
+
144
+ add_action("admin_bar_menu", [&$this, "addToolbarItems"], 300);
145
+ }
146
+
147
+ public static function getInstance() {
148
+ if (is_null(self::$_instance)) {
149
+ self::$_instance = new self();
150
+ }
151
+
152
+ return self::$_instance;
153
+ }
154
+
155
+ public function extraPluginHeaders($headers) {
156
+ $headers[] = "wpDiscuz Update";
157
+
158
+ return $headers;
159
+ }
160
+
161
+ public function shouldUpdate($shouldUpdate, $plugin) {
162
+ if (!isset($plugin->plugin, $plugin->new_version)) {
163
+ return $shouldUpdate;
164
+ }
165
+
166
+ if ("wpdiscuz/class.WpdiscuzCore.php" !== $plugin->plugin) {
167
+ return $shouldUpdate;
168
+ }
169
+
170
+ $pluginData = get_plugin_data(__FILE__);
171
+
172
+ if (isset($pluginData["wpDiscuz Update"]) && $pluginData["wpDiscuz Update"] === "manual") {
173
+ return false;
174
+ }
175
+
176
+ return $shouldUpdate;
177
+ }
178
+
179
+ public function pluginActivation($networkwide) {
180
+ if (function_exists("is_multisite") && is_multisite() && $networkwide) {
181
+ $oldBlogID = $this->dbManager->getBlogID();
182
+ $oldSitePluginVersion = $this->version;
183
+ $blogIDs = $this->dbManager->getBlogIDs();
184
+ foreach ($blogIDs as $blogID) {
185
+ switch_to_blog($blogID);
186
+ $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
187
+ $this->activateWpDiscuz();
188
+ }
189
+ switch_to_blog($oldBlogID);
190
+ $this->version = $oldSitePluginVersion;
191
+
192
+ return;
193
+ }
194
+ $this->activateWpDiscuz();
195
+ }
196
+
197
+ public function addNewBlog($new_site) {
198
+ if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
199
+ $oldBlogID = $this->dbManager->getBlogID();
200
+ $oldSitePluginVersion = $this->version;
201
+ switch_to_blog($new_site->blogID);
202
+ $this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
203
+ $this->activateWpDiscuz();
204
+ switch_to_blog($oldBlogID);
205
+ $this->version = $oldSitePluginVersion;
206
+ }
207
+ }
208
+
209
+ public function deleteBlog($blogID) {
210
+ if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
211
+ $oldBlogID = $this->dbManager->getBlogID();
212
+ switch_to_blog($blogID);
213
+ $this->dbManager->dropTables();
214
+ switch_to_blog($oldBlogID);
215
+ }
216
+ }
217
+
218
+ private function activateWpDiscuz() {
219
+ $this->dbManager->dbCreateTables();
220
+ $this->pluginNewVersion();
221
+ }
222
+
223
+ public function wpdiscuzTextDomain() {
224
+ load_plugin_textdomain("wpdiscuz", false, dirname(plugin_basename(__FILE__)) . "/languages/");
225
+ }
226
+
227
+ public function registerJobs() {
228
+ if (!wp_next_scheduled(self::DELETE_UNATTACHED_FILES_ACTION)) {
229
+ wp_schedule_event(current_time("timestamp"), self::DELETE_UNATTACHED_FILES_KEY_RECURRENCE, self::DELETE_UNATTACHED_FILES_ACTION);
230
+ }
231
+ }
232
+
233
+ public function deregisterJobs() {
234
+ if (wp_next_scheduled(self::DELETE_UNATTACHED_FILES_ACTION)) {
235
+ wp_clear_scheduled_hook(self::DELETE_UNATTACHED_FILES_ACTION);
236
+ }
237
+ }
238
+
239
+ public function setIntervals($schedules) {
240
+ $schedules[self::DELETE_UNATTACHED_FILES_KEY_RECURRENCE] = [
241
+ "interval" => self::DELETE_UNATTACHED_FILES_RECURRENCE * HOUR_IN_SECONDS,
242
+ "display" => esc_html__("Every 48 hours", "wpdiscuz")
243
+ ];
244
+ return $schedules;
245
+ }
246
+
247
+ public function updateAutomatically() {
248
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
249
+ $loadLastCommentId = WpdiscuzHelper::sanitize(INPUT_POST, "loadLastCommentId", FILTER_SANITIZE_NUMBER_INT, 0);
250
+ if ($postId) {
251
+ $this->isWpdiscuzLoaded = true;
252
+ $visibleCommentIds = rtrim(WpdiscuzHelper::sanitize(INPUT_POST, "visibleCommentIds", FILTER_SANITIZE_STRING, ""), ",");
253
+ $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
254
+ $commentListArgs = $this->getCommentListArgs($postId);
255
+ if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
256
+ $lastCommentId = $this->dbManager->getLastCommentId($this->commentsArgs);
257
+ if ($lastCommentId > $loadLastCommentId) {
258
+ $response = [];
259
+ $response["loadLastCommentId"] = $lastCommentId;
260
+ $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
261
+ $sentEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? trim($_COOKIE["comment_author_email_" . COOKIEHASH]) : "";
262
+ $email = !empty($commentListArgs["current_user"]->ID) ? $commentListArgs["current_user"]->user_email : $sentEmail;
263
+ $newCommentIds = $this->dbManager->getNewCommentIds($this->commentsArgs, $loadLastCommentId, $email, $visibleCommentIds);
264
+ $newCommentIds = apply_filters("wpdiscuz_live_update_new_comment_ids", $newCommentIds, $postId, $commentListArgs["current_user"]);
265
+ $response["message"] = [];
266
+ foreach ($newCommentIds as $newCommentId) {
267
+ $comment = get_comment($newCommentId);
268
+ if (($comment->comment_parent && (in_array($comment->comment_parent, explode(",", $visibleCommentIds)) || in_array($comment->comment_parent, $newCommentIds))) || !$comment->comment_parent) {
269
+ $commentHtml = wp_list_comments($commentListArgs, [$comment]);
270
+ $commentObject = [
271
+ "comment_parent" => $comment->comment_parent,
272
+ "comment_html" => $commentHtml
273
+ ];
274
+ if ($comment->comment_parent) {
275
+ array_push($response["message"], $commentObject);
276
+ } else {
277
+ array_unshift($response["message"], $commentObject);
278
+ }
279
+ }
280
+ }
281
+ $response["wc_all_comments_count_new"] = get_comments_number($postId);
282
+ $response["wc_all_comments_count_before_threads_html"] = "<span class='wpdtc' title='" . esc_attr($response["wc_all_comments_count_new"]) . "'>" . esc_html($this->helper->getNumber($response["wc_all_comments_count_new"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["wc_all_comments_count_new"] ? $this->form->getHeaderTextSingle() : $this->form->getHeaderTextPlural()), $response["wc_all_comments_count_new"]));
283
+ $response["wc_all_comments_count_bubble_html"] = "<span id='wpd-bubble-all-comments-count'" . ($response["wc_all_comments_count_new"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["wc_all_comments_count_new"]) . "'>" . esc_html($this->helper->getNumber($response["wc_all_comments_count_new"])) . "</span>";
284
+ wp_send_json_success($response);
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ public function bubbleUpdate() {
291
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
292
+ $newCommentIds = WpdiscuzHelper::sanitize(INPUT_POST, "newCommentIds", FILTER_SANITIZE_STRING, "");
293
+ if ($postId && $newCommentIds) {
294
+ $this->isWpdiscuzLoaded = true;
295
+ $commentListArgs = $this->getCommentListArgs($postId);
296
+ if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
297
+ $newCommentIds = explode(",", trim($newCommentIds, ","));
298
+ $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
299
+ $response = ["message" => []];
300
+ foreach ($newCommentIds as $newCommentId) {
301
+ $comment = get_comment($newCommentId);
302
+ $commentHtml = wp_list_comments($commentListArgs, [$comment]);
303
+ $response["message"][] = [
304
+ "comment_id" => $comment->comment_ID,
305
+ "comment_parent" => $comment->comment_parent,
306
+ "comment_html" => $commentHtml
307
+ ];
308
+ }
309
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
310
+ wp_send_json_success($response);
311
+ }
312
+ }
313
+ }
314
+
315
+ public function addComment() {
316
+ $this->helper->validateNonce();
317
+ $isAnonymous = false;
318
+ $uniqueId = trim(WpdiscuzHelper::sanitize(INPUT_POST, "wpdiscuz_unique_id", FILTER_SANITIZE_STRING, ""));
319
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
320
+ $comment_content = isset($_POST["wc_comment"]) ? $_POST["wc_comment"] : "";
321
+
322
+ if ($uniqueId && $postId && $comment_content) {
323
+ $this->isWpdiscuzLoaded = true;
324
+ $this->form = $this->wpdiscuzForm->getForm($postId);
325
+ $this->form->initFormFields();
326
+ $currentUser = WpdiscuzHelper::getCurrentUser();
327
+ if ($this->form->isUserCanSeeComments($currentUser, $postId)) {
 
328
  do_action("wpdiscuz_before_comment_post");
329
  if (!comments_open($postId)) {
330
  wp_die(esc_html($this->options->getPhrase("wc_commenting_is_closed")));
369
  wp_send_json_error("wc_msg_required_fields");
370
  }
371
 
372
+ $uid_data = $this->helper->getUIDData($uniqueId);
373
+ $comment_parent = intval($uid_data[0]);
374
+ $parentComment = $comment_parent ? get_comment($comment_parent) : null;
375
+ $comment_parent = isset($parentComment->comment_ID) ? $parentComment->comment_ID : 0;
376
+ if ($parentComment && intval(get_comment_meta($comment_parent, self::META_KEY_CLOSED, true))) {
377
+ wp_die(esc_html($this->options->getPhrase("wc_closed_comment_thread", ["comment" => $parentComment])));
378
+ }
379
+ $isReply = $wooExists && !$replyForWoo ? 0 : $comment_parent;
380
  if ($isReply) {
381
  $commentMinLength = intval($this->options->content["replyTextMinLength"]);
382
  $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
383
  } else {
384
+ $commentMinLength = intval($this->options->content["commentTextMinLength"]);
385
+ $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
386
  }
387
  $contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($comment_content)) : strlen(strip_tags($comment_content));
388
  if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
396
  if ($name && $email && $comment_content) {
397
  $website_url = $website_url ? urldecode($website_url) : "";
398
  $stickyComment = WpdiscuzHelper::sanitize(INPUT_POST, "wc_sticky_comment", FILTER_SANITIZE_NUMBER_INT, "");
399
+ $closedComment = absint(WpdiscuzHelper::sanitize(INPUT_POST, "wc_closed_comment", FILTER_SANITIZE_NUMBER_INT, 0));
400
 
401
  $this->helper->restrictCommentingPerUser($email, $comment_parent, $postId);
402
  $wc_user_agent = isset($_SERVER["HTTP_USER_AGENT"]) ? sanitize_text_field($_SERVER["HTTP_USER_AGENT"]) : "";
474
  } else {
475
  wp_send_json_error("wc_invalid_field");
476
  }
477
+ } else {
478
+ wp_send_json_error("wc_msg_required_fields");
479
  }
480
+ } else {
481
+ wp_send_json_error("wc_msg_required_fields");
482
+ }
483
+ }
484
+
485
+ /**
486
+ * save edited comment via ajax
487
+ */
488
+ public function saveEditedComment() {
489
+ $this->helper->validateNonce();
490
+ $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
491
+ $trimmedContent = isset($_POST["wc_comment"]) ? trim($_POST["wc_comment"]) : "";
492
+ if (!$trimmedContent || !strip_tags($trimmedContent)) {
493
+ wp_send_json_error("wc_msg_required_fields");
494
+ }
495
+ $trimmedContent = ($this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop")) && !$this->options->showEditorToolbar() ? html_entity_decode($trimmedContent) : $trimmedContent;
496
+ if ($commentId) {
497
+ $this->isWpdiscuzLoaded = true;
498
+ $comment = get_comment($commentId);
499
+ $currentUser = WpdiscuzHelper::getCurrentUser();
500
+ $uniqueId = $comment->comment_ID . "_" . $comment->comment_parent;
501
+ $highLevelUser = current_user_can("moderate_comments");
502
+ $isCurrentUserCanEdit = $this->helper->isCommentEditable($comment) && $this->helper->canUserEditComment($comment, $currentUser);
503
+ $this->form = $this->wpdiscuzForm->getForm($comment->comment_post_ID);
504
+ $this->form->initFormFields();
505
+ $this->form->validateFields($currentUser);
506
+ if (!intval(get_comment_meta($comment->comment_ID, self::META_KEY_CLOSED, true)) && ($highLevelUser || $isCurrentUserCanEdit) && $this->form->isUserCanSeeComments($currentUser, $comment->comment_post_ID)) {
507
+ $isInRange = $this->helper->isContentInRange($trimmedContent, $comment->comment_parent);
508
+
509
+ if (!$isInRange && !$highLevelUser) {
510
+ if ($comment->comment_parent) {
511
+ $commentMinLength = intval($this->options->content["replyTextMinLength"]);
512
+ $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
513
+ } else {
514
  $commentMinLength = intval($this->options->content["commentTextMinLength"]);
515
  $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
516
  }
517
+ $contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($trimmedContent)) : strlen(strip_tags($trimmedContent));
518
+ if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
519
+ wp_send_json_error("wc_msg_input_min_length");
520
+ }
521
+
522
+ if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
523
+ wp_send_json_error("wc_msg_input_max_length");
524
+ }
525
+ }
526
+
527
+ if ($isInRange || $highLevelUser) {
528
+ $response = [];
529
+ if ($trimmedContent !== $comment->comment_content) {
530
+ $trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
531
+ $commentContent = $this->helper->filterCommentText($trimmedContent);
532
+ $userAgent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
533
+ $commentarr = [
534
+ "comment_ID" => $commentId,
535
+ "comment_content" => $commentContent,
536
+ "comment_agent" => $userAgent,
537
+ "comment_approved" => $comment->comment_approved
538
+ ];
539
+ wp_update_comment(wp_slash($commentarr));
540
+ $lastEditedAt = current_time("mysql", 1);
541
+ update_comment_meta($commentId, self::META_KEY_LAST_EDITED_AT, $lastEditedAt);
542
+ update_comment_meta($commentId, self::META_KEY_LAST_EDITED_BY, !empty($currentUser->ID) ? $currentUser->ID : $comment->comment_author_email);
543
+ if ($this->options->moderation["displayEditingInfo"]) {
544
+ if (!empty($currentUser->ID)) {
545
+ $lastEditedBy = get_user_by("id", $currentUser->ID);
546
+ } else {
547
+ $lastEditedBy = get_user_by("email", $currentUser->comment_author_email);
548
+ }
549
+ $username = $lastEditedBy ? $lastEditedBy->display_name : $comment->comment_author;
550
+ $response["lastEdited"] = "<div class='wpd-comment-last-edited'><i class='far fa-edit'></i>" . esc_html(sprintf($this->options->getPhrase("wc_last_edited", ["comment" => $comment]), $this->helper->dateDiff($lastEditedAt), $username)) . "</div>";
551
+ }
552
+ do_action("wpdiscuz_clean_post_cache", $comment->comment_post_ID, "comment_edited");
553
+ do_action("wpdiscuz_reset_comments_cache", $comment->comment_post_ID);
554
+ }
555
+
556
+ $this->form->saveCommentMeta($comment->comment_ID);
557
+ $commentContent = isset($commentContent) ? $commentContent : $trimmedContent;
558
+ if ($this->options->content["enableImageConversion"]) {
559
+ $commentContent = $this->helper->makeClickable($commentContent);
560
+ }
561
+ $commentLink = get_comment_link($comment);
562
+ $commentContent = apply_filters("comment_text", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
563
+ $commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
564
+ if (stripos($commentContent, "[/spoiler]") !== false) {
565
+ $commentReadMoreLimit = 0;
566
+ $commentContent = $this->helper->spoiler($commentContent);
567
+ }
568
+ if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($commentContent)) > $commentReadMoreLimit) {
569
+ $commentContent = WpdiscuzHelper::getCommentExcerpt($commentContent, $uniqueId, $this->options);
570
+ }
571
+ $commentContent = apply_filters("wpdiscuz_after_read_more", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
572
+ if ($this->options->social["enableTwitterShare"]) {
573
+ $response["twitterShareLink"] = esc_url_raw("https://twitter.com/intent/tweet?text=" . $this->helper->getTwitterShareContent($commentContent, $commentLink) . "&url=" . urlencode($commentLink));
574
+ }
575
+ if ($this->options->social["enableWhatsappShare"]) {
576
+ $response["whatsappShareLink"] = esc_url_raw((wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com") . "/send?text=" . $this->helper->getWhatsappShareContent($commentContent, $commentLink));
577
+ }
578
+
579
+ $components = $this->helper->getComponents($this->form->getTheme(), $this->form->getLayout());
580
+ $inlineContent = "";
581
+ if ($inlineFormID = intval(get_comment_meta($comment->comment_ID, self::META_KEY_FEEDBACK_FORM_ID, true))) {
582
+ $feedbackForm = $this->dbManager->getFeedbackForm($inlineFormID);
583
+ $inlineContent = "<div class='wpd-inline-feedback-wrapper'><span class='wpd-inline-feedback-info'>" . esc_html($this->options->getPhrase("wc_feedback_content_text")) . "</span> <i class='fas fa-quote-left'></i>" . wp_trim_words($feedbackForm->content, apply_filters("wpdiscuz_feedback_content_words_count", 20)) . "&quot; <a class='wpd-feedback-content-link' data-feedback-content-id='{$feedbackForm->id}' href='#wpd-inline-{$feedbackForm->id}'>" . esc_html($this->options->getPhrase("wc_read_more")) . "</a></div>";
584
+ }
585
+ $response["message"] = str_replace(["{TEXT_WRAPPER_CLASSES}", "{TEXT}"], [
586
+ "wpd-comment-text",
587
+ $inlineContent . $commentContent
588
+ ], $components["text.html"]);
589
+ $response["callbackFunctions"] = [];
590
+ $response = apply_filters("wpdiscuz_comment_edit_save", $response);
591
+ wp_send_json_success($response);
592
+ } else {
593
+ wp_send_json_error("wc_comment_edit_not_possible");
594
+ }
595
+ } else {
596
+ wp_send_json_error("wc_comment_edit_not_possible");
597
+ }
598
+ }
599
+ }
600
+
601
+ /**
602
+ * Gets single comment with its full thread and displays in comment list
603
+ */
604
+ public function getSingleComment() {
605
+ $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
606
+ $comment = get_comment($commentId);
607
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
608
+ if ($commentId && $postId && $comment && $comment->comment_post_ID == $postId) {
609
+ $commentListArgs = $this->getCommentListArgs($postId);
610
+ $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
611
+ if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
612
  $showUnapprovedComment = false;
613
+ $includeUnapproved = null;
614
  if ($comment->comment_approved === "0") {
615
  if ($commentListArgs["high_level_user"]) {
616
  $showUnapprovedComment = true;
627
  }
628
  if ($comment->comment_approved === "1" || $showUnapprovedComment) {
629
  $this->isWpdiscuzLoaded = true;
630
+ $commentStatusIn = ["1"];
631
  if ($this->commentsArgs["status"] === "all") {
632
  $commentStatusIn[] = "0";
633
  }
634
 
635
  if (!$this->options->wp["threadComments"]) {
636
+ $comments = [$comment];
637
  $parentComment = $comment;
638
  } else if ($parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved)) {
639
  $args = [
640
+ "format" => "flat",
641
+ "status" => $this->commentsArgs["status"],
642
  "orderby" => $this->commentsArgs["orderby"],
643
  "post_id" => $this->commentsArgs["post_id"],
644
  ];
645
  if (!empty($this->commentsArgs["include_unapproved"])) {
646
  $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
647
  }
648
+ $tree = $parentComment->get_children($args);
649
  $comments = array_merge([$parentComment], $tree);
650
  }
651
  if ($parentComment) {
652
+ $commentListArgs["isSingle"] = true;
653
  $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
654
  if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
655
  if (!empty($commentListArgs['current_user']->ID)) {
658
  $commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
659
  }
660
  }
661
+ $response = [];
662
+ $response["message"] = wp_list_comments($commentListArgs, $comments);
663
+ $response["parentCommentID"] = $parentComment->comment_ID;
664
  $response["callbackFunctions"] = [];
665
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
666
  wp_send_json_success($response);
667
  }
668
  }
669
+ }
670
+ }
671
+ }
672
+
673
+ public function loadMoreComments() {
674
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
675
+ $lastParentId = WpdiscuzHelper::sanitize(INPUT_POST, "lastParentId", FILTER_SANITIZE_NUMBER_INT, 0);
676
+ if ($lastParentId >= 0 && $postId) {
677
+ $this->form = $this->wpdiscuzForm->getForm($postId);
678
+ if ($this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $postId)) {
679
  $this->isWpdiscuzLoaded = true;
680
  $isFirstLoad = WpdiscuzHelper::sanitize(INPUT_POST, "isFirstLoad", FILTER_SANITIZE_NUMBER_INT, 1);
681
  // max value of php int for limit
703
  $args["post_id"] = $postId;
704
  $args = apply_filters("wpdiscuz_filter_args", $args);
705
  $commentData = $this->getWPComments($args);
706
+ if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
707
+ $commentData["loadLastCommentId"] = $this->dbManager->getLastCommentId($this->commentsArgs);
708
+ }
709
  $commentData["callbackFunctions"] = [];
710
  $commentData = apply_filters("wpdiscuz_ajax_callbacks", $commentData);
711
  wp_send_json_success($commentData);
712
+ }
713
+ }
714
+ }
715
+
716
+ public function sorting() {
717
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
718
+ $sorting = trim(WpdiscuzHelper::sanitize(INPUT_POST, "sorting", FILTER_SANITIZE_STRING, ""));
719
+ if ($postId && $sorting) {
720
+ $this->form = $this->wpdiscuzForm->getForm($postId);
721
+ if ($this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $postId)) {
722
  $this->isWpdiscuzLoaded = true;
723
+ $args = ["post_id" => $postId];
724
  if ($sorting === "newest") {
725
  $args["orderby"] = $this->options->thread_display["orderCommentsBy"];
726
+ $args["order"] = "desc";
727
  } else if ($sorting === "oldest") {
728
  $args["orderby"] = $this->options->thread_display["orderCommentsBy"];
729
+ $args["order"] = "asc";
730
  } else if ($sorting === "by_vote") {
731
  $args["orderby"] = "by_vote";
732
+ $args["order"] = $this->options->wp["commentOrder"];
733
  }
734
  $args["first_load"] = 1;
735
+ $args["wpdType"] = WpdiscuzHelper::sanitize(INPUT_POST, "wpdType", FILTER_SANITIZE_STRING, "");
736
+ $args = apply_filters("wpdiscuz_filter_args", $args);
737
+ $commentData = $this->getWPComments($args);
738
+ $response = [
739
+ "last_parent_id" => $commentData["last_parent_id"],
740
  "is_show_load_more" => $commentData["is_show_load_more"],
741
+ "message" => $commentData["comment_list"],
742
  "callbackFunctions" => [],
743
  ];
744
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
745
  wp_send_json_success($response);
746
+ }
747
+ }
748
+ }
749
+
750
+ /**
751
+ * get comments by comment type
752
+ */
753
+ public function getWPComments($args = []) {
754
+ global $post;
755
+ $postId = isset($args["post_id"]) ? $args["post_id"] : $post->ID;
756
+ $defaults = $this->getDefaultCommentsArgs($postId);
757
+ $this->commentsArgs = wp_parse_args($args, $defaults);
758
+ $commentListArgs = $this->getCommentListArgs($postId);
759
+ do_action("wpdiscuz_before_getcomments", $this->commentsArgs, $commentListArgs["current_user"], $args);
760
+ $commentData = [];
761
+
762
+ if ($commentCache = $this->cache->getCommentsCache($this->commentsArgs)) {
763
+ $commentList = $commentCache["commentList"];
764
+ $commentData = $commentCache["commentData"];
765
+ if ($this->options->wp["isPaginate"]) {
766
+ $commentListArgs["page"] = 0;
767
+ $commentListArgs["per_page"] = 0;
768
  $commentListArgs["reverse_top_level"] = $this->options->wp["commentOrder"] === "desc";
769
  }
770
+ if ($this->options->wp["threadComments"] && $this->options->thread_display["isLoadOnlyParentComments"] && $commentList) {
771
+ $commentList = $this->getChildren($commentList, $commentListArgs);
772
+ }
773
+ } else {
774
+ $commentList = $this->_getWPComments($commentListArgs, $commentData);
775
+ $this->cache->setCommentsCache($this->commentsArgs, $commentList, $commentData);
776
+ }
777
+
778
+ if ($count = count($commentList)) {
779
+ $commentListArgs["lastCommentIdInList"] = $commentList[$count - 1]->comment_ID;
780
+ }
781
+
782
+ $commentData["comment_list"] = wp_list_comments($commentListArgs, $commentList);
783
+ $this->commentsArgs["caller"] = "";
784
+
785
+ return $commentData;
786
+ }
787
+
788
+ public function _getWPComments(&$commentListArgs, &$commentData) {
789
+ if ($this->options->wp["isPaginate"]) {// PAGINATION
790
+ $page = get_query_var("cpage");
791
+ $this->commentsArgs["number"] = $this->options->wp["commentPerPage"];
792
+ $this->commentsArgs["order"] = "asc";
793
+ $this->commentsArgs["caller"] = "";
794
+ if ($this->options->wp["threadComments"]) {
795
+ $this->commentsArgs["parent"] = 0;
796
+ }
797
+
798
+ if ($page) {
799
+ $this->commentsArgs["offset"] = ($page - 1) * $this->options->wp["commentPerPage"];
800
+ } else if ($this->options->wp["defaultCommentsPage"] === "oldest") {
801
+ $this->commentsArgs["offset"] = 0;
802
+ }
803
+
804
+ $commentListArgs["page"] = 0;
805
+ $commentListArgs["per_page"] = 0;
806
+ $commentListArgs["reverse_top_level"] = $this->options->wp["commentOrder"] === "desc";
807
+
808
+ $commentList = get_comments($this->commentsArgs);
809
+ if ($this->options->wp["threadComments"] && $commentList) {
810
+ $commentList = $this->getChildren($commentList, $commentListArgs);
811
+ }
812
+ $this->getStickyComments(true, $commentList, $commentListArgs);
813
+ } else {
814
+ $limitBefore = $this->commentsArgs["number"];
815
+ if ($this->commentsArgs["number"]) {
816
+ $this->commentsArgs["number"] += 1;
817
+ }
818
+ if ($this->commentsArgs["wpdType"] === "inline") {
819
+ $this->commentsArgs["meta_query"] = [
820
+ [
821
+ "key" => self::META_KEY_FEEDBACK_FORM_ID,
822
+ "value" => 0,
823
+ "compare" => "!=",
824
+ ],
825
+ ];
826
+ }
827
+ $commentList = get_comments($this->commentsArgs);
828
+ $commentListCount = count($commentList);
829
+ if ($limitBefore && $commentListCount > $limitBefore) {
830
+ unset($commentList[$commentListCount - 1]);
831
+ $commentListCount--;
832
+ $commentData["is_show_load_more"] = true;
833
+ } else {
834
+ $commentData["is_show_load_more"] = false;
835
+ }
836
+ if ($commentList) {
837
+ $commentData["last_parent_id"] = $commentList[$commentListCount - 1]->comment_ID;
838
+ if ($this->options->wp["threadComments"]) {
839
+ $commentList = $this->getChildren($commentList, $commentListArgs);
840
+ }
841
+ } else {
842
+ $commentData["last_parent_id"] = 0;
843
+ }
844
+ $this->getStickyComments(false, $commentList, $commentListArgs);
845
+ $commentListArgs["page"] = 1;
846
+ $commentListArgs["last_parent_id"] = $commentData["last_parent_id"];
847
+ }
848
+ if ($commentList && $this->options->thread_layouts["highlightVotingButtons"]) {
849
+ if (!empty($commentListArgs["current_user"]->ID)) {
850
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($commentList, $commentListArgs['current_user']->ID);
851
+ } else {
852
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($commentList, md5($this->helper->getRealIPAddr()));
853
+ }
854
+ }
855
+
856
+ return apply_filters("comments_array", $commentList, $this->commentsArgs["post_id"]);
857
+ }
858
+
859
+ private function getChildren($commentList, &$commentListArgs) {
860
+ $parentComments = [];
861
+ $args = [
862
+ "format" => "flat",
863
+ "status" => $this->commentsArgs["status"],
864
+ "orderby" => $this->commentsArgs["orderby"],
865
+ "post_id" => $this->commentsArgs["post_id"],
866
  "update_comment_meta_cache" => false,
867
+ "no_found_rows" => false,
868
  "update_comment_post_cache" => false,
869
+ ];
870
+ if (!empty($this->commentsArgs["include_unapproved"])) {
871
+ $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
872
+ }
873
+ foreach ($commentList as $parentComment) {
874
+ $parentComments[] = $parentComment;
875
+ $children = $parentComment->get_children($args);
876
+ if ($this->options->thread_display["isLoadOnlyParentComments"]) {
877
+ $commentListArgs["wpdiscuz_child_count_" . $parentComment->comment_ID] = count($children);
878
+ } else {
879
+ $parentComments = array_merge($parentComments, $children);
880
+ }
881
+ }
882
+
883
+ return $parentComments;
884
+ }
885
+
886
+ public function commentsTemplateQueryArgs($args) {
887
+ global $post;
888
+ if ($this->isWpdiscuzLoaded) {
889
+ if ($this->options->wp["isPaginate"]) {
890
+ $args["caller"] = "wpdiscuz";
891
+ } else {
892
+ $args["post__not_in"] = $post->ID;
893
+ }
894
+ }
895
+
896
+ return $args;
897
+ }
898
+
899
+ public function preGetComments($queryObj) {
900
+ if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz-") {
901
+ $vars = $queryObj->query_vars;
902
+ $vars["comment__in"] = "";
903
+ $queryObj->query_vars = $vars;
904
+ }
905
+ }
906
+
907
+ public function foundCommentsQuery($q, $qObj) {
908
+ if ($this->options->wp["isPaginate"] && isset($qObj->query_vars["caller"]) && $qObj->query_vars["caller"] === "wpdiscuz" && empty($this->commentsArgs["sticky"])) {
909
+ global $wpdb, $post;
910
+ $where = "WHERE";
911
+ if (!empty($qObj->query_vars["include_unapproved"][0])) {
912
+ if (is_numeric($qObj->query_vars["include_unapproved"][0])) {
913
+ $where .= " (comment_approved = '1' OR " . $wpdb->prepare("(user_id = %d AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
914
+ } else {
915
+ $where .= " (comment_approved = '1' OR " . $wpdb->prepare("(comment_author_email = %s AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
916
+ }
917
+ } else {
918
+ $where .= " comment_approved = '1'";
919
+ }
920
+ $where .= " AND comment_post_ID = {$post->ID}";
921
+ if ($this->options->wp["threadComments"]) {
922
+ $where .= " AND comment_parent = 0";
923
+ }
924
+ $typesNotIn = apply_filters("wpdiscuz_found_comments_query", [self::WPDISCUZ_STICKY_COMMENT], $post->ID);
925
+ foreach ($typesNotIn as &$type) {
926
+ $type = esc_sql($type);
927
+ }
928
+ $where .= " AND comment_type NOT IN ('" . implode("','", $typesNotIn) . "')";
929
+ $q = "SELECT COUNT(*) FROM {$wpdb->comments} $where";
930
+ }
931
+
932
+ return $q;
933
+ }
934
+
935
+ /**
936
+ * add comments clauses
937
+ * add new orderby clause when sort type is vote and wordpress comments order is older (ASC)
938
+ */
939
+ public function commentsClauses($args) {
940
+ global $wpdb;
941
+ if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz" && !$this->options->wp["isPaginate"]) {
942
+ $orderby = "";
943
+ $args["caller"] = $this->commentsArgs["caller"] = "wpdiscuz-";
944
+ if ($this->options->thread_layouts["showVotingButtons"] && $this->commentsArgs["orderby"] === "by_vote") {
945
+ $args["join"] .= " LEFT JOIN " . $wpdb->commentmeta . " AS `cm` ON " . $wpdb->comments . ".comment_ID = `cm`.comment_id AND (`cm`.meta_key = '" . self::META_KEY_VOTES . "')";
946
+ $orderby = " IFNULL(`cm`.meta_value,0)+0 DESC, ";
947
+ } else if ($this->commentsArgs["last_parent_id"] && empty($this->commentsArgs["sticky"])) {
948
+ $args["where"] = $wpdb->comments . ".`comment_ID`" . ($this->commentsArgs["order"] === 'desc' ? " < " : " > ") . $this->commentsArgs["last_parent_id"] . ($args["where"] ? " AND " : "") . $args["where"];
949
+ }
950
+ $args["orderby"] = $orderby . $wpdb->comments . ".`{$this->options->thread_display["orderCommentsBy"]}` ";
951
+ $args["orderby"] .= isset($args["order"]) ? "" : $this->commentsArgs["order"];
952
+ }
953
+
954
+ return $args;
955
+ }
956
+
957
+ public function getDefaultCommentsArgs($postId = 0) {
958
+ global $user_ID;
959
+ $commenter = wp_get_current_commenter();
960
+ $args = [
961
+ "caller" => "wpdiscuz",
962
+ "post_id" => intval($postId),
963
+ "last_parent_id" => 0,
964
+ "orderby" => $this->options->thread_display["orderCommentsBy"],
965
+ "order" => $this->options->wp["commentOrder"],
966
+ // max value of php int for limit
967
+ "number" => $this->options->thread_display["commentListLoadType"] == 3 ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"],
968
+ "status" => !$this->options->wp["isPaginate"] && current_user_can("moderate_comments") ? "all" : "approve",
969
  "update_comment_meta_cache" => false,
970
+ "no_found_rows" => false,
971
  "update_comment_post_cache" => false,
972
+ "type__not_in" => [self::WPDISCUZ_STICKY_COMMENT],
973
+ "wpdType" => "",
974
+ "page" => 1,
975
+ ];
976
+ if ($this->options->wp["isPaginate"]) {
977
+ $args["page"] = intval(get_query_var("cpage"));
978
+ }
979
+ if ($this->options->wp["threadComments"]) {
980
+ $args["parent"] = 0;
981
+ }
982
+ if (!current_user_can("moderate_comments")) {
983
+ if ($user_ID) {
984
+ $args["include_unapproved"] = [$user_ID];
985
+ } elseif (!empty($commenter["comment_author_email"])) {
986
+ $args["include_unapproved"] = [$commenter["comment_author_email"]];
987
+ }
988
+ }
989
+
990
+ return apply_filters("wpdiscuz_comments_args", $args);
991
+ }
992
+
993
+ /**
994
+ * register options page for plugin
995
+ */
996
+ public function addPluginOptionsPage() {
997
+ add_menu_page("wpDiscuz", "wpDiscuz", "manage_options", self::PAGE_WPDISCUZ, "", "dashicons-admin-comments", 26);
998
+ add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Dashboard", "wpdiscuz"), "&raquo; " . esc_html__("Dashboard", "wpdiscuz"), "manage_options", self::PAGE_WPDISCUZ, [
999
+ &$this->options,
1000
+ "dashboard"
1001
+ ]);
1002
+ add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Settings", "wpdiscuz"), "&raquo; " . esc_html__("Settings", "wpdiscuz"), "manage_options", self::PAGE_SETTINGS, [
1003
+ &$this->options,
1004
+ "mainOptionsForm"
1005
+ ]);
1006
+ if (!$this->options->general["isUsePoMo"]) {
1007
+ add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Phrases", "wpdiscuz"), "&raquo; " . esc_html__("Phrases", "wpdiscuz"), "manage_options", self::PAGE_PHRASES, [
1008
+ &$this->options,
1009
+ "phrasesOptionsForm"
1010
+ ]);
1011
+ }
1012
+ add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Tools", "wpdiscuz"), "&raquo; " . esc_html__("Tools", "wpdiscuz"), "manage_options", self::PAGE_TOOLS, [
1013
+ &$this->options,
1014
+ "tools"
1015
+ ]);
1016
+ add_submenu_page(self::PAGE_WPDISCUZ, "&raquo; " . esc_html__("Addons", "wpdiscuz"), "&raquo; " . esc_html__("Addons", "wpdiscuz"), "manage_options", self::PAGE_ADDONS, [
1017
+ &$this->options,
1018
+ "addons"
1019
+ ]);
1020
+ }
1021
+
1022
+ /**
1023
+ * Scripts and styles registration on administration pages
1024
+ */
1025
+ public function backendFiles() {
1026
+ global $typenow, $pagenow;
1027
+ $wp_version = get_bloginfo("version");
1028
+ $wpdiscuzWpPages = apply_filters("wpdiscuz_wp_admin_pages", ["edit-comments.php", "admin.php", "comment.php"]);
1029
+ $wpdiscuzPages = apply_filters("wpdiscuz_admin_pages", [
1030
+ self::PAGE_WPDISCUZ,
1031
+ self::PAGE_SETTINGS,
1032
+ self::PAGE_PHRASES,
1033
+ self::PAGE_TOOLS,
1034
+ self::PAGE_ADDONS
1035
+ ]);
1036
+ wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
1037
+
1038
+ if ((isset($_GET["page"]) && in_array($_GET["page"], $wpdiscuzPages) && in_array($pagenow, $wpdiscuzWpPages)) || ($typenow === "wpdiscuz_form") || ($pagenow === self::PAGE_COMMENTS)) {
1039
+ $nonceKey = ($key = get_home_url()) ? md5($key) : "wpdiscuz-media-uploader-nonce";
1040
+ $args = [
1041
+ "msgConfirmResetOptions" => esc_html__("Do you really want to reset all options?", "wpdiscuz"),
1042
+ "msgConfirmResetTabOptions" => esc_html__("Do you really want to reset tab options?", "wpdiscuz"),
1043
+ "msgConfirmRemoveVotes" => esc_html__("Do you really want to remove voting data?", "wpdiscuz"),
1044
+ "msgConfirmResetPhrases" => esc_html__("Do you really want to reset phrases?", "wpdiscuz"),
1045
+ "wmuMsgConfirmAttachmentDelete" => esc_html__("Do you really want to delet this attachment?", "wpdiscuz"),
1046
+ "msgConfirmPurgeCache" => esc_html__("Do you really want to delete comments and users cache?", "wpdiscuz"),
1047
+ "wmuSecurity" => wp_create_nonce($nonceKey),
1048
+ WpDiscuzConstants::GLOBAL_NONCE_NAME => $this->helper->generateNonce()
1049
+ ];
1050
+ // Media Upload Lightbox
1051
+ wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox.css"));
1052
+ wp_enqueue_style("wmu-colorbox-css");
1053
+ wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox.min.js"), ["jquery"]);
1054
+ wp_enqueue_script("wmu-colorbox-js");
1055
+
1056
+ wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-backend.css"));
1057
+ wp_enqueue_style("wpdiscuz-mu-css");
1058
+ wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-backend.js"), ["jquery"], $this->version, true);
1059
+ wp_localize_script("wpdiscuz-mu-js", "wpdiscuzMUJsObj", $args);
1060
+ wp_enqueue_script("wpdiscuz-mu-js");
1061
+
1062
+ wp_enqueue_style("wpdiscuz-font-awesome");
1063
+ wp_enqueue_style("wp-color-picker");
1064
+ wp_enqueue_script("wp-color-picker");
1065
+ wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
1066
+ wp_enqueue_style("wpdiscuz-options-css");
1067
+ wp_register_script("wpdiscuz-options-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-options.js"), ["jquery"], $this->version);
1068
+ wp_enqueue_script("wpdiscuz-options-js");
1069
+ wp_localize_script("wpdiscuz-options-js", "wpdiscuzObj", $args);
1070
+ wp_enqueue_script("thickbox");
1071
+ wp_register_script("wpdiscuz-contenthover", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/contenthover/jquery.contenthover.min.js"), ["jquery"], $this->version, true);
1072
+ wp_enqueue_script("wpdiscuz-contenthover");
1073
+
1074
+ if (isset($_GET["page"])) {
1075
+ if ($_GET["page"] === self::PAGE_WPDISCUZ) {
1076
  wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
1077
  wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
1078
  wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
1082
  wp_register_script("wpdiscuz-chart-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/chart/chart.min.js"), [], $this->version, true);
1083
  wp_enqueue_script("wpdiscuz-chart-js");
1084
  } else if ($_GET["page"] === self::PAGE_PHRASES) {
1085
+ wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
1086
+ wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
1087
+ wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
1088
+ wp_enqueue_script("wpdiscuz-easy-responsive-tabs-js");
1089
+ wp_register_script("wpdiscuz-jquery-cookie", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
1090
+ wp_enqueue_script("wpdiscuz-jquery-cookie");
1091
  }
1092
+ }
1093
+ } else if ($pagenow === "comment.php") {
1094
+ wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
1095
+ wp_enqueue_style("wpdiscuz-options-css");
1096
+ wp_enqueue_style("wpdiscuz-font-awesome");
1097
+ }
1098
+ if (version_compare($wp_version, "4.2.0", ">=")) {
1099
+ wp_register_script("wpdiscuz-addon-notes", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-notes.js"), ["jquery"], $this->version, true);
1100
+ wp_enqueue_script("wpdiscuz-addon-notes");
1101
+ }
1102
+
1103
+ if (!get_option(self::OPTION_SLUG_DEACTIVATION) && (strpos($this->requestUri, "/plugins.php") !== false)) {
1104
+ $reasonArgs = [
1105
+ "msgReasonRequired" => esc_html__("Please check one of reasons before sending feedback!", "wpdiscuz"),
1106
+ "msgReasonDescRequired" => esc_html__("Please provide more information", "wpdiscuz"),
1107
+ "adminUrl" => get_admin_url()
1108
+ ];
1109
+ wp_register_style("wpdiscuz-lity-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.css"), null, $this->version);
1110
+ wp_enqueue_style("wpdiscuz-lity-css");
1111
+ wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.js"), ["jquery"], $this->version);
1112
+ wp_enqueue_script("wpdiscuz-lity-js");
1113
+ wp_register_style("wpdiscuz-deactivation-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-deactivation.css"));
1114
+ wp_enqueue_style("wpdiscuz-deactivation-css");
1115
+ wp_register_script("wpdiscuz-deactivation-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-deactivation.js"), ["jquery"], $this->version);
1116
+ wp_enqueue_script("wpdiscuz-deactivation-js");
1117
+ wp_localize_script("wpdiscuz-deactivation-js", "deactivationObj", $reasonArgs);
1118
+ }
1119
+ wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", null);
1120
+ wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js");
1121
+ wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", "wpdObject", [
1122
+ "ajaxUrl" => admin_url("admin-ajax.php"),
1123
+ "shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
1124
+ "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
1125
+ "tooltip" => $this->options->getPhrase("wc_feedback_shortcode_tooltip"),
1126
+ "popup_title" => $this->options->getPhrase("wc_feedback_popup_title"),
1127
+ "leave_feebdack" => $this->options->getPhrase("wc_please_leave_feebdack"),
1128
+ "no_text_selected" => esc_html__("No text is selected. Please select a part of text from post content.", "wpdiscuz")
1129
+ ]);
1130
+ }
1131
+
1132
+ /**
1133
+ * Styles and scripts registration to use on front page
1134
+ */
1135
+ public function frontendFiles() {
1136
+ global $post;
1137
+ $this->isWpdiscuzLoaded = $this->helper->isLoadWpdiscuz($post);
1138
+ $suf = $this->options->general["loadMinVersion"] ? ".min" : "";
1139
+ wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
1140
+ wp_register_style("wpdiscuz-ratings", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings$suf.css"), null, $this->version);
1141
+ wp_register_style("wpdiscuz-ratings-rtl", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings-rtl$suf.css"), null, $this->version);
1142
+ if (!$this->isWpdiscuzLoaded && $this->options->rating["ratingCssOnNoneSingular"]) {
1143
+ wp_enqueue_style("wpdiscuz-ratings");
1144
+ if (is_rtl()) {
1145
+ wp_enqueue_style("wpdiscuz-ratings-rtl");
1146
+ }
1147
+ }
1148
+ if ($this->isWpdiscuzLoaded) {
1149
+ $this->form = $this->wpdiscuzForm->getForm($post->ID);
1150
+ $this->form->initFormMeta();
1151
+ $this->wpdiscuzOptionsJs = $this->options->getOptionsForJs();
1152
+ $this->wpdiscuzOptionsJs["version"] = $this->version;
1153
+ $this->wpdiscuzOptionsJs["wc_post_id"] = $post->ID;
1154
+ $this->wpdiscuzOptionsJs["isCookiesEnabled"] = has_action("set_comment_cookies");
1155
+ $this->wpdiscuzOptionsJs["loadLastCommentId"] = 0;
1156
+ $this->wpdiscuzOptionsJs[WpDiscuzConstants::GLOBAL_NONCE_NAME] = $this->helper->generateNonce();
1157
+
1158
+ if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
1159
+ $cArgs = $this->getDefaultCommentsArgs($post->ID);
1160
+ $this->wpdiscuzOptionsJs["loadLastCommentId"] = $this->dbManager->getLastCommentId($cArgs);
1161
+ }
1162
+ $this->wpdiscuzOptionsJs["dataFilterCallbacks"] = [];
1163
+ $this->wpdiscuzOptionsJs["phraseFilters"] = [];
1164
+ $this->wpdiscuzOptionsJs["scrollSize"] = 32;
1165
+ $this->wpdiscuzOptionsJs = apply_filters("wpdiscuz_js_options", $this->wpdiscuzOptionsJs, $this->options);
1166
+ $this->wpdiscuzOptionsJs["url"] = admin_url("admin-ajax.php");
1167
+ $this->wpdiscuzOptionsJs["customAjaxUrl"] = plugins_url(WPDISCUZ_DIR_NAME . "/utils/ajax/wpdiscuz-ajax.php");
1168
+ $this->wpdiscuzOptionsJs["bubbleUpdateUrl"] = rest_url("wpdiscuz/v1/update");
1169
+ $this->wpdiscuzOptionsJs["restNonce"] = wp_create_nonce("wp_rest");
1170
+ $loadQuill = $this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop");
1171
+ $customCSSSlug = "wpdiscuz-frontend-custom-css";
1172
+ $customFileName = "style-custom";
1173
+ if (is_rtl()) {
1174
+ $customCSSSlug = "wpdiscuz-frontend-custom-rtl-css";
1175
+ $customFileName = "style-custom-rtl";
1176
+ if ($this->options->thread_styles["theme"] === "wpd-minimal") {
1177
+ $cssSlug = "wpdiscuz-frontend-minimal-rtl-css";
1178
+ $fileName = "style-minimal-rtl";
1179
+ } else {
1180
+ $cssSlug = "wpdiscuz-frontend-rtl-css";
1181
+ $fileName = "style-rtl";
1182
+ }
1183
+ } else if ($this->options->thread_styles["theme"] === "wpd-minimal") {
1184
+ $cssSlug = "wpdiscuz-frontend-minimal-css";
1185
+ $fileName = "style-minimal";
1186
+ } else {
1187
+ $cssSlug = "wpdiscuz-frontend-css";
1188
+ $fileName = "style";
1189
+ }
1190
+ $this->helper->enqueueWpDiscuzStyle($cssSlug, $fileName, $this->version, $this->form);
1191
+ $this->helper->enqueueWpDiscuzStyle($customCSSSlug, $customFileName, $this->version, $this->form);
1192
+ wp_add_inline_style($cssSlug, $this->helper->initCustomCss());
1193
+ $ucArgs = [
1194
+ "msgConfirmDeleteComment" => esc_html($this->options->getPhrase("wc_confirm_comment_delete")),
1195
+ "msgConfirmCancelSubscription" => esc_html($this->options->getPhrase("wc_confirm_cancel_subscription")),
1196
+ "msgConfirmCancelFollow" => esc_html($this->options->getPhrase("wc_confirm_cancel_follow")),
1197
+ "additionalTab" => (int) apply_filters("wpdiscuz_enable_content_modal", false),
1198
+ ];
1199
+ if ($this->options->thread_styles["enableFontAwesome"]) {
1200
+ if ($this->form->hasIcon) {
1201
+ wp_enqueue_style("wpdiscuz-font-awesome");
1202
+ } else {
1203
+ wp_register_style("wpdiscuz-fa", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fa.min.css"), null, $this->version);
1204
+ wp_enqueue_style("wpdiscuz-fa");
1205
+ }
1206
+ }
1207
+ if ($this->options->general["loadComboVersion"]) {
1208
+ $combo_js = "";
1209
+ $combo_css = "";
1210
+ if (!$loadQuill) {
1211
+ $combo_js = "-no_quill";
1212
+ $combo_css = "-no_quill";
1213
+ }
1214
+ wp_register_style("wpdiscuz-combo-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-combo$combo_css.min.css"));
1215
+ wp_enqueue_style("wpdiscuz-combo-css");
1216
+ wp_register_script("wpdiscuz-combo-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-combo$combo_js.min.js"), ["jquery"], $this->version, true);
1217
+ wp_enqueue_script("wpdiscuz-combo-js");
1218
+ wp_localize_script("wpdiscuz-combo-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
1219
+ wp_localize_script("wpdiscuz-combo-js", "wpdiscuzUCObj", $ucArgs);
1220
+ if ($loadQuill) {
1221
+ wp_add_inline_script("wpdiscuz-combo-js", $this->options->editorOptions(), "before");
1222
+ }
1223
+ } else {
1224
+ wp_register_script("wpdiscuz-cookie-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
1225
+ wp_enqueue_script("wpdiscuz-cookie-js");
1226
+ //
1227
+ if ($loadQuill) {
1228
+ wp_register_style("quill-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/quill/quill.snow$suf.css"), null, "1.3.6");
1229
+ wp_enqueue_style("quill-css");
1230
+ wp_register_script("quill", plugins_url("/assets/third-party/quill/quill$suf.js", __FILE__), ["wpdiscuz-cookie-js"], "1.3.6", true);
1231
+ wp_enqueue_script("quill");
1232
+ wp_add_inline_script("quill", $this->options->editorOptions(), "before");
1233
+ wp_register_script("wpd-editor", plugins_url("/assets/js/wpd-editor$suf.js", __FILE__), ["quill"], "1.3.6", true);
1234
+ wp_enqueue_script("wpd-editor");
1235
+ }
1236
+ wp_register_script("autogrowtextarea-js", plugins_url("/assets/third-party/autogrow/jquery.autogrowtextarea.min.js", __FILE__), ["jquery"], "1.3.6", true);
1237
+ wp_enqueue_script("autogrowtextarea-js");
1238
+ wp_register_script("wpdiscuz-ajax-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz$suf.js"), [$loadQuill ? "wpd-editor" : "jquery"], $this->version, true);
1239
+ wp_enqueue_script("wpdiscuz-ajax-js");
1240
+ wp_localize_script("wpdiscuz-ajax-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
1241
+ //
1242
+ if ($this->options->content["wmuIsEnabled"]) {
1243
+ // Media Upload Lightbox
1244
+ if ($this->options->content["wmuIsLightbox"]) {
1245
+ wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox$suf.css"));
1246
+ wp_enqueue_style("wmu-colorbox-css");
1247
+ wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox$suf.js"), ["jquery"], $this->version, true);
1248
+ wp_enqueue_script("wmu-colorbox-js");
1249
+ }
1250
+ wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-frontend$suf.css"));
1251
+ wp_enqueue_style("wpdiscuz-mu-css");
1252
+ wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-frontend$suf.js"), ["wpdiscuz-ajax-js"], $this->version, true);
1253
+ wp_enqueue_script("wpdiscuz-mu-js");
1254
+ }
1255
+ if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
1256
+ wp_register_style("wpdiscuz-user-content-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-user-content$suf.css"), null, $this->version);
1257
+ wp_enqueue_style("wpdiscuz-user-content-css");
1258
+ wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity$suf.js"), ["jquery"], $this->version, true);
1259
+ wp_enqueue_script("wpdiscuz-lity-js");
1260
+ wp_register_script("wpdiscuz-user-content-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-user-content$suf.js"), ["wpdiscuz-lity-js"], $this->version, true);
1261
+ wp_enqueue_script("wpdiscuz-user-content-js");
1262
+ wp_localize_script("wpdiscuz-user-content-js", "wpdiscuzUCObj", $ucArgs);
1263
+ }
1264
+ }
1265
+ if ($this->form->showRecaptcha() && apply_filters("wpdiscuz_recaptcha_site_key", $this->options->recaptcha["siteKey"]) && apply_filters("wpdiscuz_recaptcha_secret", $this->options->recaptcha["secretKey"])) {
1266
+ wp_register_script("wpdiscuz-google-recaptcha", apply_filters("wpdiscuz_recaptcha_url", $this->options->recaptcha["reCaptchaUrl"]), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], "1.0.0", true);
1267
+ wp_enqueue_script("wpdiscuz-google-recaptcha");
1268
+ }
1269
+ if (!$loadQuill && $this->options->form["enableQuickTags"]) {
1270
+ wp_enqueue_script("quicktags");
1271
+ wp_register_script("wpdiscuz-quicktags", plugins_url("/assets/third-party/quicktags/wpdiscuz-quictags.js", __FILE__), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], $this->version, true);
1272
+ wp_enqueue_script("wpdiscuz-quicktags");
1273
+ }
1274
+ do_action("wpdiscuz_front_scripts", $this->options);
1275
+ }
1276
+ }
1277
+
1278
+ public function uninstall() {
1279
+ if (is_admin() && !empty($_GET["action"]) && $_GET["action"] === "wpdiscuz-uninstall") {
1280
+ if (check_admin_referer("wpdiscuz_uninstall") && current_user_can("manage_options")) {
1281
+ $this->dbManager->deleteCommentMeta(self::META_KEY_VOTES);
1282
+ $this->dbManager->deleteCommentMeta(self::META_KEY_VOTES_SEPARATE);
1283
+ $this->dbManager->deleteCommentMeta(self::META_KEY_CLOSED);
1284
+ $this->dbManager->deleteCommentMeta(self::META_KEY_FEEDBACK_FORM_ID);
1285
+ $this->dbManager->deleteCommentMeta(self::META_KEY_LAST_EDITED_AT);
1286
+ $this->dbManager->deleteCommentMeta(self::META_KEY_LAST_EDITED_BY);
1287
+
1288
+ $this->dbManager->makeStickyCommentsRegular();
1289
+
1290
+ $this->dbManager->deleteStatisticCaches();
1291
+ $this->dbManager->deletePostMeta(self::POSTMETA_RATING_COUNT);
1292
+ $this->dbManager->deletePostMeta(self::POSTMETA_POST_RATING);
1293
+ $this->dbManager->deletePostMeta(self::POSTMETA_POST_RATING_COUNT);
1294
+ $this->dbManager->deleteFieldsRatingsPostMeta();
1295
  foreach (get_posts(["numberposts" => -1, "post_type" => "wpdiscuz_form"]) as $form) {
1296
+ wp_delete_post($form->ID, true);
1297
+ }
1298
+
1299
+ $this->dbManager->deleteUserMeta(self::USERMETA_LAST_VISIT);
1300
+
1301
+ delete_option(self::OPTION_SLUG_OPTIONS);
1302
+ delete_option(self::OPTION_SLUG_VERSION);
1303
+ delete_option(self::OPTION_SLUG_DEACTIVATION);
1304
+ delete_option(self::OPTION_SLUG_SHOW_DEMO);
1305
+ delete_option(self::OPTION_SLUG_HASH_KEY);
1306
+ delete_option(self::OPTION_SLUG_SHOW_VOTE_REG_MESSAGE);
1307
+ delete_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE);
1308
+ delete_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE);
1309
+ delete_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE);
1310
+ delete_option(self::OPTION_SLUG_WIZARD_COMPLETED);
1311
+ delete_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE);
1312
+ delete_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG);
1313
+ delete_option(self::OPTION_SLUG_SHOW_RATING_REBUIL_MSG);
1314
+ delete_option("wpdiscuz_form_content_type_rel");
1315
+ delete_option("wpdiscuz_form_post_rel");
1316
+
1317
+ if (!class_exists("WP_Filesystem_Direct")) {
1318
+ require_once ABSPATH . "wp-admin/includes/class-wp-filesystem-base.php";
1319
+ require_once ABSPATH . "wp-admin/includes/class-wp-filesystem-direct.php";
1320
  }
1321
+ $fs = new WP_Filesystem_Direct([]);
1322
+ $path = wp_upload_dir();
1323
+ $fs->rmdir($path["basedir"] . self::WPDISCUZ_CACHE_DIR, true);
1324
+
1325
+ $this->dbManager->dropTables();
1326
+
1327
+ deactivate_plugins(plugin_basename(__FILE__));
1328
+ }
1329
+ wp_safe_redirect(admin_url("plugins.php"));
1330
+ exit();
1331
+ }
1332
+ }
1333
+
1334
+ public function pluginNewVersion() {
1335
+ $pluginData = get_plugin_data(__FILE__);
1336
+ if (version_compare($pluginData["Version"], $this->version, ">")) {
1337
+ $this->dbManager->dbCreateTables();
1338
+ $this->wpdiscuzForm->createDefaultForm($this->version);
1339
+ $options = $this->changeOldOptions(get_option(self::OPTION_SLUG_OPTIONS), $pluginData);
1340
+ if ($this->version === "5.3.2") {
1341
+ $this->mergeOptions($options);
1342
+ } else {
1343
+ $this->addNewOptions($options);
1344
+ }
1345
+ $this->addNewPhrases();
1346
+ update_option(self::OPTION_SLUG_VERSION, $pluginData["Version"]);
1347
 
1348
+ if (version_compare($this->version, "2.1.2", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1349
+ $this->dbManager->alterPhrasesTable();
1350
+ }
1351
+
1352
+ if (version_compare($this->version, "2.1.7", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1353
+ $this->dbManager->alterVotingTable();
1354
+ }
1355
+
1356
+ if (version_compare($this->version, "5.0.5", "<=") && version_compare($this->version, "1.0.0", "!=")) {
1357
+ $this->dbManager->alterNotificationTable();
1358
+ }
1359
+
1360
+ if (version_compare($this->version, "5.1.2", "<=")) {
1361
+ $this->dbManager->deleteOldStatisticCaches();
1362
+ }
1363
+
1364
+ if (version_compare($this->version, "7.0.0", "<")) {
1365
+ $this->deactivateAddons();
1366
+ if (version_compare($this->version, "1.0.0", "!=") && version_compare($this->version, "7.0.0-beta-1", "<")) {
1367
+ $this->dbManager->alterVotingTableForDateAndPostId();
1368
+ $this->options->replaceOldOptions($options);
1369
+ }
1370
+ $this->setRecaptchaOptions($options);
1371
+ $showVoteRegenerate = intval($this->dbManager->showVoteRegenerate());
1372
+ add_option(self::OPTION_SLUG_SHOW_VOTE_REG_MESSAGE, ($showVoteRegenerate ? "1" : "0"), "", "no");
1373
+ $showClosedRegenerate = intval($this->dbManager->showClosedRegenerate());
1374
+ add_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE, ($showClosedRegenerate ? "1" : "0"), "", "no");
1375
+ $showVoteDataRegenerate = intval($this->dbManager->showVoteDataRegenerate());
1376
+ add_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE, ($showVoteDataRegenerate ? "1" : "0"), "", "no");
1377
+ add_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE, ($this->dbManager->usersHaveComments() ? "1" : "0"), "", "no");
1378
+ add_option(self::OPTION_SLUG_WIZARD_COMPLETED, "0", "", "no");
1379
+ add_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE, ($this->version === "1.0.0" ? "0" : "1"), "", "no");
1380
+ $this->removeOldFiles();
1381
+ $this->dbManager->deleteStatisticCaches();
1382
+ if (($advancedNocaptcha = get_option("anr_admin_options")) && !empty($advancedNocaptcha["enabled_forms"]) && ($key = array_search("comment", $advancedNocaptcha["enabled_forms"]))) {
1383
+ unset($advancedNocaptcha["enabled_forms"][$key]);
1384
+ update_option("anr_admin_options", $advancedNocaptcha);
1385
+ }
1386
+ if (($invisibleRecaptcha = get_option("ic-wordpress-settings")) && !empty($invisibleRecaptcha["CF"])) {
1387
+ unset($invisibleRecaptcha["CF"]);
1388
+ update_option("ic-wordpress-settings", $invisibleRecaptcha);
1389
+ }
1390
+ }
1391
+ if (version_compare($this->version, "7.0.3", "<") && version_compare($this->version, "1.0.0", "!=")) {
1392
+ $this->dbManager->alterSubscriptionTable();
1393
+ }
1394
+ if (version_compare($this->version, "7.1.4", "<") && version_compare($this->version, "1.0.0", "!=")) {
1395
+ $showRatingRebuildMsg = intval($this->dbManager->showRatingRebuildMsg());
1396
+ add_option(self::OPTION_SLUG_SHOW_RATING_REBUIL_MSG, ($showRatingRebuildMsg ? "1" : "0"), "", "no");
1397
+ }
1398
+ if (version_compare($this->version, "7.3.0", "<") && version_compare($this->version, "1.0.0", "!=")) {
1399
+ wp_clear_scheduled_hook("wpdiscuz_gravatars_cache_add");
1400
+ wp_clear_scheduled_hook("wpdiscuz_gravatars_cache_delete");
1401
+ $this->cache->deleteGravatarsFolder();
1402
+ $this->dbManager->deleteGravatarsTable();
1403
  }
1404
+ do_action("wpdiscuz_clean_all_caches", $pluginData["Version"], $this->version);
1405
+ }
1406
+ do_action("wpdiscuz_check_version");
1407
+ }
1408
+
1409
+ /**
1410
+ * remove old captcha files
1411
+ */
1412
+ private function removeOldFiles() {
1413
+ $wpUploadsDir = wp_upload_dir();
1414
+ $captchaDir = $wpUploadsDir["basedir"] . "/wpdiscuz/captcha/";
1415
+ if (file_exists($captchaDir)) {
1416
+ $files = function_exists("scandir") ? scandir($captchaDir) : false;
1417
+ if ($files && is_array($files)) {
1418
+ foreach ($files as $file) {
1419
+ if ($file !== "." && $file !== "..") {
1420
+ $fileName = $captchaDir . $file;
1421
+ if (is_file($fileName)) {
1422
+ @unlink($fileName);
1423
+ } else {
1424
+ @rmdir($fileName);
1425
+ }
1426
+ }
1427
+ }
1428
+ }
1429
+ @rmdir($captchaDir);
1430
+ }
1431
+ }
1432
+
1433
+ private function deactivateAddons() {
1434
+ $plugins = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1435
  if (is_plugin_active("wpdiscuz-buddypress-integration/wpDiscuzBPIntegration.php")) {
1436
  $plugins[] = "wpdiscuz-buddypress-integration/wpDiscuzBPIntegration.php";
1437
  }
1438
+ if (is_plugin_active("wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php")) {
1439
+ $plugins[] = "wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php";
1440
+ }
1441
+ if (is_plugin_active("wpdiscuz-advanced-likers/class.WpdiscuzVoters.php")) {
1442
+ $plugins[] = "wpdiscuz-advanced-likers/class.WpdiscuzVoters.php";
1443
+ }
1444
+ if (is_plugin_active("wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php")) {
1445
+ $plugins[] = "wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php";
1446
+ }
1447
+ if (is_plugin_active("wpdiscuz-comment-search/wpDiscuzCommentSearch.php")) {
1448
+ $plugins[] = "wpdiscuz-comment-search/wpDiscuzCommentSearch.php";
1449
+ }
1450
+ if (is_plugin_active("wpdiscuz-comment-translation/wpdiscuz-translate.php")) {
1451
+ $plugins[] = "wpdiscuz-comment-translation/wpdiscuz-translate.php";
1452
+ }
1453
+ if (is_plugin_active("wpdiscuz-emoticons/wpDiscuzSmile.php")) {
1454
+ $plugins[] = "wpdiscuz-emoticons/wpDiscuzSmile.php";
1455
+ }
1456
+ if (is_plugin_active("wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php")) {
1457
+ $plugins[] = "wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php";
1458
+ }
1459
+ if (is_plugin_active("wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php")) {
1460
+ $plugins[] = "wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php";
1461
+ }
1462
+ if (is_plugin_active("wpdiscuz-mycred/wpdiscuz-mc.php")) {
1463
+ $plugins[] = "wpdiscuz-mycred/wpdiscuz-mc.php";
1464
+ }
1465
+ if (is_plugin_active("wpdiscuz-online-users/wpdiscuz-ou.php")) {
1466
+ $plugins[] = "wpdiscuz-online-users/wpdiscuz-ou.php";
1467
+ }
1468
+ if (is_plugin_active("wpdiscuz-recaptcha/wpDiscuzReCaptcha.php")) {
1469
+ $plugins[] = "wpdiscuz-recaptcha/wpDiscuzReCaptcha.php";
1470
+ }
1471
+ if (is_plugin_active("wpdiscuz-report-flagging/wpDiscuzFlagComment.php")) {
1472
+ $plugins[] = "wpdiscuz-report-flagging/wpDiscuzFlagComment.php";
1473
+ }
1474
+ if (is_plugin_active("wpdiscuz-subscribe-manager/wpdSubscribeManager.php")) {
1475
+ $plugins[] = "wpdiscuz-subscribe-manager/wpdSubscribeManager.php";
1476
+ }
1477
+ if (is_plugin_active("wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php")) {
1478
+ $plugins[] = "wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php";
1479
+ }
1480
+ if (is_plugin_active("wpdiscuz-widgets/wpDiscuzWidgets.php")) {
1481
+ $plugins[] = "wpdiscuz-widgets/wpDiscuzWidgets.php";
1482
+ }
1483
+ if ($plugins) {
1484
+ deactivate_plugins($plugins);
1485
+ add_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG, "1", "", "no");
1486
+ }
1487
+ }
1488
+
1489
+ /**
1490
+ * set recaptcha options
1491
+ */
1492
+ private function setRecaptchaOptions($options) {
1493
+ if (!$options[self::TAB_RECAPTCHA]["siteKey"] && ($recaptchaSettings = get_option("wpdiscuz_recaptcha"))) {
1494
+ $options[self::TAB_RECAPTCHA]["siteKey"] = $recaptchaSettings["site_key"];
1495
+ $options[self::TAB_RECAPTCHA]["secretKey"] = $recaptchaSettings["secret_key"];
1496
+ $options[self::TAB_RECAPTCHA]["theme"] = $recaptchaSettings["theme"];
1497
+ $options[self::TAB_RECAPTCHA]["lang"] = $recaptchaSettings["lang"];
1498
+ $options[self::TAB_RECAPTCHA]["showForGuests"] = 1;
1499
+ $options[self::TAB_RECAPTCHA]["requestMethod"] = $recaptchaSettings["request_method"];
1500
+ $options[self::TAB_RECAPTCHA]["isShowOnSubscribeForm"] = $recaptchaSettings["isShowOnSubscribeForm"] === "on" ? 1 : 0;
1501
+ $this->options->initOptions($options);
1502
+ $this->options->updateOptions();
1503
+ }
1504
+ }
1505
+
1506
+ /**
1507
+ * merge old and new options
1508
+ */
1509
+ private function addNewOptions(&$options) {
1510
+ $options = array_merge($this->options->getDefaultOptions(), $options);
1511
+ $this->options->initOptions($options);
1512
+ $this->options->updateOptions();
1513
+ }
1514
+
1515
+ /**
1516
+ * merge old and new options recursively
1517
+ */
1518
+ private function mergeOptions(&$options) {
1519
+ $newOptions = [];
1520
+ $defaults = $this->options->getDefaultOptions();
1521
+ foreach ($options as $key => $value) {
1522
+ $newOptions[$key] = array_merge($defaults[$key], $value);
1523
+ }
1524
+ $options = $newOptions;
1525
+ $this->options->initOptions($options);
1526
+ $this->options->updateOptions();
1527
+ }
1528
+
1529
+ /**
1530
+ * merge old and new phrases
1531
+ */
1532
+ private function addNewPhrases() {
1533
+ if ($this->dbManager->isPhraseExists("wc_be_the_first_text")) {
1534
+ $wc_saved_phrases = $this->dbManager->getPhrases();
1535
+ $this->options->initPhrases();
1536
+ $wc_phrases = $this->options->phrases;
1537
+ $wc_new_phrases = array_merge($wc_phrases, $wc_saved_phrases);
1538
+ $this->dbManager->updatePhrases($wc_new_phrases);
1539
+ }
1540
+ }
1541
+
1542
+ /**
1543
+ * change old options if needed
1544
+ */
1545
+ private function changeOldOptions($options, $pluginData) {
1546
+ $oldOptions = maybe_unserialize($options);
1547
+ if (isset($oldOptions["wc_comment_list_order"])) {
1548
+ update_option("comment_order", $oldOptions["wc_comment_list_order"]);
1549
+ }
1550
+ if (isset($oldOptions["wc_comment_count"])) {
1551
+ update_option("comments_per_page", $oldOptions["wc_comment_count"]);
1552
+ }
1553
+ if (isset($oldOptions["wc_load_all_comments"])) {
1554
+ $this->options->commentListLoadType = 1;
1555
+ }
1556
+ if (isset($this->options->disableFontAwesome) && $this->options->disableFontAwesome && $pluginData["Version"] === "5.0.4") {
1557
+ $this->options->disableFontAwesome = 0;
1558
+ $oldOptions["disableFontAwesome"] = 0;
1559
+ }
1560
+
1561
+ if (version_compare($this->version, "5.2.1", "<=")) {
1562
+ $oldOptions["isNativeAjaxEnabled"] = 1;
1563
+ }
1564
+ if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.2", "<")) {
1565
+ $oldOptions[self::TAB_RATING]["enablePostRatingSchema"] = 0;
1566
+ }
1567
+ if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.4", "<")) {
1568
+ $newMimeTypes = [];
1569
+ foreach ($oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] as $exts => $type) {
1570
+ foreach (explode('|', $exts) as $ext) {
1571
+ $newMimeTypes[$ext] = $type;
1572
+ }
1573
+ }
1574
+ $oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] = $newMimeTypes;
1575
+ }
1576
+
1577
+ return $oldOptions;
1578
+ }
1579
+
1580
+ // Add settings link on plugin page
1581
+ public function addPluginSettingsLink($links) {
1582
+ $links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)) . "'>" . esc_html__("Settings", "wpdiscuz") . "</a>";
1583
+ $links[] = "<a href='" . esc_url_raw(wp_nonce_url(admin_url("plugins.php?action=wpdiscuz-uninstall"), "wpdiscuz_uninstall")) . "' style='color:#b32d2e;' onclick='return confirm(\"" . __("IMPORTANT! Uninstall is not a simple deactivation action. This action will permanently remove all data added by wpDiscuz (comment subscriptions, attachments, like/dislikes, and all other data that do not exist in the native comment system...) from database. Please backup database before this action. If you are sure that you want to delete all wpDiscuz data please confirm. If not, just cancel it, then you can deactivate this plugin.", "wpdiscuz") . "\")'>" . esc_html__("Uninstall", "wpdiscuz") . "</a>";
1584
+ return $links;
1585
+ }
1586
+
1587
+ public function initCurrentPostType() {
1588
+ global $post;
1589
+ if ($this->isWpdiscuzLoaded) {
1590
+ $this->form = $this->wpdiscuzForm->getForm($post->ID);
1591
+ add_filter("comments_template", [&$this, "addCommentForm"], 9999999);
1592
+ }
1593
+ }
1594
+
1595
+ public function addContentModal() {
1596
+ echo "<a href='javascript:void(0);' id='wpdUserContentInfoAnchor' style='display:none;' rel='#wpdUserContentInfo' data-wpd-lity>wpDiscuz</a>";
1597
+ echo "<div id='wpdUserContentInfo' style='overflow:auto;background:#FDFDF6;padding:20px;width:600px;max-width:100%;border-radius:6px;' class='lity-hide'></div>";
1598
+ }
1599
+
1600
+ public function saveLastVisit($post) {
1601
+ $currentUser = WpdiscuzHelper::getCurrentUser();
1602
+ if (!empty($currentUser->ID)) {
1603
+ $lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true);
1604
+ $lastVisit = is_array($lastVisit) ? $lastVisit : [];
1605
+ $lastVisit[$post->ID] = current_time("timestamp");
1606
+ update_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, $lastVisit);
1607
+ }
1608
+ }
1609
+
1610
+ public function addCommentForm() {
1611
+ return $this->helper->getCommentFormPath($this->form->getTheme());
1612
+ }
1613
+
1614
+ public function getCommentListArgs($postId) {
1615
+ $post = get_post($postId);
1616
+ $postsAuthors = $post->comment_count && $this->options->login["enableProfileURLs"] ? $this->dbManager->getPostsAuthors() : [];
1617
+ $voteSvgs = [
1618
+ "fa-plus|fa-minus" => [
1619
+ "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='plus' class='svg-inline--fa fa-plus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
1620
+ "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='minus' class='svg-inline--fa fa-minus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
1621
+ ],
1622
+ "fa-chevron-up|fa-chevron-down" => [
1623
+ "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-up' class='svg-inline--fa fa-chevron-up fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z'></path></svg>",
1624
+ "<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-down' class='svg-inline--fa fa-chevron-down fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z'></path></svg>",
1625
+ ],
1626
+ "fa-thumbs-up|fa-thumbs-down" => [
1627
+ "<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0V0z'/><path d='M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z'/></svg>",
1628
+ "<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0z'/><path d='M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z'/></svg>",
1629
+ ],
1630
+ "fa-smile|fa-frown" => [
1631
+ "<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='smile' class='svg-inline--fa fa-smile fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z'></path></svg>",
1632
+ "<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='frown' class='svg-inline--fa fa-frown fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160-64c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-80 128c-40.2 0-78 17.7-103.8 48.6-8.5 10.2-7.1 25.3 3.1 33.8 10.2 8.4 25.3 7.1 33.8-3.1 16.6-19.9 41-31.4 66.9-31.4s50.3 11.4 66.9 31.4c8.1 9.7 23.1 11.9 33.8 3.1 10.2-8.5 11.5-23.6 3.1-33.8C326 321.7 288.2 304 248 304z'></path></svg>",
1633
+ ],
1634
+ ];
1635
+ $currentUser = WpdiscuzHelper::getCurrentUser();
1636
+ $currentUserEmail = "";
1637
+ $isUserLoggedIn = false;
1638
+ if (!empty($currentUser->ID)) {
1639
+ $currentUserEmail = $currentUser->user_email;
1640
+ $isUserLoggedIn = true;
1641
+ } else if (!empty($_COOKIE["comment_author_email_" . COOKIEHASH])) {
1642
+ $currentUserEmail = urldecode(trim($_COOKIE["comment_author_email_" . COOKIEHASH]));
1643
+ }
1644
+ $this->form = $this->wpdiscuzForm->getForm($postId);
1645
+ $high_level_user = current_user_can("moderate_comments");
1646
+ $can_stick_or_close = $post->post_author == $currentUser->ID;
1647
+ $post_permalink = get_permalink($postId);
1648
+ $theme = $this->form->getTheme();
1649
+ $layout = $this->form->getLayout();
1650
+ $replyForWoo = apply_filters("wpdiscuz_product_review_replies", true, $postId);
1651
+ $isMobile = wp_is_mobile();
1652
+ include_once $this->helper->getWalkerPath($theme);
1653
+ $args = [
1654
+ "style" => "div",
1655
+ "echo" => false,
1656
+ "isSingle" => false,
1657
+ "reverse_top_level" => false,
1658
+ "post_id" => $postId,
1659
+ "reverse_children" => !$this->options->thread_display["reverseChildren"],
1660
+ "post_author" => $post->post_author,
1661
+ "posts_authors" => $postsAuthors,
1662
+ "voting_icons" => $voteSvgs[$this->options->thread_layouts["votingButtonsIcon"]],
1663
+ "high_level_user" => $high_level_user,
1664
+ "avatar_trackback" => apply_filters("wpdiscuz_avatar_trackback", plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/trackback.png")),
1665
+ "wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 64),
1666
+ "can_stick_or_close" => $can_stick_or_close,
1667
+ "user_follows" => $this->dbManager->getUserFollows($currentUserEmail),
1668
+ "current_user" => $currentUser,
1669
+ "current_user_email" => $currentUserEmail,
1670
+ "is_share_enabled" => $this->options->isShareEnabled(),
1671
+ "post_permalink" => $post_permalink,
1672
+ "can_user_reply" => comments_open($post->ID) && $this->options->wp["threadComments"] && (($this->form ? $this->form->isUserCanComment($currentUser, $postId) : true) || $high_level_user) && !(class_exists("WooCommerce") && get_post_type($post) === "product" && !$replyForWoo),
1673
+ "can_user_follow" => $this->options->subscription["isFollowActive"] && $isUserLoggedIn && !empty($currentUserEmail) && $this->helper->isUserCanFollowOrSubscribe($currentUserEmail),
1674
+ "can_user_vote" => $currentUser->ID || $this->options->thread_layouts["isGuestCanVote"],
1675
+ "wpd_stick_btn" => $this->options->moderation["enableStickButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_stick_btn wpd-cta-button'>%s</span>" : "",
1676
+ "wpd_close_btn" => $this->options->moderation["enableCloseButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_close_btn wpd-cta-button'>%s</span>" : "",
1677
+ "is_wpdiscuz_comment" => true,
1678
+ "share_buttons" => "",
1679
+ "feedback_content_words_count" => apply_filters("wpdiscuz_feedback_content_words_count", 20),
1680
+ "user_votes" => [],
1681
+ "last_visit" => $this->options->thread_display["highlightUnreadComments"] && ($lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true)) && !empty($lastVisit[$postId]) ? $lastVisit[$postId] : "",
1682
+ "site_url" => get_site_url(),
1683
+ "layout" => $layout,
1684
+ "components" => $this->helper->getComponents($theme, $layout),
1685
+ "follow_tooltip_position" => $layout ? (!is_rtl() ? ($isMobile ? 'left' : 'right') : ($isMobile ? 'right' : 'left')) : "top",
1686
+ "walker" => new WpdiscuzWalker($this->helper, $this->helperOptimization, $this->dbManager, $this->options, $this->cache),
1687
+ "commentsArgs" => $this->commentsArgs,
1688
+ ];
1689
+ if ($this->options->social["enableFbShare"] && $this->options->social["fbAppID"]) {
1690
+ $args["share_buttons"] .= "<span class='wc_fb'><i class='fab fa-facebook-f wpf-cta' aria-hidden='true' title='" . esc_attr($this->options->getPhrase("wc_share_facebook")) . "'></i></span>";
1691
+ }
1692
+ if ($this->options->social["enableVkShare"]) {
1693
+ $args["share_buttons"] .= "<a class='wc_vk' rel='noreferrer' target='_blank' href='https://vk.com/share.php?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->getPhrase("wc_share_vk")) . "'><i class='fab fa-vk wpf-cta' aria-hidden='true'></i></a>";
1694
+ }
1695
+ if ($this->options->social["enableOkShare"]) {
1696
+ $args["share_buttons"] .= "<a class='wc_ok' rel='noreferrer' target='_blank' href='https://connect.ok.ru/offer?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->getPhrase("wc_share_ok")) . "'><i class='fab fa-odnoklassniki wpf-cta' aria-hidden='true'></i></a>";
1697
+ }
1698
+ if ($this->options->social["enableWhatsappShare"]) {
1699
+ $args["whatsapp_url"] = $isMobile ? "https://api.whatsapp.com" : "https://web.whatsapp.com";
1700
+ }
1701
+ return apply_filters("wpdiscuz_comment_list_args", $args);
1702
+ }
1703
+
1704
+ public function addNewRoles() {
1705
+ global $wp_roles;
1706
+ $roles = apply_filters("editable_roles", $wp_roles->roles);
1707
+ $newBlogRoles = [];
1708
+ $newBlogRoleLabels = [];
1709
+ $newRolePhrases = [];
1710
+ foreach ($roles as $roleName => $roleInfo) {
1711
+ $newBlogRoles[$roleName] = isset($this->options->labels["blogRoles"][$roleName]) ? $this->options->labels["blogRoles"][$roleName] : "#00B38F";
1712
+ if ($roleName === "administrator") {
1713
+ $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1714
+ $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
1715
+ } elseif ($roleName === "post_author") {
1716
+ $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1717
+ $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
1718
+ } elseif ($roleName === "editor") {
1719
+ $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
1720
+ $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
1721
+ } else {
1722
+ $newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 0;
1723
+ $newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
1724
+ }
1725
+ }
1726
+ $newBlogRoles["post_author"] = isset($this->options->labels["blogRoles"]["post_author"]) ? $this->options->labels["blogRoles"]["post_author"] : "#00B38F";
1727
+ $newBlogRoleLabels["post_author"] = isset($this->options->labels["blogRoleLabels"]["post_author"]) ? $this->options->labels["blogRoleLabels"]["post_author"] : 1;
1728
+ $newBlogRoles["guest"] = isset($this->options->labels["blogRoles"]["guest"]) ? $this->options->labels["blogRoles"]["guest"] : "#00B38F";
1729
+ $newBlogRoleLabels["guest"] = isset($this->options->labels["blogRoleLabels"]["guest"]) ? $this->options->labels["blogRoleLabels"]["guest"] : 0;
1730
+ $newRolePhrases["wc_blog_role_post_author"] = isset($this->options->phrases["wc_blog_role_post_author"]) ? $this->options->phrases["wc_blog_role_post_author"] : esc_html__("Author", "wpdiscuz");
1731
+ $newRolePhrases["wc_blog_role_guest"] = isset($this->options->phrases["wc_blog_role_guest"]) ? $this->options->phrases["wc_blog_role_guest"] : esc_html__("Guest", "wpdiscuz");
1732
+ foreach ($this->options->phrases as $key => $value) {
1733
+ if (strpos("wc_blog_role_", $key) === 0) {
1734
+ unset($this->options->phrases[$key]);
1735
+ }
1736
+ }
1737
+ foreach ($newRolePhrases as $key => $value) {
1738
+ $this->options->phrases[$key] = $value;
1739
+ }
1740
+ $this->options->labels["blogRoles"] = $newBlogRoles;
1741
+ $this->options->labels["blogRoleLabels"] = $newBlogRoleLabels;
1742
+ }
1743
+
1744
+ public function showReplies() {
1745
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1746
+ $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
1747
+ if ($postId) {
1748
+ $this->isWpdiscuzLoaded = true;
1749
+ $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1750
+ $commentListArgs = $this->getCommentListArgs($postId);
1751
+ if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1752
+ $this->commentsArgs["parent"] = $commentId;
1753
+ $this->commentsArgs["number"] = null;
1754
+ $comment = get_comment($commentId);
1755
+ $args = [
1756
+ "format" => "flat",
1757
+ "status" => $this->commentsArgs["status"],
1758
+ "orderby" => $this->commentsArgs["orderby"],
1759
+ "post_id" => $this->commentsArgs["post_id"],
1760
+ "update_comment_meta_cache" => false,
1761
+ "no_found_rows" => false,
1762
+ "update_comment_post_cache" => false,
1763
  ];
1764
  if (!empty($this->commentsArgs["include_unapproved"])) {
1765
  $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1766
  }
1767
+ $children = $comment->get_children($args);
1768
  $commentListArgs["wpdiscuz_child_count_" . $comment->comment_ID] = count($children);
1769
+ $comments = array_merge([$comment], $children);
1770
  if ($comments) {
1771
  $response = [];
1772
  if ($this->options->thread_layouts["highlightVotingButtons"]) {
1776
  $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1777
  }
1778
  }
1779
+ $response["comment_list"] = wp_list_comments($commentListArgs, $comments);
1780
  $response["callbackFunctions"] = [];
1781
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1782
  wp_send_json_success($response);
1783
  }
1784
+ }
1785
+ }
1786
+ }
1787
+
1788
+ public function mostReactedComment() {
1789
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1790
+ if ($postId) {
1791
+ $this->isWpdiscuzLoaded = true;
1792
+ $commentListArgs = $this->getCommentListArgs($postId);
1793
  if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1794
+ $commentId = $this->dbManager->getMostReactedCommentId($postId);
1795
+ $comment = get_comment($commentId);
1796
+ if ($comment && $comment->comment_post_ID == $postId) {
1797
+ $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1798
+ $commentStatusIn = ["1"];
1799
+ if ($this->commentsArgs["status"] === "all") {
1800
+ $commentStatusIn[] = "0";
1801
+ }
1802
+ $args = [
1803
+ "format" => "flat",
1804
+ "status" => $this->commentsArgs["status"],
1805
+ "orderby" => $this->commentsArgs["orderby"],
1806
+ "post_id" => $this->commentsArgs["post_id"],
1807
+ ];
1808
+ $includeUnapproved = null;
1809
+ if (!empty($this->commentsArgs["include_unapproved"])) {
1810
+ $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1811
+ $includeUnapproved = $this->commentsArgs["include_unapproved"];
1812
+ }
1813
+ $parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved);
1814
+ $tree = $parentComment->get_children($args);
1815
+ $comments = array_merge([$parentComment], $tree);
1816
+ $commentListArgs["isSingle"] = true;
1817
+ $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
1818
+ $response = [];
1819
+ if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
1820
+ if (!empty($commentListArgs['current_user']->ID)) {
1821
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
1822
+ } else {
1823
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1824
+ }
1825
+ }
1826
+ $response["message"] = wp_list_comments($commentListArgs, $comments);
1827
+ $response["commentId"] = $commentId;
1828
+ $response["parentCommentID"] = $parentComment->comment_ID;
1829
+ $response["callbackFunctions"] = [];
1830
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1831
+ wp_send_json_success($response);
1832
+ }
1833
+ }
1834
+ }
1835
+ }
1836
+
1837
+ public function hottestThread() {
1838
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
1839
+ if ($postId) {
1840
+ $this->isWpdiscuzLoaded = true;
1841
+ $commentListArgs = $this->getCommentListArgs($postId);
1842
+ if ($this->form->isUserCanSeeComments($commentListArgs["current_user"], $postId)) {
1843
+ $this->commentsArgs = $this->getDefaultCommentsArgs($postId);
1844
+ $commentStatusIn = ["1"];
1845
+ if ($this->commentsArgs["status"] === "all") {
1846
+ $commentStatusIn[] = "0";
1847
+ }
1848
+ $parentCommentIds = $this->dbManager->getParentCommentsHavingReplies($postId, $commentStatusIn);
1849
+ $childCount = 0;
1850
+ $hottestCommentId = 0;
1851
+ $hottestChildren = [];
1852
+ foreach ($parentCommentIds as $parentCommentId) {
1853
+ $children = $this->dbManager->getHottestTree($parentCommentId);
1854
+ $tmpCount = count($children);
1855
+ if ($childCount < $tmpCount) {
1856
+ $childCount = $tmpCount;
1857
+ $hottestCommentId = $parentCommentId;
1858
+ $hottestChildren = $children;
1859
+ }
1860
+ }
1861
+
1862
+ if ($hottestCommentId && $hottestChildren) {
1863
+ $args = [
1864
+ "format" => "flat",
1865
+ "status" => $this->commentsArgs["status"],
1866
+ "orderby" => $this->commentsArgs["orderby"],
1867
+ "post_id" => $this->commentsArgs["post_id"],
1868
+ ];
1869
+ $includeUnapproved = null;
1870
+ if (!empty($this->commentsArgs["include_unapproved"])) {
1871
+ $args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
1872
+ $includeUnapproved = $this->commentsArgs["include_unapproved"];
1873
+ }
1874
+ $parentComment = $this->helperOptimization->getCommentRoot($hottestCommentId, $commentStatusIn, $includeUnapproved);
1875
+ $tree = $parentComment->get_children($args);
1876
+ $comments = array_merge([$parentComment], $tree);
1877
+ $commentListArgs["isSingle"] = true;
1878
+ $commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
1879
+ $response = [];
1880
+ if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
1881
+ if (!empty($commentListArgs['current_user']->ID)) {
1882
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
1883
+ } else {
1884
+ $commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
1885
+ }
1886
+ }
1887
+ $response["message"] = wp_list_comments($commentListArgs, $comments);
1888
+ $response["commentId"] = $hottestCommentId;
1889
+ $response["callbackFunctions"] = [];
1890
+ $response = apply_filters("wpdiscuz_ajax_callbacks", $response);
1891
+ wp_send_json_success($response);
1892
+ }
1893
+ }
1894
+ }
1895
+ }
1896
+
1897
+ private function getStickyComments($isPaginate, &$commentList, &$commentListArgs) {
1898
+ if (!empty($this->commentsArgs["first_load"])) {
1899
+ $this->commentsArgs["sticky"] = 1;
1900
+ $this->commentsArgs["number"] = null;
1901
+ if ($isPaginate) {
1902
+ $this->commentsArgs["number"] = "";
1903
+ $this->commentsArgs["offset"] = "";
1904
+ $this->commentsArgs["parent"] = "";
1905
+ }
1906
+ $this->commentsArgs["caller"] = "wpdiscuz";
1907
+ $this->commentsArgs["type__not_in"] = [];
1908
+ $this->commentsArgs["type__in"] = [self::WPDISCUZ_STICKY_COMMENT];
1909
+ $stickyComments = get_comments($this->commentsArgs);
1910
+ if ($stickyComments) {
1911
+ if ($this->options->wp["threadComments"]) {
1912
+ $stickyComments = $this->getChildren($stickyComments, $commentListArgs);
1913
+ }
1914
+ $commentList = ($isPaginate && $this->options->wp["commentOrder"] === "desc") ? array_merge($commentList, $stickyComments) : array_merge($stickyComments, $commentList);
1915
+ }
1916
+ }
1917
+ }
1918
+
1919
+ public function footerContents() {
1920
+ if ($this->isWpdiscuzLoaded) {
1921
+ global $post;
1922
+ if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
1923
+ $this->addContentModal();
1924
+ }
1925
+ if ($this->options->live["enableBubble"]) {
1926
+ $this->addBubble($post);
1927
+ }
1928
+ if ($this->options->thread_display["highlightUnreadComments"]) {
1929
+ $this->saveLastVisit($post);
1930
+ }
1931
+ echo "<div id='wpd-editor-source-code-wrapper-bg'></div><div id='wpd-editor-source-code-wrapper'><textarea id='wpd-editor-source-code'></textarea><button id='wpd-insert-source-code'>Insert</button><input type='hidden' id='wpd-editor-uid' /></div>";
1932
+ }
1933
+ }
1934
+
1935
+ public function addBubble($post) {
1936
+ if (comments_open($post->ID)) {
1937
+ echo "<div id='wpd-bubble-wrapper'>";
1938
+ $commentsNumber = get_comments_number($post->ID);
1939
+ echo "<span id='wpd-bubble-all-comments-count'" . ($commentsNumber ? "" : " style='display:none;'") . " title='" . esc_attr($commentsNumber) . "'>" . esc_html($this->helper->getNumber($commentsNumber)) . "</span>";
1940
+ echo "<div id='wpd-bubble-count'>";
1941
+ echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-count-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-count-second' d='M0 0h24v24H0z' /></svg>";
1942
+ echo "<span class='wpd-new-comments-count'>0</span>";
1943
+ echo "</div>";
1944
+ echo "<div id='wpd-bubble'>";
1945
+ echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-plus-first' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/><path class='wpd-bubble-plus-second' d='M0 0h24v24H0z' /></svg>";
1946
+ echo "<div id='wpd-bubble-add-message'>" . esc_html($this->options->getPhrase("wc_bubble_invite_message")) . "<span id='wpd-bubble-add-message-close'><a href='#'>x</a></span></div>";
1947
+ echo "</div>";
1948
+ echo "<div id='wpd-bubble-notification'><svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-notification-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-notification-second' d='M0 0h24v24H0z' /></svg>";
1949
+ if ($this->options->live["bubbleShowNewCommentMessage"]) {
1950
+ echo "<div id='wpd-bubble-notification-message'>";
1951
+ echo "<div id='wpd-bubble-author'>";
1952
+ echo "<div>";
1953
+ echo "<span id='wpd-bubble-author-avatar'></span>";
1954
+ echo "<span id='wpd-bubble-author-name'></span>";
1955
+ echo "<span id='wpd-bubble-comment-date'>(<span class='wpd-bubble-spans'></span>)</span>";
1956
+ echo "</div>";
1957
+ echo "<span id='wpd-bubble-comment-close'><a href='#'>x</a></span>";
1958
+ echo "</div>";
1959
+ echo "<div id='wpd-bubble-comment'>";
1960
+ echo "<span id='wpd-bubble-comment-text'></span>";
1961
+ echo "<span id='wpd-bubble-comment-reply-link'>| <a href='#'>Reply</a></span>";
1962
+ echo "</div>";
1963
+ echo "</div>";
1964
+ }
1965
+ echo "</div>";
1966
+ echo "</div>";
1967
+ }
1968
+ }
1969
+
1970
+ public function registerRestRoutes() {
1971
+ $controller = new WpdiscuzRest($this->dbManager, $this->options, $this->helper, $this->wpdiscuzForm);
1972
+ $controller->registerRoutes();
1973
+ }
1974
+
1975
+ public function mceButton($buttons) {
1976
+ global $post;
1977
+ if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1978
+ array_push($buttons, "|", "wpDiscuz");
1979
+ }
1980
+
1981
+ return $buttons;
1982
+ }
1983
+
1984
+ public function mceExternalPlugin($plugin_array) {
1985
+ global $post;
1986
+ if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1987
+ $plugin_array["wpDiscuz"] = esc_url_raw(plugins_url("assets/js/wpdiscuz-shortcode-tinymce.js", __FILE__));
1988
+ }
1989
+
1990
+ return $plugin_array;
1991
+ }
1992
+
1993
+ public function gutenbergButton() {
1994
+ global $post;
1995
+ if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
1996
+ wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-shortcode-gutenberg.js"), [
1997
+ "wp-blocks",
1998
+ "wp-editor",
1999
+ "wp-components"
2000
+ ]);
2001
+ wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js");
2002
+ wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", "wpdObject", [
2003
+ "shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
2004
+ "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
2005
+ "tooltip" => $this->options->getPhrase("wc_feedback_shortcode_tooltip"),
2006
+ "popup_title" => $this->options->getPhrase("wc_feedback_popup_title"),
2007
+ "leave_feebdack" => $this->options->getPhrase("wc_please_leave_feebdack")
2008
+ ]);
2009
+ }
2010
+ }
2011
+
2012
+ public function feedbackDialog() {
2013
+ global $post;
2014
+ if (!empty($post->ID) && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
2015
+ ?>
2016
  <style type="text/css">
2017
  #TB_title {
2018
  background: #E9E9E9 !important;
2118
  <div class="wpd-inline-type">
2119
  <label>
2120
  <input type="radio" name="wpd-inline-type" value="0" checked="checked"/>
2121
+ <?php esc_html_e("CLOSED", "wpdiscuz") ?>
2122
  </label>
2123
  </div>
2124
  <img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-closed.png")) ?>"
2128
  <div class="wpd-inline-type">
2129
  <label>
2130
  <input type="radio" name="wpd-inline-type" value="1"/>
2131
+ <?php esc_html_e("OPENED", "wpdiscuz") ?>
2132
  </label>
2133
  </div>
2134
  <img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-opened.png")) ?>"
2142
  id="wpd-put-shortcode"><?php esc_html_e("Add Inline Feedback Button", "wpdiscuz"); ?></button>
2143
  </div>
2144
  </div>
2145
+ <?php
2146
+ }
2147
+ }
2148
+
2149
+ public function feedbackShortcode($atts, $content = "") {
2150
+ global $post;
2151
+ if ($this->isWpdiscuzLoaded && comments_open($post->ID) && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && $this->form->isUserCanSeeComments(WpdiscuzHelper::getCurrentUser(), $post->ID)) {
2152
+ $atts = shortcode_atts([
2153
+ "id" => "",
2154
+ "question" => "",
2155
+ "opened" => 0
2156
+ ], $atts, self::WPDISCUZ_FEEDBACK_SHORTCODE);
2157
+ if ($atts["id"] && $atts["question"] && ($inline_form = $this->dbManager->getFeedbackFormByUid($post->ID, $atts["id"]))) {
2158
+ $content = "<div class='wpd-inline-shortcode wpd-inline-" . ($inline_form->opened && $this->form->isUserCanComment(WpdiscuzHelper::getCurrentUser(), $post->ID) ? "opened" : "closed") . "' id='wpd-inline-" . $inline_form->id . "'>" . html_entity_decode($content);
2159
+ $content .= "<div class='wpd-inline-icon-wrapper'>";
2160
+ $content .= "<svg class='wpd-inline-icon" . ($this->options->inline["inlineFeedbackAttractionType"] === "blink" ? " wpd-ignored" : "") . "' xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-inline-icon-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-inline-icon-second' d='M0 0h24v24H0z' /></svg>";
2161
+ $args = [
2162
+ "count" => true,
2163
+ "meta_query" => [
2164
+ [
2165
+ "key" => self::META_KEY_FEEDBACK_FORM_ID,
2166
+ "value" => $inline_form->id,
2167
+ "compare" => "=",
2168
+ ],
2169
+ ],
2170
+ ];
2171
+ $count = get_comments($args);
2172
+ $content .= "<div class='wpd-inline-icon-count" . esc_attr($count ? " wpd-has-comments" : "") . "'>" . esc_html($count) . "</div>";
2173
+ $content .= "<div class='wpd-inline-form-wrapper'>";
2174
+ $content .= "<div class='wpd-inline-form-question'>" . esc_html($inline_form->question);
2175
+ $content .= "<span class='wpd-inline-form-close'><a href='#'>x</a></span>";
2176
+ $content .= "</div>";
2177
+ $content .= "</div>";
2178
+ $content .= "</div>";
2179
+ $content .= "</div>";
2180
+ }
2181
+ }
2182
+
2183
+ return $content;
2184
+ }
2185
+
2186
+ public function addInlineComment() {
2187
+ $inline_form_id = WpdiscuzHelper::sanitize(INPUT_POST, "inline_form_id", FILTER_SANITIZE_NUMBER_INT, 0);
2188
+ if ($inline_form_id && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && ($inline_form = $this->dbManager->getFeedbackForm($inline_form_id))) {
2189
+ if (wp_verify_nonce(WpdiscuzHelper::sanitize(INPUT_POST, "_wpd_inline_nonce", FILTER_SANITIZE_STRING, ""), "wpd_inline_nonce_" . $inline_form->post_id)) {
2190
+ if (!comments_open($inline_form->post_id)) {
2191
+ wp_die(esc_html($this->options->getPhrase("wc_commenting_is_closed")));
2192
+ }
2193
+ $this->isWpdiscuzLoaded = true;
2194
+ $currentUser = WpdiscuzHelper::getCurrentUser();
2195
+ $this->form = $this->wpdiscuzForm->getForm($inline_form->post_id);
2196
+ if ($this->form->isUserCanSeeComments($currentUser, $inline_form->post_id)) {
2197
  $isAnonymous = false;
2198
  if (!empty($currentUser->ID)) {
2199
  $user_id = $currentUser->ID;
2200
+ $name = $this->helper->getCurrentUserDisplayName($currentUser);
2201
+ $email = $currentUser->user_email;
2202
  } else {
2203
  $user_id = 0;
2204
+ $name = urldecode(trim(sanitize_text_field($_POST["wpd_inline_name"])));
2205
  if (!empty($_POST["wpd_inline_email"]) && ($email = sanitize_email(trim($_POST["wpd_inline_email"])))) {
2206
  if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
2207
  wp_send_json_error("wc_error_email_text");
2208
  }
2209
  } else {
2210
+ $email = uniqid() . "@example.com";
2211
  $isAnonymous = true;
2212
  }
2213
  $email = urldecode($email);
2214
  }
2215
+ $email = apply_filters("wpdiscuz_feedback_commenter_email", $email);
2216
 
2217
  $comment_content = !empty($_POST["wpd_inline_comment"]) ? stripslashes(trim($_POST["wpd_inline_comment"])) : "";
2218
  $comment_content = $this->helper->filterCommentText($comment_content);
2221
  }
2222
  $commentMinLength = intval($this->options->content["commentTextMinLength"]);
2223
  $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
2224
+ $contentLength = function_exists("mb_strlen") ? mb_strlen($comment_content) : strlen($comment_content);
2225
  if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
2226
  wp_send_json_error("wc_msg_input_min_length");
2227
  }
2230
  }
2231
 
2232
  if ($name && $email && $comment_content) {
2233
+ $wc_user_agent = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
2234
+ $new_commentdata = [
2235
+ "user_id" => $user_id,
2236
+ "comment_post_ID" => $inline_form->post_id,
2237
+ "comment_parent" => 0,
2238
+ "comment_author" => $name,
2239
  "comment_author_email" => $email,
2240
+ "comment_author_url" => "",
2241
+ "comment_content" => $comment_content,
2242
+ "comment_agent" => $wc_user_agent,
2243
+ "comment_type" => self::$DEFAULT_COMMENT_TYPE,
2244
  ];
2245
  $this->helper->restrictCommentingPerUser($email, 0, $inline_form->post_id);
2246
  $new_comment_id = wp_new_comment(wp_slash($new_commentdata));
2247
  add_comment_meta($new_comment_id, self::META_KEY_FEEDBACK_FORM_ID, $inline_form->id);
2248
+ $args = [
2249
+ "count" => true,
2250
  "meta_query" => [
2251
  [
2252
+ "key" => self::META_KEY_FEEDBACK_FORM_ID,
2253
+ "value" => $inline_form->id,
2254
  "compare" => "=",
2255
  ],
2256
  ],
2278
  if ($newComment->comment_approved === "spam" || $newComment->comment_approved === "trash") {
2279
  wp_send_json_error();
2280
  }
2281
+ $response = [];
2282
+ $commentListArgs = $this->getCommentListArgs($inline_form->post_id);
2283
+ $response["message"] = wp_list_comments($commentListArgs, [$newComment]);
2284
+ $response["newCount"] = esc_html(get_comments($args));
2285
+ $response["new_comment_id"] = $new_comment_id;
2286
+ $response["notification"] = esc_html($this->options->getPhrase("wc_feedback_comment_success"));
2287
+ $response["allCommentsCountNew"] = get_comments_number($inline_form->post_id);
2288
  $response["allCommentsCountBeforeThreadsHtml"] = "<span class='wpdtc' title='" . esc_attr($response["allCommentsCountNew"]) . "'>" . esc_html($this->helper->getNumber($response["allCommentsCountNew"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["allCommentsCountNew"] ? $this->form->getHeaderTextSingle() : $this->form->getHeaderTextPlural()), $response["allCommentsCountNew"]));
2289
  $response["allCommentsCountBubbleHtml"] = "<span id='wpd-bubble-all-comments-count'" . ($response["allCommentsCountNew"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["allCommentsCountNew"]) . "'>" . esc_html($this->helper->getNumber($response["allCommentsCountNew"])) . "</span>";
2290
  do_action("wpdiscuz_clean_post_cache", $inline_form->post_id, "inline_comment_posted");
2291
+ do_action("wpdiscuz_clean_post_cache", $inline_form->post_id, "comment_posted");
2292
+ do_action("wpdiscuz_reset_comments_cache", $inline_form->post_id);
2293
  wp_send_json_success($response);
2294
  } else {
2295
  wp_send_json_error("wc_invalid_field");
2296
  }
2297
  }
2298
  }
2299
+ }
2300
+ wp_send_json_error("wc_msg_required_fields");
2301
+ }
2302
+
2303
+ public function validateRecaptcha($commentdata) {
2304
+ if (!current_user_can("moderate_comments")) {
2305
+ $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, "");
2306
+ if (!$postId) {
2307
+ global $post;
2308
+ if (!empty($post->ID)) {
2309
+ $postId = $post->ID;
2310
+ } else if (!empty($commentdata["comment_post_ID"])) {
2311
+ $postId = $commentdata["comment_post_ID"];
2312
+ }
2313
+ }
2314
+ if ($postId && ($post = get_post($postId))) {
2315
+ $form = $this->wpdiscuzForm->getForm($postId);
2316
+ if ($form->getFormID()) {
2317
+ $currentUser = WpdiscuzHelper::getCurrentUser();
2318
+ if (empty($currentUser->ID) || (!empty($currentUser->ID) && $currentUser->ID != $post->post_author)) {
2319
+ $inlineVerified = wp_verify_nonce(WpdiscuzHelper::sanitize(INPUT_POST, "_wpd_inline_nonce", FILTER_SANITIZE_STRING, ""), "wpd_inline_nonce_" . $postId);
2320
+ if (!$inlineVerified) {
2321
+ if (apply_filters("wpdiscuz_verify_recaptcha", true, $commentdata)) {
2322
+ $typesExclude = ["pingback", "trackback"];
2323
+ if (!empty($commentdata["comment_type"]) && in_array($commentdata["comment_type"], $typesExclude)) {
2324
+ return $commentdata;
2325
+ }
2326
+ $form->initFormFields();
2327
+ $form->validateDefaultCaptcha($currentUser);
2328
+ }
2329
+ }
2330
+ }
2331
+ }
2332
+ }
2333
+ }
2334
+ return $commentdata;
2335
+ }
2336
+
2337
+ public function addToolbarItems($admin_bar) {
2338
+ if ($this->isWpdiscuzLoaded && current_user_can("manage_options")) {
2339
  $admin_bar->add_menu([
2340
+ "id" => self::PAGE_WPDISCUZ,
2341
  "title" => "wpDiscuz",
2342
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)),
2343
+ "meta" => [
2344
  "title" => "wpDiscuz",
2345
+ "target" => "_blank",
2346
  ],
2347
  ]);
2348
  $admin_bar->add_menu([
2349
+ "id" => self::PAGE_WPDISCUZ . "-child",
2350
  "parent" => self::PAGE_WPDISCUZ,
2351
  "title" => esc_html__("Dashboard", "wpdiscuz"),
2352
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)),
2353
+ "meta" => [
2354
  "title" => esc_html__("Dashboard", "wpdiscuz"),
2355
  "target" => "_blank",
2356
  ],
2357
  ]);
2358
  $admin_bar->add_menu([
2359
+ "id" => self::PAGE_SETTINGS,
2360
  "parent" => self::PAGE_WPDISCUZ,
2361
  "title" => esc_html__("Settings", "wpdiscuz"),
2362
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)),
2363
+ "meta" => [
2364
  "title" => esc_html__("Settings", "wpdiscuz"),
2365
  "target" => "_blank",
2366
  ],
2367
  ]);
2368
+ if (!$this->options->general["isUsePoMo"]) {
2369
+ $admin_bar->add_menu([
2370
+ "id" => self::PAGE_PHRASES,
2371
+ "parent" => self::PAGE_WPDISCUZ,
2372
+ "title" => esc_html__("Phrases", "wpdiscuz"),
2373
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_PHRASES)),
2374
+ "meta" => [
2375
+ "title" => esc_html__("Phrases", "wpdiscuz"),
2376
+ "target" => "_blank",
2377
+ ],
2378
+ ]);
2379
+ }
2380
+ $admin_bar->add_menu([
2381
+ "id" => self::PAGE_TOOLS,
2382
+ "parent" => self::PAGE_WPDISCUZ,
2383
+ "title" => esc_html__("Tools", "wpdiscuz"),
2384
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_TOOLS)),
2385
+ "meta" => [
2386
+ "title" => esc_html__("Tools", "wpdiscuz"),
2387
+ "target" => "_blank",
2388
+ ],
2389
+ ]);
2390
+ $admin_bar->add_menu([
2391
+ "id" => self::PAGE_ADDONS,
2392
+ "parent" => self::PAGE_WPDISCUZ,
2393
+ "title" => esc_html__("Addons", "wpdiscuz"),
2394
+ "href" => esc_url_raw(admin_url("admin.php?page=" . self::PAGE_ADDONS)),
2395
+ "meta" => [
2396
+ "title" => esc_html__("Addons", "wpdiscuz"),
2397
+ "target" => "_blank",
2398
+ ],
2399
+ ]);
2400
+ if ($this->options->general["isCacheEnabled"]) {
2401
  $admin_bar->add_menu([
2402
  "id" => "purgeAllCaches",
2403
  "parent" => self::PAGE_WPDISCUZ,
2418
  "title" => esc_html__("Purge All Caches", "wpdiscuz"),
2419
  ],
2420
  ]);
2421
+ }
2422
+ }
2423
+ }
2424
+ }
2425
 
2426
  }
2427
 
forms/wpdFormAttr/Login/Utils.php CHANGED
@@ -344,7 +344,7 @@ class Utils {
344
  }
345
 
346
  public static function addOAuthState($provider, $secret, $postID) {
347
- add_option(wpdFormConst::WPDISCUZ_OAUTH_STATE_TOKEN.md5($secret),[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER => $provider , wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID => $postID]);
348
  }
349
 
350
  public static function generateOAuthState($appID) {
344
  }
345
 
346
  public static function addOAuthState($provider, $secret, $postID) {
347
+ add_option(wpdFormConst::WPDISCUZ_OAUTH_STATE_TOKEN.md5($secret),[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER => $provider , wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID => $postID],'','no');
348
  }
349
 
350
  public static function generateOAuthState($appID) {
includes/class.WpdiscuzDBManager.php CHANGED
@@ -183,18 +183,9 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
183
  $sqlCommentIds = "SELECT `comment_ID` FROM `{$this->db->comments}` WHERE `comment_ID` IN(" . $visibleCommentIds . ")" . $approved . ";";
184
  $notRemovedCommentIDs = $this->db->get_col($sqlCommentIds);
185
  return array_values(array_diff(explode(",", $visibleCommentIds), $notRemovedCommentIDs));
186
- }
187
-
188
- public function getUserByNickname($nickname) {
189
- $caps = "";
190
- if (is_multisite()) {
191
- $caps = " INNER JOIN `{$this->db->usermeta}` AS `um2` ON `u`.`ID` = `um2`.`user_id` AND `um2`.`meta_key` = '{$this->db->prefix}capabilities'";
192
- }
193
- $sql = $this->db->prepare("SELECT `u`.`ID`, `u`.`user_email`, `u`.`display_name` FROM `{$this->db->users}` AS `u` INNER JOIN `{$this->db->usermeta}` AS `um` ON `u`.`ID` = `um`.`user_id` AND `um`.`meta_key` = 'nickname'$caps WHERE `um`.`meta_value` = %s LIMIT 1", $nickname);
194
- return $this->db->get_row($sql);
195
- }
196
 
197
- public function getUserByNicknameOrNicename($nickname) {
198
  $caps = "";
199
  if (is_multisite()) {
200
  $caps = " INNER JOIN `{$this->db->usermeta}` AS `um2` ON `u`.`ID` = `um2`.`user_id` AND `um2`.`meta_key` = '{$this->db->prefix}capabilities'";
183
  $sqlCommentIds = "SELECT `comment_ID` FROM `{$this->db->comments}` WHERE `comment_ID` IN(" . $visibleCommentIds . ")" . $approved . ";";
184
  $notRemovedCommentIDs = $this->db->get_col($sqlCommentIds);
185
  return array_values(array_diff(explode(",", $visibleCommentIds), $notRemovedCommentIDs));
186
+ }
 
 
 
 
 
 
 
 
 
187
 
188
+ public function getUserByNicename($nickname) {
189
  $caps = "";
190
  if (is_multisite()) {
191
  $caps = " INNER JOIN `{$this->db->usermeta}` AS `um2` ON `u`.`ID` = `um2`.`user_id` AND `um2`.`meta_key` = '{$this->db->prefix}capabilities'";
includes/class.WpdiscuzRest.php CHANGED
@@ -2,122 +2,155 @@
2
 
3
  class WpdiscuzRest extends WP_REST_Controller {
4
 
5
- private $dbManager;
6
- private $options;
7
- private $helper;
8
- private $wpdiscuzForm;
9
- private $resource_name;
 
10
 
11
- public function __construct($dbManager, $options, $helper, $wpdiscuzForm) {
12
- $this->dbManager = $dbManager;
13
- $this->options = $options;
14
- $this->helper = $helper;
15
- $this->wpdiscuzForm = $wpdiscuzForm;
16
- $this->namespace = "wpdiscuz/v1";
17
- $this->resource_name = "update";
18
- }
19
 
20
- public function registerRoutes() {
21
- register_rest_route($this->namespace, "/" . $this->resource_name, [
22
- [
23
- "methods" => "GET",
24
- "callback" => [&$this, "checkNewComments"],
25
- "permission_callback" => [&$this, "checkPermission"],
26
- "args" => [
27
- "postId" => [
28
- "required" => true,
29
- "type" => "number",
30
- ],
31
- "lastId" => [
32
- "required" => true,
33
- "type" => "number",
34
- ],
35
- "visibleCommentIds" => [
36
- "required" => true,
37
- "type" => "string",
38
- ],
39
- ],
40
- ],
41
- ]);
42
- }
43
 
44
- public function checkPermission() {
45
- if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
46
- $currentUser = WpdiscuzHelper::getCurrentUser();
47
- return !empty($currentUser->ID) || (empty($currentUser->ID) && $this->options->live["liveUpdateGuests"]);
48
- }
49
- return false;
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- public function checkNewComments($data) {
53
- $params = $data->get_params();
54
- $response = ["ids" => [], "commentIDsToRemove" => []];
55
- $status = current_user_can("moderate_comments") ? "all" : "approved";
56
- $args = ["status" => $status, "post_id" => $params["postId"]];
57
- global $wpdiscuz;
58
- $wpdiscuz->isWpdiscuzLoaded = true;
59
- $commentId = $this->dbManager->getLastCommentId($args);
60
- if ($params["visibleCommentIds"]) {
61
- $response["commentIDsToRemove"] = $this->dbManager->commentIDsToRemove($args, $params["visibleCommentIds"]);
62
- }
63
- $form = $this->wpdiscuzForm->getForm($params["postId"]);
64
- if ($commentId > $params["lastId"]) {
65
- $currentUser = WpdiscuzHelper::getCurrentUser();
66
- $sentEmail = !empty($_COOKIE["comment_author_email_" . COOKIEHASH]) ? trim($_COOKIE["comment_author_email_" . COOKIEHASH]) : "";
67
- $email = !empty($currentUser->ID) ? $currentUser->user_email : $sentEmail;
68
- $newCommentIds = $this->dbManager->getNewCommentIds($args, $params["lastId"], $email, $params["visibleCommentIds"]);
69
- $newCommentIds = apply_filters("wpdiscuz_bubble_new_comment_ids", $newCommentIds, $params["postId"], $currentUser);
70
- if (!empty($newCommentIds)) {
71
- $response["ids"] = $newCommentIds;
72
- if ($this->options->live["bubbleShowNewCommentMessage"]) {
73
- $comment = get_comment($commentId);
74
- $comment->comment_content = apply_filters("comment_text", $comment->comment_content, $comment, ["is_wpdiscuz_comment" => true]);
75
- $comment->comment_content = strip_tags($comment->comment_content);
76
- if (stripos($comment->comment_content, "[/spoiler]") === false) {
77
- $user = "";
78
- if ($comment->user_id) {
79
- $user = get_user_by("id", $comment->user_id);
80
- } else if ($this->options->login["isUserByEmail"]) {
81
- $user = get_user_by("email", $comment->comment_author_email);
82
- }
83
- if ($user) {
84
- $authorName = $user->display_name ? $user->display_name : $comment->comment_author;
85
- $authorAvatarField = $user->ID;
86
- $gravatarUserId = $user->ID;
87
- $gravatarUserEmail = $user->user_email;
88
- } else {
89
- $authorName = $comment->comment_author ? $comment->comment_author : esc_html($this->options->getPhrase("wc_anonymous"));
90
- $authorAvatarField = $comment->comment_author_email;
91
- $gravatarUserId = 0;
92
- $gravatarUserEmail = $comment->comment_author_email;
93
- }
94
- $gravatarArgs = [
95
- "wpdiscuz_gravatar_field" => $authorAvatarField,
96
- "wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 16),
97
- "wpdiscuz_gravatar_user_id" => $gravatarUserId,
98
- "wpdiscuz_gravatar_user_email" => $gravatarUserEmail,
99
- "wpdiscuz_current_user" => $user,
100
- ];
101
- if (function_exists("mb_substr")) {
102
- $response["commentText"] = mb_substr($comment->comment_content, 0, 50);
103
- } else {
104
- $response["commentText"] = substr($comment->comment_content, 0, 50);
105
- }
106
- if (strlen($comment->comment_content) > strlen($response["commentText"])) {
107
- $response["commentText"] .= "...";
108
- }
109
- $response["commentDate"] = esc_html($this->helper->dateDiff($comment->comment_date_gmt));
110
- $response["commentLink"] = esc_url_raw(get_comment_link($comment));
111
- $response["authorName"] = esc_html(apply_filters("wpdiscuz_comment_author", $authorName, $comment));
112
- $response["avatar"] = get_avatar($gravatarArgs["wpdiscuz_gravatar_field"], $gravatarArgs["wpdiscuz_gravatar_size"], "", $authorName, $gravatarArgs);
113
- }
114
- }
115
- }
116
- }
117
- $response["all_comments_count"] = get_comments_number($params["postId"]);
118
- $response["all_comments_count_before_threads_html"] = "<span class='wpdtc' title='" . esc_attr($response["all_comments_count"]) . "'>" . esc_html($this->helper->getNumber($response["all_comments_count"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["all_comments_count"] ? $form->getHeaderTextSingle() : $form->getHeaderTextPlural()), $response["all_comments_count"]));
119
- $response["all_comments_count_bubble_html"] = "<span id='wpd-bubble-all-comments-count'" . ($response["all_comments_count"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["all_comments_count"]) . "'>" . esc_html($this->helper->getNumber($response["all_comments_count"])) . "</span>";
120
- return $response;
121
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  }
2
 
3
  class WpdiscuzRest extends WP_REST_Controller {
4
 
5
+ private $dbManager;
6
+ private $options;
7
+ private $helper;
8
+ private $wpdiscuzForm;
9
+ private $resource_name;
10
+ private $routes;
11
 
12
+ public function __construct($dbManager, $options, $helper, $wpdiscuzForm) {
13
+ $this->dbManager = $dbManager;
14
+ $this->options = $options;
15
+ $this->helper = $helper;
16
+ $this->wpdiscuzForm = $wpdiscuzForm;
 
 
 
17
 
18
+ $this->namespace = "wpdiscuz/v1";
19
+ $this->resource_name = "update";
20
+ $this->initRoutes();
21
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ public function initRoutes() {
24
+ $routes = [];
25
+ if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
26
+ $routes["wpdiscuz"] = [
27
+ "namespace" => $this->namespace,
28
+ "resource_name" => $this->resource_name,
29
+ "data" => [
30
+ [
31
+ "methods" => "GET",
32
+ "callback" => [&$this, "checkNewComments"],
33
+ "permission_callback" => [&$this, "checkPermission"],
34
+ "args" => [
35
+ "postId" => [
36
+ "required" => true,
37
+ "type" => "number",
38
+ ],
39
+ "lastId" => [
40
+ "required" => true,
41
+ "type" => "number",
42
+ ],
43
+ "visibleCommentIds" => [
44
+ "required" => true,
45
+ "type" => "string",
46
+ ],
47
+ ],
48
+ ],
49
+ ]
50
+ ];
51
+ }
52
+ $this->routes = apply_filters("wpdiscuz_rest_routes", $routes, $this->namespace);
53
+ }
54
 
55
+ public function registerRoutes() {
56
+ if (!empty($this->routes)) {
57
+ foreach ($this->routes as $route) {
58
+ if ($this->isValidRoute($route)) {
59
+ register_rest_route($route["namespace"], "/" . $route["resource_name"], $route["data"]);
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ public function checkPermission() {
66
+ if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
67
+ $currentUser = WpdiscuzHelper::getCurrentUser();
68
+ return !empty($currentUser->ID) || (empty($currentUser->ID) && $this->options->live["liveUpdateGuests"]);
69
+ }
70
+ return false;
71
+ }
72
+
73
+ public function checkNewComments($data) {
74
+ $params = $data->get_params();
75
+ $response = ["ids" => [], "commentIDsToRemove" => []];
76
+ $status = current_user_can("moderate_comments") ? "all" : "approved";
77
+ $args = ["status" => $status, "post_id" => $params["postId"]];
78
+ global $wpdiscuz;
79
+ $wpdiscuz->isWpdiscuzLoaded = true;
80
+ $commentId = $this->dbManager->getLastCommentId($args);
81
+ if ($params["visibleCommentIds"]) {
82
+ $response["commentIDsToRemove"] = $this->dbManager->commentIDsToRemove($args, $params["visibleCommentIds"]);
83
+ }
84
+ $form = $this->wpdiscuzForm->getForm($params["postId"]);
85
+ if ($commentId > $params["lastId"]) {
86
+ $currentUser = WpdiscuzHelper::getCurrentUser();
87
+ $sentEmail = !empty($_COOKIE["comment_author_email_" . COOKIEHASH]) ? trim($_COOKIE["comment_author_email_" . COOKIEHASH]) : "";
88
+ $email = !empty($currentUser->ID) ? $currentUser->user_email : $sentEmail;
89
+ $newCommentIds = $this->dbManager->getNewCommentIds($args, $params["lastId"], $email, $params["visibleCommentIds"]);
90
+ $newCommentIds = apply_filters("wpdiscuz_bubble_new_comment_ids", $newCommentIds, $params["postId"], $currentUser);
91
+ if (!empty($newCommentIds)) {
92
+ $response["ids"] = $newCommentIds;
93
+ if ($this->options->live["bubbleShowNewCommentMessage"]) {
94
+ $comment = get_comment($commentId);
95
+ $comment->comment_content = apply_filters("comment_text", $comment->comment_content, $comment, ["is_wpdiscuz_comment" => true]);
96
+ $comment->comment_content = strip_tags($comment->comment_content);
97
+ if (stripos($comment->comment_content, "[/spoiler]") === false) {
98
+ $user = "";
99
+ if ($comment->user_id) {
100
+ $user = get_user_by("id", $comment->user_id);
101
+ } else if ($this->options->login["isUserByEmail"]) {
102
+ $user = get_user_by("email", $comment->comment_author_email);
103
+ }
104
+ if ($user) {
105
+ $authorName = $user->display_name ? $user->display_name : $comment->comment_author;
106
+ $authorAvatarField = $user->ID;
107
+ $gravatarUserId = $user->ID;
108
+ $gravatarUserEmail = $user->user_email;
109
+ } else {
110
+ $authorName = $comment->comment_author ? $comment->comment_author : esc_html($this->options->getPhrase("wc_anonymous"));
111
+ $authorAvatarField = $comment->comment_author_email;
112
+ $gravatarUserId = 0;
113
+ $gravatarUserEmail = $comment->comment_author_email;
114
+ }
115
+ $gravatarArgs = [
116
+ "wpdiscuz_gravatar_field" => $authorAvatarField,
117
+ "wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 16),
118
+ "wpdiscuz_gravatar_user_id" => $gravatarUserId,
119
+ "wpdiscuz_gravatar_user_email" => $gravatarUserEmail,
120
+ "wpdiscuz_current_user" => $user,
121
+ ];
122
+ if (function_exists("mb_substr")) {
123
+ $response["commentText"] = mb_substr($comment->comment_content, 0, 50);
124
+ } else {
125
+ $response["commentText"] = substr($comment->comment_content, 0, 50);
126
+ }
127
+ if (strlen($comment->comment_content) > strlen($response["commentText"])) {
128
+ $response["commentText"] .= "...";
129
+ }
130
+ $response["commentDate"] = esc_html($this->helper->dateDiff($comment->comment_date_gmt));
131
+ $response["commentLink"] = esc_url_raw(get_comment_link($comment));
132
+ $response["authorName"] = esc_html(apply_filters("wpdiscuz_comment_author", $authorName, $comment));
133
+ $response["avatar"] = get_avatar($gravatarArgs["wpdiscuz_gravatar_field"], $gravatarArgs["wpdiscuz_gravatar_size"], "", $authorName, $gravatarArgs);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ $response["all_comments_count"] = get_comments_number($params["postId"]);
139
+ $response["all_comments_count_before_threads_html"] = "<span class='wpdtc' title='" . esc_attr($response["all_comments_count"]) . "'>" . esc_html($this->helper->getNumber($response["all_comments_count"])) . "</span> " . esc_html(apply_filters("wpdiscuz_comment_count_phrase", (1 == $response["all_comments_count"] ? $form->getHeaderTextSingle() : $form->getHeaderTextPlural()), $response["all_comments_count"]));
140
+ $response["all_comments_count_bubble_html"] = "<span id='wpd-bubble-all-comments-count'" . ($response["all_comments_count"] ? "" : " style='display:none;'") . " title='" . esc_attr($response["all_comments_count"]) . "'>" . esc_html($this->helper->getNumber($response["all_comments_count"])) . "</span>";
141
+ return $response;
142
+ }
143
+
144
+ private function isValidRoute($route) {
145
+ $isValid = empty($route) || !is_array($route) ? false : true;
146
+ if ($isValid) {
147
+ $isValid = !empty($route["namespace"]) &&
148
+ !empty($route["resource_name"]) &&
149
+ !empty($route["data"][0]["methods"]) &&
150
+ !empty($route["data"][0]["callback"]) &&
151
+ !empty($route["data"][0]["permission_callback"]);
152
+ }
153
+ return $isValid;
154
+ }
155
 
156
  }
includes/interface.WpDiscuzConstants.php CHANGED
@@ -74,8 +74,8 @@ interface WpDiscuzConstants {
74
  const POSTMETA_STATISTICS = "_wpdiscuz_statistics";
75
  const POSTMETA_REACTED = "reacted";
76
  const POSTMETA_RATING_COUNT = "wpdiscuz_rating_count";
77
- const POSTMETA_RATING_SEPARATE_AVG = "wpdiscuz_post_rating_";
78
- const POSTMETA_RATING_SEPARATE_COUNT = "wpdiscuz_post_rating_count_";
79
  /* === USER CONTENT === */
80
  const TRS_USER_HASH = "wpdiscuz_user_hash_";
81
  /* === SOCIAL LOGIN */
@@ -91,10 +91,13 @@ interface WpDiscuzConstants {
91
  const METAKEY_ATTACHMENTS = "wmu_attachments";
92
  const KEY_IMAGES = "images";
93
  const INPUT_NAME = "wmu_files";
94
- const DELETE_UNATTACHED_FILES_ACTION = "wpdiscuz_delete_unattached_images";
95
- const DELETE_UNATTACHED_FILES_KEY_RECURRENCE = "wpdiscuz_delete_unattached_images_every_48h";
96
- const DELETE_UNATTACHED_FILES_RECURRENCE = 48;
97
  /* === POST RATING */
98
  const POSTMETA_POST_RATING = "wpdiscuz_post_rating";
99
  const POSTMETA_POST_RATING_COUNT = "wpdiscuz_post_rating_count";
 
 
 
100
  }
74
  const POSTMETA_STATISTICS = "_wpdiscuz_statistics";
75
  const POSTMETA_REACTED = "reacted";
76
  const POSTMETA_RATING_COUNT = "wpdiscuz_rating_count";
77
+ const POSTMETA_RATING_SEPARATE_AVG = "wpdiscuz_post_rating_";
78
+ const POSTMETA_RATING_SEPARATE_COUNT = "wpdiscuz_post_rating_count_";
79
  /* === USER CONTENT === */
80
  const TRS_USER_HASH = "wpdiscuz_user_hash_";
81
  /* === SOCIAL LOGIN */
91
  const METAKEY_ATTACHMENTS = "wmu_attachments";
92
  const KEY_IMAGES = "images";
93
  const INPUT_NAME = "wmu_files";
94
+ const DELETE_UNATTACHED_FILES_ACTION = "wpdiscuz_delete_unattached_images";
95
+ const DELETE_UNATTACHED_FILES_KEY_RECURRENCE = "wpdiscuz_delete_unattached_images_every_48h";
96
+ const DELETE_UNATTACHED_FILES_RECURRENCE = 48;
97
  /* === POST RATING */
98
  const POSTMETA_POST_RATING = "wpdiscuz_post_rating";
99
  const POSTMETA_POST_RATING_COUNT = "wpdiscuz_post_rating_count";
100
+
101
+ /* === NONCE */
102
+ const GLOBAL_NONCE_NAME = "wpdiscuz_nonce";
103
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
3
  Tags: comment, comments, ajax comments, comment form, comment fields
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
- Stable tag: 7.3.3
7
  Requires PHP: 5.6 and higher
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -185,24 +185,32 @@ Nothing will be lost! **Comments - wpDiscuz** will show all old comments.
185
 
186
  == Changelog ==
187
 
188
- = Comments - wpDiscuz v7.3.3 =
189
 
190
- * Fixed: Replies made from dashboard are invisible
191
- * Fixed: Most voted comments are not loading
192
- * Fixed: VK social login issue
 
193
 
194
  **IMPORTANT!**
195
 
196
  * Please don't forget delete all caches and purge CDN after the update.
197
 
198
 
 
 
 
 
 
 
 
199
  = Comments - wpDiscuz v7.3.2 =
200
 
201
  * Added: Better UI for option search in wpDiscuz settings page
202
  * Changed: Reducing plugin links in the dashboard plugin activation page
203
- * Fixed: Small security issues with data filtering, preventing XSS attacks
204
- * Fixed: Fatal Error - Uncaught Error, cannot use string offset as an array
205
- * Fixed: Fatal Error - Too few arguments to function cleanCommentRelatedRows()
206
 
207
 
208
  = Comments - wpDiscuz v7.3.1 =
3
  Tags: comment, comments, ajax comments, comment form, comment fields
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
+ Stable tag: 7.3.4
7
  Requires PHP: 5.6 and higher
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
185
 
186
  == Changelog ==
187
 
188
+ = Comments - wpDiscuz v7.3.4 =
189
 
190
+ * Fixed bug: Small security issue, wp_nonce verification to all ajax actions
191
+ * Fixed Bug: Issues with "sticky" and "closed" comments
192
+ * Fixed Bug: PHP Error - Too few arguments to function cleanCommentRelatedRows()
193
+ * Fixed Bug: Comments still can be deleted by user from "My contents and settings" popup even when deleting is disabled in "Front End Moderation" addon.
194
 
195
  **IMPORTANT!**
196
 
197
  * Please don't forget delete all caches and purge CDN after the update.
198
 
199
 
200
+ = Comments - wpDiscuz v7.3.3 =
201
+
202
+ * Fixed Bug: Replies made from dashboard are invisible
203
+ * Fixed Bug: Most voted comments are not loading
204
+ * Fixed Bug: VK social login issue
205
+
206
+
207
  = Comments - wpDiscuz v7.3.2 =
208
 
209
  * Added: Better UI for option search in wpDiscuz settings page
210
  * Changed: Reducing plugin links in the dashboard plugin activation page
211
+ * Fixed Bug: Small security issues with data filtering, preventing XSS attacks
212
+ * Fixed Bug: Fatal Error - Uncaught Error, cannot use string offset as an array
213
+ * Fixed Bug: Fatal Error - Too few arguments to function cleanCommentRelatedRows()
214
 
215
 
216
  = Comments - wpDiscuz v7.3.1 =
utils/class.WpdiscuzHelper.php CHANGED
@@ -134,11 +134,29 @@ class WpdiscuzHelper implements WpDiscuzConstants {
134
  return $text;
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  public function getNumber($number) {
138
  if ($this->options->general["humanReadableNumbers"]) {
139
  if (absint($number) >= 1000000) {
140
- $number = sprintf(esc_html__("%sM", "wpdiscuz"), str_replace(".0", "", number_format($number / 1000000, 1)));
141
- } else if (absint($number) >= 1000) {
142
  $number = sprintf(esc_html__("%sK", "wpdiscuz"), str_replace(".0", "", number_format($number / 1000, 1)));
143
  }
144
  }
@@ -207,8 +225,8 @@ class WpdiscuzHelper implements WpDiscuzConstants {
207
  $commentMinLength = intval($this->options->content["replyTextMinLength"]);
208
  $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
209
  } else {
210
- $commentMinLength = intval($this->options->content["commentTextMinLength"]);
211
- $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
212
  }
213
  $commentContent = trim(strip_tags($commentContent));
214
  $contentLength = function_exists("mb_strlen") ? mb_strlen($commentContent) : strlen($commentContent);
@@ -468,6 +486,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
468
  }
469
 
470
  public function wpdGetInfo() {
 
471
  $response = "";
472
  $currentUser = self::getCurrentUser();
473
  if ($currentUser && $currentUser->ID) {
@@ -599,6 +618,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
599
  }
600
 
601
  public function getActivityPage() {
 
602
  ob_start();
603
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/activity/activity-page.php";
604
  $html = ob_get_clean();
@@ -606,6 +626,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
606
  }
607
 
608
  private function getSubscriptionsTitleHtml() {
 
609
  ob_start();
610
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/title.php";
611
  return ob_get_clean();
@@ -623,6 +644,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
623
  }
624
 
625
  public function getSubscriptionsPage() {
 
626
  ob_start();
627
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/subscriptions-page.php";
628
  $html = ob_get_clean();
@@ -630,6 +652,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
630
  }
631
 
632
  private function getFollowsTitleHtml() {
 
633
  ob_start();
634
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/follows/title.php";
635
  return ob_get_clean();
@@ -654,15 +677,15 @@ class WpdiscuzHelper implements WpDiscuzConstants {
654
  }
655
 
656
  public static function fixEmailFrom($domain) {
657
- $domain = strtolower($domain);
658
- if (substr($domain, 0, 4) === "www.") {
659
- $domain = substr($domain, 4);
660
- }
661
- $localhost = ['127.0.0.1', '::1'];
662
- if (in_array($_SERVER['REMOTE_ADDR'], $localhost, true)) {
663
- $domain .= ".com";
664
- }
665
- return $domain;
666
  }
667
 
668
  public function fixLocalhostIp($ip) {
@@ -796,7 +819,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
796
  }
797
 
798
  public function userMentioning($content, $comment, $args = []) {
799
- if (apply_filters("wpdiscuz_enable_user_mentioning", true) && !empty($args["is_wpdiscuz_comment"]) && ($users = $this->getMentionedUsers($content, false))) {
800
  foreach ($users as $k => $user) {
801
  $user_link = "";
802
  if (class_exists("BuddyPress")) {
@@ -827,17 +850,13 @@ class WpdiscuzHelper implements WpDiscuzConstants {
827
  return $content;
828
  }
829
 
830
- public function getMentionedUsers($content, $onlyNick = true) {
831
  $users = [];
832
  if (preg_match_all("/(@[^\s\,\@\.\!\?\#\$\%\:\;\'\"\`\~\)\(\}\{\|\\\[\]]*)/is", $content, $nicknames)) {
833
  $nicknames = array_map("strip_tags", $nicknames[0]);
834
  $nicknames = array_unique($nicknames);
835
  foreach ($nicknames as $k => $nickname) {
836
- if ($onlyNick) {
837
- $user = $this->dbManager->getUserByNickname(ltrim($nickname, "@"));
838
- } else {
839
- $user = $this->dbManager->getUserByNicknameOrNicename(ltrim($nickname, "@"));
840
- }
841
  if ($user) {
842
  $users[] = ["replace" => $nickname, "u_id" => $user->ID, "name" => $user->display_name, "email" => $user->user_email];
843
  }
@@ -846,22 +865,22 @@ class WpdiscuzHelper implements WpDiscuzConstants {
846
  return $users;
847
  }
848
 
849
- public function checkFeedbackShortcodes($post_ID, $post_after, $post_before) {
850
- if (comments_open($post_ID) && ($form = $this->wpdiscuzForm->getForm($post_ID)) && $form->getFormID()) {
851
  preg_match_all(self::$inlineFormPattern, $post_before->post_content, $matchesBefore, PREG_SET_ORDER);
852
- if ($post_after->post_content) {
853
  preg_match_all(self::$inlineFormPattern, $post_after->post_content, $matchesAfter, PREG_SET_ORDER);
854
  } else {
855
- $matchesAfter = $matchesBefore;
856
- $matchesBefore = [];
857
  }
858
- if ($matchesAfter || $matchesBefore) {
859
- $inlineFormsBefore = [];
860
- $defaultAtts = ["id" => "", "question" => "", "opened" => 0, "content" => ""];
861
- foreach ($matchesBefore as $k => $matchBefore) {
862
- if (isset($matchBefore[3])) {
863
- $matchBefore[3] = str_replace('\"', "'", addslashes($matchBefore[3]));
864
- if (preg_match_all(self::$inlineFormAttsPattern, $matchBefore[3], $attsBefore, PREG_SET_ORDER)) {
865
  $atts = [];
866
  foreach ($attsBefore as $k1 => $attrBefore) {
867
  $atts[$attrBefore[1]] = $attrBefore[2];
@@ -871,44 +890,44 @@ class WpdiscuzHelper implements WpDiscuzConstants {
871
  $inlineFormsBefore[$atts["id"]] = ["question" => $atts["question"], "opened" => $atts["opened"], "content" => $matchBefore[5]];
872
  }
873
  }
874
- }
875
- }
876
- foreach ($matchesAfter as $k => $matchAfter) {
877
- if (isset($matchAfter[3])) {
878
- $matchAfter[3] = str_replace('\"', "'", addslashes($matchAfter[3]));
879
- if (function_exists("use_block_editor_for_post") && use_block_editor_for_post($post_ID)) {
880
- $matchAfter[3] = json_decode('"' . $matchAfter[3] . '"');
881
- }
882
- if (preg_match_all(self::$inlineFormAttsPattern, $matchAfter[3], $attsAfter, PREG_SET_ORDER)) {
883
- $atts = [];
884
- foreach ($attsAfter as $k1 => $attrAfter) {
885
- $atts[$attrAfter[1]] = $attrAfter[2];
886
- }
887
- $atts["content"] = $matchAfter[5];
888
- $atts = array_merge($defaultAtts, $atts);
889
- if (($atts["id"] = trim($atts["id"])) && ($atts["question"] = strip_tags($atts["question"]))) {
890
- if (isset($inlineFormsBefore[$atts["id"]])) {
891
- if ($this->dbManager->getFeedbackFormByUid($post_ID, $atts["id"])) {
892
- if ($atts["question"] !== $inlineFormsBefore[$atts["id"]]["question"] || $atts["opened"] !== $inlineFormsBefore[$atts["id"]]["opened"] || $atts["content"] !== $inlineFormsBefore[$atts["id"]]["content"]) {
893
- $this->dbManager->updateFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
894
- }
895
- } else {
896
- $this->dbManager->addFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
897
- }
898
- unset($inlineFormsBefore[$atts["id"]]);
899
- } else {
900
- $this->dbManager->addFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
901
- }
902
- }
903
- }
904
- }
905
- }
906
- foreach ($inlineFormsBefore as $uid => $inlineFormBefore) {
907
- $this->dbManager->deleteFeedbackForm($post_ID, $uid);
908
- }
909
- }
910
- }
911
- }
912
 
913
  public function getCommentFormPath($theme) {
914
  if (file_exists(get_stylesheet_directory() . "/wpdiscuz/comment-form.php")) {
@@ -987,7 +1006,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
987
  }
988
 
989
  public function isUnapprovedInTree($comments) {
990
- foreach ($comments as $comment) {
991
  if ($comment->comment_approved === "0") {
992
  return true;
993
  }
@@ -995,145 +1014,145 @@ class WpdiscuzHelper implements WpDiscuzConstants {
995
  return $this->isUnapprovedInTree($children);
996
  }
997
  }
998
- return false;
999
  }
1000
-
1001
  public function getCommentAuthor($comment, $args) {
1002
- $user = ["user" => ""];
1003
- if ($comment->user_id) {
1004
- $user["user"] = get_user_by("id", $comment->user_id);
1005
- } else if ($this->options->login["isUserByEmail"]) {
1006
- $user["user"] = get_user_by("email", $comment->comment_author_email);
1007
- }
1008
- $user["commentAuthorUrl"] = ("http://" === $comment->comment_author_url) ? "" : $comment->comment_author_url;
1009
- $user["commentAuthorUrl"] = apply_filters("get_comment_author_url", $user["commentAuthorUrl"], $comment->comment_ID, $comment);
1010
- $user["commentWrapClass"] = [];
1011
- if ($user["user"]) {
1012
- $user["authorName"] = $comment->comment_author;
1013
- $user["authorAvatarField"] = $user["user"]->ID;
1014
- $user["gravatarUserId"] = $user["user"]->ID;
1015
- $user["gravatarUserEmail"] = $comment->comment_author_email;
1016
- $user["profileUrl"] = in_array($user["user"]->ID, $args["posts_authors"]) ? get_author_posts_url($user["user"]->ID) : "";
1017
- $user["profileUrl"] = $this->getProfileUrl($user["profileUrl"], $user["user"]);
1018
- if ($this->options->social["displayIconOnAvatar"] && ($socialProvider = get_user_meta($user["user"]->ID, self::WPDISCUZ_SOCIAL_PROVIDER_KEY, true))) {
1019
- $user["commentWrapClass"][] = "wpd-soc-user-" . $socialProvider;
1020
- if ($socialProvider === "facebook") {
1021
- $user["socIcon"] = "<i class='fab fa-facebook-f'></i>";
1022
- } else if ($socialProvider === "disqus") {
1023
- $user["socIcon"] = "<i class='wpd-soc-user-disqus'>D</i>";
1024
- } else if ($socialProvider === "ok") {
1025
- $user["socIcon"] = "<i class='fab fa-odnoklassniki'></i>";
1026
- } else if ($socialProvider === "yandex") {
1027
- $user["socIcon"] = "<i class='fab fa-yandex-international'></i>";
1028
- } else if ($socialProvider === "mailru") {
1029
- $user["socIcon"] = "<i class='fas fa-at'></i>";
1030
- } else if ($socialProvider === "baidu") {
1031
- $user["socIcon"] = "<i class='fas fa-paw'></i>";
1032
- } else {
1033
- $user["socIcon"] = "<i class='fab fa-{$socialProvider}'></i>";
1034
- }
1035
- }
1036
- } else {
1037
- $user["authorName"] = $comment->comment_author ? $comment->comment_author : esc_html($this->options->getPhrase("wc_anonymous"));
1038
- $user["authorAvatarField"] = $comment->comment_author_email;
1039
- $user["gravatarUserId"] = 0;
1040
- $user["gravatarUserEmail"] = $comment->comment_author_email;
1041
- $user["profileUrl"] = "";
1042
- }
1043
- $user["authorName"] = apply_filters("wpdiscuz_comment_author", $user["authorName"], $comment);
1044
- if ($this->options->thread_layouts["showAvatars"] && $this->options->wp["showAvatars"]) {
1045
- $user["authorAvatarField"] = apply_filters("wpdiscuz_author_avatar_field", $user["authorAvatarField"], $comment, $user["user"], $user["profileUrl"]);
1046
- $user["gravatarArgs"] = [
1047
- "wpdiscuz_gravatar_field" => $user["authorAvatarField"],
1048
- "wpdiscuz_gravatar_size" => $args["wpdiscuz_gravatar_size"],
1049
- "wpdiscuz_gravatar_user_id" => $user["gravatarUserId"],
1050
- "wpdiscuz_gravatar_user_email" => $user["gravatarUserEmail"],
1051
- "wpdiscuz_current_user" => $user["user"],
1052
- ];
1053
- $user["avatar"] = get_avatar($user["gravatarArgs"]["wpdiscuz_gravatar_field"], $user["gravatarArgs"]["wpdiscuz_gravatar_size"], "", $user["authorName"], $user["gravatarArgs"]);
1054
- }
1055
- $user["authorNameHtml"] = $user["authorName"];
1056
- if ($this->options->login["enableProfileURLs"]) {
1057
- if ($user["profileUrl"]) {
1058
- $attributes = apply_filters("wpdiscuz_avatar_link_attributes", [
1059
- "href" => $user["profileUrl"],
1060
- "target" => "_blank",
1061
- "rel" => "noreferrer ugc"
1062
- ]);
1063
- if ($attributes && is_array($attributes)) {
1064
- $attributesHtml = "";
1065
- foreach ($attributes as $attribute => $value) {
1066
- $attributesHtml .= " $attribute='{$value}'";
1067
- }
1068
- $user["authorAvatarSprintf"] = "<a" . str_replace("%", "%%", $attributesHtml) . ">%s</a>";
1069
- } else {
1070
- $user["authorAvatarSprintf"] = "<a rel='noreferrer ugc' href='" . str_replace("%", "%%", $user["profileUrl"]) . "' target='_blank'>%s</a>";
1071
- }
1072
- }
1073
- if ((($href = $user["commentAuthorUrl"]) && $this->options->login["websiteAsProfileUrl"]) || ($href = $user["profileUrl"])) {
1074
- $rel = "noreferrer ugc";
1075
- if (strpos($href, $args["site_url"]) !== 0) {
1076
- $rel .= " nofollow";
1077
- }
1078
- $attributes = apply_filters("wpdiscuz_author_link_attributes", [
1079
- "href" => $href,
1080
- "rel" => $rel,
1081
- "target" => "_blank"
1082
- ]);
1083
- if ($attributes && is_array($attributes)) {
1084
- $attributesHtml = "";
1085
- foreach ($attributes as $attribute => $value) {
1086
- $attributesHtml .= " $attribute='$value'";
1087
- }
1088
- $user["authorNameHtml"] = "<a$attributesHtml>{$user["authorNameHtml"]}</a>";
1089
- } else {
1090
- $user["authorNameHtml"] = "<a rel='$rel' href='$href' target='_blank'>{$user["authorNameHtml"]}</a>";
1091
- }
1092
- }
1093
- }
1094
- $this->fillUserRoleData($user, $args);
1095
- return $user;
1096
- }
1097
-
1098
- public function fillUserRoleData(&$user, $args) {
1099
- $user["author_title"] = "";
1100
- $user["commentWrapRoleClass"] = [];
1101
- if ($user["user"]) {
1102
- if ($user["user"]->ID == $args["post_author"]) {
1103
- $user["commentWrapRoleClass"][] = "wpd-blog-user";
1104
- $user["commentWrapRoleClass"][] = "wpd-blog-post_author";
1105
- if (!empty($this->options->labels["blogRoleLabels"]["post_author"])) {
1106
- $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_post_author"));
1107
- }
1108
- } else {
1109
- if ($this->options->labels["blogRoles"]) {
1110
- if ($user["user"]->roles && is_array($user["user"]->roles)) {
1111
- foreach ($user["user"]->roles as $k => $role) {
1112
- if (isset($this->options->labels["blogRoles"][$role])) {
1113
- $user["commentWrapRoleClass"][] = "wpd-blog-user";
1114
- $user["commentWrapRoleClass"][] = "wpd-blog-" . $role;
1115
- $rolePhrase = esc_html($this->options->getPhrase("wc_blog_role_" . $role, ["default" => ""]));
1116
- if (!empty($this->options->labels["blogRoleLabels"][$role])) {
1117
- $user["author_title"] = apply_filters("wpdiscuz_user_label", $rolePhrase, $user["user"]);
1118
- }
1119
- break;
1120
- }
1121
- }
1122
- } else {
1123
- $user["commentWrapRoleClass"][] = "wpd-blog-guest";
1124
- if (!empty($this->options->labels["blogRoleLabels"]["guest"])) {
1125
- $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_guest"));
1126
- }
1127
- }
1128
- }
1129
- }
1130
- } else {
1131
- $user["commentWrapRoleClass"][] = "wpd-blog-guest";
1132
- if (!empty($this->options->labels["blogRoleLabels"]["guest"])) {
1133
- $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_guest"));
1134
- }
1135
- }
1136
- }
1137
 
1138
  public function getProfileUrl($profile_url, $user) {
1139
  if ($this->options->login["enableProfileURLs"] && $user) {
@@ -1294,17 +1313,17 @@ class WpdiscuzHelper implements WpDiscuzConstants {
1294
  echo "#wpdcom .wpd-blog-post_author .wpd-avatar img{border-color: " . $color . ";}";
1295
  }
1296
  if ($role !== "subscriber" && $role !== "guest") {
1297
- echo "#wpdcom.wpd-layout-1 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-color: " . $color . ";}\r\n";
1298
  }
1299
  if ($role === "administrator" || $role === "editor" || $role === "post_author") {
1300
  echo "#wpdcom.wpd-layout-2 .wpd-comment.wpd-reply .wpd-comment-wrap.wpd-blog-" . $role . "{border-" . $left . ": 3px solid " . $color . ";}\r\n";
1301
  }
1302
  if ($role !== "guest") {
1303
- echo "#wpdcom.wpd-layout-2 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-bottom-color: " . $color . ";}\r\n";
1304
  }
1305
  echo "#wpdcom.wpd-layout-3 .wpd-blog-" . $role . " .wpd-comment-subheader{border-top: 1px dashed " . $color . ";}\r\n";
1306
  if ($role !== "subscriber" && $role !== "guest") {
1307
- echo "#wpdcom.wpd-layout-3 .wpd-reply .wpd-blog-" . $role . " .wpd-comment-right{border-" . $left . ": 1px solid " . $color . ";}\r\n";
1308
  }
1309
  }
1310
  ?>
@@ -1438,8 +1457,8 @@ class WpdiscuzHelper implements WpDiscuzConstants {
1438
  }
1439
  return '#' . implode($hexCode);
1440
  }
1441
-
1442
- public static function sanitize($action,$variable_name, $filter,$default){
1443
  $variable = filter_input($action, $variable_name, $filter);
1444
  return $variable ? $variable : $default;
1445
  }
134
  return $text;
135
  }
136
 
137
+ //================== Nonce==================================================
138
+ public function generateNonceKey() {
139
+ return ($key = get_home_url()) ? md5($key) : self::GLOBAL_NONCE_NAME;
140
+ }
141
+
142
+ public function generateNonce() {
143
+ return wp_create_nonce($this->generateNonceKey());
144
+ }
145
+
146
+ public function validateNonce() {
147
+ $nonce = !empty($_REQUEST[self::GLOBAL_NONCE_NAME]) ? sanitize_text_field($_REQUEST[self::GLOBAL_NONCE_NAME]) : "";
148
+ if (!wp_verify_nonce($nonce, $this->generateNonceKey())) {
149
+ wp_die(__("Nonce is invalid.", "wpdiscuz"));
150
+ }
151
+ }
152
+
153
+ //==========================================================================
154
+
155
  public function getNumber($number) {
156
  if ($this->options->general["humanReadableNumbers"]) {
157
  if (absint($number) >= 1000000) {
158
+ $number = sprintf(esc_html__("%sM", "wpdiscuz"), str_replace(".0", "", number_format($number / 1000000, 1)));
159
+ } else if (absint($number) >= 1000) {
160
  $number = sprintf(esc_html__("%sK", "wpdiscuz"), str_replace(".0", "", number_format($number / 1000, 1)));
161
  }
162
  }
225
  $commentMinLength = intval($this->options->content["replyTextMinLength"]);
226
  $commentMaxLength = intval($this->options->content["replyTextMaxLength"]);
227
  } else {
228
+ $commentMinLength = intval($this->options->content["commentTextMinLength"]);
229
+ $commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
230
  }
231
  $commentContent = trim(strip_tags($commentContent));
232
  $contentLength = function_exists("mb_strlen") ? mb_strlen($commentContent) : strlen($commentContent);
486
  }
487
 
488
  public function wpdGetInfo() {
489
+ $this->validateNonce();
490
  $response = "";
491
  $currentUser = self::getCurrentUser();
492
  if ($currentUser && $currentUser->ID) {
618
  }
619
 
620
  public function getActivityPage() {
621
+ $this->validateNonce();
622
  ob_start();
623
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/activity/activity-page.php";
624
  $html = ob_get_clean();
626
  }
627
 
628
  private function getSubscriptionsTitleHtml() {
629
+ $this->validateNonce();
630
  ob_start();
631
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/title.php";
632
  return ob_get_clean();
644
  }
645
 
646
  public function getSubscriptionsPage() {
647
+ $this->validateNonce();
648
  ob_start();
649
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/subscriptions-page.php";
650
  $html = ob_get_clean();
652
  }
653
 
654
  private function getFollowsTitleHtml() {
655
+ $this->validateNonce();
656
  ob_start();
657
  include_once WPDISCUZ_DIR_PATH . "/utils/layouts/follows/title.php";
658
  return ob_get_clean();
677
  }
678
 
679
  public static function fixEmailFrom($domain) {
680
+ $domain = strtolower($domain);
681
+ if (substr($domain, 0, 4) === "www.") {
682
+ $domain = substr($domain, 4);
683
+ }
684
+ $localhost = ['127.0.0.1', '::1'];
685
+ if (in_array($_SERVER['REMOTE_ADDR'], $localhost, true)) {
686
+ $domain .= ".com";
687
+ }
688
+ return $domain;
689
  }
690
 
691
  public function fixLocalhostIp($ip) {
819
  }
820
 
821
  public function userMentioning($content, $comment, $args = []) {
822
+ if (apply_filters("wpdiscuz_enable_user_mentioning", true) && !empty($args["is_wpdiscuz_comment"]) && ($users = $this->getMentionedUsers($content))) {
823
  foreach ($users as $k => $user) {
824
  $user_link = "";
825
  if (class_exists("BuddyPress")) {
850
  return $content;
851
  }
852
 
853
+ public function getMentionedUsers($content) {
854
  $users = [];
855
  if (preg_match_all("/(@[^\s\,\@\.\!\?\#\$\%\:\;\'\"\`\~\)\(\}\{\|\\\[\]]*)/is", $content, $nicknames)) {
856
  $nicknames = array_map("strip_tags", $nicknames[0]);
857
  $nicknames = array_unique($nicknames);
858
  foreach ($nicknames as $k => $nickname) {
859
+ $user = $this->dbManager->getUserByNicename(ltrim($nickname, "@"));
 
 
 
 
860
  if ($user) {
861
  $users[] = ["replace" => $nickname, "u_id" => $user->ID, "name" => $user->display_name, "email" => $user->user_email];
862
  }
865
  return $users;
866
  }
867
 
868
+ public function checkFeedbackShortcodes($post_ID, $post_after, $post_before) {
869
+ if (comments_open($post_ID) && ($form = $this->wpdiscuzForm->getForm($post_ID)) && $form->getFormID()) {
870
  preg_match_all(self::$inlineFormPattern, $post_before->post_content, $matchesBefore, PREG_SET_ORDER);
871
+ if ($post_after->post_content) {
872
  preg_match_all(self::$inlineFormPattern, $post_after->post_content, $matchesAfter, PREG_SET_ORDER);
873
  } else {
874
+ $matchesAfter = $matchesBefore;
875
+ $matchesBefore = [];
876
  }
877
+ if ($matchesAfter || $matchesBefore) {
878
+ $inlineFormsBefore = [];
879
+ $defaultAtts = ["id" => "", "question" => "", "opened" => 0, "content" => ""];
880
+ foreach ($matchesBefore as $k => $matchBefore) {
881
+ if (isset($matchBefore[3])) {
882
+ $matchBefore[3] = str_replace('\"', "'", addslashes($matchBefore[3]));
883
+ if (preg_match_all(self::$inlineFormAttsPattern, $matchBefore[3], $attsBefore, PREG_SET_ORDER)) {
884
  $atts = [];
885
  foreach ($attsBefore as $k1 => $attrBefore) {
886
  $atts[$attrBefore[1]] = $attrBefore[2];
890
  $inlineFormsBefore[$atts["id"]] = ["question" => $atts["question"], "opened" => $atts["opened"], "content" => $matchBefore[5]];
891
  }
892
  }
893
+ }
894
+ }
895
+ foreach ($matchesAfter as $k => $matchAfter) {
896
+ if (isset($matchAfter[3])) {
897
+ $matchAfter[3] = str_replace('\"', "'", addslashes($matchAfter[3]));
898
+ if (function_exists("use_block_editor_for_post") && use_block_editor_for_post($post_ID)) {
899
+ $matchAfter[3] = json_decode('"' . $matchAfter[3] . '"');
900
+ }
901
+ if (preg_match_all(self::$inlineFormAttsPattern, $matchAfter[3], $attsAfter, PREG_SET_ORDER)) {
902
+ $atts = [];
903
+ foreach ($attsAfter as $k1 => $attrAfter) {
904
+ $atts[$attrAfter[1]] = $attrAfter[2];
905
+ }
906
+ $atts["content"] = $matchAfter[5];
907
+ $atts = array_merge($defaultAtts, $atts);
908
+ if (($atts["id"] = trim($atts["id"])) && ($atts["question"] = strip_tags($atts["question"]))) {
909
+ if (isset($inlineFormsBefore[$atts["id"]])) {
910
+ if ($this->dbManager->getFeedbackFormByUid($post_ID, $atts["id"])) {
911
+ if ($atts["question"] !== $inlineFormsBefore[$atts["id"]]["question"] || $atts["opened"] !== $inlineFormsBefore[$atts["id"]]["opened"] || $atts["content"] !== $inlineFormsBefore[$atts["id"]]["content"]) {
912
+ $this->dbManager->updateFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
913
+ }
914
+ } else {
915
+ $this->dbManager->addFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
916
+ }
917
+ unset($inlineFormsBefore[$atts["id"]]);
918
+ } else {
919
+ $this->dbManager->addFeedbackForm($post_ID, $atts["id"], $atts["question"], $atts["opened"], $atts["content"]);
920
+ }
921
+ }
922
+ }
923
+ }
924
+ }
925
+ foreach ($inlineFormsBefore as $uid => $inlineFormBefore) {
926
+ $this->dbManager->deleteFeedbackForm($post_ID, $uid);
927
+ }
928
+ }
929
+ }
930
+ }
931
 
932
  public function getCommentFormPath($theme) {
933
  if (file_exists(get_stylesheet_directory() . "/wpdiscuz/comment-form.php")) {
1006
  }
1007
 
1008
  public function isUnapprovedInTree($comments) {
1009
+ foreach ($comments as $comment) {
1010
  if ($comment->comment_approved === "0") {
1011
  return true;
1012
  }
1014
  return $this->isUnapprovedInTree($children);
1015
  }
1016
  }
1017
+ return false;
1018
  }
1019
+
1020
  public function getCommentAuthor($comment, $args) {
1021
+ $user = ["user" => ""];
1022
+ if ($comment->user_id) {
1023
+ $user["user"] = get_user_by("id", $comment->user_id);
1024
+ } else if ($this->options->login["isUserByEmail"]) {
1025
+ $user["user"] = get_user_by("email", $comment->comment_author_email);
1026
+ }
1027
+ $user["commentAuthorUrl"] = ("http://" === $comment->comment_author_url) ? "" : $comment->comment_author_url;
1028
+ $user["commentAuthorUrl"] = apply_filters("get_comment_author_url", $user["commentAuthorUrl"], $comment->comment_ID, $comment);
1029
+ $user["commentWrapClass"] = [];
1030
+ if ($user["user"]) {
1031
+ $user["authorName"] = $comment->comment_author;
1032
+ $user["authorAvatarField"] = $user["user"]->ID;
1033
+ $user["gravatarUserId"] = $user["user"]->ID;
1034
+ $user["gravatarUserEmail"] = $comment->comment_author_email;
1035
+ $user["profileUrl"] = in_array($user["user"]->ID, $args["posts_authors"]) ? get_author_posts_url($user["user"]->ID) : "";
1036
+ $user["profileUrl"] = $this->getProfileUrl($user["profileUrl"], $user["user"]);
1037
+ if ($this->options->social["displayIconOnAvatar"] && ($socialProvider = get_user_meta($user["user"]->ID, self::WPDISCUZ_SOCIAL_PROVIDER_KEY, true))) {
1038
+ $user["commentWrapClass"][] = "wpd-soc-user-" . $socialProvider;
1039
+ if ($socialProvider === "facebook") {
1040
+ $user["socIcon"] = "<i class='fab fa-facebook-f'></i>";
1041
+ } else if ($socialProvider === "disqus") {
1042
+ $user["socIcon"] = "<i class='wpd-soc-user-disqus'>D</i>";
1043
+ } else if ($socialProvider === "ok") {
1044
+ $user["socIcon"] = "<i class='fab fa-odnoklassniki'></i>";
1045
+ } else if ($socialProvider === "yandex") {
1046
+ $user["socIcon"] = "<i class='fab fa-yandex-international'></i>";
1047
+ } else if ($socialProvider === "mailru") {
1048
+ $user["socIcon"] = "<i class='fas fa-at'></i>";
1049
+ } else if ($socialProvider === "baidu") {
1050
+ $user["socIcon"] = "<i class='fas fa-paw'></i>";
1051
+ } else {
1052
+ $user["socIcon"] = "<i class='fab fa-{$socialProvider}'></i>";
1053
+ }
1054
+ }
1055
+ } else {
1056
+ $user["authorName"] = $comment->comment_author ? $comment->comment_author : esc_html($this->options->getPhrase("wc_anonymous"));
1057
+ $user["authorAvatarField"] = $comment->comment_author_email;
1058
+ $user["gravatarUserId"] = 0;
1059
+ $user["gravatarUserEmail"] = $comment->comment_author_email;
1060
+ $user["profileUrl"] = "";
1061
+ }
1062
+ $user["authorName"] = apply_filters("wpdiscuz_comment_author", $user["authorName"], $comment);
1063
+ if ($this->options->thread_layouts["showAvatars"] && $this->options->wp["showAvatars"]) {
1064
+ $user["authorAvatarField"] = apply_filters("wpdiscuz_author_avatar_field", $user["authorAvatarField"], $comment, $user["user"], $user["profileUrl"]);
1065
+ $user["gravatarArgs"] = [
1066
+ "wpdiscuz_gravatar_field" => $user["authorAvatarField"],
1067
+ "wpdiscuz_gravatar_size" => $args["wpdiscuz_gravatar_size"],
1068
+ "wpdiscuz_gravatar_user_id" => $user["gravatarUserId"],
1069
+ "wpdiscuz_gravatar_user_email" => $user["gravatarUserEmail"],
1070
+ "wpdiscuz_current_user" => $user["user"],
1071
+ ];
1072
+ $user["avatar"] = get_avatar($user["gravatarArgs"]["wpdiscuz_gravatar_field"], $user["gravatarArgs"]["wpdiscuz_gravatar_size"], "", $user["authorName"], $user["gravatarArgs"]);
1073
+ }
1074
+ $user["authorNameHtml"] = $user["authorName"];
1075
+ if ($this->options->login["enableProfileURLs"]) {
1076
+ if ($user["profileUrl"]) {
1077
+ $attributes = apply_filters("wpdiscuz_avatar_link_attributes", [
1078
+ "href" => $user["profileUrl"],
1079
+ "target" => "_blank",
1080
+ "rel" => "noreferrer ugc"
1081
+ ]);
1082
+ if ($attributes && is_array($attributes)) {
1083
+ $attributesHtml = "";
1084
+ foreach ($attributes as $attribute => $value) {
1085
+ $attributesHtml .= " $attribute='{$value}'";
1086
+ }
1087
+ $user["authorAvatarSprintf"] = "<a" . str_replace("%", "%%", $attributesHtml) . ">%s</a>";
1088
+ } else {
1089
+ $user["authorAvatarSprintf"] = "<a rel='noreferrer ugc' href='" . str_replace("%", "%%", $user["profileUrl"]) . "' target='_blank'>%s</a>";
1090
+ }
1091
+ }
1092
+ if ((($href = $user["commentAuthorUrl"]) && $this->options->login["websiteAsProfileUrl"]) || ($href = $user["profileUrl"])) {
1093
+ $rel = "noreferrer ugc";
1094
+ if (strpos($href, $args["site_url"]) !== 0) {
1095
+ $rel .= " nofollow";
1096
+ }
1097
+ $attributes = apply_filters("wpdiscuz_author_link_attributes", [
1098
+ "href" => $href,
1099
+ "rel" => $rel,
1100
+ "target" => "_blank"
1101
+ ]);
1102
+ if ($attributes && is_array($attributes)) {
1103
+ $attributesHtml = "";
1104
+ foreach ($attributes as $attribute => $value) {
1105
+ $attributesHtml .= " $attribute='$value'";
1106
+ }
1107
+ $user["authorNameHtml"] = "<a$attributesHtml>{$user["authorNameHtml"]}</a>";
1108
+ } else {
1109
+ $user["authorNameHtml"] = "<a rel='$rel' href='$href' target='_blank'>{$user["authorNameHtml"]}</a>";
1110
+ }
1111
+ }
1112
+ }
1113
+ $this->fillUserRoleData($user, $args);
1114
+ return $user;
1115
+ }
1116
+
1117
+ public function fillUserRoleData(&$user, $args) {
1118
+ $user["author_title"] = "";
1119
+ $user["commentWrapRoleClass"] = [];
1120
+ if ($user["user"]) {
1121
+ if ($user["user"]->ID == $args["post_author"]) {
1122
+ $user["commentWrapRoleClass"][] = "wpd-blog-user";
1123
+ $user["commentWrapRoleClass"][] = "wpd-blog-post_author";
1124
+ if (!empty($this->options->labels["blogRoleLabels"]["post_author"])) {
1125
+ $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_post_author"));
1126
+ }
1127
+ } else {
1128
+ if ($this->options->labels["blogRoles"]) {
1129
+ if ($user["user"]->roles && is_array($user["user"]->roles)) {
1130
+ foreach ($user["user"]->roles as $k => $role) {
1131
+ if (isset($this->options->labels["blogRoles"][$role])) {
1132
+ $user["commentWrapRoleClass"][] = "wpd-blog-user";
1133
+ $user["commentWrapRoleClass"][] = "wpd-blog-" . $role;
1134
+ $rolePhrase = esc_html($this->options->getPhrase("wc_blog_role_" . $role, ["default" => ""]));
1135
+ if (!empty($this->options->labels["blogRoleLabels"][$role])) {
1136
+ $user["author_title"] = apply_filters("wpdiscuz_user_label", $rolePhrase, $user["user"]);
1137
+ }
1138
+ break;
1139
+ }
1140
+ }
1141
+ } else {
1142
+ $user["commentWrapRoleClass"][] = "wpd-blog-guest";
1143
+ if (!empty($this->options->labels["blogRoleLabels"]["guest"])) {
1144
+ $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_guest"));
1145
+ }
1146
+ }
1147
+ }
1148
+ }
1149
+ } else {
1150
+ $user["commentWrapRoleClass"][] = "wpd-blog-guest";
1151
+ if (!empty($this->options->labels["blogRoleLabels"]["guest"])) {
1152
+ $user["author_title"] = esc_html($this->options->getPhrase("wc_blog_role_guest"));
1153
+ }
1154
+ }
1155
+ }
1156
 
1157
  public function getProfileUrl($profile_url, $user) {
1158
  if ($this->options->login["enableProfileURLs"] && $user) {
1313
  echo "#wpdcom .wpd-blog-post_author .wpd-avatar img{border-color: " . $color . ";}";
1314
  }
1315
  if ($role !== "subscriber" && $role !== "guest") {
1316
+ echo "#wpdcom.wpd-layout-1 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-color: " . $color . ";}\r\n";
1317
  }
1318
  if ($role === "administrator" || $role === "editor" || $role === "post_author") {
1319
  echo "#wpdcom.wpd-layout-2 .wpd-comment.wpd-reply .wpd-comment-wrap.wpd-blog-" . $role . "{border-" . $left . ": 3px solid " . $color . ";}\r\n";
1320
  }
1321
  if ($role !== "guest") {
1322
+ echo "#wpdcom.wpd-layout-2 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-bottom-color: " . $color . ";}\r\n";
1323
  }
1324
  echo "#wpdcom.wpd-layout-3 .wpd-blog-" . $role . " .wpd-comment-subheader{border-top: 1px dashed " . $color . ";}\r\n";
1325
  if ($role !== "subscriber" && $role !== "guest") {
1326
+ echo "#wpdcom.wpd-layout-3 .wpd-reply .wpd-blog-" . $role . " .wpd-comment-right{border-" . $left . ": 1px solid " . $color . ";}\r\n";
1327
  }
1328
  }
1329
  ?>
1457
  }
1458
  return '#' . implode($hexCode);
1459
  }
1460
+
1461
+ public static function sanitize($action, $variable_name, $filter, $default) {
1462
  $variable = filter_input($action, $variable_name, $filter);
1463
  return $variable ? $variable : $default;
1464
  }
utils/class.WpdiscuzHelperAjax.php CHANGED
@@ -67,6 +67,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
67
  }
68
 
69
  public function stickComment() {
 
70
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
71
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
72
  if ($postId && $commentId) {
@@ -96,6 +97,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
96
  }
97
 
98
  public function closeThread() {
 
99
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
100
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
101
  if ($postId && $commentId) {
@@ -182,6 +184,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
182
  * Import subscriptions from "Subscribe To Comments Reloaded" plugin
183
  */
184
  public function importSTCR() {
 
185
  $response = ["progress" => 0];
186
  $stcrData = isset($_POST["stcrData"]) ? sanitize_textarea_field($_POST["stcrData"]) : "";
187
  if ($stcrData) {
@@ -213,6 +216,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
213
  * Import subscriptions from "Lightweight Subscribe To Comments" plugin
214
  */
215
  public function importLSTC() {
 
216
  $response = ["progress" => 0];
217
  $lstcData = isset($_POST["lstcData"]) ? sanitize_textarea_field($_POST["lstcData"]) : "";
218
  if ($lstcData) {
@@ -241,6 +245,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
241
  }
242
 
243
  public function deleteComment() {
 
244
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
245
  $currentUser = WpdiscuzHelper::getCurrentUser();
246
  if ($commentId && !empty($currentUser->ID) && $this->options->login["showActivityTab"] && ($comment = get_comment($commentId)) && intval($currentUser->ID) === intval($comment->user_id)) {
@@ -250,6 +255,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
250
  }
251
 
252
  public function deleteSubscription() {
 
253
  $subscriptionId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
254
  $currentUser = WpdiscuzHelper::getCurrentUser();
255
  if ($subscriptionId && !empty($currentUser->ID) && $this->options->login["showSubscriptionsTab"] && ($subscription = $this->dbManager->getSubscriptionById($subscriptionId)) && $currentUser->user_email === $subscription->email) {
@@ -259,6 +265,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
259
  }
260
 
261
  public function deleteFollow() {
 
262
  $followId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
263
  $currentUser = WpdiscuzHelper::getCurrentUser();
264
  if ($followId && !empty($currentUser->ID) && $this->options->login["showFollowsTab"] && ($follow = $this->dbManager->getFollowById($followId)) && $currentUser->ID === intval($follow->follower_id)) {
@@ -270,6 +277,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
270
 
271
  public function emailDeleteLinks() {
272
  global $wp_rewrite;
 
273
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
274
  $post = get_post($postId);
275
  $currentUser = WpdiscuzHelper::getCurrentUser();
@@ -309,6 +317,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
309
 
310
  public function guestAction() {
311
  global $wp_rewrite;
 
312
  $guestEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? $_COOKIE["comment_author_email_" . COOKIEHASH] : "";
313
  $guestAction = filter_input(INPUT_POST, "guestAction", FILTER_SANITIZE_STRING);
314
  $postId = filter_input(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT);
@@ -376,6 +385,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
376
  }
377
 
378
  public function followUser() {
 
379
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
380
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
381
  if ($postId && $commentId) {
@@ -450,6 +460,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
450
  }
451
 
452
  public function regenerateVoteMetas() {
 
453
  $response = ["progress" => 0];
454
  $voteRegenerateData = isset($_POST["voteRegenerateData"]) ? $_POST["voteRegenerateData"] : "";
455
  if ($voteRegenerateData) {
@@ -482,6 +493,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
482
  }
483
 
484
  public function regenerateClosedComments() {
 
485
  $response = ["progress" => 0];
486
  $closedRegenerateData = isset($_POST["closedRegenerateData"]) ? sanitize_textarea_field($_POST["closedRegenerateData"]) : "";
487
  if ($closedRegenerateData) {
@@ -546,6 +558,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
546
  }
547
 
548
  public function syncCommenterData() {
 
549
  $syncCommenterData = !empty($_POST["syncCommenterData"]) ? sanitize_textarea_field($_POST["syncCommenterData"]) : "";
550
  if ($syncCommenterData) {
551
  parse_str($syncCommenterData, $data);
@@ -560,6 +573,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
560
  }
561
 
562
  public function rebuildRatings() {
 
563
  $response = ["progress" => 0];
564
  $rebuildRatings = isset($_POST["rebuildRatings"]) ? sanitize_textarea_field($_POST["rebuildRatings"]) : "";
565
  if ($rebuildRatings) {
@@ -592,6 +606,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
592
  }
593
 
594
  public function fixTables() {
 
595
  $fixTables = isset($_POST["fixTables"]) ? sanitize_textarea_field($_POST["fixTables"]) : "";
596
  if ($fixTables) {
597
  parse_str($fixTables, $data);
@@ -659,6 +674,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
659
  }
660
 
661
  public function voteOnComment() {
 
662
  $isUserLoggedIn = is_user_logged_in();
663
  if (!$this->options->thread_layouts["isGuestCanVote"] && !$isUserLoggedIn) {
664
  wp_send_json_error("wc_login_to_vote");
@@ -766,6 +782,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
766
  }
767
 
768
  public function getInlineCommentForm() {
 
769
  $post_id = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
770
  if ($post_id && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && $this->dbManager->postHasFeedbackForms($post_id)) {
771
  $currentUser = WpdiscuzHelper::getCurrentUser();
@@ -841,6 +858,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
841
  * get comment text from db
842
  */
843
  public function editComment() {
 
844
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
845
  if ($commentId) {
846
  $comment = get_comment($commentId);
@@ -861,6 +879,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
861
  }
862
 
863
  public function userRate() {
 
864
  $rating = WpdiscuzHelper::sanitize(INPUT_POST, "rating", FILTER_SANITIZE_NUMBER_INT, 0);
865
  $post_id = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
866
  if ($rating && $post_id && ($form = $this->wpdiscuzForm->getForm($post_id))) {
@@ -909,6 +928,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
909
  }
910
 
911
  public function unsubscribe() {
 
912
  $sid = WpdiscuzHelper::sanitize(INPUT_POST, "sid", FILTER_SANITIZE_NUMBER_INT, 0);
913
  $skey = WpdiscuzHelper::sanitize(INPUT_POST, "skey", FILTER_SANITIZE_STRING, "");
914
  if ($sid && $skey) {
@@ -919,10 +939,12 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
919
  }
920
 
921
  public function wpd_stat_brief() {
 
922
  wp_send_json_success(["all" => esc_html($this->dbManager->getCommentsCount()), "inline" => esc_html($this->dbManager->getInlineCommentsCount()), "threads" => esc_html($this->dbManager->getThreadsCount()), "replies" => esc_html($this->dbManager->getRepliesCount()), "users" => esc_html($this->dbManager->getUserCommentersCount()), "guests" => esc_html($this->dbManager->getGuestCommentersCount())]);
923
  }
924
 
925
  public function wpd_stat_subs() {
 
926
  ob_start();
927
  ?>
928
  <ul class="wpd-box-list">
@@ -938,6 +960,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
938
  }
939
 
940
  public function wpd_stat_graph() {
 
941
  $interval = trim(WpdiscuzHelper::sanitize(INPUT_POST, "interval", FILTER_SANITIZE_STRING, ""));
942
  if ($interval) {
943
  $all = $this->dbManager->getGraphAllComments($interval);
@@ -968,6 +991,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
968
  }
969
 
970
  public function wpd_stat_user() {
 
971
  $orderby = WpdiscuzHelper::sanitize(INPUT_POST, "orderby", FILTER_SANITIZE_STRING, "");
972
  $order = WpdiscuzHelper::sanitize(INPUT_POST, "order", FILTER_SANITIZE_STRING, "");
973
  $page = WpdiscuzHelper::sanitize(INPUT_POST, "page", FILTER_SANITIZE_STRING, "");
@@ -1034,6 +1058,7 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
1034
  }
1035
 
1036
  public function searchOption() {
 
1037
  $search = WpdiscuzHelper::sanitize(INPUT_POST, "s", FILTER_SANITIZE_STRING, "");
1038
  if ($search) {
1039
  $optionsObject = $this->options;
67
  }
68
 
69
  public function stickComment() {
70
+ $this->helper->validateNonce();
71
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
72
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
73
  if ($postId && $commentId) {
97
  }
98
 
99
  public function closeThread() {
100
+ $this->helper->validateNonce();
101
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
102
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
103
  if ($postId && $commentId) {
184
  * Import subscriptions from "Subscribe To Comments Reloaded" plugin
185
  */
186
  public function importSTCR() {
187
+ $this->helper->validateNonce();
188
  $response = ["progress" => 0];
189
  $stcrData = isset($_POST["stcrData"]) ? sanitize_textarea_field($_POST["stcrData"]) : "";
190
  if ($stcrData) {
216
  * Import subscriptions from "Lightweight Subscribe To Comments" plugin
217
  */
218
  public function importLSTC() {
219
+ $this->helper->validateNonce();
220
  $response = ["progress" => 0];
221
  $lstcData = isset($_POST["lstcData"]) ? sanitize_textarea_field($_POST["lstcData"]) : "";
222
  if ($lstcData) {
245
  }
246
 
247
  public function deleteComment() {
248
+ $this->helper->validateNonce();
249
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
250
  $currentUser = WpdiscuzHelper::getCurrentUser();
251
  if ($commentId && !empty($currentUser->ID) && $this->options->login["showActivityTab"] && ($comment = get_comment($commentId)) && intval($currentUser->ID) === intval($comment->user_id)) {
255
  }
256
 
257
  public function deleteSubscription() {
258
+ $this->helper->validateNonce();
259
  $subscriptionId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
260
  $currentUser = WpdiscuzHelper::getCurrentUser();
261
  if ($subscriptionId && !empty($currentUser->ID) && $this->options->login["showSubscriptionsTab"] && ($subscription = $this->dbManager->getSubscriptionById($subscriptionId)) && $currentUser->user_email === $subscription->email) {
265
  }
266
 
267
  public function deleteFollow() {
268
+ $this->helper->validateNonce();
269
  $followId = WpdiscuzHelper::sanitize(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT, 0);
270
  $currentUser = WpdiscuzHelper::getCurrentUser();
271
  if ($followId && !empty($currentUser->ID) && $this->options->login["showFollowsTab"] && ($follow = $this->dbManager->getFollowById($followId)) && $currentUser->ID === intval($follow->follower_id)) {
277
 
278
  public function emailDeleteLinks() {
279
  global $wp_rewrite;
280
+ $this->helper->validateNonce();
281
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
282
  $post = get_post($postId);
283
  $currentUser = WpdiscuzHelper::getCurrentUser();
317
 
318
  public function guestAction() {
319
  global $wp_rewrite;
320
+ $this->helper->validateNonce();
321
  $guestEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? $_COOKIE["comment_author_email_" . COOKIEHASH] : "";
322
  $guestAction = filter_input(INPUT_POST, "guestAction", FILTER_SANITIZE_STRING);
323
  $postId = filter_input(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT);
385
  }
386
 
387
  public function followUser() {
388
+ $this->helper->validateNonce();
389
  $postId = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
390
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
391
  if ($postId && $commentId) {
460
  }
461
 
462
  public function regenerateVoteMetas() {
463
+ $this->helper->validateNonce();
464
  $response = ["progress" => 0];
465
  $voteRegenerateData = isset($_POST["voteRegenerateData"]) ? $_POST["voteRegenerateData"] : "";
466
  if ($voteRegenerateData) {
493
  }
494
 
495
  public function regenerateClosedComments() {
496
+ $this->helper->validateNonce();
497
  $response = ["progress" => 0];
498
  $closedRegenerateData = isset($_POST["closedRegenerateData"]) ? sanitize_textarea_field($_POST["closedRegenerateData"]) : "";
499
  if ($closedRegenerateData) {
558
  }
559
 
560
  public function syncCommenterData() {
561
+ $this->helper->validateNonce();
562
  $syncCommenterData = !empty($_POST["syncCommenterData"]) ? sanitize_textarea_field($_POST["syncCommenterData"]) : "";
563
  if ($syncCommenterData) {
564
  parse_str($syncCommenterData, $data);
573
  }
574
 
575
  public function rebuildRatings() {
576
+ $this->helper->validateNonce();
577
  $response = ["progress" => 0];
578
  $rebuildRatings = isset($_POST["rebuildRatings"]) ? sanitize_textarea_field($_POST["rebuildRatings"]) : "";
579
  if ($rebuildRatings) {
606
  }
607
 
608
  public function fixTables() {
609
+ $this->helper->validateNonce();
610
  $fixTables = isset($_POST["fixTables"]) ? sanitize_textarea_field($_POST["fixTables"]) : "";
611
  if ($fixTables) {
612
  parse_str($fixTables, $data);
674
  }
675
 
676
  public function voteOnComment() {
677
+ $this->helper->validateNonce();
678
  $isUserLoggedIn = is_user_logged_in();
679
  if (!$this->options->thread_layouts["isGuestCanVote"] && !$isUserLoggedIn) {
680
  wp_send_json_error("wc_login_to_vote");
782
  }
783
 
784
  public function getInlineCommentForm() {
785
+ $this->helper->validateNonce();
786
  $post_id = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
787
  if ($post_id && apply_filters("wpdiscuz_enable_feedback_shortcode_button", true) && $this->dbManager->postHasFeedbackForms($post_id)) {
788
  $currentUser = WpdiscuzHelper::getCurrentUser();
858
  * get comment text from db
859
  */
860
  public function editComment() {
861
+ $this->helper->validateNonce();
862
  $commentId = WpdiscuzHelper::sanitize(INPUT_POST, "commentId", FILTER_SANITIZE_NUMBER_INT, 0);
863
  if ($commentId) {
864
  $comment = get_comment($commentId);
879
  }
880
 
881
  public function userRate() {
882
+ $this->helper->validateNonce();
883
  $rating = WpdiscuzHelper::sanitize(INPUT_POST, "rating", FILTER_SANITIZE_NUMBER_INT, 0);
884
  $post_id = WpdiscuzHelper::sanitize(INPUT_POST, "postId", FILTER_SANITIZE_NUMBER_INT, 0);
885
  if ($rating && $post_id && ($form = $this->wpdiscuzForm->getForm($post_id))) {
928
  }
929
 
930
  public function unsubscribe() {
931
+ $this->helper->validateNonce();
932
  $sid = WpdiscuzHelper::sanitize(INPUT_POST, "sid", FILTER_SANITIZE_NUMBER_INT, 0);
933
  $skey = WpdiscuzHelper::sanitize(INPUT_POST, "skey", FILTER_SANITIZE_STRING, "");
934
  if ($sid && $skey) {
939
  }
940
 
941
  public function wpd_stat_brief() {
942
+ $this->helper->validateNonce();
943
  wp_send_json_success(["all" => esc_html($this->dbManager->getCommentsCount()), "inline" => esc_html($this->dbManager->getInlineCommentsCount()), "threads" => esc_html($this->dbManager->getThreadsCount()), "replies" => esc_html($this->dbManager->getRepliesCount()), "users" => esc_html($this->dbManager->getUserCommentersCount()), "guests" => esc_html($this->dbManager->getGuestCommentersCount())]);
944
  }
945
 
946
  public function wpd_stat_subs() {
947
+ $this->helper->validateNonce();
948
  ob_start();
949
  ?>
950
  <ul class="wpd-box-list">
960
  }
961
 
962
  public function wpd_stat_graph() {
963
+ $this->helper->validateNonce();
964
  $interval = trim(WpdiscuzHelper::sanitize(INPUT_POST, "interval", FILTER_SANITIZE_STRING, ""));
965
  if ($interval) {
966
  $all = $this->dbManager->getGraphAllComments($interval);
991
  }
992
 
993
  public function wpd_stat_user() {
994
+ $this->helper->validateNonce();
995
  $orderby = WpdiscuzHelper::sanitize(INPUT_POST, "orderby", FILTER_SANITIZE_STRING, "");
996
  $order = WpdiscuzHelper::sanitize(INPUT_POST, "order", FILTER_SANITIZE_STRING, "");
997
  $page = WpdiscuzHelper::sanitize(INPUT_POST, "page", FILTER_SANITIZE_STRING, "");
1058
  }
1059
 
1060
  public function searchOption() {
1061
+ $this->helper->validateNonce();
1062
  $search = WpdiscuzHelper::sanitize(INPUT_POST, "s", FILTER_SANITIZE_STRING, "");
1063
  if ($search) {
1064
  $optionsObject = $this->options;
utils/class.WpdiscuzHelperOptimization.php CHANGED
@@ -177,10 +177,10 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
177
  }
178
  }
179
 
180
- public function cleanCommentRelatedRows($commentId, $comment) {
181
  $this->dbManager->deleteSubscriptions($commentId);
182
  $this->dbManager->deleteVotes($commentId);
183
- if (!empty($comment->comment_post_ID)) {
184
  $this->cleanPostCache($comment->comment_post_ID);
185
  }
186
  }
177
  }
178
  }
179
 
180
+ public function cleanCommentRelatedRows($commentId, $comment = null) {
181
  $this->dbManager->deleteSubscriptions($commentId);
182
  $this->dbManager->deleteVotes($commentId);
183
+ if ($comment && !empty($comment->comment_post_ID)) {
184
  $this->cleanPostCache($comment->comment_post_ID);
185
  }
186
  }
utils/layouts/activity/activity-page.php CHANGED
@@ -25,6 +25,7 @@ if ($action && $currentUserEmail) {
25
  } else if ($currentUserEmail) {
26
  $args["author_email"] = $currentUserEmail;
27
  }
 
28
  $items = get_comments($args);
29
  if ($items && is_array($items)) {
30
  $args["number"] = null;
25
  } else if ($currentUserEmail) {
26
  $args["author_email"] = $currentUserEmail;
27
  }
28
+
29
  $items = get_comments($args);
30
  if ($items && is_array($items)) {
31
  $args["number"] = null;
utils/layouts/activity/item.php CHANGED
@@ -3,9 +3,12 @@ if (!defined("ABSPATH")) {
3
  exit();
4
  }
5
  $title = get_the_title($item->comment_post_ID);
 
 
 
6
  ?>
7
  <div class="wpd-item">
8
- <div class="wpd-item-left">
9
  <div class="wpd-item-link wpd-comment-meta">
10
  <i class="fas fa-user"></i>
11
  <?php echo esc_html($item->comment_author); ?> &nbsp;
@@ -24,10 +27,12 @@ $title = get_the_title($item->comment_post_ID);
24
  </a>
25
  </div>
26
  </div>
27
- <div class="wpd-item-right">
28
- <a href="#" class="wpd-delete-content wpd-not-clicked" data-wpd-content-id="<?php echo esc_attr($item->comment_ID); ?>" data-wpd-parent-id="<?php echo esc_attr($item->comment_parent); ?>" data-wpd-delete-action="wpdDeleteComment" title="<?php esc_attr_e($this->options->getPhrase("wc_delete_this_comment", ["comment" => $item])); ?>">
29
- <i class="fas fa-trash-alt"></i>
30
- </a>
31
- </div>
 
 
32
  <div class="wpd-clear"></div>
33
  </div>
3
  exit();
4
  }
5
  $title = get_the_title($item->comment_post_ID);
6
+
7
+ $canDeleteComment = (boolean) apply_filters("wpdiscuz_can_delete_comment", true, $item->comment_ID);
8
+ $commentLeftStyle = $canDeleteComment ? "" : "width:99%;border-right:none;";
9
  ?>
10
  <div class="wpd-item">
11
+ <div class="wpd-item-left" style="<?php echo $commentLeftStyle; ?>">
12
  <div class="wpd-item-link wpd-comment-meta">
13
  <i class="fas fa-user"></i>
14
  <?php echo esc_html($item->comment_author); ?> &nbsp;
27
  </a>
28
  </div>
29
  </div>
30
+ <?php if ($canDeleteComment) { ?>
31
+ <div class="wpd-item-right">
32
+ <a href="#" class="wpd-delete-content wpd-not-clicked" data-wpd-content-id="<?php echo esc_attr($item->comment_ID); ?>" data-wpd-parent-id="<?php echo esc_attr($item->comment_parent); ?>" data-wpd-delete-action="wpdDeleteComment" title="<?php esc_attr_e($this->options->getPhrase("wc_delete_this_comment", ["comment" => $item])); ?>">
33
+ <i class="fas fa-trash-alt"></i>
34
+ </a>
35
+ </div>
36
+ <?php } ?>
37
  <div class="wpd-clear"></div>
38
  </div>