Comments – wpDiscuz - Version 3.0.9

Version Description

If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.

  • Fixed Bug: Warning: Could not find/open font in class.WpdiscuzHelper.php on line 524
  • Fixed Bug: MySQL error - You have an error in your SQL syntax...

IMPORTANT:

  • If you have installed these plugins, please go to wpDiscuz Settings > Integrations tab and read the instruction:

    BuddyPress, Users Ultra, Ultimate Member, UserPro plugins, MyCRED

Download this release

Release Info

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

Code changes from version 3.0.8 to 3.0.9

assets/js/wpdiscuz.js CHANGED
@@ -344,7 +344,7 @@ jQuery(document).ready(function ($) {
344
 
345
  var wpdiscuzHasMoreComments = $('#wpdiscuzHasMoreComments').val();
346
  var isRun = false;
347
- if (commentListLoadType == 2 && !wordpressIsPaginate) {
348
  $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
349
  $(window).scroll(function () {
350
  var scrollHeight = document.getElementById('wcThreadWrapper').scrollHeight;
344
 
345
  var wpdiscuzHasMoreComments = $('#wpdiscuzHasMoreComments').val();
346
  var isRun = false;
347
+ if (commentListLoadType == 2 && !wordpressIsPaginate && $('#wcThreadWrapper').length) {
348
  $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
349
  $(window).scroll(function () {
350
  var scrollHeight = document.getElementById('wcThreadWrapper').scrollHeight;
assets/js/wpdiscuz.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
- jQuery(document).ready(function(C){wpdiscuzValidator.message.invalid=wpdiscuz_ajax_obj.wpdiscuz_options.wc_invalid_field;wpdiscuzValidator.message.empty=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_empty_text;wpdiscuzValidator.message.email=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_email_text;wpdiscuzValidator.message.url=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_url_text;wpdiscuzValidator.message.min=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_max_length;var Q=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var q=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!Q;var P=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members>0&&Q;var A=wpdiscuz_ajax_obj.wpdiscuz_options.commentListLoadType;var U=wpdiscuz_ajax_obj.wpdiscuz_options.wordpressIsPaginate;var n=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var j=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var i=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var H=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var R=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var G=wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;var b=0;var l="comment_date_gmt";var L=[];var u=[];D();g();f();if(G){C(".wpdiscuz-vote-sort-up").addClass("wpdiscuz-sort-button-active");l="meta_value_num";b=1}else{C(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active")}C("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){C(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor")-1)});if(C(".wc_main_comm_form").length){e()}C(document).delegate(".wc-reply-link","click",function(){if(C(this).hasClass("wpdiscuz-clonned")){C("#wc-secondary-form-wrapper-"+m(C(this),0)).slideToggle(700)}else{h(C(this))}e()});C(document).delegate("textarea.wc_comment","focus",function(){if(!(C(this).next(".autogrow-textarea-mirror").length)){C(this).autoGrow()}var X=C(this).parents(".wc-form-wrapper");C(".wc-form-footer",X).slideDown(700)});C(document).delegate(".wc-share-link","click",function(){var X=C(this).parents(".wc-comment-right");C(".share_buttons_box",X).slideToggle(1000)});C(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(X){X.preventDefault()});C(document).delegate(".wc-toggle","click",function(){var Y=m(C(this),0);var X=C(this);C("#wc-comm-"+Y+"> .wc-reply").slideToggle(700,function(){if(C(this).is(":hidden")){X.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" &or;")}else{X.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" &and;")}})});C(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(C(this).hasClass("wc-reply")){C(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color},1500)}else{C(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color},1500)}});C(document).delegate(".wc_captcha_refresh_img","click",function(){O(C(this))});function O(ab){if(q||P){var Z=ab.parents(".wc-form-wrapper");var X=Z.hasClass("wc-secondary-form-wrapper")?0:1;var ac=m(ab,X);var aa="uniqueId="+ac;var Y=d("generateCaptcha",aa);Y.done(function(ae){try{var ai=C.parseJSON(ae);if(ai.code==1){var ag=C(ab).prev().children(".wc_captcha_img");var ak=ag.attr("src");var ad=ak.lastIndexOf("/")+1;var af=ak.substring(0,ad)+ai.message;ag.attr("src",af);var aj=C(".wpdiscuz-cnonce",Z);aj.attr("id",ai.key);aj.attr("value",ai.key)}}catch(ah){console.log(ah)}})}}C(document).delegate(".wc_comm_submit","click",function(){var ab=1;var Y=C(this).parents("form");if(!Y.hasClass("wc_main_comm_form")){ab=B(C(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&C(".wc_email",Y).val()){C(".wc_email",Y).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(C(".wc_email",Y).val())){C(".wc_email",Y).removeAttr("required");C(".wc_email",Y).next(".alert").html("")}if(wpdiscuzValidator.checkAll(Y)){var X=Y.serialize()+"&wc_comment_depth="+ab;if(q||P){var Z=C(".wc_captcha_img",Y);var aa=Z.attr("src");var ad=aa.lastIndexOf("/")+1;var ac=aa.substring(ad);X+="&fileName="+ac}if(wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs){X+="&wpdiscuz_zs="+wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs}d("addComment",X).done(function(af){var ag="";var ah="";try{var aj=C.parseJSON(af);ag=aj.code;if(parseInt(ag)>=0){var ae=aj.is_main;ah=aj.message;C(".wc_header_text_count").html(aj.wc_all_comments_count_new);if(ae){C(".wc-thread-wrapper").prepend(ah)}else{C("#wc-secondary-form-wrapper-"+ag).slideToggle(700);if(aj.is_in_same_container==1){C("#wc-secondary-form-wrapper-"+ag).after(ah)}else{C("#wc-secondary-form-wrapper-"+ag).after(ah.replace("wc-reply","wc-reply wc-no-left-margin"))}}o(aj);T(aj);t(Y,aj);Y.get(0).reset();e();f();C(".wc_comment",Y).css("height","45.6px")}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];s(Y,ag,ah,true)}}catch(ai){if(af.indexOf("<")>=0&&af.indexOf(">")>=0){ah=ai}else{ah=af}s(Y,"wc_invalid_field",ah,true)}D();C(".wpdiscuz-loading-bar").hide()})}O(C(".wc_captcha_refresh_img",Y))});function o(Z){if(!Z.held_moderate){var Y="comment_id="+Z.new_comment_id+"&email="+Z.user_email+"&isParent="+Z.is_main;var X=d("checkNotificationType",Y);X.done(function(aa){try{Z=C.parseJSON(aa)}catch(ab){console.log(ab)}})}}function T(Z){if(Z.redirect>0&&Z.new_comment_id){var Y="commentId="+Z.new_comment_id;var X=d("redirect",Y);X.done(function(aa){Z=C.parseJSON(aa);if(Z.code==1){setTimeout(function(){window.location.href=Z.redirect_to},5000)}})}}function e(){if(C.cookie("wc_author_name")){C(".wc_comm_form .wc_name").val(C.cookie("wc_author_name"))}if(C.cookie("wc_author_email")){C(".wc_comm_form .wc_email").val(C.cookie("wc_author_email"))}if(C.cookie("wc_author_website")){C(".wc_comm_form .wc_website").val(C.cookie("wc_author_website"))}}function t(X,Y){if(C(".wc_email",X).val()){C.cookie("wc_author_email",C(".wc_email",X).val())}else{C.cookie("wc_author_email",Y.user_email)}if(C(".wc_name",X).val()){C.cookie("wc_author_name",C(".wc_name",X).val())}else{C.cookie("wc_author_name",Y.user_name)}C.cookie("wc_author_website",C(".wc_website",X).val())}var S;C(document).delegate(".wc_editable_comment","click",function(){var aa=m(C(this),0);var X=V(aa);var Z=C(this);var Y="commentId="+X;S=C("#wc-comm-"+aa+" .wc-comment-text").html();d("editComment",Y).done(function(ac){try{var ag=C.parseJSON(ac);var ae="";var ad=ag.code;if(parseInt(ad)>=0){var ab='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+aa+'" style="min-height: 2em;">'+ag.message+"</textarea>";C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-text").replaceWith(ab);document.getElementById("wc_edit_comment-"+aa).focus();C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ab="";C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ae=wpdiscuz_ajax_obj.wpdiscuz_options[ad];s(Z,ad,ae,false)}}catch(af){console.log(af)}C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wc_save_edited_comment","click",function(){var ac=m(C(this));var Y=V(ac);var X=C("#wc-comm-"+ac+" textarea#wc_edit_comment-"+ac);var Z=X.val();var ab=C(this);if(C.trim(Z).length>0){var aa="commentId="+Y+"&commentContent="+Z;d("saveEditedComment",aa).done(function(ad){try{var ah=C.parseJSON(ad);var ae=ah.code;var af="";if(parseInt(ae)>=0){I(ac,ah.message)}else{af=wpdiscuz_ajax_obj.wpdiscuz_options[ae];s(ab,ae,af,false)}X="";Z=""}catch(ag){console.log(ag)}C(".wpdiscuz-loading-bar").hide()})}});C(document).delegate(".wc_cancel_edit","click",function(){var X=m(C(this));I(X,S)});function I(Z,Y){C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var X='<div class="wc-comment-text">'+k(Y)+"</div>";C("#wc-comm-"+Z+" #wc_edit_comment-"+Z).replaceWith(X)}function k(aa,Z){var Y=(Z||typeof Z==="undefined")?"<br/>":"<br>";var X=(aa+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+Y+"$2");return X.replace("<br><br>","<br/>")}C(document).delegate(".wc-load-more-submit","click",function(){F()});var p=C("#wpdiscuzHasMoreComments").val();var E=false;if(A==2&&!U){C(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide();C(window).scroll(function(){var X=document.getElementById("wcThreadWrapper").scrollHeight;if(C(window).scrollTop()>=X&&E===false&&p){E=true;F()}})}function F(){var X;if(l=="meta_value_num"){X="offset="+b+"&orderBy="+l+"&order="+a;b++}else{X="orderBy="+l+"&order="+a+"&lastParentId="+v()}X+="&loadAllCommnts="+A;d("loadMoreComments",X).done(function(Y){try{var aa=C.parseJSON(Y);C(".wpdiscuz-comment-pagination").before(aa.comment_list);r(aa);C(".wpdiscuz_single").remove();E=false;p=aa.is_show_load_more;f()}catch(Z){console.log(Z)}D();C(".wpdiscuz-loading-bar").hide();C(".wc-load-more-submit").blur()})}function r(X){if(X.is_show_load_more!=false){N(X.last_parent_id)}else{C(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}}C(document).delegate(".wc_vote","click",function(){var X=C(this);var aa="";var ab="";var Y=C(this).parents(".wc-comment-right").attr("id");Y=Y.substring(Y.lastIndexOf("-")+1);var Z;if(C(this).hasClass("wc-up")){Z=1}else{Z=-1}var ac="commentId="+Y+"&voteType="+Z;d("voteOnComment",ac).done(function(ad){try{var af=C.parseJSON(ad);aa=af.code;if(parseInt(aa)>=0){var ag=C(".wc-comment-footer .wc-vote-result",C("#comment-"+Y));C(ag).text(parseInt(C(ag).text())+Z)}else{ab=wpdiscuz_ajax_obj.wpdiscuz_options[aa];s(X,aa,ab,false)}}catch(ae){console.log(ae)}C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wpdiscuz-sort-button","click",function(){p=1;if(!(C(this).hasClass("wpdiscuz-sort-button-active"))){var aa=C(this);if(C(this).hasClass("wpdiscuz-vote-sort-up")){l="meta_value_num";a="desc"}else{l="comment_date_gmt";a=C(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var Z="orderBy="+l+"&order="+a;var X="";var Y="";d("wpdiscuzSorting",Z).done(function(ab){try{var ad=C.parseJSON(ab);X=ad.code;Y=ad.message;if(parseInt(X)>0){C("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){C(this).remove()});C("#wpcomm .wc-thread-wrapper").prepend(Y);b=parseInt(ad.loadCount)}else{}K(aa);r(ad)}catch(ac){console.log(ac)}D();C(".wpdiscuz-loading-bar").hide()})}});function K(X){C(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){C(this).removeClass("wpdiscuz-sort-button-active")});X.addClass("wpdiscuz-sort-button-active")}function W(){var ab=location.href;var aa=ab.match(/#comment\-(\d+)/);if(aa!==null){var Y=aa[1];if(!C("#comment-"+Y).length){var Z="commentId="+Y;var X=d("getSingleComment",Z);X.done(function(ac){try{var ae=C.parseJSON(ac);C(".wc-thread-wrapper").prepend(ae.message);C("html, body").animate({scrollTop:C(".wc-thread-wrapper").offset().top},1000)}catch(ad){console.log(ad)}D();C(".wpdiscuz-loading-bar").hide()})}}}W();if(j>0&&R&&(Q||(!Q&&!H))){setInterval(M,parseInt(i)*1000)}function M(){var aa=z();var Y=(C.cookie("wc_author_email")!=undefined&&C.cookie("wc_author_email")!="")?C.cookie("wc_author_email"):"";var Z="loadLastCommentId="+R+"&visibleCommentIds="+aa+"&email="+Y;var X=d("liveUpdate",Z);X.done(function(ac){try{var ah=C.parseJSON(ac);if(ah.code==1){if(j==1){x(ah)}else{u=u.concat(ah.message.comments);L=L.concat(ah.message.author_replies);var ad=u.length;var ab=L.length;if(ad>0){var af=ad+" ";af+=ad>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;C(".wc_new_comment").html(af).show()}else{C(".wc_new_comment").hide()}if(ab>0){var ae=ab+" ";ae+=ab>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;C(".wc_new_reply").html(ae).show()}else{C(".wc_new_reply").hide()}}C(".wc_header_text_count").html(ah.wc_all_comments_count_new);R=ah.loadLastCommentId}}catch(ag){console.log(ag)}D();C(".wpdiscuz-loading-bar").hide()})}function x(aa){if(aa.message!==undefined){var X;var Z=aa.message;for(var Y=0;Y<Z.length;Y++){X=Z[Y];w(X.comment_parent,X.comment_html)}f()}}C(document).delegate(".wc-update-on-click","click",function(){var X;var Y=C(this);if(Y.hasClass("wc_new_comment")){X="newCommentIds="+u.join()}else{X="newCommentIds="+L.join()}d("updateOnClick",X).done(function(Z){try{var ab=C.parseJSON(Z);x(ab);if(Y.hasClass("wc_new_comment")){u=[];C(".wc_new_comment").hide()}else{L=[];C(".wc_new_reply").hide()}}catch(aa){console.log(aa)}D();C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wpdiscuz-readmore","click",function(){var Z=m(C(this));var X=V(Z);var Y="commentId="+X;d("readMore",Y).done(function(aa){try{var ac=C.parseJSON(aa);if(ac.code){C("#wpdiscuz-readmore-"+Z).after(" "+ac.message);C("#wpdiscuz-readmore-"+Z).remove()}}catch(ab){console.log(ab)}C(".wpdiscuz-loading-bar").hide()})});function s(ab,Y,aa,Z){var X;var ac;if(Z){ac=ab.parents(".wc-form-wrapper")}else{ac=ab.closest(".wc-comment")}X=ac.children(".wpdiscuz-comment-message");X.addClass(Y);X.html(aa);X.show().delay(5000).fadeOut(1000,function(){X.removeClass();X.addClass("wpdiscuz-comment-message");X.html("")})}function h(Y){var Z=m(Y,0);C("#wpdiscuz_form_anchor-"+Z).before(J(Z));var X=C("#wc-secondary-form-wrapper-"+Z);X.slideToggle(700,function(){Y.addClass("wpdiscuz-clonned")});O(C(".wc_captcha_refresh_img",X))}function J(Y){var X=C("#wpdiscuz_hidden_secondary_form").html();return X.replace(/wpdiscuzuniqueid/g,Y)}function m(Z,Y){var X="";if(Y){X=Z.parents(".wc-main-form-wrapper").attr("id")}else{X=Z.parents(".wc-comment").attr("id")}var aa=X.substring(X.lastIndexOf("-")+1);return aa}function V(X){return X.substring(0,X.indexOf("_"))}function y(Y){var X=Y.substring(Y.indexOf("_")+1);return X}function v(){var X=C(".wc-load-more-link").attr("href");return X.substring(X.lastIndexOf("=")+1)}function N(X){var Y=C(".wc-load-more-link").attr("href");C(".wc-load-more-link").attr("href",Y.replace(/[\d]+$/m,X));if(A!=2){C(".wpdiscuz-comment-pagination").show()}}function B(Z){var Y=Z.attr("class");var X=Y.split(" ");var aa="";C.each(X,function(ab,ac){if("wc_comment_level"===c(ac,false)){aa=c(ac,true)}});return parseInt(aa)+1}function c(X,Y){var Z="";if(Y){Z=X.substring(X.indexOf("-")+1)}else{Z=X.substring(0,X.indexOf("-"))}return Z}function w(Z,Y){if(Z==0){C(".wc-thread-wrapper").prepend(Y)}else{var X=m(C("#comment-"+Z),0);C("#wpdiscuz_form_anchor-"+X).after(Y)}}function z(){var Z;var X;var Y="";C(".wc-comment-right").each(function(){Z=m(C(this),0);X=V(Z);Y+=X+","});return Y}function D(){C(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});C(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function g(){if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(C(".wc_social_plugin_wrapper .social_connect_form").length){C(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}}}}}function f(){C("#wcThreadWrapper .wc-comment").each(function(X){if(C("> .wc-reply",this).length){C("> .wc-comment-right .wc-comment-footer .wc-toggle",this).removeClass("wpdiscuz-hidden")}})}function d(Y,X){if(Y!=="liveUpdate"&&Y!=="generateCaptcha"){C(".wpdiscuz-loading-bar").show()}X+="&postId="+n;return C.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:X,action:Y}})}});
1
+
2
+ jQuery(document).ready(function(C){wpdiscuzValidator.message.invalid=wpdiscuz_ajax_obj.wpdiscuz_options.wc_invalid_field;wpdiscuzValidator.message.empty=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_empty_text;wpdiscuzValidator.message.email=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_email_text;wpdiscuzValidator.message.url=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_url_text;wpdiscuzValidator.message.min=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_max_length;var Q=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var q=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!Q;var P=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members>0&&Q;var A=wpdiscuz_ajax_obj.wpdiscuz_options.commentListLoadType;var U=wpdiscuz_ajax_obj.wpdiscuz_options.wordpressIsPaginate;var n=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var j=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var i=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var H=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var R=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var G=wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;var b=0;var l="comment_date_gmt";var L=[];var u=[];D();g();f();if(G){C(".wpdiscuz-vote-sort-up").addClass("wpdiscuz-sort-button-active");l="meta_value_num";b=1}else{C(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active")}C("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){C(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor")-1)});if(C(".wc_main_comm_form").length){e()}C(document).delegate(".wc-reply-link","click",function(){if(C(this).hasClass("wpdiscuz-clonned")){C("#wc-secondary-form-wrapper-"+m(C(this),0)).slideToggle(700)}else{h(C(this))}e()});C(document).delegate("textarea.wc_comment","focus",function(){if(!(C(this).next(".autogrow-textarea-mirror").length)){C(this).autoGrow()}var X=C(this).parents(".wc-form-wrapper");C(".wc-form-footer",X).slideDown(700)});C(document).delegate(".wc-share-link","click",function(){var X=C(this).parents(".wc-comment-right");C(".share_buttons_box",X).slideToggle(1000)});C(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(X){X.preventDefault()});C(document).delegate(".wc-toggle","click",function(){var Y=m(C(this),0);var X=C(this);C("#wc-comm-"+Y+"> .wc-reply").slideToggle(700,function(){if(C(this).is(":hidden")){X.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" &or;")}else{X.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" &and;")}})});C(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(C(this).hasClass("wc-reply")){C(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color},1500)}else{C(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color},1500)}});C(document).delegate(".wc_captcha_refresh_img","click",function(){O(C(this))});function O(ab){if(q||P){var Z=ab.parents(".wc-form-wrapper");var X=Z.hasClass("wc-secondary-form-wrapper")?0:1;var ac=m(ab,X);var aa="uniqueId="+ac;var Y=d("generateCaptcha",aa);Y.done(function(ae){try{var ai=C.parseJSON(ae);if(ai.code==1){var ag=C(ab).prev().children(".wc_captcha_img");var ak=ag.attr("src");var ad=ak.lastIndexOf("/")+1;var af=ak.substring(0,ad)+ai.message;ag.attr("src",af);var aj=C(".wpdiscuz-cnonce",Z);aj.attr("id",ai.key);aj.attr("value",ai.key)}}catch(ah){console.log(ah)}})}}C(document).delegate(".wc_comm_submit","click",function(){var ab=1;var Y=C(this).parents("form");if(!Y.hasClass("wc_main_comm_form")){ab=B(C(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&C(".wc_email",Y).val()){C(".wc_email",Y).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(C(".wc_email",Y).val())){C(".wc_email",Y).removeAttr("required");C(".wc_email",Y).next(".alert").html("")}if(wpdiscuzValidator.checkAll(Y)){var X=Y.serialize()+"&wc_comment_depth="+ab;if(q||P){var Z=C(".wc_captcha_img",Y);var aa=Z.attr("src");var ad=aa.lastIndexOf("/")+1;var ac=aa.substring(ad);X+="&fileName="+ac}if(wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs){X+="&wpdiscuz_zs="+wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs}d("addComment",X).done(function(af){var ag="";var ah="";try{var aj=C.parseJSON(af);ag=aj.code;if(parseInt(ag)>=0){var ae=aj.is_main;ah=aj.message;C(".wc_header_text_count").html(aj.wc_all_comments_count_new);if(ae){C(".wc-thread-wrapper").prepend(ah)}else{C("#wc-secondary-form-wrapper-"+ag).slideToggle(700);if(aj.is_in_same_container==1){C("#wc-secondary-form-wrapper-"+ag).after(ah)}else{C("#wc-secondary-form-wrapper-"+ag).after(ah.replace("wc-reply","wc-reply wc-no-left-margin"))}}o(aj);T(aj);t(Y,aj);Y.get(0).reset();e();f();C(".wc_comment",Y).css("height","45.6px")}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];s(Y,ag,ah,true)}}catch(ai){if(af.indexOf("<")>=0&&af.indexOf(">")>=0){ah=ai}else{ah=af}s(Y,"wc_invalid_field",ah,true)}D();C(".wpdiscuz-loading-bar").hide()})}O(C(".wc_captcha_refresh_img",Y))});function o(Z){if(!Z.held_moderate){var Y="comment_id="+Z.new_comment_id+"&email="+Z.user_email+"&isParent="+Z.is_main;var X=d("checkNotificationType",Y);X.done(function(aa){try{Z=C.parseJSON(aa)}catch(ab){console.log(ab)}})}}function T(Z){if(Z.redirect>0&&Z.new_comment_id){var Y="commentId="+Z.new_comment_id;var X=d("redirect",Y);X.done(function(aa){Z=C.parseJSON(aa);if(Z.code==1){setTimeout(function(){window.location.href=Z.redirect_to},5000)}})}}function e(){if(C.cookie("wc_author_name")){C(".wc_comm_form .wc_name").val(C.cookie("wc_author_name"))}if(C.cookie("wc_author_email")){C(".wc_comm_form .wc_email").val(C.cookie("wc_author_email"))}if(C.cookie("wc_author_website")){C(".wc_comm_form .wc_website").val(C.cookie("wc_author_website"))}}function t(X,Y){if(C(".wc_email",X).val()){C.cookie("wc_author_email",C(".wc_email",X).val())}else{C.cookie("wc_author_email",Y.user_email)}if(C(".wc_name",X).val()){C.cookie("wc_author_name",C(".wc_name",X).val())}else{C.cookie("wc_author_name",Y.user_name)}C.cookie("wc_author_website",C(".wc_website",X).val())}var S;C(document).delegate(".wc_editable_comment","click",function(){var aa=m(C(this),0);var X=V(aa);var Z=C(this);var Y="commentId="+X;S=C("#wc-comm-"+aa+" .wc-comment-text").html();d("editComment",Y).done(function(ac){try{var ag=C.parseJSON(ac);var ae="";var ad=ag.code;if(parseInt(ad)>=0){var ab='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+aa+'" style="min-height: 2em;">'+ag.message+"</textarea>";C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-text").replaceWith(ab);document.getElementById("wc_edit_comment-"+aa).focus();C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ab="";C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();C("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ae=wpdiscuz_ajax_obj.wpdiscuz_options[ad];s(Z,ad,ae,false)}}catch(af){console.log(af)}C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wc_save_edited_comment","click",function(){var ac=m(C(this));var Y=V(ac);var X=C("#wc-comm-"+ac+" textarea#wc_edit_comment-"+ac);var Z=X.val();var ab=C(this);if(C.trim(Z).length>0){var aa="commentId="+Y+"&commentContent="+Z;d("saveEditedComment",aa).done(function(ad){try{var ah=C.parseJSON(ad);var ae=ah.code;var af="";if(parseInt(ae)>=0){I(ac,ah.message)}else{af=wpdiscuz_ajax_obj.wpdiscuz_options[ae];s(ab,ae,af,false)}X="";Z=""}catch(ag){console.log(ag)}C(".wpdiscuz-loading-bar").hide()})}});C(document).delegate(".wc_cancel_edit","click",function(){var X=m(C(this));I(X,S)});function I(Z,Y){C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();C("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var X='<div class="wc-comment-text">'+k(Y)+"</div>";C("#wc-comm-"+Z+" #wc_edit_comment-"+Z).replaceWith(X)}function k(aa,Z){var Y=(Z||typeof Z==="undefined")?"<br/>":"<br>";var X=(aa+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+Y+"$2");return X.replace("<br><br>","<br/>")}C(document).delegate(".wc-load-more-submit","click",function(){F()});var p=C("#wpdiscuzHasMoreComments").val();var E=false;if(A==2&&!U&&C("#wcThreadWrapper").length){C(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide();C(window).scroll(function(){var X=document.getElementById("wcThreadWrapper").scrollHeight;if(C(window).scrollTop()>=X&&E===false&&p){E=true;F()}})}function F(){var X;if(l=="meta_value_num"){X="offset="+b+"&orderBy="+l+"&order="+a;b++}else{X="orderBy="+l+"&order="+a+"&lastParentId="+v()}X+="&loadAllCommnts="+A;d("loadMoreComments",X).done(function(Y){try{var aa=C.parseJSON(Y);C(".wpdiscuz-comment-pagination").before(aa.comment_list);r(aa);C(".wpdiscuz_single").remove();E=false;p=aa.is_show_load_more;f()}catch(Z){console.log(Z)}D();C(".wpdiscuz-loading-bar").hide();C(".wc-load-more-submit").blur()})}function r(X){if(X.is_show_load_more!=false){N(X.last_parent_id)}else{C(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}}C(document).delegate(".wc_vote","click",function(){var X=C(this);var aa="";var ab="";var Y=C(this).parents(".wc-comment-right").attr("id");Y=Y.substring(Y.lastIndexOf("-")+1);var Z;if(C(this).hasClass("wc-up")){Z=1}else{Z=-1}var ac="commentId="+Y+"&voteType="+Z;d("voteOnComment",ac).done(function(ad){try{var af=C.parseJSON(ad);aa=af.code;if(parseInt(aa)>=0){var ag=C(".wc-comment-footer .wc-vote-result",C("#comment-"+Y));C(ag).text(parseInt(C(ag).text())+Z)}else{ab=wpdiscuz_ajax_obj.wpdiscuz_options[aa];s(X,aa,ab,false)}}catch(ae){console.log(ae)}C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wpdiscuz-sort-button","click",function(){p=1;if(!(C(this).hasClass("wpdiscuz-sort-button-active"))){var aa=C(this);if(C(this).hasClass("wpdiscuz-vote-sort-up")){l="meta_value_num";a="desc"}else{l="comment_date_gmt";a=C(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var Z="orderBy="+l+"&order="+a;var X="";var Y="";d("wpdiscuzSorting",Z).done(function(ab){try{var ad=C.parseJSON(ab);X=ad.code;Y=ad.message;if(parseInt(X)>0){C("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){C(this).remove()});C("#wpcomm .wc-thread-wrapper").prepend(Y);b=parseInt(ad.loadCount)}else{}K(aa);r(ad)}catch(ac){console.log(ac)}D();C(".wpdiscuz-loading-bar").hide()})}});function K(X){C(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){C(this).removeClass("wpdiscuz-sort-button-active")});X.addClass("wpdiscuz-sort-button-active")}function W(){var ab=location.href;var aa=ab.match(/#comment\-(\d+)/);if(aa!==null){var Y=aa[1];if(!C("#comment-"+Y).length){var Z="commentId="+Y;var X=d("getSingleComment",Z);X.done(function(ac){try{var ae=C.parseJSON(ac);C(".wc-thread-wrapper").prepend(ae.message);C("html, body").animate({scrollTop:C(".wc-thread-wrapper").offset().top},1000)}catch(ad){console.log(ad)}D();C(".wpdiscuz-loading-bar").hide()})}}}W();if(j>0&&R&&(Q||(!Q&&!H))){setInterval(M,parseInt(i)*1000)}function M(){var aa=z();var Y=(C.cookie("wc_author_email")!=undefined&&C.cookie("wc_author_email")!="")?C.cookie("wc_author_email"):"";var Z="loadLastCommentId="+R+"&visibleCommentIds="+aa+"&email="+Y;var X=d("liveUpdate",Z);X.done(function(ac){try{var ah=C.parseJSON(ac);if(ah.code==1){if(j==1){x(ah)}else{u=u.concat(ah.message.comments);L=L.concat(ah.message.author_replies);var ad=u.length;var ab=L.length;if(ad>0){var af=ad+" ";af+=ad>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;C(".wc_new_comment").html(af).show()}else{C(".wc_new_comment").hide()}if(ab>0){var ae=ab+" ";ae+=ab>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;C(".wc_new_reply").html(ae).show()}else{C(".wc_new_reply").hide()}}C(".wc_header_text_count").html(ah.wc_all_comments_count_new);R=ah.loadLastCommentId}}catch(ag){console.log(ag)}D();C(".wpdiscuz-loading-bar").hide()})}function x(aa){if(aa.message!==undefined){var X;var Z=aa.message;for(var Y=0;Y<Z.length;Y++){X=Z[Y];w(X.comment_parent,X.comment_html)}f()}}C(document).delegate(".wc-update-on-click","click",function(){var X;var Y=C(this);if(Y.hasClass("wc_new_comment")){X="newCommentIds="+u.join()}else{X="newCommentIds="+L.join()}d("updateOnClick",X).done(function(Z){try{var ab=C.parseJSON(Z);x(ab);if(Y.hasClass("wc_new_comment")){u=[];C(".wc_new_comment").hide()}else{L=[];C(".wc_new_reply").hide()}}catch(aa){console.log(aa)}D();C(".wpdiscuz-loading-bar").hide()})});C(document).delegate(".wpdiscuz-readmore","click",function(){var Z=m(C(this));var X=V(Z);var Y="commentId="+X;d("readMore",Y).done(function(aa){try{var ac=C.parseJSON(aa);if(ac.code){C("#wpdiscuz-readmore-"+Z).after(" "+ac.message);C("#wpdiscuz-readmore-"+Z).remove()}}catch(ab){console.log(ab)}C(".wpdiscuz-loading-bar").hide()})});function s(ab,Y,aa,Z){var X;var ac;if(Z){ac=ab.parents(".wc-form-wrapper")}else{ac=ab.closest(".wc-comment")}X=ac.children(".wpdiscuz-comment-message");X.addClass(Y);X.html(aa);X.show().delay(5000).fadeOut(1000,function(){X.removeClass();X.addClass("wpdiscuz-comment-message");X.html("")})}function h(Y){var Z=m(Y,0);C("#wpdiscuz_form_anchor-"+Z).before(J(Z));var X=C("#wc-secondary-form-wrapper-"+Z);X.slideToggle(700,function(){Y.addClass("wpdiscuz-clonned")});O(C(".wc_captcha_refresh_img",X))}function J(Y){var X=C("#wpdiscuz_hidden_secondary_form").html();return X.replace(/wpdiscuzuniqueid/g,Y)}function m(Z,Y){var X="";if(Y){X=Z.parents(".wc-main-form-wrapper").attr("id")}else{X=Z.parents(".wc-comment").attr("id")}var aa=X.substring(X.lastIndexOf("-")+1);return aa}function V(X){return X.substring(0,X.indexOf("_"))}function y(Y){var X=Y.substring(Y.indexOf("_")+1);return X}function v(){var X=C(".wc-load-more-link").attr("href");return X.substring(X.lastIndexOf("=")+1)}function N(X){var Y=C(".wc-load-more-link").attr("href");C(".wc-load-more-link").attr("href",Y.replace(/[\d]+$/m,X));if(A!=2){C(".wpdiscuz-comment-pagination").show()}}function B(Z){var Y=Z.attr("class");var X=Y.split(" ");var aa="";C.each(X,function(ab,ac){if("wc_comment_level"===c(ac,false)){aa=c(ac,true)}});return parseInt(aa)+1}function c(X,Y){var Z="";if(Y){Z=X.substring(X.indexOf("-")+1)}else{Z=X.substring(0,X.indexOf("-"))}return Z}function w(Z,Y){if(Z==0){C(".wc-thread-wrapper").prepend(Y)}else{var X=m(C("#comment-"+Z),0);C("#wpdiscuz_form_anchor-"+X).after(Y)}}function z(){var Z;var X;var Y="";C(".wc-comment-right").each(function(){Z=m(C(this),0);X=V(Z);Y+=X+","});return Y}function D(){C(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});C(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function g(){if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(C(".wc_social_plugin_wrapper .social_connect_form").length){C(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(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 > .wc-form-wrapper > .wc-secondary-forms-social-content")}}}}}function f(){C("#wcThreadWrapper .wc-comment").each(function(X){if(C("> .wc-reply",this).length){C("> .wc-comment-right .wc-comment-footer .wc-toggle",this).removeClass("wpdiscuz-hidden")}})}function d(Y,X){if(Y!=="liveUpdate"&&Y!=="generateCaptcha"){C(".wpdiscuz-loading-bar").show()}X+="&postId="+n;return C.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:X,action:Y}})}});
class.WpdiscuzCore.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  * Plugin Name: wpDiscuz - Supercharged native comments
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
- * Version: 3.0.8
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: http://www.gvectors.com/
9
  * Plugin URI: http://www.gvectors.com/wpdiscuz/
3
  /*
4
  * Plugin Name: wpDiscuz - Supercharged native comments
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
+ * Version: 3.0.9
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: http://www.gvectors.com/
9
  * Plugin URI: http://www.gvectors.com/wpdiscuz/
manager/class.WpdiscuzDBManager.php CHANGED
@@ -249,10 +249,10 @@ class WpdiscuzDBManager {
249
  public function getPostVotedCommentIds($args) {
250
  $commentParent = $args['is_threaded'] ? 'AND `c`.`comment_parent` = 0' : '';
251
  if ($args['limit']) {
252
- $sqlPostVotedCommentIds = $this->db->prepare("SELECT `c`.`comment_ID` FROM `" . $this->dbprefix . "comments` AS `c` INNER JOIN `" . $this->dbprefix . "commentmeta` AS `cm` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `cm`.`meta_key` = 'wpdiscuz_votes' AND `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 $commentParent ORDER BY (`cm`.`meta_value`+0) desc, `c`.`comment_date_gmt` {$args['date_order']} LIMIT %d OFFSET %d", $args['post_id'], $args['limit'], $args['offset']);
253
  } else {
254
  $allParentCounts = count($this->getAllParentCommentCount($args['post_id'], $args['is_threaded']));
255
- $sqlPostVotedCommentIds = $this->db->prepare("SELECT `c`.`comment_ID` FROM `" . $this->dbprefix . "comments` AS `c` INNER JOIN `" . $this->dbprefix . "commentmeta` AS `cm` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `cm`.`meta_key` = 'wpdiscuz_votes' AND `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 $commentParent ORDER BY (`cm`.`meta_value`+0) desc, `c`.`comment_date_gmt` {$args['date_order']} LIMIT %d OFFSET %d", $args['post_id'], $allParentCounts, $args['viewed_comment_count']);
256
  }
257
  $postVotedCommentIds = $this->db->get_results($sqlPostVotedCommentIds, ARRAY_N);
258
  return $this->matrixToArray($postVotedCommentIds);
@@ -479,12 +479,15 @@ class WpdiscuzDBManager {
479
  }
480
 
481
  public function getOptimizedCommetnIds($postId) {
482
- $sql = $this->db->prepare("SELECT `cm`.`comment_id` FROM `" . $this->dbprefix . "commentmeta` AS `cm` INNER JOIN `" . $this->dbprefix . "comments` AS `c` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 AND `cm`.`meta_key` = '" . WpdiscuzCore::META_KEY_CHILDREN . "';", $postId);
483
  $commentIds = $this->db->get_results($sql, ARRAY_N);
484
  return $this->matrixToArray($commentIds);
485
  }
486
 
487
  public function getIdsInMeta($commentIds) {
 
 
 
488
  $this->db->query("SET SESSION group_concat_max_len = 1000000;");
489
  $sql = "SELECT GROUP_CONCAT(TRIM(BOTH ',' FROM `meta_value`)) FROM `" . $this->dbprefix . "commentmeta` WHERE `meta_key` = '" . WpdiscuzCore::META_KEY_CHILDREN . "' AND comment_id IN ($commentIds)";
490
  $comments = $this->db->get_results($sql, ARRAY_N);
249
  public function getPostVotedCommentIds($args) {
250
  $commentParent = $args['is_threaded'] ? 'AND `c`.`comment_parent` = 0' : '';
251
  if ($args['limit']) {
252
+ $sqlPostVotedCommentIds = $this->db->prepare("SELECT `c`.`comment_ID` FROM `" . $this->dbprefix . "comments` AS `c` INNER JOIN `" . $this->dbprefix . "commentmeta` AS `cm` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `cm`.`meta_key` = 'wpdiscuz_votes' AND `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 $commentParent ORDER BY (`cm`.`meta_value` + 0) desc, `c`.`comment_date_gmt` {$args['date_order']} LIMIT %d OFFSET %d", $args['post_id'], $args['limit'], $args['offset']);
253
  } else {
254
  $allParentCounts = count($this->getAllParentCommentCount($args['post_id'], $args['is_threaded']));
255
+ $sqlPostVotedCommentIds = $this->db->prepare("SELECT `c`.`comment_ID` FROM `" . $this->dbprefix . "comments` AS `c` INNER JOIN `" . $this->dbprefix . "commentmeta` AS `cm` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `cm`.`meta_key` = 'wpdiscuz_votes' AND `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 $commentParent ORDER BY (`cm`.`meta_value` + 0) desc, `c`.`comment_date_gmt` {$args['date_order']} LIMIT %d OFFSET %d", $args['post_id'], $allParentCounts, $args['viewed_comment_count']);
256
  }
257
  $postVotedCommentIds = $this->db->get_results($sqlPostVotedCommentIds, ARRAY_N);
258
  return $this->matrixToArray($postVotedCommentIds);
479
  }
480
 
481
  public function getOptimizedCommetnIds($postId) {
482
+ $sql = $this->db->prepare("SELECT `cm`.`comment_id` FROM `" . $this->dbprefix . "commentmeta` AS `cm` INNER JOIN `" . $this->dbprefix . "comments` AS `c` ON `c`.`comment_ID` = `cm`.`comment_id` WHERE `c`.`comment_post_ID` = %d AND `c`.`comment_approved` = 1 AND `cm`.`meta_key` = '" . WpdiscuzCore::META_KEY_CHILDREN . "' AND `cm`.`meta_value` != '';", $postId);
483
  $commentIds = $this->db->get_results($sql, ARRAY_N);
484
  return $this->matrixToArray($commentIds);
485
  }
486
 
487
  public function getIdsInMeta($commentIds) {
488
+ if (!$commentIds) {
489
+ return array();
490
+ }
491
  $this->db->query("SET SESSION group_concat_max_len = 1000000;");
492
  $sql = "SELECT GROUP_CONCAT(TRIM(BOTH ',' FROM `meta_value`)) FROM `" . $this->dbprefix . "commentmeta` WHERE `meta_key` = '" . WpdiscuzCore::META_KEY_CHILDREN . "' AND comment_id IN ($commentIds)";
493
  $comments = $this->db->get_results($sql, ARRAY_N);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: wordpress comments, ajax comments, ajax, live update, live comments, realtime chat, chat, realtime commenting, Lazy load, Lazy load comments, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jatpack comments alternative, Facebook comments alternative, comment form, commenting, reply, comments, better comments, discussions, comment notifications, comment template, activity, comment author, comment system, redirect, comment redirect, first commenter, email commenting, social login, boost comments, native comments
5
  Requires at least: 4.3
6
  Tested up to: 4.3.1
7
- Stable tag: 3.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -142,6 +142,23 @@ wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
142
 
143
  == Changelog ==
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  = 3.0.8 =
146
 
147
  * Boosted: Super high performance with reduced number of SQL queries. Instead of 2000 SQLs for 1000 comments wpDiscuz 3.0.8 only executes 39 SQLs.
@@ -151,19 +168,6 @@ wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
151
  * Fixed Bug: Error: No such file or directory in .../class.WpdiscuzHelper.php on line 610
152
  * Fixed Bug: Losing "Read more" dots after click.
153
 
154
- IMPORTANT:
155
-
156
- * If you have installed these plugins, please go to wpDiscuz Settings > Integrations tab and read the instruction:
157
-
158
- * BuddyPress,
159
- * Users Ultra,
160
- * Ultimate Member,
161
- * UserPro plugins,
162
- * MyCRED
163
-
164
- - If you have JatPack installed please deactivate JatPack comments, it affects wpDiscuz
165
- - If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
166
-
167
  = 3.0.7 =
168
 
169
  * Added: Long comment text breaking function with "Read more" link
4
  Tags: wordpress comments, ajax comments, ajax, live update, live comments, realtime chat, chat, realtime commenting, Lazy load, Lazy load comments, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jatpack comments alternative, Facebook comments alternative, comment form, commenting, reply, comments, better comments, discussions, comment notifications, comment template, activity, comment author, comment system, redirect, comment redirect, first commenter, email commenting, social login, boost comments, native comments
5
  Requires at least: 4.3
6
  Tested up to: 4.3.1
7
+ Stable tag: 3.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
142
 
143
  == Changelog ==
144
 
145
+ = 3.0.9 =
146
+
147
+ **If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.**
148
+
149
+ * Fixed Bug: Warning: Could not find/open font in class.WpdiscuzHelper.php on line 524
150
+ * Fixed Bug: MySQL error - You have an error in your SQL syntax...
151
+
152
+ IMPORTANT:
153
+
154
+ * If you have installed these plugins, please go to wpDiscuz Settings > Integrations tab and read the instruction:
155
+
156
+ BuddyPress,
157
+ Users Ultra,
158
+ Ultimate Member,
159
+ UserPro plugins,
160
+ MyCRED
161
+
162
  = 3.0.8 =
163
 
164
  * Boosted: Super high performance with reduced number of SQL queries. Instead of 2000 SQLs for 1000 comments wpDiscuz 3.0.8 only executes 39 SQLs.
168
  * Fixed Bug: Error: No such file or directory in .../class.WpdiscuzHelper.php on line 610
169
  * Fixed Bug: Losing "Read more" dots after click.
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  = 3.0.7 =
172
 
173
  * Added: Long comment text breaking function with "Read more" link
utils/class.WpdiscuzHelper.php CHANGED
@@ -49,7 +49,6 @@ class WpdiscuzHelper {
49
  $this->optionsSerialized = $wpdiscuzOptionsSerialized;
50
  $this->dbManager = $dbManager;
51
  $this->captchaDir = DIR_PATH . WPD_DS . 'utils' . WPD_DS . 'temp';
52
- $this->captchaFonth = DIR_PATH . WPD_DS . 'captcha' . WPD_DS . 'consolai.ttf';
53
  }
54
 
55
  // Set timezone
@@ -518,10 +517,11 @@ class WpdiscuzHelper {
518
  $angle = 0;
519
  $x = 5;
520
  $y = 20;
 
521
  for ($i = 0; $i < strlen($randomString); $i++) {
522
  $color = imagecolorallocate($im, rand(0, 255), 0, rand(0, 255));
523
  $letter = substr($randomString, $i, 1);
524
- imagettftext($im, $size, $angle, $x, $y, $color, $this->captchaFonth, $letter);
525
  $x += 13;
526
  }
527
 
49
  $this->optionsSerialized = $wpdiscuzOptionsSerialized;
50
  $this->dbManager = $dbManager;
51
  $this->captchaDir = DIR_PATH . WPD_DS . 'utils' . WPD_DS . 'temp';
 
52
  }
53
 
54
  // Set timezone
517
  $angle = 0;
518
  $x = 5;
519
  $y = 20;
520
+ $fonth = $filesPath . 'consolai.ttf';
521
  for ($i = 0; $i < strlen($randomString); $i++) {
522
  $color = imagecolorallocate($im, rand(0, 255), 0, rand(0, 255));
523
  $letter = substr($randomString, $i, 1);
524
+ imagettftext($im, $size, $angle, $x, $y, $color, $fonth, $letter);
525
  $x += 13;
526
  }
527
 
utils/class.WpdiscuzOptimizationHelper.php CHANGED
@@ -57,7 +57,9 @@ class WpdiscuzOptimizationHelper {
57
  if ($isIdsInMeta) {
58
  $ids = implode(',', $commentIds);
59
  $children = $this->dbManager->getIdsInMeta($ids);
60
- $comments = explode(',', trim($children[0] . "", ','));
 
 
61
  } else {
62
  foreach ($commentIds as $commentId) {
63
  $children = $this->dbManager->getCommentMeta($commentId, WpdiscuzCore::META_KEY_CHILDREN);
57
  if ($isIdsInMeta) {
58
  $ids = implode(',', $commentIds);
59
  $children = $this->dbManager->getIdsInMeta($ids);
60
+ if ($children) {
61
+ $comments = explode(',', trim($children[0] . "", ','));
62
+ }
63
  } else {
64
  foreach ($commentIds as $commentId) {
65
  $children = $this->dbManager->getCommentMeta($commentId, WpdiscuzCore::META_KEY_CHILDREN);