Comments – wpDiscuz - Version 3.1.0

Version Description

  • ccelerated: Better WordPress comments cache compatibility
  • Added: Finally we make wpDiscuz compatible from 3.8.0 Wordpress version
  • Added: Comment front-end editing for all user roles (+ admin, editor, author)
  • Fixed Bug: Show/Hide replies button disappearing when clicking on sorting buttons
  • Fixed Bug: Problem with "Guest" phrase
  • Fixed Bug: Comments HTML content conflict with Read more function
  • Fixed Bug: Small bugs with live update
  • Fixed Bug: Load rest of comments issue
  • Fixed Bug: Editable subscription phrase for Postmatic
  • Fixed Bug: Sorting issue by most voted comments when nested comments are disabled

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

  • If you have JatPack installed please deactivate JatPack comments, it affects wpDiscuz

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

Download this release

Release Info

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

Code changes from version 3.0.9 to 3.1.0

assets/css/options-css.min.css CHANGED
@@ -3,4 +3,5 @@
3
  .wc-form input.wc_share_button {display: none;}
4
  .wc-form input[type="text"].regular-text{ width:160px; }
5
  .wc-form .wpdiscuz-option-title {vertical-align: middle;}
6
- .wc-form .wc-hidden {display: none;}
 
3
  .wc-form input.wc_share_button {display: none;}
4
  .wc-form input[type="text"].regular-text{ width:160px; }
5
  .wc-form .wpdiscuz-option-title {vertical-align: middle;}
6
+ .wc-form .wc-hidden {display: none;}
7
+ .wc-form .resp-tabs-container.integrationsChild {margin-bottom: 5px;}
assets/img/plugin-icon/plugin-icon-48.png CHANGED
Binary file
assets/js/wpdiscuz.js CHANGED
@@ -14,11 +14,11 @@ jQuery(document).ready(function ($) {
14
  var wpdiscuzPostId = wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;
15
  var commentListUpdateType = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;
16
  var commentListUpdateTimer = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;
17
- var liveUpdateGuests = wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;
18
  var loadLastCommentId = wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;
19
  var wpdiscuzCommentOrder = wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;
20
  var commentsVoteOrder = wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;
21
- var wpdiscuzLoadCount = 0;
22
  var wpdiscuzCommentOrderBy = 'comment_date_gmt';
23
  var wpdiscuzReplyArray = [];
24
  var wpdiscuzCommentArray = [];
@@ -28,8 +28,7 @@ jQuery(document).ready(function ($) {
28
  displayShowHideReplies();
29
  if (commentsVoteOrder) {
30
  $('.wpdiscuz-vote-sort-up').addClass('wpdiscuz-sort-button-active');
31
- wpdiscuzCommentOrderBy = 'meta_value_num';
32
- wpdiscuzLoadCount = 1;
33
  } else {
34
  $('.wpdiscuz-date-sort-' + wpdiscuzCommentOrder).addClass('wpdiscuz-sort-button-active');
35
  }
@@ -91,11 +90,9 @@ jQuery(document).ready(function ($) {
91
  }
92
  });
93
  //============================== CAPTCHA ============================== //
94
-
95
  $(document).delegate('.wc_captcha_refresh_img', 'click', function () {
96
  changeCaptchaImage($(this));
97
  });
98
-
99
  function changeCaptchaImage(reloadImage) {
100
  if (isShowCaptchaForGuests || isShowCaptchaForMembers) {
101
  var form = reloadImage.parents('.wc-form-wrapper');
@@ -119,11 +116,10 @@ jQuery(document).ready(function ($) {
119
  } catch (e) {
120
  console.log(e);
121
  }
122
- // $('.wpdiscuz-loading-bar').hide();
123
  });
124
  }
125
  }
126
-
127
  //============================== CAPTCHA ============================== //
128
  //============================== ADD COMMENT FUNCTION ============================== //
129
 
@@ -270,7 +266,6 @@ jQuery(document).ready(function ($) {
270
  var message = '';
271
  var messageKey = obj.code;
272
  if (parseInt(messageKey) >= 0) {
273
- // wcCommentTextBeforeEditing = obj.message;
274
  var editableTextarea = '<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-' + uniqueID + '" style="min-height: 2em;">' + obj.message + '</textarea>';
275
  $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-text').replaceWith(editableTextarea);
276
  document.getElementById('wc_edit_comment-' + uniqueID).focus();
@@ -344,11 +339,11 @@ jQuery(document).ready(function ($) {
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;
351
- if ($(window).scrollTop() >= scrollHeight && isRun === false && wpdiscuzHasMoreComments) {
352
  isRun = true;
353
  wpdiscuzLoadComments();
354
  }
@@ -357,13 +352,8 @@ jQuery(document).ready(function ($) {
357
 
358
  function wpdiscuzLoadComments() {
359
  var data;
360
- if (wpdiscuzCommentOrderBy == 'meta_value_num') {
361
- data = 'offset=' + wpdiscuzLoadCount + '&orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder;
362
- wpdiscuzLoadCount++;
363
- } else {
364
- data = 'orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder + '&lastParentId=' + getLastParentID();
365
- }
366
- data += '&loadAllCommnts=' + commentListLoadType;
367
  getAjaxObject('loadMoreComments', data).done(function (response) {
368
  try {
369
  var obj = $.parseJSON(response);
@@ -371,7 +361,6 @@ jQuery(document).ready(function ($) {
371
  setLoadMoreVisibility(obj);
372
  $('.wpdiscuz_single').remove();
373
  isRun = false;
374
- wpdiscuzHasMoreComments = obj.is_show_load_more;
375
  displayShowHideReplies();
376
  } catch (e) {
377
  console.log(e);
@@ -383,11 +372,17 @@ jQuery(document).ready(function ($) {
383
  }
384
 
385
  function setLoadMoreVisibility(obj) {
386
- if (obj.is_show_load_more != false) {
387
- setLastParentID(obj.last_parent_id);
388
- } else {
 
389
  $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
 
 
 
 
390
  }
 
391
  }
392
 
393
  //============================== LOAD MORE ============================== //
@@ -426,11 +421,11 @@ jQuery(document).ready(function ($) {
426
  //============================== VOTE ============================== //
427
  //============================== SORTING ============================== //
428
  $(document).delegate('.wpdiscuz-sort-button', 'click', function () {
429
- wpdiscuzHasMoreComments = 1;
430
  if (!($(this).hasClass('wpdiscuz-sort-button-active'))) {
431
  var clickedBtn = $(this);
432
  if ($(this).hasClass('wpdiscuz-vote-sort-up')) {
433
- wpdiscuzCommentOrderBy = 'meta_value_num';
434
  wpdiscuzCommentOrder = 'desc';
435
  } else {
436
  wpdiscuzCommentOrderBy = 'comment_date_gmt';
@@ -457,6 +452,7 @@ jQuery(document).ready(function ($) {
457
  } catch (e) {
458
  console.log(e);
459
  }
 
460
  addTooltipster();
461
  $('.wpdiscuz-loading-bar').hide();
462
  });
@@ -499,7 +495,7 @@ jQuery(document).ready(function ($) {
499
  getSingleComment();
500
  //============================== SINGLE COMMENT ============================== //
501
  //============================== LIVE UPDATE ============================== //
502
- if (commentListUpdateType > 0 && loadLastCommentId && (isUserLoggedIn || (!isUserLoggedIn && !liveUpdateGuests))) {
503
  setInterval(liveUpdate, parseInt(commentListUpdateTimer) * 1000);
504
  }
505
 
@@ -594,7 +590,7 @@ jQuery(document).ready(function ($) {
594
  try {
595
  var obj = $.parseJSON(response);
596
  if (obj.code) {
597
- $('#wpdiscuz-readmore-' + uniqueId).after(' ' + obj.message);
598
  $('#wpdiscuz-readmore-' + uniqueId).remove();
599
  }
600
  } catch (e) {
@@ -617,7 +613,7 @@ jQuery(document).ready(function ($) {
617
  msgContainer = parentContainer.children('.wpdiscuz-comment-message');
618
  msgContainer.addClass(messageKey);
619
  msgContainer.html(message);
620
- msgContainer.show().delay(5000).fadeOut(1000, function () {
621
  msgContainer.removeClass();
622
  msgContainer.addClass('wpdiscuz-comment-message');
623
  msgContainer.html('');
@@ -655,11 +651,6 @@ jQuery(document).ready(function ($) {
655
  return uniqueID.substring(0, uniqueID.indexOf('_'));
656
  }
657
 
658
- function getCommentParentID(uniqueID) {
659
- var commentID = uniqueID.substring(uniqueID.indexOf('_') + 1);
660
- return commentID;
661
- }
662
-
663
  function getLastParentID() {
664
  var url = $('.wc-load-more-link').attr("href");
665
  return url.substring(url.lastIndexOf('=') + 1);
@@ -753,7 +744,7 @@ jQuery(document).ready(function ($) {
753
  * @returns {jqXHR}
754
  */
755
  function getAjaxObject(action, data) {
756
- if (action !== 'liveUpdate' && action !== 'generateCaptcha') {
757
  $('.wpdiscuz-loading-bar').show();
758
  }
759
  data += '&postId=' + wpdiscuzPostId;
14
  var wpdiscuzPostId = wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;
15
  var commentListUpdateType = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;
16
  var commentListUpdateTimer = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;
17
+ var disableGuestsLiveUpdate = wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;
18
  var loadLastCommentId = wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;
19
  var wpdiscuzCommentOrder = wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;
20
  var commentsVoteOrder = wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;
21
+ var wpdiscuzLoadCount = 1;
22
  var wpdiscuzCommentOrderBy = 'comment_date_gmt';
23
  var wpdiscuzReplyArray = [];
24
  var wpdiscuzCommentArray = [];
28
  displayShowHideReplies();
29
  if (commentsVoteOrder) {
30
  $('.wpdiscuz-vote-sort-up').addClass('wpdiscuz-sort-button-active');
31
+ wpdiscuzCommentOrderBy = 'by_vote';
 
32
  } else {
33
  $('.wpdiscuz-date-sort-' + wpdiscuzCommentOrder).addClass('wpdiscuz-sort-button-active');
34
  }
90
  }
91
  });
92
  //============================== CAPTCHA ============================== //
 
93
  $(document).delegate('.wc_captcha_refresh_img', 'click', function () {
94
  changeCaptchaImage($(this));
95
  });
 
96
  function changeCaptchaImage(reloadImage) {
97
  if (isShowCaptchaForGuests || isShowCaptchaForMembers) {
98
  var form = reloadImage.parents('.wc-form-wrapper');
116
  } catch (e) {
117
  console.log(e);
118
  }
119
+ $('.wpdiscuz-loading-bar').hide();
120
  });
121
  }
122
  }
 
123
  //============================== CAPTCHA ============================== //
124
  //============================== ADD COMMENT FUNCTION ============================== //
125
 
266
  var message = '';
267
  var messageKey = obj.code;
268
  if (parseInt(messageKey) >= 0) {
 
269
  var editableTextarea = '<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-' + uniqueID + '" style="min-height: 2em;">' + obj.message + '</textarea>';
270
  $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-text').replaceWith(editableTextarea);
271
  document.getElementById('wc_edit_comment-' + uniqueID).focus();
339
 
340
  var wpdiscuzHasMoreComments = $('#wpdiscuzHasMoreComments').val();
341
  var isRun = false;
342
+ if (commentListLoadType == 2 && !wordpressIsPaginate) {
343
  $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
344
  $(window).scroll(function () {
345
  var scrollHeight = document.getElementById('wcThreadWrapper').scrollHeight;
346
+ if ($(window).scrollTop() >= scrollHeight && isRun === false && wpdiscuzHasMoreComments == 1) {
347
  isRun = true;
348
  wpdiscuzLoadComments();
349
  }
352
 
353
  function wpdiscuzLoadComments() {
354
  var data;
355
+ data = 'offset=' + wpdiscuzLoadCount + '&orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder + '&lastParentId=' + getLastParentID();
356
+ wpdiscuzLoadCount++;
 
 
 
 
 
357
  getAjaxObject('loadMoreComments', data).done(function (response) {
358
  try {
359
  var obj = $.parseJSON(response);
361
  setLoadMoreVisibility(obj);
362
  $('.wpdiscuz_single').remove();
363
  isRun = false;
 
364
  displayShowHideReplies();
365
  } catch (e) {
366
  console.log(e);
372
  }
373
 
374
  function setLoadMoreVisibility(obj) {
375
+ var hasMoreComments = 0;
376
+ if (obj.is_show_load_more == false) {
377
+ hasMoreComments = 0;
378
+ wpdiscuzHasMoreComments = 0;
379
  $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
380
+ } else {
381
+ setLastParentID(obj.last_parent_id);
382
+ wpdiscuzHasMoreComments = 1;
383
+ hasMoreComments = 1;
384
  }
385
+ $('#wpdiscuzHasMoreComments').val(hasMoreComments);
386
  }
387
 
388
  //============================== LOAD MORE ============================== //
421
  //============================== VOTE ============================== //
422
  //============================== SORTING ============================== //
423
  $(document).delegate('.wpdiscuz-sort-button', 'click', function () {
424
+ wpdiscuzHasMoreComments = $('#wpdiscuzHasMoreComments').val();
425
  if (!($(this).hasClass('wpdiscuz-sort-button-active'))) {
426
  var clickedBtn = $(this);
427
  if ($(this).hasClass('wpdiscuz-vote-sort-up')) {
428
+ wpdiscuzCommentOrderBy = 'by_vote';
429
  wpdiscuzCommentOrder = 'desc';
430
  } else {
431
  wpdiscuzCommentOrderBy = 'comment_date_gmt';
452
  } catch (e) {
453
  console.log(e);
454
  }
455
+ displayShowHideReplies();
456
  addTooltipster();
457
  $('.wpdiscuz-loading-bar').hide();
458
  });
495
  getSingleComment();
496
  //============================== SINGLE COMMENT ============================== //
497
  //============================== LIVE UPDATE ============================== //
498
+ if (commentListUpdateType > 0 && loadLastCommentId && (isUserLoggedIn || (!isUserLoggedIn && !disableGuestsLiveUpdate))) {
499
  setInterval(liveUpdate, parseInt(commentListUpdateTimer) * 1000);
500
  }
501
 
590
  try {
591
  var obj = $.parseJSON(response);
592
  if (obj.code) {
593
+ $('#comment-' + commentId + ' > .wc-comment-text').html(' ' + obj.message);
594
  $('#wpdiscuz-readmore-' + uniqueId).remove();
595
  }
596
  } catch (e) {
613
  msgContainer = parentContainer.children('.wpdiscuz-comment-message');
614
  msgContainer.addClass(messageKey);
615
  msgContainer.html(message);
616
+ msgContainer.show().delay(4000).fadeOut(1000, function () {
617
  msgContainer.removeClass();
618
  msgContainer.addClass('wpdiscuz-comment-message');
619
  msgContainer.html('');
651
  return uniqueID.substring(0, uniqueID.indexOf('_'));
652
  }
653
 
 
 
 
 
 
654
  function getLastParentID() {
655
  var url = $('.wc-load-more-link').attr("href");
656
  return url.substring(url.lastIndexOf('=') + 1);
744
  * @returns {jqXHR}
745
  */
746
  function getAjaxObject(action, data) {
747
+ if (action !== 'liveUpdate') {
748
  $('.wpdiscuz-loading-bar').show();
749
  }
750
  data += '&postId=' + wpdiscuzPostId;
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("#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}})}});
1
+
2
+ jQuery(document).ready(function(D){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 B=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 x=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 H=wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;var b=1;var l="comment_date_gmt";var L=[];var u=[];E();g();f();if(H){D(".wpdiscuz-vote-sort-up").addClass("wpdiscuz-sort-button-active");l="by_vote"}else{D(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active")}D("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){D(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor")-1)});if(D(".wc_main_comm_form").length){e()}D(document).delegate(".wc-reply-link","click",function(){if(D(this).hasClass("wpdiscuz-clonned")){D("#wc-secondary-form-wrapper-"+m(D(this),0)).slideToggle(700)}else{h(D(this))}e()});D(document).delegate("textarea.wc_comment","focus",function(){if(!(D(this).next(".autogrow-textarea-mirror").length)){D(this).autoGrow()}var X=D(this).parents(".wc-form-wrapper");D(".wc-form-footer",X).slideDown(700)});D(document).delegate(".wc-share-link","click",function(){var X=D(this).parents(".wc-comment-right");D(".share_buttons_box",X).slideToggle(1000)});D(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(X){X.preventDefault()});D(document).delegate(".wc-toggle","click",function(){var Y=m(D(this),0);var X=D(this);D("#wc-comm-"+Y+"> .wc-reply").slideToggle(700,function(){if(D(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;")}})});D(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(D(this).hasClass("wc-reply")){D(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color},1500)}else{D(">.wc-comment-right",this).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color},1500)}});D(document).delegate(".wc_captcha_refresh_img","click",function(){O(D(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=D.parseJSON(ae);if(ai.code==1){var ag=D(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=D(".wpdiscuz-cnonce",Z);aj.attr("id",ai.key);aj.attr("value",ai.key)}}catch(ah){console.log(ah)}D(".wpdiscuz-loading-bar").hide()})}}D(document).delegate(".wc_comm_submit","click",function(){var ab=1;var Y=D(this).parents("form");if(!Y.hasClass("wc_main_comm_form")){ab=C(D(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&D(".wc_email",Y).val()){D(".wc_email",Y).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(D(".wc_email",Y).val())){D(".wc_email",Y).removeAttr("required");D(".wc_email",Y).next(".alert").html("")}if(wpdiscuzValidator.checkAll(Y)){var X=Y.serialize()+"&wc_comment_depth="+ab;if(q||P){var Z=D(".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=D.parseJSON(af);ag=aj.code;if(parseInt(ag)>=0){var ae=aj.is_main;ah=aj.message;D(".wc_header_text_count").html(aj.wc_all_comments_count_new);if(ae){D(".wc-thread-wrapper").prepend(ah)}else{D("#wc-secondary-form-wrapper-"+ag).slideToggle(700);if(aj.is_in_same_container==1){D("#wc-secondary-form-wrapper-"+ag).after(ah)}else{D("#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();D(".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)}E();D(".wpdiscuz-loading-bar").hide()})}O(D(".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=D.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=D.parseJSON(aa);if(Z.code==1){setTimeout(function(){window.location.href=Z.redirect_to},5000)}})}}function e(){if(D.cookie("wc_author_name")){D(".wc_comm_form .wc_name").val(D.cookie("wc_author_name"))}if(D.cookie("wc_author_email")){D(".wc_comm_form .wc_email").val(D.cookie("wc_author_email"))}if(D.cookie("wc_author_website")){D(".wc_comm_form .wc_website").val(D.cookie("wc_author_website"))}}function t(X,Y){if(D(".wc_email",X).val()){D.cookie("wc_author_email",D(".wc_email",X).val())}else{D.cookie("wc_author_email",Y.user_email)}if(D(".wc_name",X).val()){D.cookie("wc_author_name",D(".wc_name",X).val())}else{D.cookie("wc_author_name",Y.user_name)}D.cookie("wc_author_website",D(".wc_website",X).val())}var S;D(document).delegate(".wc_editable_comment","click",function(){var aa=m(D(this),0);var X=V(aa);var Z=D(this);var Y="commentId="+X;S=D("#wc-comm-"+aa+" .wc-comment-text").html();d("editComment",Y).done(function(ac){try{var ag=D.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>";D("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-text").replaceWith(ab);document.getElementById("wc_edit_comment-"+aa).focus();D("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ab="";D("#wc-comm-"+aa+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();D("#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)}D(".wpdiscuz-loading-bar").hide()})});D(document).delegate(".wc_save_edited_comment","click",function(){var ac=m(D(this));var Y=V(ac);var X=D("#wc-comm-"+ac+" textarea#wc_edit_comment-"+ac);var Z=X.val();var ab=D(this);if(D.trim(Z).length>0){var aa="commentId="+Y+"&commentContent="+Z;d("saveEditedComment",aa).done(function(ad){try{var ah=D.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)}D(".wpdiscuz-loading-bar").hide()})}});D(document).delegate(".wc_cancel_edit","click",function(){var X=m(D(this));I(X,S)});function I(Z,Y){D("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();D("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();D("#wc-comm-"+Z+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var X='<div class="wc-comment-text">'+k(Y)+"</div>";D("#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/>")}D(document).delegate(".wc-load-more-submit","click",function(){G()});var p=D("#wpdiscuzHasMoreComments").val();var F=false;if(B==2&&!U){D(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide();D(window).scroll(function(){var X=document.getElementById("wcThreadWrapper").scrollHeight;if(D(window).scrollTop()>=X&&F===false&&p==1){F=true;G()}})}function G(){var X;X="offset="+b+"&orderBy="+l+"&order="+a+"&lastParentId="+v();b++;d("loadMoreComments",X).done(function(Y){try{var aa=D.parseJSON(Y);D(".wpdiscuz-comment-pagination").before(aa.comment_list);r(aa);D(".wpdiscuz_single").remove();F=false;f()}catch(Z){console.log(Z)}E();D(".wpdiscuz-loading-bar").hide();D(".wc-load-more-submit").blur()})}function r(Y){var X=0;if(Y.is_show_load_more==false){X=0;p=0;D(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}else{N(Y.last_parent_id);p=1;X=1}D("#wpdiscuzHasMoreComments").val(X)}D(document).delegate(".wc_vote","click",function(){var X=D(this);var aa="";var ab="";var Y=D(this).parents(".wc-comment-right").attr("id");Y=Y.substring(Y.lastIndexOf("-")+1);var Z;if(D(this).hasClass("wc-up")){Z=1}else{Z=-1}var ac="commentId="+Y+"&voteType="+Z;d("voteOnComment",ac).done(function(ad){try{var af=D.parseJSON(ad);aa=af.code;if(parseInt(aa)>=0){var ag=D(".wc-comment-footer .wc-vote-result",D("#comment-"+Y));D(ag).text(parseInt(D(ag).text())+Z)}else{ab=wpdiscuz_ajax_obj.wpdiscuz_options[aa];s(X,aa,ab,false)}}catch(ae){console.log(ae)}D(".wpdiscuz-loading-bar").hide()})});D(document).delegate(".wpdiscuz-sort-button","click",function(){p=D("#wpdiscuzHasMoreComments").val();if(!(D(this).hasClass("wpdiscuz-sort-button-active"))){var aa=D(this);if(D(this).hasClass("wpdiscuz-vote-sort-up")){l="by_vote";a="desc"}else{l="comment_date_gmt";a=D(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=D.parseJSON(ab);X=ad.code;Y=ad.message;if(parseInt(X)>0){D("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){D(this).remove()});D("#wpcomm .wc-thread-wrapper").prepend(Y);b=parseInt(ad.loadCount)}else{}K(aa);r(ad)}catch(ac){console.log(ac)}f();E();D(".wpdiscuz-loading-bar").hide()})}});function K(X){D(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){D(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(!D("#comment-"+Y).length){var Z="commentId="+Y;var X=d("getSingleComment",Z);X.done(function(ac){try{var ae=D.parseJSON(ac);D(".wc-thread-wrapper").prepend(ae.message);D("html, body").animate({scrollTop:D(".wc-thread-wrapper").offset().top},1000)}catch(ad){console.log(ad)}E();D(".wpdiscuz-loading-bar").hide()})}}}W();if(j>0&&R&&(Q||(!Q&&!x))){setInterval(M,parseInt(i)*1000)}function M(){var aa=A();var Y=(D.cookie("wc_author_email")!=undefined&&D.cookie("wc_author_email")!="")?D.cookie("wc_author_email"):"";var Z="loadLastCommentId="+R+"&visibleCommentIds="+aa+"&email="+Y;var X=d("liveUpdate",Z);X.done(function(ac){try{var ah=D.parseJSON(ac);if(ah.code==1){if(j==1){y(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;D(".wc_new_comment").html(af).show()}else{D(".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;D(".wc_new_reply").html(ae).show()}else{D(".wc_new_reply").hide()}}D(".wc_header_text_count").html(ah.wc_all_comments_count_new);R=ah.loadLastCommentId}}catch(ag){console.log(ag)}E();D(".wpdiscuz-loading-bar").hide()})}function y(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()}}D(document).delegate(".wc-update-on-click","click",function(){var X;var Y=D(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=D.parseJSON(Z);y(ab);if(Y.hasClass("wc_new_comment")){u=[];D(".wc_new_comment").hide()}else{L=[];D(".wc_new_reply").hide()}}catch(aa){console.log(aa)}E();D(".wpdiscuz-loading-bar").hide()})});D(document).delegate(".wpdiscuz-readmore","click",function(){var Z=m(D(this));var X=V(Z);var Y="commentId="+X;d("readMore",Y).done(function(aa){try{var ac=D.parseJSON(aa);if(ac.code){D("#comment-"+X+" > .wc-comment-text").html(" "+ac.message);D("#wpdiscuz-readmore-"+Z).remove()}}catch(ab){console.log(ab)}D(".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(4000).fadeOut(1000,function(){X.removeClass();X.addClass("wpdiscuz-comment-message");X.html("")})}function h(Y){var Z=m(Y,0);D("#wpdiscuz_form_anchor-"+Z).before(J(Z));var X=D("#wc-secondary-form-wrapper-"+Z);X.slideToggle(700,function(){Y.addClass("wpdiscuz-clonned")});O(D(".wc_captcha_refresh_img",X))}function J(Y){var X=D("#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 z(Y){var X=Y.substring(Y.indexOf("_")+1);return X}function v(){var X=D(".wc-load-more-link").attr("href");return X.substring(X.lastIndexOf("=")+1)}function N(X){var Y=D(".wc-load-more-link").attr("href");D(".wc-load-more-link").attr("href",Y.replace(/[\d]+$/m,X));if(B!=2){D(".wpdiscuz-comment-pagination").show()}}function C(Z){var Y=Z.attr("class");var X=Y.split(" ");var aa="";D.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){D(".wc-thread-wrapper").prepend(Y)}else{var X=m(D("#comment-"+Z),0);D("#wpdiscuz_form_anchor-"+X).after(Y)}}function A(){var Z;var X;var Y="";D(".wc-comment-right").each(function(){Z=m(D(this),0);X=V(Z);Y+=X+","});return Y}function E(){D(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});D(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function g(){if(D(".wc_social_plugin_wrapper .wp-social-login-provider-list").length){D(".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(D(".wc_social_plugin_wrapper .the_champ_login_container").length){D(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(D(".wc_social_plugin_wrapper .social_connect_form").length){D(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(D(".wc_social_plugin_wrapper .oneall_social_login_providers").length){D(".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(){D("#wcThreadWrapper .wc-comment").each(function(X){if(D("> .wc-reply",this).length){D("> .wc-comment-right .wc-comment-footer .wc-toggle",this).removeClass("wpdiscuz-hidden")}})}function d(Y,X){if(Y!=="liveUpdate"){D(".wpdiscuz-loading-bar").show()}X+="&postId="+n;return D.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:X,action:Y}})}});
assets/third-party/colorpicker/js/jqColorPicker.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  (function(h,C,k){var F=h(document),c,i,l,t,E="",j,o,z,n,y,f,D,b="touchmove.a mousemove.a pointermove.a",A="touchstart.a mousedown.a pointerdown.a",I="touchend.a mouseup.a pointerup.a",B=false,x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(J){J()},d='<div class="cp-color-picker"><div class="cp-z-slider"><div class="cp-z-cursor"></div></div><div class="cp-xy-slider"><div class="cp-white"></div><div class="cp-xy-cursor"></div></div><div class="cp-alpha"><div class="cp-alpha-cursor"></div></div></div>',r=".cp-color-picker{position:absolute;overflow:hidden;padding:6px 6px 0;background-color:#444;color:#bbb;font-family:Arial,Helvetica,sans-serif;font-size:12px;font-weight:400;cursor:default;border-radius:5px}.cp-color-picker>div{position:relative;overflow:hidden}.cp-xy-slider{float:left;height:128px;width:128px;margin-bottom:6px;background:linear-gradient(to right,#FFF,rgba(255,255,255,0))}.cp-white{height:100%;width:100%;background:linear-gradient(rgba(0,0,0,0),#000)}.cp-xy-cursor{position:absolute;top:0;width:10px;height:10px;margin:-5px;border:1px solid #fff;border-radius:100%;box-sizing:border-box}.cp-z-slider{float:right;margin-left:6px;height:128px;width:20px;background:linear-gradient(red 0,#f0f 17%,#00f 33%,#0ff 50%,#0f0 67%,#ff0 83%,red 100%)}.cp-z-cursor{position:absolute;margin-top:-4px;width:100%;border:4px solid #fff;border-color:transparent #fff;box-sizing:border-box}.cp-alpha{clear:both;width:100%;height:16px;margin:6px 0;background:linear-gradient(to right,#444,rgba(0,0,0,0))}.cp-alpha-cursor{position:absolute;margin-left:-4px;height:100%;border:4px solid #fff;border-color:#fff transparent;box-sizing:border-box}",a=function(J){l=this.color=new C(J);t=l.options};a.prototype={render:e,toggle:v};function m(J){return J.value||J.getAttribute("value")||h(J).css("background-color")||"#fff"}function w(J){J=J.originalEvent&&J.originalEvent.touches?J.originalEvent.touches[0]:J;return J.originalEvent?J.originalEvent:J}function s(J){return h(J.find(t.doRender)[0]||J[0])}function v(K){var L=h(this),J=L.offset(),M=h(window),N=t.gap;if(K){j=s(L);i.$trigger=L;(o||q()).css({left:(o[0]._left=J.left)-((o[0]._left=o[0]._left+o[0]._width-(M.scrollLeft()+M.width()))+N>0?o[0]._left+N:0),top:(o[0]._top=J.top+L.outerHeight())-((o[0]._top=o[0]._top+o[0]._height-(M.scrollTop()+M.height()))+N>0?o[0]._top+N:0)}).show(t.animationSpeed,function(){if(K===true){return}f._width=f.width();z._width=z.width();z._height=z.height();l.setColor(m(j[0]));e(true)})}else{h(o).hide(t.animationSpeed,function(){j.blur();i.$trigger=null;e(false)})}}function q(){h("head").append('<style type="text/css">'+(t.css||r)+(t.cssAddon||"")+"</style>");return i.$UI=o=h(d).css({margin:t.margin}).appendTo("body").show(0,function(){var J=h(this);B=t.GPU&&J.css("perspective")!==k;z=h(".cp-xy-slider",this);n=h(".cp-xy-cursor",this);y=h(".cp-z-cursor",this);f=h(".cp-alpha",this).toggle(!!t.opacity);D=h(".cp-alpha-cursor",this);t.buildCallback.call(i,J);J.prepend("<div>").children().eq(0).css("width",J.children().eq(0).width());this._width=this.offsetWidth;this._height=this.offsetHeight}).hide().on(A,".cp-xy-slider,.cp-z-slider,.cp-alpha",H)}function H(K){var J=this.className.replace(/cp-(.*?)(?:\s*|$)/,"$1").replace("-","_");K.preventDefault&&K.preventDefault();K.returnValue=false;j._offset=h(this).offset();(J=J==="xy_slider"?u:J==="z_slider"?p:g)(K);e();F.on(I,function(L){F.off(".a")}).on(b,function(L){J(L);e()})}function u(K){var L=w(K),J=L.pageX-j._offset.left,M=L.pageY-j._offset.top;l.setColor({s:J/z._width*100,v:100-(M/z._height*100)},"hsv")}function p(J){var K=w(J).pageY-j._offset.top;l.setColor({h:360-(K/z._height*360)},"hsv")}function g(K){var J=w(K).pageX-j._offset.left,L=J/f._width;l.setColor({},"rgb",L)}function e(J){var U=l.colors,M=U.hueRGB,O=U.RND.rgb,V=U.RND.hsl,L="#222",Q="#ddd",S=j.data("colorMode"),T=U.alpha!==1,R=Math.round(U.alpha*100)/100,Z=O.r+", "+O.g+", "+O.b,X=(S==="HEX"&&!T?"#"+U.HEX:S==="rgb"||(S==="HEX"&&T)?(!T?"rgb("+Z+")":"rgba("+Z+", "+R+")"):("hsl"+(T?"a(":"(")+V.h+", "+V.s+"%, "+V.l+"%"+(T?", "+R:"")+")")),ab=U.HUELuminance>0.22?L:Q,N=U.rgbaMixBlack.luminance>0.22?L:Q,aa=(1-U.hsv.h)*z._height,Y=U.hsv.s*z._width,W=(1-U.hsv.v)*z._height,ac=R*f._width,ad=B?"translate3d":"",K=j.val(),P=j[0].hasAttribute("value")&&K===""&&J!==k;z._css={backgroundColor:"rgb("+M.r+","+M.g+","+M.b+")"};n._css={transform:ad+"("+Y+"px, "+W+"px, 0)",left:!B?Y:"",top:!B?W:"",borderColor:U.RGBLuminance>0.22?L:Q};y._css={transform:ad+"(0, "+aa+"px, 0)",top:!B?aa:"",borderColor:"transparent "+ab};f._css={backgroundColor:"rgb("+Z+")"};D._css={transform:ad+"("+ac+"px, 0, 0)",left:!B?ac:"",borderColor:N+" transparent"};j._css={backgroundColor:P?"":X,color:P?"":U.rgbaMixBGMixCustom.luminance>0.22?L:Q};j.text=P?"":K!==X?X:"";J!==k?G(J):x(G)}function G(J){z.css(z._css);n.css(n._css);y.css(y._css);f.css(f._css);D.css(D._css);t.doRender&&j.css(j._css);j.text&&j.val(j.text);t.renderCallback.call(i,j,typeof J==="boolean"?J:k)}h.fn.colorPicker=function(J){var K=function(){};J=h.extend({animationSpeed:150,GPU:true,doRender:true,customBG:"#FFF",opacity:true,renderCallback:K,buildCallback:K,body:document.body,scrollResize:true,gap:4},J);!i&&J.scrollResize&&h(window).on("resize.a scroll.a",function(){if(i.$trigger){i.toggle.call(i.$trigger[0],true)}});c=c?c.add(this):this;c.colorPicker=i||(i=new a(J));E+=(E?", ":"")+this.selector;h(J.body).off(".a").on(A,function(M){var L=h(M.target);if(h.inArray(L.closest(E)[0],c)===-1&&!L.closest(o).length){v()}}).on("focus.a click.a",E,v).on("change.a",E,function(){l.setColor(this.value||"#FFF");c.colorPicker.render(true)});return this.each(function(){var M=m(this),N=M.split("("),L=s(h(this));L.data("colorMode",N[1]?N[0].substr(0,3):"HEX").attr("readonly",t.preventFocus);J.doRender&&L.css({"background-color":M,color:function(){return l.setColor(M).rgbaMixBGMixCustom.luminance>0.22?"#222":"#ddd"}})})};h.fn.colorPicker.destroy=function(){h(i.color.options.body).off(".a");i.toggle(false);c=null;E=""}})(jQuery,Colors);
1
+
2
  (function(h,C,k){var F=h(document),c,i,l,t,E="",j,o,z,n,y,f,D,b="touchmove.a mousemove.a pointermove.a",A="touchstart.a mousedown.a pointerdown.a",I="touchend.a mouseup.a pointerup.a",B=false,x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(J){J()},d='<div class="cp-color-picker"><div class="cp-z-slider"><div class="cp-z-cursor"></div></div><div class="cp-xy-slider"><div class="cp-white"></div><div class="cp-xy-cursor"></div></div><div class="cp-alpha"><div class="cp-alpha-cursor"></div></div></div>',r=".cp-color-picker{position:absolute;overflow:hidden;padding:6px 6px 0;background-color:#444;color:#bbb;font-family:Arial,Helvetica,sans-serif;font-size:12px;font-weight:400;cursor:default;border-radius:5px}.cp-color-picker>div{position:relative;overflow:hidden}.cp-xy-slider{float:left;height:128px;width:128px;margin-bottom:6px;background:linear-gradient(to right,#FFF,rgba(255,255,255,0))}.cp-white{height:100%;width:100%;background:linear-gradient(rgba(0,0,0,0),#000)}.cp-xy-cursor{position:absolute;top:0;width:10px;height:10px;margin:-5px;border:1px solid #fff;border-radius:100%;box-sizing:border-box}.cp-z-slider{float:right;margin-left:6px;height:128px;width:20px;background:linear-gradient(red 0,#f0f 17%,#00f 33%,#0ff 50%,#0f0 67%,#ff0 83%,red 100%)}.cp-z-cursor{position:absolute;margin-top:-4px;width:100%;border:4px solid #fff;border-color:transparent #fff;box-sizing:border-box}.cp-alpha{clear:both;width:100%;height:16px;margin:6px 0;background:linear-gradient(to right,#444,rgba(0,0,0,0))}.cp-alpha-cursor{position:absolute;margin-left:-4px;height:100%;border:4px solid #fff;border-color:#fff transparent;box-sizing:border-box}",a=function(J){l=this.color=new C(J);t=l.options};a.prototype={render:e,toggle:v};function m(J){return J.value||J.getAttribute("value")||h(J).css("background-color")||"#fff"}function w(J){J=J.originalEvent&&J.originalEvent.touches?J.originalEvent.touches[0]:J;return J.originalEvent?J.originalEvent:J}function s(J){return h(J.find(t.doRender)[0]||J[0])}function v(K){var L=h(this),J=L.offset(),M=h(window),N=t.gap;if(K){j=s(L);i.$trigger=L;(o||q()).css({left:(o[0]._left=J.left)-((o[0]._left=o[0]._left+o[0]._width-(M.scrollLeft()+M.width()))+N>0?o[0]._left+N:0),top:(o[0]._top=J.top+L.outerHeight())-((o[0]._top=o[0]._top+o[0]._height-(M.scrollTop()+M.height()))+N>0?o[0]._top+N:0)}).show(t.animationSpeed,function(){if(K===true){return}f._width=f.width();z._width=z.width();z._height=z.height();l.setColor(m(j[0]));e(true)})}else{h(o).hide(t.animationSpeed,function(){j.blur();i.$trigger=null;e(false)})}}function q(){h("head").append('<style type="text/css">'+(t.css||r)+(t.cssAddon||"")+"</style>");return i.$UI=o=h(d).css({margin:t.margin}).appendTo("body").show(0,function(){var J=h(this);B=t.GPU&&J.css("perspective")!==k;z=h(".cp-xy-slider",this);n=h(".cp-xy-cursor",this);y=h(".cp-z-cursor",this);f=h(".cp-alpha",this).toggle(!!t.opacity);D=h(".cp-alpha-cursor",this);t.buildCallback.call(i,J);J.prepend("<div>").children().eq(0).css("width",J.children().eq(0).width());this._width=this.offsetWidth;this._height=this.offsetHeight}).hide().on(A,".cp-xy-slider,.cp-z-slider,.cp-alpha",H)}function H(K){var J=this.className.replace(/cp-(.*?)(?:\s*|$)/,"$1").replace("-","_");K.preventDefault&&K.preventDefault();K.returnValue=false;j._offset=h(this).offset();(J=J==="xy_slider"?u:J==="z_slider"?p:g)(K);e();F.on(I,function(L){F.off(".a")}).on(b,function(L){J(L);e()})}function u(K){var L=w(K),J=L.pageX-j._offset.left,M=L.pageY-j._offset.top;l.setColor({s:J/z._width*100,v:100-(M/z._height*100)},"hsv")}function p(J){var K=w(J).pageY-j._offset.top;l.setColor({h:360-(K/z._height*360)},"hsv")}function g(K){var J=w(K).pageX-j._offset.left,L=J/f._width;l.setColor({},"rgb",L)}function e(J){var U=l.colors,M=U.hueRGB,O=U.RND.rgb,V=U.RND.hsl,L="#222",Q="#ddd",S=j.data("colorMode"),T=U.alpha!==1,R=Math.round(U.alpha*100)/100,Z=O.r+", "+O.g+", "+O.b,X=(S==="HEX"&&!T?"#"+U.HEX:S==="rgb"||(S==="HEX"&&T)?(!T?"rgb("+Z+")":"rgba("+Z+", "+R+")"):("hsl"+(T?"a(":"(")+V.h+", "+V.s+"%, "+V.l+"%"+(T?", "+R:"")+")")),ab=U.HUELuminance>0.22?L:Q,N=U.rgbaMixBlack.luminance>0.22?L:Q,aa=(1-U.hsv.h)*z._height,Y=U.hsv.s*z._width,W=(1-U.hsv.v)*z._height,ac=R*f._width,ad=B?"translate3d":"",K=j.val(),P=j[0].hasAttribute("value")&&K===""&&J!==k;z._css={backgroundColor:"rgb("+M.r+","+M.g+","+M.b+")"};n._css={transform:ad+"("+Y+"px, "+W+"px, 0)",left:!B?Y:"",top:!B?W:"",borderColor:U.RGBLuminance>0.22?L:Q};y._css={transform:ad+"(0, "+aa+"px, 0)",top:!B?aa:"",borderColor:"transparent "+ab};f._css={backgroundColor:"rgb("+Z+")"};D._css={transform:ad+"("+ac+"px, 0, 0)",left:!B?ac:"",borderColor:N+" transparent"};j._css={backgroundColor:P?"":X,color:P?"":U.rgbaMixBGMixCustom.luminance>0.22?L:Q};j.text=P?"":K!==X?X:"";J!==k?G(J):x(G)}function G(J){z.css(z._css);n.css(n._css);y.css(y._css);f.css(f._css);D.css(D._css);t.doRender&&j.css(j._css);j.text&&j.val(j.text);t.renderCallback.call(i,j,typeof J==="boolean"?J:k)}h.fn.colorPicker=function(J){var K=function(){};J=h.extend({animationSpeed:150,GPU:true,doRender:true,customBG:"#FFF",opacity:true,renderCallback:K,buildCallback:K,body:document.body,scrollResize:true,gap:4},J);!i&&J.scrollResize&&h(window).on("resize.a scroll.a",function(){if(i.$trigger){i.toggle.call(i.$trigger[0],true)}});c=c?c.add(this):this;c.colorPicker=i||(i=new a(J));E+=(E?", ":"")+this.selector;h(J.body).off(".a").on(A,function(M){var L=h(M.target);if(h.inArray(L.closest(E)[0],c)===-1&&!L.closest(o).length){v()}}).on("focus.a click.a",E,v).on("change.a",E,function(){l.setColor(this.value||"#FFF");c.colorPicker.render(true)});return this.each(function(){var M=m(this),N=M.split("("),L=s(h(this));L.data("colorMode",N[1]?N[0].substr(0,3):"HEX").attr("readonly",t.preventFocus);J.doRender&&L.css({"background-color":M,color:function(){return l.setColor(M).rgbaMixBGMixCustom.luminance>0.22?"#222":"#ddd"}})})};h.fn.colorPicker.destroy=function(){h(i.color.options.body).off(".a");i.toggle(false);c=null;E=""}})(jQuery,Colors);
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.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/
@@ -14,8 +14,9 @@ if (!defined('ABSPATH')) {
14
  exit();
15
  }
16
 
17
- define('WPD_DS', DIRECTORY_SEPARATOR);
18
- define('DIR_PATH', dirname(__FILE__));
 
19
 
20
  include_once 'utils/interface.WpDiscuzConstants.php';
21
  include_once 'options/class.WpdiscuzOptions.php';
@@ -29,15 +30,15 @@ include_once 'templates/comment/class.WpdiscuzWalker.php';
29
 
30
  class WpdiscuzCore implements WpDiscuzConstants {
31
 
32
- public $options;
33
- public $optionsSerialized;
34
  public $helper;
35
- public $emailHelper;
36
- public $optimizationHelper;
37
  public $dbManager;
38
- public $css;
39
- public $wpdiscuzWalker;
40
- public static $PLUGIN_DIRECTORY;
 
 
 
 
41
 
42
  public function __construct() {
43
  $this->dbManager = new WpdiscuzDBManager();
@@ -56,7 +57,6 @@ class WpdiscuzCore implements WpDiscuzConstants {
56
  add_action('wp_head', array(&$this->css, 'initCustomCss'));
57
 
58
  add_action('plugins_loaded', array(&$this, 'wpdiscuzTextDomain'));
59
- add_action('init', array(&$this, 'initPluginDirName'), 1);
60
  add_action('admin_init', array(&$this, 'pluginNewVersion'), 2);
61
  add_action('admin_enqueue_scripts', array(&$this, 'adminPageStylesScripts'), 2315);
62
  add_action('wp_enqueue_scripts', array(&$this, 'frontEndStylesScripts'));
@@ -88,6 +88,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
88
  add_action('deleted_comment', array(&$this->optimizationHelper, 'deleteCommentFromTree'), 267);
89
  $plugin = plugin_basename(__FILE__);
90
  add_filter("plugin_action_links_$plugin", array(&$this, 'addPluginSettingsLink'));
 
91
  if ($this->optionsSerialized->commentEditableTime) {
92
  add_action('wp_ajax_editComment', array(&$this, 'editComment'));
93
  add_action('wp_ajax_nopriv_editComment', array(&$this, 'editComment'));
@@ -127,40 +128,58 @@ class WpdiscuzCore implements WpDiscuzConstants {
127
  parse_str($commentData);
128
  $postId = intval(trim($postId));
129
  $loadLastCommentId = intval(trim($loadLastCommentId));
130
- $lastCommentId = $this->dbManager->getLastCommentId($postId);
131
  $visibleCommentIds = trim($visibleCommentIds, ',');
132
- $email = trim($email);
133
-
134
- if ($current_user->ID) {
135
- $email = $current_user->user_email;
136
- }
137
- if ($lastCommentId > $loadLastCommentId) {
138
- $messageArray['code'] = 1;
139
- $messageArray['loadLastCommentId'] = $lastCommentId;
140
- if ($this->optionsSerialized->commentListUpdateType == 1) {
141
- $visibleCommentIds = explode(',', $visibleCommentIds);
142
- $newCommentIds = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email, $this->optionsSerialized->wordpressCommentOrder);
143
  $commentListArgs = $this->getCommentListArgs($postId);
144
  $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
145
  $commentListArgs['current_user'] = $current_user;
146
- foreach ($newCommentIds as $newCommentId) {
147
- $comment = get_comment($newCommentId);
148
- if (($comment->comment_parent && (in_array($comment->comment_parent, $visibleCommentIds) || in_array($comment->comment_parent, $newCommentIds))) || !$comment->comment_parent) {
149
- $comments = get_comments(array('comment__in' => $newCommentId));
150
- $commentHtml = wp_list_comments($commentListArgs, $comments);
151
- $messageArray['message'][] = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
 
153
  }
 
154
  } else {
155
- $authorReplies = $this->dbManager->getAuthorNewReplies($visibleCommentIds, $loadLastCommentId, $email);
156
- $messageArray['message']['author_replies'] = $authorReplies;
157
- $messageArray['message']['comments'] = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email, $this->optionsSerialized->wordpressCommentOrder, implode(',', $authorReplies));
158
  }
159
- $messageArray['wc_all_comments_count_new'] = $this->dbManager->getCommentsCount($postId);
160
- } else {
161
- $messageArray['code'] = 0;
162
  }
163
- wp_die(json_encode($messageArray));
164
  }
165
 
166
  public function updateOnClick() {
@@ -169,20 +188,24 @@ class WpdiscuzCore implements WpDiscuzConstants {
169
  global $current_user;
170
  get_currentuserinfo();
171
  parse_str($commentData);
172
- $messageArray['code'] = 1;
173
- $newCommentIds = explode(',', $newCommentIds);
174
- $postId = trim(intval($postId));
175
- $commentListArgs = $this->getCommentListArgs($postId);
176
- $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
177
- $commentListArgs['current_user'] = $current_user;
178
- foreach ($newCommentIds as $newCommentId) {
179
- $comment = get_comment($newCommentId);
180
- $comments = get_comments(array('comment__in' => $newCommentId));
181
- $commentHtml = wp_list_comments($commentListArgs, $comments);
182
- $messageArray['message'][] = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
 
 
 
 
183
  }
184
- wp_die(json_encode($messageArray));
185
  }
 
186
  }
187
 
188
  public function addComment() {
@@ -340,13 +363,18 @@ class WpdiscuzCore implements WpDiscuzConstants {
340
  $commentId = intval($commentId);
341
  if ($commentId) {
342
  $comment = get_comment($commentId);
343
- $isInRange = $this->helper->isContentInRange($comment->comment_content);
344
- $isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
345
- if (isset($current_user) && $comment->user_id == $current_user->ID && $isEditable) {
346
  $message_array['code'] = 1;
347
  $message_array['message'] = $comment->comment_content;
348
  } else {
349
- $message_array['code'] = 'wc_comment_edit_not_possible';
 
 
 
 
 
 
 
350
  }
351
  } else {
352
  $message_array['code'] = 'wc_comment_edit_not_possible';
@@ -369,7 +397,8 @@ class WpdiscuzCore implements WpDiscuzConstants {
369
  $comment = get_comment($commentId);
370
  $current_user = wp_get_current_user();
371
  $trimmedCommentContent = trim($commentContent);
372
- if ($trimmedCommentContent && $this->helper->isContentInRange($trimmedCommentContent) && isset($current_user) && $comment->user_id == $current_user->ID) {
 
373
  if ($trimmedCommentContent != $comment->comment_content) {
374
  $commentContent = wp_kses($commentContent, $this->helper->wc_allowed_tags);
375
  $author_ip = $this->helper->getRealIPAddr();
@@ -384,8 +413,12 @@ class WpdiscuzCore implements WpDiscuzConstants {
384
  if (wp_update_comment($commentarr)) {
385
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
386
  $message_array['code'] = 1;
387
- $commentContent = ($this->optionsSerialized->commentReadMoreLimit && count($commentWordsLimit = explode(' ', $commentContent)) > $this->optionsSerialized->commentReadMoreLimit) ? $this->helper->getCommentExcerpt($commentWordsLimit, $commentContent, $uniqueId) : $commentContent;
388
- $message_array['message'] = $this->helper->makeClickable($commentContent);
 
 
 
 
389
  } else {
390
  $message_array['code'] = 'wc_comment_not_updated';
391
  }
@@ -414,13 +447,16 @@ class WpdiscuzCore implements WpDiscuzConstants {
414
  $parentComment = $this->optimizationHelper->getCommentRoot($commentId);
415
  $tree = array();
416
  $tree = $this->optimizationHelper->getTreeByParentId($parentComment->comment_ID, $tree);
417
- $comments = get_comments(array('comment__in' => array_merge(array($parentComment->comment_ID), $tree)));
 
 
418
  $commentListArgs = $this->getCommentListArgs($postId);
419
  $commentListArgs['isSingle'] = true;
420
  $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
421
  $commentListArgs['current_user'] = $current_user;
422
  $messageArray['message'] = wp_list_comments($commentListArgs, $comments);
423
  }
 
424
  wp_die(json_encode($messageArray));
425
  }
426
  }
@@ -444,30 +480,26 @@ class WpdiscuzCore implements WpDiscuzConstants {
444
  }
445
  }
446
  }
 
447
  wp_die(json_encode($messageArray));
448
  }
449
 
450
  public function loadMoreComments() {
451
  if (isset($_POST['wpdiscuzAjaxData'])) {
452
- global $wp_version;
453
  parse_str($_POST['wpdiscuzAjaxData']);
454
  $postId = intval(trim($postId));
455
- $limit = intval(trim($loadAllCommnts) == 1) ? 0 : $this->optionsSerialized->wordpressCommentPerPage;
456
  $args = array('limit' => $limit);
457
  $orderBy = trim($orderBy);
458
- if ($orderBy == 'meta_value_num') {
459
- if (version_compare($wp_version, '4.3.0', '>=')) {
460
- $args['meta_key'] = self::META_KEY_VOTES;
461
- }
462
- $args['order'] = 'desc';
463
- $args['orderby'] = 'meta_value_num';
464
- $args['offset'] = intval($offset) * $limit;
465
  } else {
466
- $args['order'] = trim($order) ? trim($order) : $this->optionsSerialized->wordpressCommentOrder;
 
467
  $args['last_parent_id'] = intval($lastParentId);
468
- }
469
  $args['post_id'] = $postId;
470
-
471
  $data = $this->getWPComments($args);
472
  wp_die(json_encode($data));
473
  }
@@ -535,7 +567,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
535
  $order = trim($order);
536
  if ($postId && $orderBy && $order) {
537
  $args = array('order' => $order, 'post_id' => $postId);
538
- if (in_array($orderBy, array('meta_value_num', 'comment_date_gmt'))) {
539
  $args['orderby'] = $orderBy;
540
  } else {
541
  $args['orderby'] = 'comment_date_gmt';
@@ -562,9 +594,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
562
  $commentId = intval(trim($commentId));
563
  $comment = get_comment($commentId);
564
  if ($comment) {
565
- $commentReadMorePart = explode(' ', $comment->comment_content, $this->optionsSerialized->commentReadMoreLimit + 1);
566
- $commentContent = $commentReadMorePart[count($commentReadMorePart) - 1];
567
- $commentContent = wp_kses($commentContent, $this->helper->wc_allowed_tags);
568
  $commentContent = apply_filters('comment_text', $commentContent);
569
  $commentContent = $this->helper->makeClickable($commentContent);
570
  $messageArray['code'] = 1;
@@ -581,103 +611,73 @@ class WpdiscuzCore implements WpDiscuzConstants {
581
  * get comments by comment type
582
  */
583
  public function getWPComments($args = array()) {
584
- global $post, $wp_version, $current_user;
585
  get_currentuserinfo();
586
- $defaults = array(
587
- 'last_parent_id' => 0,
588
- 'post_id' => isset($post->ID) ? $post->ID : '',
589
- 'offset' => 0,
590
- 'orderby' => 'comment_date_gmt',
591
- 'order' => $this->optionsSerialized->wordpressCommentOrder,
592
- 'date_order' => $this->optionsSerialized->wordpressCommentOrder,
593
- 'limit' => $this->optionsSerialized->wordpressCommentPerPage,
594
- 'is_threaded' => 1,
595
- 'status' => 'approve'
596
- );
597
-
598
- if (version_compare($wp_version, '4.3.0', '>=')) {
599
- $defaults['meta_key'] = WpdiscuzCore::META_KEY_VOTES;
600
- }
601
- $parsedArgs = wp_parse_args($args, $defaults);
602
  $commentData = array();
603
- $commentListArgs = $this->getCommentListArgs($parsedArgs['post_id']);
604
-
605
- $commentList = $this->_getWPComments($parsedArgs, $commentListArgs, $commentData);
606
  $commentListArgs['current_user'] = $current_user;
607
  $wcWpComments = wp_list_comments($commentListArgs, $commentList);
608
  $commentData['comment_list'] = $wcWpComments;
609
  return $commentData;
610
  }
611
 
612
- /**
613
- * add new orderby clause when sort type is vote and wordpress commnts order is older (ASC)
614
- */
615
- public function filterVoteSortingOrderBY($args) {
616
- global $wpdb;
617
- $orderbyArray = explode(',', $args['orderby']);
618
- if (count($orderbyArray) > 1) {
619
- $args['orderby'] = $orderbyArray[0] . ',' . $wpdb->prefix . 'comments.comment_date_gmt ' . $this->optionsSerialized->wordpressCommentOrder;
620
- }
621
- return $args;
622
- }
623
-
624
- private function _getWPComments($args, &$commentListArgs, &$commentData) {
625
  if (!$this->optionsSerialized->wordpressIsPaginate) {
626
- $parentIds = array();
627
- $rootComments = array();
628
-
629
- $args['is_threaded'] = $this->optionsSerialized->wordpressThreadComments;
630
- if ($args['limit'] == 0) {
631
- $args['viewed_comment_count'] = $this->optionsSerialized->wordpressCommentPerPage;
632
- }
633
- $this->dbManager->getCommentList($args);
634
-
635
- if ($args['comment__in']) {
636
- $parentIds = $args['comment__in'];
637
- if ($args['orderby'] == 'meta_value_num') {
638
- $rootComments = $this->getTopVotedComments($args);
639
- }
640
- if (!$rootComments) {
641
- $rootComments = get_comments($args);
642
- }
643
- }
644
- if ($args['is_threaded']) {
645
- $commentmetaIds = $this->optimizationHelper->getCommentListByParentIds($parentIds, $args['post_id']);
646
- if ($commentmetaIds) {
647
- $args['comment__in'] = $commentmetaIds;
648
- $commentList = get_comments($args);
649
- $commentList = array_merge($rootComments, $commentList);
650
- } else {
651
- $commentList = $rootComments;
652
- }
653
- } else {
654
- $commentList = $rootComments;
655
  }
656
  $commentListArgs['page'] = 1;
657
- $commentListArgs['reverse_top_level'] = false;
658
- $commentData['last_parent_id'] = $parentIds ? $parentIds[count($parentIds) - 1] : 0;
659
  $commentListArgs['last_parent_id'] = $commentData['last_parent_id'];
660
- $commentData['is_show_load_more'] = $this->helper->isShowLoadMore($commentData['last_parent_id'], $args);
661
- } else {
662
- if ($this->optionsSerialized->wordpressCommentOrder == 'desc') {
663
- $commentListArgs['reverse_top_level'] = false;
664
- }
665
- $commentList = get_comments(array('post_id' => $args['post_id'], 'status' => 'approve', 'order' => $this->optionsSerialized->wordpressCommentOrder));
666
  }
 
 
667
  return $commentList;
668
  }
669
 
670
- private function getTopVotedComments(&$args) {
671
- global $wp_version;
672
- $rootComments = array();
673
- if (version_compare($wp_version, '4.3.0', '<')) {
674
- foreach ($args['comment__in'] as $commentId) {
675
- $rootComments[] = get_comment($commentId);
 
 
 
 
 
 
 
 
676
  }
677
- } elseif ($this->optionsSerialized->wordpressCommentOrder == 'asc') {
678
- add_filter('comments_clauses', array(&$this, 'filterVoteSortingOrderBY'));
679
  }
680
- return $rootComments;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  }
682
 
683
  /**
@@ -694,28 +694,28 @@ class WpdiscuzCore implements WpDiscuzConstants {
694
  * Scripts and styles registration on administration pages
695
  */
696
  public function adminPageStylesScripts() {
697
- wp_register_style('wpdiscuz-cp-index-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/colorpicker/css/index.css'));
698
  wp_enqueue_style('wpdiscuz-cp-index-css');
699
- wp_register_style('wpdiscuz-cp-compatibility-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/colorpicker/css/compatibility.css'));
700
  wp_enqueue_style('wpdiscuz-cp-compatibility-css');
701
- wp_register_script('wpdiscuz-cp-colors-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/colorpicker/js/colors.js'), array('jquery'), '1.0.0', false);
702
  wp_enqueue_script('wpdiscuz-cp-colors-js');
703
- wp_register_script('wpdiscuz-cp-colorpicker-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/colorpicker/js/jqColorPicker.min.js'), array('jquery'), '1.0.0', false);
704
  wp_enqueue_script('wpdiscuz-cp-colorpicker-js');
705
- wp_register_script('wpdiscuz-cp-index-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/colorpicker/js/index.js'), array('jquery'), '1.0.0', false);
706
  wp_enqueue_script('wpdiscuz-cp-index-js');
707
- wp_register_style('wpdiscuz-easy-responsive-tabs-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css'), true);
708
  wp_enqueue_style('wpdiscuz-easy-responsive-tabs-css');
709
- wp_register_script('wpdiscuz-easy-responsive-tabs-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js'), array('jquery'), '1.0.0', true);
710
  wp_enqueue_script('wpdiscuz-easy-responsive-tabs-js');
711
- wp_register_style('wpdiscuz-options-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/css/options-css.min.css'));
712
  wp_enqueue_style('wpdiscuz-options-css');
713
  $realLastCommentId = $this->dbManager->getLastCommentId();
714
- wp_register_script('wpdiscuz-options-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/wpdiscuz-options.min.js'), array('jquery'));
715
  wp_localize_script('wpdiscuz-options-js', 'admin_options_obj', array('lastCommentId' => $realLastCommentId));
716
  wp_enqueue_script('wpdiscuz-options-js');
717
  wp_enqueue_script('thickbox');
718
- wp_register_script('wpdiscuz-jquery-cookie', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/jquery.cookie.min.js'), array('jquery'), '1.0.0', true);
719
  wp_enqueue_script('wpdiscuz-jquery-cookie');
720
  }
721
 
@@ -724,41 +724,41 @@ class WpdiscuzCore implements WpDiscuzConstants {
724
  */
725
  public function frontEndStylesScripts() {
726
  global $post;
727
- if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && is_singular() && post_type_supports($post->post_type, 'comments')) {
728
 
729
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
730
- wp_register_style('wpdiscuz-frontend-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/css/wpdiscuz.min.css'), null, get_option(WpdiscuzCore::OPTION_SLUG_VERSION));
731
  wp_enqueue_style('wpdiscuz-frontend-css');
732
 
733
  if (is_rtl()) {
734
- wp_register_style('wpdiscuz-frontend-rtl-css', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/css/wpdiscuz-rtl.min.css'), null, get_option(WpdiscuzCore::OPTION_SLUG_VERSION));
735
  wp_enqueue_style('wpdiscuz-frontend-rtl-css');
736
  }
737
 
738
- wp_register_script('wpdiscuz-jquery-ui', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/jquery-ui/jquery-ui.min.js'), array('jquery'), '1.11.2', false);
739
  wp_enqueue_script('wpdiscuz-jquery-ui');
740
 
741
  if (preg_match('/MSIE/i', $u_agent)) {
742
- wp_register_script('wpdiscuz-html5-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/tooltipster/js/html5.min.js'), array('jquery'), '1.2', false);
743
  wp_enqueue_script('wpdiscuz-html5-js');
744
  }
745
 
746
- wp_register_script('wpdiscuz-validator-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/validator.min.js'), array('jquery'), '1.0.0', false);
747
  wp_enqueue_script('wpdiscuz-validator-js');
748
- wp_register_style('wpdiscuz-validator-style', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/css/fv.min.css'));
749
  wp_enqueue_style('wpdiscuz-validator-style');
750
- wp_register_script('wpdiscuz-cookie-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/jquery.cookie.min.js'), array('jquery'), '1.4.1', false);
751
  wp_enqueue_script('wpdiscuz-cookie-js');
752
- wp_register_style('wpdiscuz-tooltipster-style', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/tooltipster/css/tooltipster.min.css'));
753
  wp_enqueue_style('wpdiscuz-tooltipster-style');
754
- wp_register_script('wpdiscuz-tooltipster-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/third-party/tooltipster/js/jquery.tooltipster.min.js'), array('jquery'), '1.2', false);
755
  wp_enqueue_script('wpdiscuz-tooltipster-js');
756
- wp_register_script('autogrowtextarea-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/jquery.autogrowtextarea.min.js'), array('jquery'), '3.0', false);
757
  wp_enqueue_script('autogrowtextarea-js');
758
  $wpdiscuz_js_options = $this->optionsSerialized->getOptionsForJs();
759
  $wpdiscuz_js_options['wc_post_id'] = $post->ID;
760
  $wpdiscuz_js_options['loadLastCommentId'] = $this->dbManager->getLastCommentId($post->ID);
761
- wp_register_script('wpdiscuz-ajax-js', plugins_url(self::$PLUGIN_DIRECTORY . '/assets/js/wpdiscuz.min.js'), array('jquery'), get_option(WpdiscuzCore::OPTION_SLUG_VERSION), false);
762
  wp_enqueue_script('wpdiscuz-ajax-js');
763
  wp_localize_script('wpdiscuz-ajax-js', 'wpdiscuz_ajax_obj', array('url' => admin_url('admin-ajax.php'), 'wpdiscuz_options' => $wpdiscuz_js_options));
764
  }
@@ -822,13 +822,6 @@ class WpdiscuzCore implements WpDiscuzConstants {
822
  }
823
  }
824
 
825
- public function initPluginDirName() {
826
- $pluginDirPath = plugin_dir_path(__FILE__);
827
- $pathArray = array_values(array_filter(explode(WPD_DS, $pluginDirPath)));
828
- $pathLastPart = $pathArray[count($pathArray) - 1];
829
- self::$PLUGIN_DIRECTORY = untrailingslashit($pathLastPart);
830
- }
831
-
832
  // Add settings link on plugin page
833
  public function addPluginSettingsLink($links) {
834
  $settingsLink = '<a href="' . admin_url() . 'edit-comments.php?page=wpdiscuz_options_page">' . __('Settings', 'wpdiscuz') . '</a>';
@@ -841,7 +834,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
841
 
842
  public function initCurrentPostType() {
843
  global $post;
844
- if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && is_singular() && post_type_supports($post->post_type, 'comments')) {
845
  add_filter('comments_template', array(&$this, 'addCommentForm'), 10);
846
  }
847
  }
@@ -855,12 +848,13 @@ class WpdiscuzCore implements WpDiscuzConstants {
855
  $postsAuthors = $this->dbManager->getPostsAuthors();
856
  $post = get_post($postId);
857
  return array(
858
- 'walker' => $this->wpdiscuzWalker,
859
  'style' => 'div',
860
  'echo' => false,
861
  'isSingle' => false,
 
862
  'post_author' => $post->post_author,
863
  'posts_authors' => $postsAuthors,
 
864
  );
865
  }
866
 
@@ -883,7 +877,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
883
  $this->optionsSerialized->blogRoles['post_author'] = isset($this->optionsSerialized->blogRoles['post_author']) ? $this->optionsSerialized->blogRoles['post_author'] : '#00B38F';
884
  $this->optionsSerialized->blogRoles['guest'] = isset($this->optionsSerialized->blogRoles['guest']) ? $this->optionsSerialized->blogRoles['guest'] : '#00B38F';
885
  $this->optionsSerialized->phrases['wc_blog_role_post_author'] = isset($this->optionsSerialized->phrases['wc_blog_role_post_author']) ? $this->optionsSerialized->phrases['wc_blog_role_post_author'] : __('Author', 'wpdiscuz');
886
- $this->optionsSerialized->phrases['wc_blog_role_guest'] = isset($this->optionsSerialized->optionsSerialized->phrases['wc_blog_role_guest']) ? $this->optionsSerialized->phrases['wc_blog_role_guest'] : __('Guest', 'wpdiscuz');
887
  }
888
 
889
  }
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.1.0
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/
14
  exit();
15
  }
16
 
17
+ define('WPDISCUZ_DS', DIRECTORY_SEPARATOR);
18
+ define('WPDISCUZ_DIR_PATH', dirname(__FILE__));
19
+ define('WPDISCUZ_DIR_NAME', basename(WPDISCUZ_DIR_PATH));
20
 
21
  include_once 'utils/interface.WpDiscuzConstants.php';
22
  include_once 'options/class.WpdiscuzOptions.php';
30
 
31
  class WpdiscuzCore implements WpDiscuzConstants {
32
 
 
 
33
  public $helper;
 
 
34
  public $dbManager;
35
+ public $optionsSerialized;
36
+ private $css;
37
+ private $options;
38
+ private $emailHelper;
39
+ private $wpdiscuzWalker;
40
+ private $optimizationHelper;
41
+ private $commentsArgs;
42
 
43
  public function __construct() {
44
  $this->dbManager = new WpdiscuzDBManager();
57
  add_action('wp_head', array(&$this->css, 'initCustomCss'));
58
 
59
  add_action('plugins_loaded', array(&$this, 'wpdiscuzTextDomain'));
 
60
  add_action('admin_init', array(&$this, 'pluginNewVersion'), 2);
61
  add_action('admin_enqueue_scripts', array(&$this, 'adminPageStylesScripts'), 2315);
62
  add_action('wp_enqueue_scripts', array(&$this, 'frontEndStylesScripts'));
88
  add_action('deleted_comment', array(&$this->optimizationHelper, 'deleteCommentFromTree'), 267);
89
  $plugin = plugin_basename(__FILE__);
90
  add_filter("plugin_action_links_$plugin", array(&$this, 'addPluginSettingsLink'));
91
+ add_filter('comments_clauses', array(&$this, 'getCommentsArgs'));
92
  if ($this->optionsSerialized->commentEditableTime) {
93
  add_action('wp_ajax_editComment', array(&$this, 'editComment'));
94
  add_action('wp_ajax_nopriv_editComment', array(&$this, 'editComment'));
128
  parse_str($commentData);
129
  $postId = intval(trim($postId));
130
  $loadLastCommentId = intval(trim($loadLastCommentId));
 
131
  $visibleCommentIds = trim($visibleCommentIds, ',');
132
+ $email = $current_user->ID ? $current_user->user_email : trim($email);
133
+ if ($visibleCommentIds && $postId && $loadLastCommentId) {
134
+ $lastCommentId = $this->dbManager->getLastCommentId($postId);
135
+ if ($lastCommentId > $loadLastCommentId) {
136
+ $messageArray['code'] = 1;
137
+ $messageArray['loadLastCommentId'] = $lastCommentId;
 
 
 
 
 
138
  $commentListArgs = $this->getCommentListArgs($postId);
139
  $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
140
  $commentListArgs['current_user'] = $current_user;
141
+ if ($this->optionsSerialized->commentListUpdateType == 1) {
142
+ $visibleCommentIds = explode(',', $visibleCommentIds);
143
+ $newCommentIds = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email);
144
+ $messageArray['message'] = array();
145
+ foreach ($newCommentIds as $newCommentId) {
146
+ $comment = get_comment($newCommentId);
147
+ if (($comment->comment_parent && (in_array($comment->comment_parent, $visibleCommentIds) || in_array($comment->comment_parent, $newCommentIds))) || !$comment->comment_parent) {
148
+ $commentHtml = wp_list_comments($commentListArgs, array($comment));
149
+ $commentObject = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
150
+ if ($comment->comment_parent) {
151
+ array_push($messageArray['message'], $commentObject);
152
+ } else {
153
+ array_unshift($messageArray['message'], $commentObject);
154
+ }
155
+ }
156
+ }
157
+ } else {
158
+ $authorComments = $this->dbManager->getAuthorVisibleComments($visibleCommentIds, $email);
159
+ $newCommentIds = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email);
160
+ $messageArray['message']['author_replies'] = array();
161
+ $messageArray['message']['comments'] = array();
162
+ foreach ($newCommentIds as $newCommentId) {
163
+ $comment = get_comment($newCommentId);
164
+ if ($this->optimizationHelper->isReplyInAuthorTree($comment->comment_ID, $authorComments)) { // if is in author tree add as reply
165
+ $messageArray['message']['author_replies'][] = $newCommentId;
166
+ } else { // add as new comment
167
+ if ($comment->comment_parent) {
168
+ array_push($messageArray['message']['comments'], $newCommentId);
169
+ } else {
170
+ array_unshift($messageArray['message']['comments'], $newCommentId);
171
+ }
172
+ }
173
  }
174
+ asort($messageArray['message']['author_replies']);
175
  }
176
+ $messageArray['wc_all_comments_count_new'] = $this->dbManager->getCommentsCount($postId);
177
  } else {
178
+ $messageArray['code'] = 0;
 
 
179
  }
180
+ wp_die(json_encode($messageArray));
 
 
181
  }
182
+ wp_die();
183
  }
184
 
185
  public function updateOnClick() {
188
  global $current_user;
189
  get_currentuserinfo();
190
  parse_str($commentData);
191
+ if ($postId && $newCommentIds) {
192
+ $messageArray['code'] = 1;
193
+ $newCommentIds = explode(',', trim($newCommentIds, ','));
194
+ $postId = trim(intval($postId));
195
+ $commentListArgs = $this->getCommentListArgs($postId);
196
+ $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
197
+ $commentListArgs['current_user'] = $current_user;
198
+ $messageArray['message'] = array();
199
+ foreach ($newCommentIds as $newCommentId) {
200
+ $comment = get_comment($newCommentId);
201
+ $commentHtml = wp_list_comments($commentListArgs, array($comment));
202
+ $commentObject = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
203
+ $messageArray['message'][] = $commentObject;
204
+ }
205
+ wp_die(json_encode($messageArray));
206
  }
 
207
  }
208
+ wp_die();
209
  }
210
 
211
  public function addComment() {
363
  $commentId = intval($commentId);
364
  if ($commentId) {
365
  $comment = get_comment($commentId);
366
+ if (current_user_can('edit_comment', $comment->comment_ID)) {
 
 
367
  $message_array['code'] = 1;
368
  $message_array['message'] = $comment->comment_content;
369
  } else {
370
+ $isInRange = $this->helper->isContentInRange($comment->comment_content);
371
+ $isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
372
+ if (isset($current_user) && $comment->user_id == $current_user->ID && $isEditable) {
373
+ $message_array['code'] = 1;
374
+ $message_array['message'] = $comment->comment_content;
375
+ } else {
376
+ $message_array['code'] = 'wc_comment_edit_not_possible';
377
+ }
378
  }
379
  } else {
380
  $message_array['code'] = 'wc_comment_edit_not_possible';
397
  $comment = get_comment($commentId);
398
  $current_user = wp_get_current_user();
399
  $trimmedCommentContent = trim($commentContent);
400
+ $isCurrentUserCanEdit = isset($current_user) && ($comment->user_id == $current_user->ID || current_user_can('edit_comment', $comment->comment_ID));
401
+ if ($trimmedCommentContent && $this->helper->isContentInRange($trimmedCommentContent) && $isCurrentUserCanEdit) {
402
  if ($trimmedCommentContent != $comment->comment_content) {
403
  $commentContent = wp_kses($commentContent, $this->helper->wc_allowed_tags);
404
  $author_ip = $this->helper->getRealIPAddr();
413
  if (wp_update_comment($commentarr)) {
414
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
415
  $message_array['code'] = 1;
416
+ if ($this->optionsSerialized->commentReadMoreLimit && count(explode(' ', strip_tags($commentContent))) > $this->optionsSerialized->commentReadMoreLimit) {
417
+ $commentContent = $this->helper->getCommentExcerpt($commentContent, $uniqueId);
418
+ }
419
+ $commentContent = apply_filters('comment_text', $commentContent);
420
+ $commentContent = $this->helper->makeClickable($commentContent);
421
+ $message_array['message'] = $commentContent;
422
  } else {
423
  $message_array['code'] = 'wc_comment_not_updated';
424
  }
447
  $parentComment = $this->optimizationHelper->getCommentRoot($commentId);
448
  $tree = array();
449
  $tree = $this->optimizationHelper->getTreeByParentId($parentComment->comment_ID, $tree);
450
+ $this->commentsArgs = $this->getDefaultCommentsArgs();
451
+ $this->commentsArgs['wc_comments'] = array_merge(array($parentComment->comment_ID), $tree);
452
+ $comments = get_comments($this->commentsArgs);
453
  $commentListArgs = $this->getCommentListArgs($postId);
454
  $commentListArgs['isSingle'] = true;
455
  $commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
456
  $commentListArgs['current_user'] = $current_user;
457
  $messageArray['message'] = wp_list_comments($commentListArgs, $comments);
458
  }
459
+ $this->commentsArgs['caller'] = '';
460
  wp_die(json_encode($messageArray));
461
  }
462
  }
480
  }
481
  }
482
  }
483
+ $this->commentsArgs['caller'] = '';
484
  wp_die(json_encode($messageArray));
485
  }
486
 
487
  public function loadMoreComments() {
488
  if (isset($_POST['wpdiscuzAjaxData'])) {
 
489
  parse_str($_POST['wpdiscuzAjaxData']);
490
  $postId = intval(trim($postId));
491
+ $limit = ($this->optionsSerialized->commentListLoadType == 1) ? 0 : $this->optionsSerialized->wordpressCommentPerPage;
492
  $args = array('limit' => $limit);
493
  $orderBy = trim($orderBy);
494
+ $args['offset'] = isset($offset) && $offset ? intval($offset) * $this->optionsSerialized->wordpressCommentPerPage : 0;
495
+ if ($orderBy == 'by_vote') {
496
+ $args['orderby'] = $orderBy;
 
 
 
 
497
  } else {
498
+ $order = trim($order);
499
+ $args['order'] = $order ? $order : $this->optionsSerialized->wordpressCommentOrder;
500
  $args['last_parent_id'] = intval($lastParentId);
501
+ }
502
  $args['post_id'] = $postId;
 
503
  $data = $this->getWPComments($args);
504
  wp_die(json_encode($data));
505
  }
567
  $order = trim($order);
568
  if ($postId && $orderBy && $order) {
569
  $args = array('order' => $order, 'post_id' => $postId);
570
+ if (in_array($orderBy, array('by_vote', 'comment_date_gmt'))) {
571
  $args['orderby'] = $orderBy;
572
  } else {
573
  $args['orderby'] = 'comment_date_gmt';
594
  $commentId = intval(trim($commentId));
595
  $comment = get_comment($commentId);
596
  if ($comment) {
597
+ $commentContent = wp_kses($comment->comment_content, $this->helper->wc_allowed_tags);
 
 
598
  $commentContent = apply_filters('comment_text', $commentContent);
599
  $commentContent = $this->helper->makeClickable($commentContent);
600
  $messageArray['code'] = 1;
611
  * get comments by comment type
612
  */
613
  public function getWPComments($args = array()) {
614
+ global $post, $current_user;
615
  get_currentuserinfo();
616
+ $postId = isset($post) ? $post->ID : '';
617
+ $defaults = $this->getDefaultCommentsArgs($postId);
618
+ $this->commentsArgs = wp_parse_args($args, $defaults);
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  $commentData = array();
620
+ $commentListArgs = $this->getCommentListArgs($this->commentsArgs['post_id']);
621
+ $commentList = $this->_getWPComments($commentListArgs, $commentData);
 
622
  $commentListArgs['current_user'] = $current_user;
623
  $wcWpComments = wp_list_comments($commentListArgs, $commentList);
624
  $commentData['comment_list'] = $wcWpComments;
625
  return $commentData;
626
  }
627
 
628
+ private function _getWPComments(&$commentListArgs, &$commentData) {
 
 
 
 
 
 
 
 
 
 
 
 
629
  if (!$this->optionsSerialized->wordpressIsPaginate) {
630
+ $this->commentsArgs['wc_comments'] = $this->dbManager->getCommentList($this->commentsArgs);
631
+ $commentData['last_parent_id'] = $this->commentsArgs['wc_comments'] ? $this->commentsArgs['wc_comments'][count($this->commentsArgs['wc_comments']) - 1] : 0;
632
+ if ($this->commentsArgs['is_threaded']) {
633
+ $commentmetaIds = $this->optimizationHelper->getCommentListByParentIds($this->commentsArgs['wc_comments'], $this->commentsArgs['post_id']);
634
+ $this->commentsArgs['wc_comments'] = array_merge($this->commentsArgs['wc_comments'], $commentmetaIds);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
  }
636
  $commentListArgs['page'] = 1;
 
 
637
  $commentListArgs['last_parent_id'] = $commentData['last_parent_id'];
638
+ $commentData['is_show_load_more'] = $this->helper->isShowLoadMore($commentData['last_parent_id'], $this->commentsArgs);
 
 
 
 
 
639
  }
640
+ $commentList = get_comments($this->commentsArgs);
641
+ $this->commentsArgs['caller'] = '';
642
  return $commentList;
643
  }
644
 
645
+ /**
646
+ * add comments clauses
647
+ * add new orderby clause when sort type is vote and wordpress commnts order is older (ASC)
648
+ */
649
+ public function getCommentsArgs($args) {
650
+ global $wpdb;
651
+ if ($this->commentsArgs['caller'] === 'wpdiscuz' && $this->commentsArgs['wc_comments']) {
652
+ $comments = implode(',', $this->commentsArgs['wc_comments']);
653
+ $commentIds = trim($comments, ',');
654
+ $args['join'] = "INNER JOIN " . $wpdb->commentmeta . " ON " . $wpdb->comments . ".comment_ID = " . $wpdb->commentmeta . ".comment_id";
655
+ $args['where'] .= " AND " . $wpdb->comments . ".comment_ID IN ($commentIds) AND ( " . $wpdb->commentmeta . ".meta_key = 'wpdiscuz_votes' ) ";
656
+ $orderby = '';
657
+ if ($this->commentsArgs['orderby'] == 'by_vote') {
658
+ $orderby = $wpdb->commentmeta . ".meta_value+0 DESC, ";
659
  }
660
+ $args['orderby'] = $orderby . $wpdb->comments . ".comment_date_gmt ";
661
+ $args['orderby'] .= isset($args['order']) ? '' : $this->commentsArgs['order'];
662
  }
663
+ return $args;
664
+ }
665
+
666
+ private function getDefaultCommentsArgs($postId = 0) {
667
+ $args = array(
668
+ 'caller' => 'wpdiscuz',
669
+ 'post_id' => $postId,
670
+ 'offset' => 0,
671
+ 'last_parent_id' => 0,
672
+ 'orderby' => 'comment_date_gmt',
673
+ 'order' => $this->optionsSerialized->wordpressCommentOrder,
674
+ 'date_order' => $this->optionsSerialized->wordpressCommentOrder,
675
+ 'limit' => $this->optionsSerialized->wordpressCommentPerPage,
676
+ 'is_threaded' => $this->optionsSerialized->wordpressThreadComments,
677
+ 'status' => 'approve',
678
+ 'wc_comments' => ''
679
+ );
680
+ return $args;
681
  }
682
 
683
  /**
694
  * Scripts and styles registration on administration pages
695
  */
696
  public function adminPageStylesScripts() {
697
+ wp_register_style('wpdiscuz-cp-index-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/colorpicker/css/index.css'));
698
  wp_enqueue_style('wpdiscuz-cp-index-css');
699
+ wp_register_style('wpdiscuz-cp-compatibility-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/colorpicker/css/compatibility.css'));
700
  wp_enqueue_style('wpdiscuz-cp-compatibility-css');
701
+ wp_register_script('wpdiscuz-cp-colors-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/colorpicker/js/colors.js'), array('jquery'), '1.0.0', false);
702
  wp_enqueue_script('wpdiscuz-cp-colors-js');
703
+ wp_register_script('wpdiscuz-cp-colorpicker-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/colorpicker/js/jqColorPicker.min.js'), array('jquery'), '1.0.0', false);
704
  wp_enqueue_script('wpdiscuz-cp-colorpicker-js');
705
+ wp_register_script('wpdiscuz-cp-index-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/colorpicker/js/index.js'), array('jquery'), '1.0.0', false);
706
  wp_enqueue_script('wpdiscuz-cp-index-js');
707
+ 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'), true);
708
  wp_enqueue_style('wpdiscuz-easy-responsive-tabs-css');
709
+ wp_register_script('wpdiscuz-easy-responsive-tabs-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js'), array('jquery'), '1.0.0', true);
710
  wp_enqueue_script('wpdiscuz-easy-responsive-tabs-js');
711
+ wp_register_style('wpdiscuz-options-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/options-css.min.css'));
712
  wp_enqueue_style('wpdiscuz-options-css');
713
  $realLastCommentId = $this->dbManager->getLastCommentId();
714
+ wp_register_script('wpdiscuz-options-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/wpdiscuz-options.min.js'), array('jquery'));
715
  wp_localize_script('wpdiscuz-options-js', 'admin_options_obj', array('lastCommentId' => $realLastCommentId));
716
  wp_enqueue_script('wpdiscuz-options-js');
717
  wp_enqueue_script('thickbox');
718
+ wp_register_script('wpdiscuz-jquery-cookie', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/jquery.cookie.min.js'), array('jquery'), '1.0.0', true);
719
  wp_enqueue_script('wpdiscuz-jquery-cookie');
720
  }
721
 
724
  */
725
  public function frontEndStylesScripts() {
726
  global $post;
727
+ if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && (is_singular() || is_front_page()) && post_type_supports($post->post_type, 'comments')) {
728
 
729
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
730
+ wp_register_style('wpdiscuz-frontend-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/wpdiscuz.min.css'), null, get_option(WpdiscuzCore::OPTION_SLUG_VERSION));
731
  wp_enqueue_style('wpdiscuz-frontend-css');
732
 
733
  if (is_rtl()) {
734
+ wp_register_style('wpdiscuz-frontend-rtl-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/wpdiscuz-rtl.min.css'), null, get_option(WpdiscuzCore::OPTION_SLUG_VERSION));
735
  wp_enqueue_style('wpdiscuz-frontend-rtl-css');
736
  }
737
 
738
+ wp_register_script('wpdiscuz-jquery-ui', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/jquery-ui/jquery-ui.min.js'), array('jquery'), '1.11.2', false);
739
  wp_enqueue_script('wpdiscuz-jquery-ui');
740
 
741
  if (preg_match('/MSIE/i', $u_agent)) {
742
+ wp_register_script('wpdiscuz-html5-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/tooltipster/js/html5.min.js'), array('jquery'), '1.2', false);
743
  wp_enqueue_script('wpdiscuz-html5-js');
744
  }
745
 
746
+ wp_register_script('wpdiscuz-validator-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/validator.min.js'), array('jquery'), '1.0.0', false);
747
  wp_enqueue_script('wpdiscuz-validator-js');
748
+ wp_register_style('wpdiscuz-validator-style', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/fv.min.css'));
749
  wp_enqueue_style('wpdiscuz-validator-style');
750
+ wp_register_script('wpdiscuz-cookie-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/jquery.cookie.min.js'), array('jquery'), '1.4.1', false);
751
  wp_enqueue_script('wpdiscuz-cookie-js');
752
+ wp_register_style('wpdiscuz-tooltipster-style', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/tooltipster/css/tooltipster.min.css'));
753
  wp_enqueue_style('wpdiscuz-tooltipster-style');
754
+ wp_register_script('wpdiscuz-tooltipster-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/tooltipster/js/jquery.tooltipster.min.js'), array('jquery'), '1.2', false);
755
  wp_enqueue_script('wpdiscuz-tooltipster-js');
756
+ wp_register_script('autogrowtextarea-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/jquery.autogrowtextarea.min.js'), array('jquery'), '3.0', false);
757
  wp_enqueue_script('autogrowtextarea-js');
758
  $wpdiscuz_js_options = $this->optionsSerialized->getOptionsForJs();
759
  $wpdiscuz_js_options['wc_post_id'] = $post->ID;
760
  $wpdiscuz_js_options['loadLastCommentId'] = $this->dbManager->getLastCommentId($post->ID);
761
+ wp_register_script('wpdiscuz-ajax-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/wpdiscuz.min.js'), array('jquery'), get_option(WpdiscuzCore::OPTION_SLUG_VERSION));
762
  wp_enqueue_script('wpdiscuz-ajax-js');
763
  wp_localize_script('wpdiscuz-ajax-js', 'wpdiscuz_ajax_obj', array('url' => admin_url('admin-ajax.php'), 'wpdiscuz_options' => $wpdiscuz_js_options));
764
  }
822
  }
823
  }
824
 
 
 
 
 
 
 
 
825
  // Add settings link on plugin page
826
  public function addPluginSettingsLink($links) {
827
  $settingsLink = '<a href="' . admin_url() . 'edit-comments.php?page=wpdiscuz_options_page">' . __('Settings', 'wpdiscuz') . '</a>';
834
 
835
  public function initCurrentPostType() {
836
  global $post;
837
+ if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && (is_singular() || is_front_page())&& post_type_supports($post->post_type, 'comments')) {
838
  add_filter('comments_template', array(&$this, 'addCommentForm'), 10);
839
  }
840
  }
848
  $postsAuthors = $this->dbManager->getPostsAuthors();
849
  $post = get_post($postId);
850
  return array(
 
851
  'style' => 'div',
852
  'echo' => false,
853
  'isSingle' => false,
854
+ 'reverse_top_level' => false,
855
  'post_author' => $post->post_author,
856
  'posts_authors' => $postsAuthors,
857
+ 'walker' => $this->wpdiscuzWalker,
858
  );
859
  }
860
 
877
  $this->optionsSerialized->blogRoles['post_author'] = isset($this->optionsSerialized->blogRoles['post_author']) ? $this->optionsSerialized->blogRoles['post_author'] : '#00B38F';
878
  $this->optionsSerialized->blogRoles['guest'] = isset($this->optionsSerialized->blogRoles['guest']) ? $this->optionsSerialized->blogRoles['guest'] : '#00B38F';
879
  $this->optionsSerialized->phrases['wc_blog_role_post_author'] = isset($this->optionsSerialized->phrases['wc_blog_role_post_author']) ? $this->optionsSerialized->phrases['wc_blog_role_post_author'] : __('Author', 'wpdiscuz');
880
+ $this->optionsSerialized->phrases['wc_blog_role_guest'] = isset($this->optionsSerialized->phrases['wc_blog_role_guest']) ? $this->optionsSerialized->phrases['wc_blog_role_guest'] : __('Guest', 'wpdiscuz');
881
  }
882
 
883
  }
includes/class.WpdiscuzCss.php CHANGED
@@ -17,7 +17,7 @@ class WpdiscuzCss {
17
  */
18
  public function initCustomCss() {
19
  global $post;
20
- if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && is_singular() && post_type_supports($post->post_type, 'comments')) {
21
  ?>
22
  <style type="text/css">#wpcomm .wc_new_comment{background:<?php echo $this->optionsSerialized->primaryColor; ?>;}#wpcomm .wc_new_reply{background:<?php echo $this->optionsSerialized->primaryColor; ?>;}#wpcomm .wc-form-wrapper{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor:'#f9f9f9'; ?>;}#wpcomm select,#wpcomm textarea,#wpcomm input[type="text"],#wpcomm input[type="email"],#wpcomm input[type="url"]{border:<?php echo $this->optionsSerialized->inputBorderColor; ?> 1px solid;}#wpcomm .wc-comment .wc-comment-right{background:<?php echo $this->optionsSerialized->commentBGColor; ?>;}#wpcomm .wc-reply .wc-comment-right{background:<?php echo $this->optionsSerialized->replyBGColor; ?>;}#wpcomm .wc-comment-text{font-size:<?php echo isset($this->optionsSerialized->commentTextSize)?$this->optionsSerialized->commentTextSize:'14px'; ?>;color:<?php echo $this->optionsSerialized->commentTextColor; ?>;}<?php $blogRoles=$this->optionsSerialized->blogRoles;if(!$blogRoles){echo '.wc-comment-author a{color:#00B38F;} .wc-comment-label{background:#00B38F;}';}foreach($blogRoles as $role=>$color){echo '#wpcomm .wc-blog-'.$role.' > .wc-comment-right .wc-comment-author,#wpcomm .wc-blog-'.$role.' > .wc-comment-right .wc-comment-author a{color:'.$color.';}';echo '#wpcomm .wc-blog-'.$role.' > .wc-comment-left .wc-comment-label{background:'.$color.';}';}?>#wpcomm .wc-comment-footer a,#wpcomm .wc-comment-footer span.wc_editable_comment,#wpcomm .wc-comment-footer span.wc_save_edited_comment,#wpcomm span.wc_cancel_edit{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}#wpcomm .wc-comment-footer .wc-vote-result{background:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}#wpcomm .wc-reply-link,#wpcomm .wc-vote-link,#wpcomm .wc-share-link{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}.wc-load-more-submit{border:1px solid <?php echo $this->optionsSerialized->inputBorderColor; ?>;}#wpcomm .wc-new-loaded-comment > .wc-comment-right{background:<?php echo $this->optionsSerialized->newLoadedCommentBGColor; ?>;}<?php echo stripslashes($this->optionsSerialized->customCss); ?>.wpdiscuz-front-actions{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor:'#f9f9f9'; ?>;}.wpdiscuz-subscribe-bar{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor : '#f9f9f9'; ?>;}.wpdiscuz-sort-buttons{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}.wpdiscuz-sort-button{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>; cursor:pointer;}.wpdiscuz-sort-button:hover{color:<?php echo $this->optionsSerialized->primaryColor; ?>;cursor:pointer;}.wpdiscuz-sort-button-active{color:<?php echo $this->optionsSerialized->primaryColor; ?>!important;cursor:default!important;}#wpcomm .page-numbers{color:<?php echo $this->optionsSerialized->commentTextColor; ?>;border:<?php echo $this->optionsSerialized->commentTextColor; ?> 1px solid;}#wpcomm span.current{background:<?php echo $this->optionsSerialized->commentTextColor; ?>;}#wpcomm .wpdiscuz-readmore{cursor:pointer;color:<?php echo $this->optionsSerialized->primaryColor; ?>;}</style>
23
  <?php
17
  */
18
  public function initCustomCss() {
19
  global $post;
20
+ if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && (is_singular() || is_front_page()) && post_type_supports($post->post_type, 'comments')) {
21
  ?>
22
  <style type="text/css">#wpcomm .wc_new_comment{background:<?php echo $this->optionsSerialized->primaryColor; ?>;}#wpcomm .wc_new_reply{background:<?php echo $this->optionsSerialized->primaryColor; ?>;}#wpcomm .wc-form-wrapper{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor:'#f9f9f9'; ?>;}#wpcomm select,#wpcomm textarea,#wpcomm input[type="text"],#wpcomm input[type="email"],#wpcomm input[type="url"]{border:<?php echo $this->optionsSerialized->inputBorderColor; ?> 1px solid;}#wpcomm .wc-comment .wc-comment-right{background:<?php echo $this->optionsSerialized->commentBGColor; ?>;}#wpcomm .wc-reply .wc-comment-right{background:<?php echo $this->optionsSerialized->replyBGColor; ?>;}#wpcomm .wc-comment-text{font-size:<?php echo isset($this->optionsSerialized->commentTextSize)?$this->optionsSerialized->commentTextSize:'14px'; ?>;color:<?php echo $this->optionsSerialized->commentTextColor; ?>;}<?php $blogRoles=$this->optionsSerialized->blogRoles;if(!$blogRoles){echo '.wc-comment-author a{color:#00B38F;} .wc-comment-label{background:#00B38F;}';}foreach($blogRoles as $role=>$color){echo '#wpcomm .wc-blog-'.$role.' > .wc-comment-right .wc-comment-author,#wpcomm .wc-blog-'.$role.' > .wc-comment-right .wc-comment-author a{color:'.$color.';}';echo '#wpcomm .wc-blog-'.$role.' > .wc-comment-left .wc-comment-label{background:'.$color.';}';}?>#wpcomm .wc-comment-footer a,#wpcomm .wc-comment-footer span.wc_editable_comment,#wpcomm .wc-comment-footer span.wc_save_edited_comment,#wpcomm span.wc_cancel_edit{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}#wpcomm .wc-comment-footer .wc-vote-result{background:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}#wpcomm .wc-reply-link,#wpcomm .wc-vote-link,#wpcomm .wc-share-link{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}.wc-load-more-submit{border:1px solid <?php echo $this->optionsSerialized->inputBorderColor; ?>;}#wpcomm .wc-new-loaded-comment > .wc-comment-right{background:<?php echo $this->optionsSerialized->newLoadedCommentBGColor; ?>;}<?php echo stripslashes($this->optionsSerialized->customCss); ?>.wpdiscuz-front-actions{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor:'#f9f9f9'; ?>;}.wpdiscuz-subscribe-bar{background:<?php echo isset($this->optionsSerialized->formBGColor)?$this->optionsSerialized->formBGColor : '#f9f9f9'; ?>;}.wpdiscuz-sort-buttons{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>;}.wpdiscuz-sort-button{color:<?php echo $this->optionsSerialized->voteReplyColor; ?>; cursor:pointer;}.wpdiscuz-sort-button:hover{color:<?php echo $this->optionsSerialized->primaryColor; ?>;cursor:pointer;}.wpdiscuz-sort-button-active{color:<?php echo $this->optionsSerialized->primaryColor; ?>!important;cursor:default!important;}#wpcomm .page-numbers{color:<?php echo $this->optionsSerialized->commentTextColor; ?>;border:<?php echo $this->optionsSerialized->commentTextColor; ?> 1px solid;}#wpcomm span.current{background:<?php echo $this->optionsSerialized->commentTextColor; ?>;}#wpcomm .wpdiscuz-readmore{cursor:pointer;color:<?php echo $this->optionsSerialized->primaryColor; ?>;}</style>
23
  <?php
manager/class.WpdiscuzDBManager.php CHANGED
@@ -178,24 +178,29 @@ class WpdiscuzDBManager {
178
  */
179
  public function getLastCommentId($postId = 0) {
180
  if ($postId) {
181
- return $this->db->get_var($this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = 1 ORDER BY `comment_ID` DESC LIMIT 1;", $postId));
182
  } else {
183
- return $this->db->get_var("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` ORDER BY `comment_ID` DESC LIMIT 1;");
184
  }
 
185
  }
186
 
187
  /**
188
- * retrives new comment ids from database for current post
189
  */
190
- public function getNewCommentIds($postId, $loadLastCommentId, $email, $ordering, $notIn = '') {
191
- $notInQuery = $notIn ? "AND `comment_ID` NOT IN($notIn)" : '';
192
- $sqlCommentIds = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_ID` > %d AND `comment_author_email` != %s AND `comment_approved` = 1 $notInQuery ORDER BY `comment_date_gmt` $ordering;", $postId, $loadLastCommentId, $email);
193
  return $this->matrixToArray($this->db->get_results($sqlCommentIds, ARRAY_N));
194
  }
195
 
196
- public function getAuthorNewReplies($visibleComments, $loadLastCommentId, $email) {
197
- $sqlCommentIds = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_parent` IN (SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_author_email` = %s AND `comment_ID` IN ($visibleComments)) AND `comment_approved` = 1 AND `comment_ID` > %d AND `comment_author_email` != %s ", $email, $loadLastCommentId, $email);
198
- return $this->matrixToArray($this->db->get_results($sqlCommentIds, ARRAY_N));
 
 
 
 
 
199
  }
200
 
201
  /**
@@ -214,14 +219,13 @@ class WpdiscuzDBManager {
214
  $commentParent = $args['is_threaded'] ? 'AND `comment_parent` = 0' : '';
215
  if ($args['limit'] == 0) {
216
  $allParentCounts = count($this->getAllParentCommentCount($args['post_id'], $args['is_threaded']));
217
- $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d OFFSET %d", $args['post_id'], $allParentCounts, $args['viewed_comment_count']);
218
  } else if ($args['last_parent_id']) {
219
  $operator = ($args['order'] == 'asc') ? '>' : '<';
220
  $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent AND `comment_ID` $operator %d ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d", $args['post_id'], $args['last_parent_id'], $args['limit']);
221
  } else {
222
  $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d", $args['post_id'], $args['limit']);
223
- }
224
-
225
  $commentIds = $this->db->get_results($sqlComments, ARRAY_N);
226
  return $this->matrixToArray($commentIds);
227
  }
@@ -229,13 +233,13 @@ class WpdiscuzDBManager {
229
  /**
230
  * get comment list ordered by date or comments votes
231
  */
232
- public function getCommentList(&$args) {
233
- if ($args['orderby'] == 'meta_value_num') {
234
  $parentIds = $this->getPostVotedCommentIds($args);
235
  } else {
236
  $parentIds = $this->getPostParentComments($args);
237
  }
238
- $args['comment__in'] = $parentIds;
239
  }
240
 
241
  /**
@@ -249,11 +253,11 @@ 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);
259
  }
@@ -262,7 +266,7 @@ class WpdiscuzDBManager {
262
  * @return type array of comment ids
263
  */
264
  public function getVotedCommentIds() {
265
- $sqlVotedCommentIds = "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_approved` = 1 AND `c`.`comment_parent` = 0;";
266
  $votedCommentIds = $this->db->get_results($sqlVotedCommentIds, ARRAY_N);
267
  return $this->matrixToArray($votedCommentIds);
268
  }
@@ -290,8 +294,8 @@ class WpdiscuzDBManager {
290
  /**
291
  * get first level comments by parent comment id
292
  */
293
- public function getCommentsByParentId($comment_id) {
294
- $sql_comments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_parent` = %d", $comment_id);
295
  $comments_id = $this->db->get_results($sql_comments, ARRAY_N);
296
  return $this->matrixToArray($comments_id);
297
  }
178
  */
179
  public function getLastCommentId($postId = 0) {
180
  if ($postId) {
181
+ $sql = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = 1 ORDER BY `comment_ID` DESC LIMIT 1;", $postId);
182
  } else {
183
+ $sql = "SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` ORDER BY `comment_ID` DESC LIMIT 1;";
184
  }
185
+ return $this->db->get_var($sql);
186
  }
187
 
188
  /**
189
+ * retrives new comment ids for live update (UA - Update Automatically)
190
  */
191
+ public function getNewCommentIds($postId, $loadLastCommentId, $email) {
192
+ $sqlCommentIds = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_ID` > %d AND `comment_author_email` != %s AND `comment_approved` = 1 ORDER BY `comment_date_gmt` ASC;", $postId, $loadLastCommentId, $email);
 
193
  return $this->matrixToArray($this->db->get_results($sqlCommentIds, ARRAY_N));
194
  }
195
 
196
+ /**
197
+ * @param type $visibleCommentIds comment ids which is visible at the moment on front end
198
+ * @param type $email the current user email
199
+ * @return type array of author comment ids
200
+ */
201
+ public function getAuthorVisibleComments($visibleCommentIds, $email) {
202
+ $sql = $this->db->prepare("SELECT `comment_ID` FROM `".$this->dbprefix."comments` WHERE `comment_approved` = 1 AND `comment_ID` IN($visibleCommentIds) AND `comment_author_email` = %s;", $email);
203
+ return $this->matrixToArray($this->db->get_results($sql, ARRAY_N));
204
  }
205
 
206
  /**
219
  $commentParent = $args['is_threaded'] ? 'AND `comment_parent` = 0' : '';
220
  if ($args['limit'] == 0) {
221
  $allParentCounts = count($this->getAllParentCommentCount($args['post_id'], $args['is_threaded']));
222
+ $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d OFFSET %d", $args['post_id'], $allParentCounts, $args['offset']);
223
  } else if ($args['last_parent_id']) {
224
  $operator = ($args['order'] == 'asc') ? '>' : '<';
225
  $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent AND `comment_ID` $operator %d ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d", $args['post_id'], $args['last_parent_id'], $args['limit']);
226
  } else {
227
  $sqlComments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_post_ID` = %d AND `comment_approved` = '1' $commentParent ORDER BY `comment_date_gmt` {$args['order']} LIMIT %d", $args['post_id'], $args['limit']);
228
+ }
 
229
  $commentIds = $this->db->get_results($sqlComments, ARRAY_N);
230
  return $this->matrixToArray($commentIds);
231
  }
233
  /**
234
  * get comment list ordered by date or comments votes
235
  */
236
+ public function getCommentList($args) {
237
+ if ($args['orderby'] == 'by_vote') {
238
  $parentIds = $this->getPostVotedCommentIds($args);
239
  } else {
240
  $parentIds = $this->getPostParentComments($args);
241
  }
242
+ return $parentIds;
243
  }
244
 
245
  /**
253
  public function getPostVotedCommentIds($args) {
254
  $commentParent = $args['is_threaded'] ? 'AND `c`.`comment_parent` = 0' : '';
255
  if ($args['limit']) {
256
+ $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` = '" . WpdiscuzCore::META_KEY_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']);
257
  } else {
258
  $allParentCounts = count($this->getAllParentCommentCount($args['post_id'], $args['is_threaded']));
259
+ $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` = '" . WpdiscuzCore::META_KEY_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['offset']);
260
+ }
261
  $postVotedCommentIds = $this->db->get_results($sqlPostVotedCommentIds, ARRAY_N);
262
  return $this->matrixToArray($postVotedCommentIds);
263
  }
266
  * @return type array of comment ids
267
  */
268
  public function getVotedCommentIds() {
269
+ $sqlVotedCommentIds = "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` = '" . WpdiscuzCore::META_KEY_VOTES . "' AND `c`.`comment_approved` = 1 AND `c`.`comment_parent` = 0;";
270
  $votedCommentIds = $this->db->get_results($sqlVotedCommentIds, ARRAY_N);
271
  return $this->matrixToArray($votedCommentIds);
272
  }
294
  /**
295
  * get first level comments by parent comment id
296
  */
297
+ public function getCommentsByParentId($commentId) {
298
+ $sql_comments = $this->db->prepare("SELECT `comment_ID` FROM `" . $this->dbprefix . "comments` WHERE `comment_parent` = %d AND `comment_approved` = 1;", $commentId);
299
  $comments_id = $this->db->get_results($sql_comments, ARRAY_N);
300
  return $this->matrixToArray($comments_id);
301
  }
options/class.WpdiscuzOptions.php CHANGED
@@ -85,23 +85,23 @@ class WpdiscuzOptions {
85
 
86
  <div class="wrap wpdiscuz_options_page">
87
  <div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
88
- <img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>"/>
89
  </div>
90
  <h2 style="padding-bottom:20px; padding-top:15px;"><?php _e('wpDiscuz General Settings', 'wpdiscuz'); ?></h2>
91
  <br style="clear:both" />
92
- <link rel="stylesheet" href="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>bxslider/jquery.bxslider.css" type="text/css" />
93
- <script src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>bxslider/jquery.min.js"></script>
94
- <script src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>bxslider/jquery.bxslider.js"></script>
95
  <table width="100%" border="0" cellspacing="1" class="widefat">
96
  <tr>
97
  <td style="padding:10px; padding-left:0px; vertical-align:top; width:500px;">
98
  <div class="slider">
99
  <ul class="bxslider">
100
- <li><a href="https://wordpress.org/plugins/woodiscuz-woocommerce-comments/screenshots/"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/3.png" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
101
- <li><a href="https://wordpress.org/plugins/woocommerce-category-slider/screenshots/"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/5.png" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
102
- <li><a href="https://wordpress.org/plugins/woocommerce-pdf-print/"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/4.png" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
103
- <li><a href="https://wordpress.org/plugins/advanced-content-pagination/screenshots/"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/1.png" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
104
- <li><a href="https://wordpress.org/plugins/author-and-post-statistic-widgets/"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/2.png" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
105
  </ul>
106
  </div>
107
  <div style="clear:both"></div>
@@ -129,7 +129,7 @@ class WpdiscuzOptions {
129
  <td style="background:#FFF; text-align:left; font-size:13px;">
130
  We do our best to make wpDiscuz the best self-hosted comment plugin for Wordpress. Thousands users are currently satisfied with wpDiscuz but only about 1% of them give us 5 start rating.
131
  However we have a very few users who for some very specific reasons are not satisfied and they are very active in decreasing wpDiscuz rating.
132
- Please help us keep plugin rating high, encouraging us to develop and maintain this plugin. Take a one minute to leave <a href="https://wordpress.org/support/view/plugin-reviews/wpdiscuz?filter=5" title="Go to wpDiscuz Reviews section on Wordpress.org"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/'); ?>assets/img/gc/5s.png" border="0" align="absmiddle" /></a> star review on <a href="https://wordpress.org/support/view/plugin-reviews/wpdiscuz?filter=5">Wordpress.org</a>. Thank You!
133
  <hr style="border-style:dotted;" />
134
  <div style="width:200px; float:right;">
135
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
@@ -210,7 +210,7 @@ class WpdiscuzOptions {
210
  optionsTabsType = 'vertical';
211
  }
212
 
213
- var url = '<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/'); ?>';
214
  $('.wpdiscuz-share-buttons').each(function () {
215
  setBG($(this));
216
  });
@@ -380,6 +380,9 @@ class WpdiscuzOptions {
380
  $this->optionsSerialized->phrases['wc_msg_required_fields'] = $_POST['wc_msg_required_fields'];
381
  $this->optionsSerialized->phrases['wc_connect_with'] = $_POST['wc_connect_with'];
382
  $this->optionsSerialized->phrases['wc_subscribed_to'] = $_POST['wc_subscribed_to'];
 
 
 
383
  foreach ($this->optionsSerialized->blogRoles as $roleName => $roleVal) {
384
  $this->optionsSerialized->phrases['wc_blog_role_' . $roleName] = $_POST['wc_blog_role_' . $roleName];
385
  }
@@ -389,7 +392,7 @@ class WpdiscuzOptions {
389
  ?>
390
  <div class="wrap wpdiscuz_options_page">
391
  <div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
392
- <img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>" style="height:43px;"/>
393
  </div>
394
  <h2 style="padding-bottom:20px; padding-top:15px;"><?php _e('WpDiscuz Front-end Phrases', 'wpdiscuz'); ?></h2>
395
  <br style="clear:both" />
85
 
86
  <div class="wrap wpdiscuz_options_page">
87
  <div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
88
+ <img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>"/>
89
  </div>
90
  <h2 style="padding-bottom:20px; padding-top:15px;"><?php _e('wpDiscuz General Settings', 'wpdiscuz'); ?></h2>
91
  <br style="clear:both" />
92
+ <link rel="stylesheet" href="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/bxslider/jquery.bxslider.css'); ?>" type="text/css" />
93
+ <script src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/bxslider/jquery.min.js'); ?>"></script>
94
+ <script src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/bxslider/jquery.bxslider.js'); ?>"></script>
95
  <table width="100%" border="0" cellspacing="1" class="widefat">
96
  <tr>
97
  <td style="padding:10px; padding-left:0px; vertical-align:top; width:500px;">
98
  <div class="slider">
99
  <ul class="bxslider">
100
+ <li><a href="https://wordpress.org/plugins/woodiscuz-woocommerce-comments/screenshots/"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/3.png'); ?>" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
101
+ <li><a href="https://wordpress.org/plugins/woocommerce-category-slider/screenshots/"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/5.png'); ?>" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
102
+ <li><a href="https://wordpress.org/plugins/woocommerce-pdf-print/"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/4.png'); ?>" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
103
+ <li><a href="https://wordpress.org/plugins/advanced-content-pagination/screenshots/"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/1.png'); ?>" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
104
+ <li><a href="https://wordpress.org/plugins/author-and-post-statistic-widgets/"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/2.png'); ?>" title="Free Download from Wordpress.org" style="padding:0px 0px 20px 20px;" /></a></li>
105
  </ul>
106
  </div>
107
  <div style="clear:both"></div>
129
  <td style="background:#FFF; text-align:left; font-size:13px;">
130
  We do our best to make wpDiscuz the best self-hosted comment plugin for Wordpress. Thousands users are currently satisfied with wpDiscuz but only about 1% of them give us 5 start rating.
131
  However we have a very few users who for some very specific reasons are not satisfied and they are very active in decreasing wpDiscuz rating.
132
+ Please help us keep plugin rating high, encouraging us to develop and maintain this plugin. Take a one minute to leave <a href="https://wordpress.org/support/view/plugin-reviews/wpdiscuz?filter=5" title="Go to wpDiscuz Reviews section on Wordpress.org"><img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/gc/5s.png'); ?>" border="0" align="absmiddle" /></a> star review on <a href="https://wordpress.org/support/view/plugin-reviews/wpdiscuz?filter=5">Wordpress.org</a>. Thank You!
133
  <hr style="border-style:dotted;" />
134
  <div style="width:200px; float:right;">
135
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
210
  optionsTabsType = 'vertical';
211
  }
212
 
213
+ var url = '<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/'); ?>';
214
  $('.wpdiscuz-share-buttons').each(function () {
215
  setBG($(this));
216
  });
380
  $this->optionsSerialized->phrases['wc_msg_required_fields'] = $_POST['wc_msg_required_fields'];
381
  $this->optionsSerialized->phrases['wc_connect_with'] = $_POST['wc_connect_with'];
382
  $this->optionsSerialized->phrases['wc_subscribed_to'] = $_POST['wc_subscribed_to'];
383
+ if (class_exists('Prompt_Comment_Form_Handling') && $this->optionsSerialized->usePostmaticForCommentNotification) {
384
+ $this->optionsSerialized->phrases['wc_postmatic_subscription_label'] = $_POST['wc_postmatic_subscription_label'];
385
+ }
386
  foreach ($this->optionsSerialized->blogRoles as $roleName => $roleVal) {
387
  $this->optionsSerialized->phrases['wc_blog_role_' . $roleName] = $_POST['wc_blog_role_' . $roleName];
388
  }
392
  ?>
393
  <div class="wrap wpdiscuz_options_page">
394
  <div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
395
+ <img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>" style="height:43px;"/>
396
  </div>
397
  <h2 style="padding-bottom:20px; padding-top:15px;"><?php _e('WpDiscuz Front-end Phrases', 'wpdiscuz'); ?></h2>
398
  <br style="clear:both" />
options/class.WpdiscuzOptionsSerialized.php CHANGED
@@ -545,6 +545,7 @@ class WpdiscuzOptionsSerialized {
545
  'wc_msg_required_fields' => __('Please fill out required fields', 'wpdiscuz'),
546
  'wc_connect_with' => __('Connect with', 'wpdiscuz'),
547
  'wc_subscribed_to' => __('You\'re subscribed to', 'wpdiscuz'),
 
548
  );
549
  }
550
 
545
  'wc_msg_required_fields' => __('Please fill out required fields', 'wpdiscuz'),
546
  'wc_connect_with' => __('Connect with', 'wpdiscuz'),
547
  'wc_subscribed_to' => __('You\'re subscribed to', 'wpdiscuz'),
548
+ 'wc_postmatic_subscription_label' => __('Participate in this discussion via email', 'wpdiscuz')
549
  );
550
  }
551
 
options/options-layouts/settings-integrations.php CHANGED
@@ -4,25 +4,25 @@ if (!defined('ABSPATH')) {
4
  }
5
  ?>
6
  <div>
7
- <h2 style="padding:5px 10px 10px 10px; margin:0px;"><?php _e('Integrations', 'wpdiscuz'); ?></h2>
8
- <table class="wp-list-table widefat plugins" style="margin-top:10px; border:none;" width="75">
9
  <tbody>
10
  <tr valign="top">
11
- <td>
12
- <div id="integrationsChild">
13
- <ul class="resp-tabs-list integrationsChild">
14
- <li><?php _e('BuddyPress', 'wpdiscuz'); ?></li>
15
- <li><?php _e('Users Ultra', 'wpdiscuz'); ?></li>
16
- <li><?php _e('User Pro', 'wpdiscuz'); ?></li>
17
- <li><?php _e('Ultimate Member', 'wpdiscuz'); ?></li>
18
- <li><?php _e('MyCred', 'wpdiscuz'); ?></li>
19
- </ul>
20
- <div class="resp-tabs-container integrationsChild">
21
- <div>
22
- <div style="width:100%; display:block;">
23
- <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
24
- <p>This code will integrate BuddyPress profile URL with wpDiscuz. BuddyPress Display Names and Avatars will be integrated automatically.</p>
25
- <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
26
  ////////////////////////////////////////////////////////////////////////
27
  // BuddyPress Profile URL Integration //////////////////////////////////
28
  ////////////////////////////////////////////////////////////////////////
@@ -35,14 +35,14 @@ function wpdiscuz_bp_profile_url($profile_url, $user) {
35
  }
36
  return $profile_url;
37
  }
38
- </pre>
39
- </div>
40
- </div>
41
- <div>
42
- <div style="width:100%; display:block;">
43
- <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
44
- <p>This code will integrate Users Ultra profile URL with wpDiscuz. Users Ultra Display Names and Avatars will be integrated automatically.</p>
45
- <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
46
  ////////////////////////////////////////////////////////////////////////
47
  // Users Ultra Profile URL Integration /////////////////////////////////
48
  ////////////////////////////////////////////////////////////////////////
@@ -55,14 +55,14 @@ function wpdiscuz_uu_profile_url($profile_url, $user) {
55
  }
56
  return $profile_url;
57
  }
58
- </pre>
59
- </div>
60
- </div>
61
- <div>
62
- <div style="width:100%; display:block;">
63
- <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
64
- <p>This code will integrate User Pro profile URL with wpDiscuz. User Pro Display Names and Avatars will be integrated automatically.</p>
65
- <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
66
  ////////////////////////////////////////////////////////////////////////
67
  // User Pro Profile URL Integration ////////////////////////////////////
68
  ////////////////////////////////////////////////////////////////////////
@@ -75,16 +75,16 @@ function wpdiscuz_up_profile_url($profile_url, $user) {
75
  }
76
  return $profile_url;
77
  }
78
- </pre>
79
- </div>
80
- </div>
81
-
82
- <div>
83
-
84
- <div style="width:100%; display:block;">
85
- <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
86
- <p>This code consists of two parts, which will integrate Ultimate Member profile Display Name and Profile URL with wpDiscuz. UM Avatars will be integrated automatically.</p>
87
- <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
88
  ////////////////////////////////////////////////////////////////////////
89
  // Ultimate Member Profile Display Name Integration ////////////////////
90
  ////////////////////////////////////////////////////////////////////////
@@ -113,14 +113,14 @@ function wpdiscuz_um_profile_url($profile_url, $user) {
113
  return $profile_url;
114
  }
115
 
116
- </pre>
117
- </div>
118
- </div>
119
- <div>
120
- <div style="width:100%; display:block;">
121
- <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
122
- <p>This code will integrate MyCred User Ranks and Badges under comment author avatar.</p>
123
- <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
124
  ////////////////////////////////////////////////////////////////////////
125
  // MyCred User Ranks and Badges Integration ////////////////////////////
126
  ////////////////////////////////////////////////////////////////////////
@@ -147,15 +147,13 @@ function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
147
  }
148
  return $afterLabelHtml;
149
  }
150
- </pre>
151
- </div>
152
- </div>
153
-
154
-
155
- </div>
156
- </div>
157
- </td>
158
- </tr>
159
- </tbody>
160
- </table>
161
  </div>
4
  }
5
  ?>
6
  <div>
7
+ <h2 style="padding:5px 10px 10px 10px; margin:0px;"><?php _e('Integrations', 'wpdiscuz'); ?></h2>
8
+ <!-- <table class="wp-list-table widefat plugins" style="margin-top:10px; border:none;" width="75">
9
  <tbody>
10
  <tr valign="top">
11
+ <td>-->
12
+ <div id="integrationsChild">
13
+ <ul class="resp-tabs-list integrationsChild">
14
+ <li><?php _e('BuddyPress', 'wpdiscuz'); ?></li>
15
+ <li><?php _e('Users Ultra', 'wpdiscuz'); ?></li>
16
+ <li><?php _e('User Pro', 'wpdiscuz'); ?></li>
17
+ <li><?php _e('Ultimate Member', 'wpdiscuz'); ?></li>
18
+ <li><?php _e('MyCred', 'wpdiscuz'); ?></li>
19
+ </ul>
20
+ <div class="resp-tabs-container integrationsChild">
21
+ <div>
22
+ <div style="width:100%; display:block;">
23
+ <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
24
+ <p>This code will integrate BuddyPress profile URL with wpDiscuz. BuddyPress Display Names and Avatars will be integrated automatically.</p>
25
+ <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
26
  ////////////////////////////////////////////////////////////////////////
27
  // BuddyPress Profile URL Integration //////////////////////////////////
28
  ////////////////////////////////////////////////////////////////////////
35
  }
36
  return $profile_url;
37
  }
38
+ </pre>
39
+ </div>
40
+ </div>
41
+ <div>
42
+ <div style="width:100%; display:block;">
43
+ <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
44
+ <p>This code will integrate Users Ultra profile URL with wpDiscuz. Users Ultra Display Names and Avatars will be integrated automatically.</p>
45
+ <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
46
  ////////////////////////////////////////////////////////////////////////
47
  // Users Ultra Profile URL Integration /////////////////////////////////
48
  ////////////////////////////////////////////////////////////////////////
55
  }
56
  return $profile_url;
57
  }
58
+ </pre>
59
+ </div>
60
+ </div>
61
+ <div>
62
+ <div style="width:100%; display:block;">
63
+ <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
64
+ <p>This code will integrate User Pro profile URL with wpDiscuz. User Pro Display Names and Avatars will be integrated automatically.</p>
65
+ <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
66
  ////////////////////////////////////////////////////////////////////////
67
  // User Pro Profile URL Integration ////////////////////////////////////
68
  ////////////////////////////////////////////////////////////////////////
75
  }
76
  return $profile_url;
77
  }
78
+ </pre>
79
+ </div>
80
+ </div>
81
+
82
+ <div>
83
+
84
+ <div style="width:100%; display:block;">
85
+ <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
86
+ <p>This code consists of two parts, which will integrate Ultimate Member profile Display Name and Profile URL with wpDiscuz. UM Avatars will be integrated automatically.</p>
87
+ <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
88
  ////////////////////////////////////////////////////////////////////////
89
  // Ultimate Member Profile Display Name Integration ////////////////////
90
  ////////////////////////////////////////////////////////////////////////
113
  return $profile_url;
114
  }
115
 
116
+ </pre>
117
+ </div>
118
+ </div>
119
+ <div>
120
+ <div style="width:100%; display:block;">
121
+ <h3 style="margin-bottom:5px;">Please add the code below in current active theme's functions.php file </h3>
122
+ <p>This code will integrate MyCred User Ranks and Badges under comment author avatar.</p>
123
+ <pre style="color:#006666; background-color:#FFF4EA; font-size:12px; padding:10px 20px 10px 20px; width:98%; overflow:auto;box-sizing:border-box;">
124
  ////////////////////////////////////////////////////////////////////////
125
  // MyCred User Ranks and Badges Integration ////////////////////////////
126
  ////////////////////////////////////////////////////////////////////////
147
  }
148
  return $afterLabelHtml;
149
  }
150
+ </pre>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ <!-- </td>
156
+ </tr>
157
+ </tbody>
158
+ </table>-->
 
 
159
  </div>
options/options-layouts/settings-show-hide.php CHANGED
@@ -76,19 +76,19 @@ if (!defined('ABSPATH')) {
76
  </td>
77
  </tr>
78
  <?php
79
- $pathToDir = DIR_PATH . WPD_DS . 'utils';
80
  $isWritable = is_writable($pathToDir);
81
  if ($isWritable) {
82
  $disableCaptcha = '';
83
  $msg = '';
84
  } else {
85
  $disableCaptcha = 'disabled="disabled"';
86
- $msg = '<p style="display: inline;">' . __('The plugin directory is not writable! Please set writable permissions to plugin directory in order to use the captcha feature', 'wpdiscuz') . '</p>';
87
  }
88
  ?>
89
  <tr valign="top">
90
  <th scope="row">
91
- <?php _e('Hide the CAPTCHA field for guests', 'wpdiscuz'); ?>
92
  </th>
93
  <td>
94
  <label for="wc_captcha_show_hide">
@@ -99,7 +99,7 @@ if (!defined('ABSPATH')) {
99
  </tr>
100
  <tr valign="top">
101
  <th scope="row">
102
- <?php _e('Show the CAPTCHA field for logged in users', 'wpdiscuz'); ?>
103
  </th>
104
  <td>
105
  <label for="wc_captcha_show_hide_for_members">
76
  </td>
77
  </tr>
78
  <?php
79
+ $pathToDir = WPDISCUZ_DIR_PATH . WPDISCUZ_DS . 'utils' . WPDISCUZ_DS . 'temp';
80
  $isWritable = is_writable($pathToDir);
81
  if ($isWritable) {
82
  $disableCaptcha = '';
83
  $msg = '';
84
  } else {
85
  $disableCaptcha = 'disabled="disabled"';
86
+ $msg = '<p style="display: inline;">' . __('The plugin captcha directory is not writable! Please set writable permissions on "wpdiscuz/utils/temp" directory in order to use the captcha feature', 'wpdiscuz') . '</p>';
87
  }
88
  ?>
89
  <tr valign="top">
90
  <th scope="row">
91
+ <?php _e('Hide the CAPTCHA field for guests', 'wpdiscuz'); ?>
92
  </th>
93
  <td>
94
  <label for="wc_captcha_show_hide">
99
  </tr>
100
  <tr valign="top">
101
  <th scope="row">
102
+ <?php _e('Show the CAPTCHA field for logged in users', 'wpdiscuz'); ?>
103
  </th>
104
  <td>
105
  <label for="wc_captcha_show_hide_for_members">
options/options-layouts/settings-style.php CHANGED
@@ -8,7 +8,7 @@ if (!defined('ABSPATH')) {
8
  <table class="wp-list-table widefat plugins" style="margin-top:10px; border:none;">
9
  <tbody>
10
  <tr valign="top">
11
- <th scope="row" style="width:55%;">
12
  <span class="wpdiscuz-option-title"><?php _e('Comment Form Background Color', 'wpdiscuz'); ?></span>
13
  </th>
14
  <td>
@@ -17,7 +17,7 @@ if (!defined('ABSPATH')) {
17
  </td>
18
  </tr>
19
  <tr valign="top">
20
- <th scope="row">
21
  <span class="wpdiscuz-option-title"><?php _e('Comment Background Color', 'wpdiscuz'); ?></span>
22
  </th>
23
  <td>
@@ -26,7 +26,7 @@ if (!defined('ABSPATH')) {
26
  </td>
27
  </tr>
28
  <tr valign="top">
29
- <th scope="row">
30
  <span class="wpdiscuz-option-title"><?php _e('Reply Background Color', 'wpdiscuz'); ?></span>
31
  </th>
32
  <td>
@@ -35,7 +35,7 @@ if (!defined('ABSPATH')) {
35
  </td>
36
  </tr>
37
  <tr valign="top">
38
- <th scope="row">
39
  <span class="wpdiscuz-option-title"><?php _e('Comment Text Color', 'wpdiscuz'); ?></span>
40
  </th>
41
  <td>
@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
44
  </td>
45
  </tr>
46
  <tr valign="top">
47
- <th scope="row">
48
  <span class="wpdiscuz-option-title"><?php _e('Vote, Reply, Share, Edit links text colors', 'wpdiscuz'); ?></span>
49
  </th>
50
  <td>
@@ -53,7 +53,7 @@ if (!defined('ABSPATH')) {
53
  </td>
54
  </tr>
55
  <tr valign="top">
56
- <th scope="row">
57
  <span class="wpdiscuz-option-title"><?php _e('Comment form fields border color', 'wpdiscuz'); ?></span>
58
  </th>
59
  <td>
@@ -62,7 +62,7 @@ if (!defined('ABSPATH')) {
62
  </td>
63
  </tr>
64
  <tr valign="top">
65
- <th scope="row">
66
  <span class="wpdiscuz-option-title"><?php _e('New loaded comments\' background color', 'wpdiscuz'); ?></span>
67
  </th>
68
  <td>
@@ -71,7 +71,7 @@ if (!defined('ABSPATH')) {
71
  </td>
72
  </tr>
73
  <tr valign="top">
74
- <th scope="row">
75
  <span class="wpdiscuz-option-title"><?php _e('Primary Color', 'wpdiscuz'); ?></span>
76
  </th>
77
  <td>
@@ -85,7 +85,7 @@ if (!defined('ABSPATH')) {
85
  $blogRoleColor = isset($this->optionsSerialized->blogRoles[$roleName]) ? $this->optionsSerialized->blogRoles[$roleName] : '#00B38F';
86
  ?>
87
  <tr valign="top">
88
- <th scope="row">
89
  <span class="wpdiscuz-option-title"><?php echo '<span style="font-weight:bold;color:' . $blogRoleColor . ';">' . ucfirst(str_replace('_', ' ', $roleName)) . '</span> ' . __('label color', 'wpdiscuz'); ?></span>
90
  </th>
91
  <td>
@@ -96,11 +96,11 @@ if (!defined('ABSPATH')) {
96
  }
97
  ?>
98
  <tr valign="top">
99
- <th scope="row">
100
  <span class="wpdiscuz-option-title"><?php _e('Custom CSS Code', 'wpdiscuz'); ?></span>
101
  </th>
102
  <td>
103
- <textarea cols="50" rows="10" class="regular-text" id="wc_custom_css" name="wc_custom_css" placeholder=""><?php echo stripslashes($this->optionsSerialized->customCss); ?></textarea>
104
  </td>
105
  </tr>
106
  </tbody>
8
  <table class="wp-list-table widefat plugins" style="margin-top:10px; border:none;">
9
  <tbody>
10
  <tr valign="top">
11
+ <th colspan="2">
12
  <span class="wpdiscuz-option-title"><?php _e('Comment Form Background Color', 'wpdiscuz'); ?></span>
13
  </th>
14
  <td>
17
  </td>
18
  </tr>
19
  <tr valign="top">
20
+ <th colspan="2">
21
  <span class="wpdiscuz-option-title"><?php _e('Comment Background Color', 'wpdiscuz'); ?></span>
22
  </th>
23
  <td>
26
  </td>
27
  </tr>
28
  <tr valign="top">
29
+ <th colspan="2">
30
  <span class="wpdiscuz-option-title"><?php _e('Reply Background Color', 'wpdiscuz'); ?></span>
31
  </th>
32
  <td>
35
  </td>
36
  </tr>
37
  <tr valign="top">
38
+ <th colspan="2">
39
  <span class="wpdiscuz-option-title"><?php _e('Comment Text Color', 'wpdiscuz'); ?></span>
40
  </th>
41
  <td>
44
  </td>
45
  </tr>
46
  <tr valign="top">
47
+ <th colspan="2">
48
  <span class="wpdiscuz-option-title"><?php _e('Vote, Reply, Share, Edit links text colors', 'wpdiscuz'); ?></span>
49
  </th>
50
  <td>
53
  </td>
54
  </tr>
55
  <tr valign="top">
56
+ <th colspan="2">
57
  <span class="wpdiscuz-option-title"><?php _e('Comment form fields border color', 'wpdiscuz'); ?></span>
58
  </th>
59
  <td>
62
  </td>
63
  </tr>
64
  <tr valign="top">
65
+ <th colspan="2">
66
  <span class="wpdiscuz-option-title"><?php _e('New loaded comments\' background color', 'wpdiscuz'); ?></span>
67
  </th>
68
  <td>
71
  </td>
72
  </tr>
73
  <tr valign="top">
74
+ <th colspan="2">
75
  <span class="wpdiscuz-option-title"><?php _e('Primary Color', 'wpdiscuz'); ?></span>
76
  </th>
77
  <td>
85
  $blogRoleColor = isset($this->optionsSerialized->blogRoles[$roleName]) ? $this->optionsSerialized->blogRoles[$roleName] : '#00B38F';
86
  ?>
87
  <tr valign="top">
88
+ <th colspan="2">
89
  <span class="wpdiscuz-option-title"><?php echo '<span style="font-weight:bold;color:' . $blogRoleColor . ';">' . ucfirst(str_replace('_', ' ', $roleName)) . '</span> ' . __('label color', 'wpdiscuz'); ?></span>
90
  </th>
91
  <td>
96
  }
97
  ?>
98
  <tr valign="top">
99
+ <th colspan="2">
100
  <span class="wpdiscuz-option-title"><?php _e('Custom CSS Code', 'wpdiscuz'); ?></span>
101
  </th>
102
  <td>
103
+ <textarea cols="40" rows="8" class="regular-text" id="wc_custom_css" name="wc_custom_css" placeholder=""><?php echo stripslashes($this->optionsSerialized->customCss); ?></textarea>
104
  </td>
105
  </tr>
106
  </tbody>
options/options-layouts/settings-subscription.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  if (!defined('ABSPATH')) {
3
  exit();
4
  }
@@ -11,35 +11,35 @@ if (!defined('ABSPATH')) {
11
  <th scope="row" style="width:55%;">
12
  <label for="wc_disable_member_confirm" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Disable subscription confirmation for registered users', 'wpdiscuz'); ?></span></label><br />
13
  <label for="show_subscription_bar" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Show comment subscription bar', 'wpdiscuz'); ?></span></label><br />
14
- <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;">
15
- <?php _e('This bar provides two subscription options: notify of "new follow-up comments" and "new replies to my comments"', 'wpdiscuz') ?>
16
- </p>
17
- <label for="wc_show_hide_reply_checkbox" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Show "Notify of new replies to this comment"', 'wpdiscuz'); ?></span></label><br />
18
- <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;">
19
- <?php _e('wpDiscuz is the only comment plugin which allows you to subscribe to certain comment replies. This option is located above [Post Comment] button in comment form. You can disable this subscription way by unchecking this option.', 'wpdiscuz') ?>
20
- </p>
21
- </th>
22
- <td>
23
- <input type="checkbox" <?php checked($this->optionsSerialized->disableMemberConfirm == 1) ?> value="1" name="wc_disable_member_confirm" id="wc_disable_member_confirm" />
24
- <br />
25
- <input type="checkbox" <?php checked($this->optionsSerialized->showSubscriptionBar == 1) ?> value="1" name="show_subscription_bar" id="show_subscription_bar" />
26
- <br /><br /><br />
27
- <input type="checkbox" <?php checked($this->optionsSerialized->showHideReplyCheckbox == 1) ?> value="1" name="wc_show_hide_reply_checkbox" id="wc_show_hide_reply_checkbox" />
28
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
29
  </tr>
30
- <?php if (class_exists('Prompt_Comment_Form_Handling')) { ?>
31
- <tr valign="top">
32
- <th scope="row">
33
- <?php _e('Use Postmatic for subscriptions and commenting by email', 'wpdiscuz'); ?>
34
- <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;"><?php _e('Postmatic allows your users subscribe to comments. Instead of just being notified, they add a reply right from their inbox.', 'wpdiscuz'); ?></p>
35
- </th>
36
- <td>
37
- <label for="wc_use_postmatic_for_comment_notification">
38
- <input type="checkbox" <?php checked($this->optionsSerialized->usePostmaticForCommentNotification == 1) ?> value="1" name="wc_use_postmatic_for_comment_notification" id="wc_use_postmatic_for_comment_notification" />
39
- </label>
40
- </td>
41
- </tr>
42
- <?php } ?>
43
  </tbody>
44
  </table>
45
  </div>
1
+ <?php
2
  if (!defined('ABSPATH')) {
3
  exit();
4
  }
11
  <th scope="row" style="width:55%;">
12
  <label for="wc_disable_member_confirm" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Disable subscription confirmation for registered users', 'wpdiscuz'); ?></span></label><br />
13
  <label for="show_subscription_bar" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Show comment subscription bar', 'wpdiscuz'); ?></span></label><br />
14
+ <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;">
15
+ <?php _e('This bar provides two subscription options: notify of "new follow-up comments" and "new replies to my comments"', 'wpdiscuz') ?>
16
+ </p>
17
+ <label for="wc_show_hide_reply_checkbox" style="line-height:22px;"><span style="line-height:22px;"><?php _e('Show "Notify of new replies to this comment"', 'wpdiscuz'); ?></span></label><br />
18
+ <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;">
19
+ <?php _e('wpDiscuz is the only comment plugin which allows you to subscribe to certain comment replies. This option is located above [Post Comment] button in comment form. You can disable this subscription way by unchecking this option.', 'wpdiscuz') ?>
20
+ </p>
21
+ </th>
22
+ <td>
23
+ <input type="checkbox" <?php checked($this->optionsSerialized->disableMemberConfirm == 1) ?> value="1" name="wc_disable_member_confirm" id="wc_disable_member_confirm" />
24
+ <br />
25
+ <input type="checkbox" <?php checked($this->optionsSerialized->showSubscriptionBar == 1) ?> value="1" name="show_subscription_bar" id="show_subscription_bar" />
26
+ <br /><br /><br />
27
+ <input type="checkbox" <?php checked($this->optionsSerialized->showHideReplyCheckbox == 1) ?> value="1" name="wc_show_hide_reply_checkbox" id="wc_show_hide_reply_checkbox" />
28
+ </td>
29
+ </tr>
30
+ <?php if (class_exists('Prompt_Comment_Form_Handling')) { ?>
31
+ <tr valign="top">
32
+ <th scope="row">
33
+ <?php _e('Use Postmatic for subscriptions and commenting by email', 'wpdiscuz'); ?>
34
+ <p style="font-size:13px; color:#999999; width:80%; padding-left:0px; margin-left:0px;"><?php _e('Postmatic allows your users subscribe to comments. Instead of just being notified, they add a reply right from their inbox.', 'wpdiscuz'); ?></p>
35
+ </th>
36
+ <td>
37
+ <label for="wc_use_postmatic_for_comment_notification">
38
+ <input type="checkbox" <?php checked($this->optionsSerialized->usePostmaticForCommentNotification == 1) ?> value="1" name="wc_use_postmatic_for_comment_notification" id="wc_use_postmatic_for_comment_notification" />
39
+ </label>
40
+ </td>
41
  </tr>
42
+ <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
43
  </tbody>
44
  </table>
45
  </div>
options/phrases-layouts/phrases-notification.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  if (!defined('ABSPATH')) {
3
  exit();
4
  }
@@ -37,6 +37,18 @@ if (!defined('ABSPATH')) {
37
  </label>
38
  </td>
39
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
40
  <tr valign="top">
41
  <th scope="row">
42
  <?php _e('Error message for empty field', 'wpdiscuz'); ?>
1
+ <?php
2
  if (!defined('ABSPATH')) {
3
  exit();
4
  }
37
  </label>
38
  </td>
39
  </tr>
40
+ <?php if (class_exists('Prompt_Comment_Form_Handling') && $this->optionsSerialized->usePostmaticForCommentNotification) { ?>
41
+ <tr valign="top">
42
+ <th scope="row">
43
+ <?php _e("Postmatic subscription label", 'wpdiscuz'); ?>
44
+ </th>
45
+ <td colspan="3">
46
+ <label for="wc_postmatic_subscription_label">
47
+ <input type="text" value="<?php echo $this->optionsSerialized->phrases['wc_postmatic_subscription_label']; ?>" name="wc_postmatic_subscription_label" id="wc_postmatic_subscription_label" />
48
+ </label>
49
+ </td>
50
+ </tr>
51
+ <?php } ?>
52
  <tr valign="top">
53
  <th scope="row">
54
  <?php _e('Error message for empty field', 'wpdiscuz'); ?>
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: gVectors Team
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UC44WQM5XJFPA
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
 
@@ -16,6 +16,10 @@ New interactive, AJAX realtime comment system. Designed to supercharge Wordpress
16
 
17
  wpDiscuz 3.0 and all future 3.x versions have been named as Supercharged. It's super fast and perfectly optimized. wpDiscuz 3 version is dozens of times faster than 1.x and 2.x versions. The Supercharged version supports millions of comments per post, so the number of comments doesn't matter anymore. You can use wpDiscuz for extremely large and active websites without any worry.
18
 
 
 
 
 
19
  **wpDiscuz Features:**
20
 
21
 
@@ -83,7 +87,10 @@ Please read the [Integrations] Tab in wpDiscuz Settings admin page
83
  * | Option to manage reply/share/vote link colors
84
  * | Front-end phrase managing options, you'll be able to translate or change all phrases
85
 
86
- wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
 
 
 
87
 
88
  This comment system is also available for WooCommerce, Plugin name is WooDiscuz:
89
  https://wordpress.org/plugins/woodiscuz-woocommerce-comments/
@@ -102,7 +109,7 @@ IMPORTANT: If you have a Cache Plugin, please delete all caches after wpDiscuz u
102
 
103
  * If you have a Cache Plugin, please delete all caches after wpDiscuz update.
104
  * If wpDiscuz comment form is missing please read this support topic:
105
- http://www.gvectors.com/questions/wpdiscuz-comment-form-is-missing/
106
 
107
 
108
  = Q&A =
@@ -124,7 +131,7 @@ wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
124
 
125
  = Please Check the Following wpDiscuz Resources =
126
 
127
- * Support Forum: <http://gvectors.com/questions/>
128
  * Plugin Page: <http://wpdiscuz.com/wpdiscuz-3-0-0/>
129
 
130
  == Screenshots ==
@@ -142,22 +149,34 @@ wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
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
 
@@ -386,7 +405,7 @@ Integrated with WordPress Social Login, Super Socializer and Social Connect plug
386
  = 2.0.8 =
387
  * Fixed Bug: Disabled comment issues (missing comment form)
388
  * If wpDiscuz comment form is missing please read this support topic:
389
- http://www.gvectors.com/questions/wpdiscuz-comment-form-is-missing/
390
 
391
  = 2.0.7 =
392
  * Fixed Bug: Comment system hiding problem on posts with disabled discussion option.
2
  Contributors: gVectors Team
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UC44WQM5XJFPA
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: 3.8.0
6
  Tested up to: 4.3.1
7
+ Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  wpDiscuz 3.0 and all future 3.x versions have been named as Supercharged. It's super fast and perfectly optimized. wpDiscuz 3 version is dozens of times faster than 1.x and 2.x versions. The Supercharged version supports millions of comments per post, so the number of comments doesn't matter anymore. You can use wpDiscuz for extremely large and active websites without any worry.
18
 
19
+ * Support Forum: http://gvectors.com/forum/
20
+ * wpDiscuz Demo: http://wpdiscuz.com/wpdiscuz-3-0-0/
21
+ * wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
22
+
23
  **wpDiscuz Features:**
24
 
25
 
87
  * | Option to manage reply/share/vote link colors
88
  * | Front-end phrase managing options, you'll be able to translate or change all phrases
89
 
90
+
91
+ * Support Forum: http://gvectors.com/forum/
92
+ * wpDiscuz Demo: http://wpdiscuz.com/wpdiscuz-3-0-0/
93
+ * wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
94
 
95
  This comment system is also available for WooCommerce, Plugin name is WooDiscuz:
96
  https://wordpress.org/plugins/woodiscuz-woocommerce-comments/
109
 
110
  * If you have a Cache Plugin, please delete all caches after wpDiscuz update.
111
  * If wpDiscuz comment form is missing please read this support topic:
112
+ http://gvectors.com/forum/how-to-and-troubleshooting/resolved-wpdiscuz-comment-form-is-missing/
113
 
114
 
115
  = Q&A =
131
 
132
  = Please Check the Following wpDiscuz Resources =
133
 
134
+ * Support Forum: <http://gvectors.com/forum/>
135
  * Plugin Page: <http://wpdiscuz.com/wpdiscuz-3-0-0/>
136
 
137
  == Screenshots ==
149
 
150
  == Changelog ==
151
 
152
+ = 3.1.0 =
153
 
154
+ * Аccelerated: Better WordPress comments cache compatibility
155
+ * Added: Finally we make wpDiscuz compatible from 3.8.0 Wordpress version
156
+ * Added: Comment front-end editing for all user roles (+ admin, editor, author)
157
+ * Fixed Bug: Show/Hide replies button disappearing when clicking on sorting buttons
158
+ * Fixed Bug: Problem with "Guest" phrase
159
+ * Fixed Bug: Comments HTML content conflict with Read more function
160
+ * Fixed Bug: Small bugs with live update
161
+ * Fixed Bug: Load rest of comments issue
162
+ * Fixed Bug: Editable subscription phrase for Postmatic
163
+ * Fixed Bug: Sorting issue by most voted comments when nested comments are disabled
164
 
165
+ If you have installed these plugins, please go to wpDiscuz Settings > Integrations tab and read the instruction:
166
+
167
+ * BuddyPress,
168
+ * Users Ultra,
169
+ * Ultimate Member,
170
+ * UserPro plugins,
171
+ * MyCRED
172
 
173
+ - If you have JatPack installed please deactivate JatPack comments, it affects wpDiscuz
174
+ - If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
175
 
176
+ = 3.0.9 =
177
 
178
+ * Fixed Bug: Warning: Could not find/open font in class.WpdiscuzHelper.php on line 524
179
+ * Fixed Bug: MySQL error - You have an error in your SQL syntax...
 
 
 
180
 
181
  = 3.0.8 =
182
 
405
  = 2.0.8 =
406
  * Fixed Bug: Disabled comment issues (missing comment form)
407
  * If wpDiscuz comment form is missing please read this support topic:
408
+ http://gvectors.com/questions/wpdiscuz-comment-form-is-missing/
409
 
410
  = 2.0.7 =
411
  * Fixed Bug: Comment system hiding problem on posts with disabled discussion option.
templates/comment/class.WpdiscuzWalker.php CHANGED
@@ -15,7 +15,6 @@ class WpdiscuzWalker extends Walker_Comment {
15
  $this->optimizationHelper = $optimizationHelper;
16
  $this->dbManager = $dbManager;
17
  $this->optionsSerialized = $optionsSerialized;
18
- add_action('plugins_loaded', array(&$this->optionsSerialized, 'initPhrasesOnLoad'), 2129);
19
  }
20
 
21
  /** START_EL */
@@ -29,9 +28,8 @@ class WpdiscuzWalker extends Walker_Comment {
29
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
30
  $commentContent = $comment->comment_content;
31
  $commentWrapperClass = '';
32
- if ($this->optionsSerialized->commentReadMoreLimit && count($commentWordsLimit = explode(' ', $commentContent)) > $this->optionsSerialized->commentReadMoreLimit) {
33
- $commentContent = $this->helper->getCommentExcerpt($commentWordsLimit, $commentContent, $uniqueId);
34
- $commentWrapperClass .= 'wpdiscuz-comment-readmore ';
35
  }
36
  $commentContent = wp_kses($commentContent, $this->helper->wc_allowed_tags);
37
  $commentContent = $this->helper->makeClickable($commentContent);
@@ -49,7 +47,17 @@ class WpdiscuzWalker extends Walker_Comment {
49
  $depth = $this->optimizationHelper->getCommentDepth($comment->comment_ID);
50
  }
51
  }
52
- $user = get_user_by('id', $comment->user_id);
 
 
 
 
 
 
 
 
 
 
53
  $commentAuthorUrl = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
54
  $commentAuthorUrl = esc_url($commentAuthorUrl, array('http', 'https'));
55
  $commentAuthorUrl = apply_filters('get_comment_author_url', $commentAuthorUrl, $comment->comment_ID, $comment);
@@ -91,10 +99,8 @@ class WpdiscuzWalker extends Walker_Comment {
91
  $authorName = $comment->comment_author ? $comment->comment_author : __('Anonymous', 'wpdiscuz');
92
  $authorName = apply_filters('wpdiscuz_comment_author', $authorName, $comment);
93
 
94
- $profileUrl = $comment->user_id && in_array($comment->user_id, $args['posts_authors']) ? get_author_posts_url($comment->user_id) : '';
95
  $profileUrl = apply_filters('wpdiscuz_profile_url', $profileUrl, $user);
96
 
97
- $authorAvatarField = $comment->user_id ? $comment->user_id : $comment->comment_author_email;
98
  $authorAvatar = $this->optionsSerialized->wordpressShowAvatars ? get_avatar($authorAvatarField) : '';
99
 
100
  if ($profileUrl) {
@@ -138,7 +144,7 @@ class WpdiscuzWalker extends Walker_Comment {
138
  $output .= '<div class="wc-comment-header">';
139
  $output .= '<div class="wc-comment-author">' . $authorName . '</div>';
140
  if (!$this->optionsSerialized->showHideCommentLink) {
141
- $output .= '<div class="wc-comment-link"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/icon-link.gif') . '" class="wc-comment-img-link" title="&lt;input type=&quot;text&quot; class=&quot;wc-comment-link-input&quot; value=&quot;' . $commentLink . '&quot; /&gt;" /></div>';
142
  }
143
  $output .= '<div class="wc-comment-date">' . $posted_date . '</div><div style="clear:right"></div>';
144
  $output .= '</div>';
@@ -147,7 +153,7 @@ class WpdiscuzWalker extends Walker_Comment {
147
  $output .= '<div class="wc-comment-footer">';
148
  if (!$this->optionsSerialized->votingButtonsShowHide) {
149
  $output .= '<div class="wc-vote-result">' . $voteCount . '</div>';
150
- $output .= ' <span class="wc-vote-link wc-up ' . $voteClass . '" title="' . $voteUp . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/thumbs-up.png') . '" align="absmiddle" class="wc-vote-img-up" /></span> &nbsp;|&nbsp; <span class="wc-vote-link wc-down ' . $voteClass . '" title="' . $voteDown . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/thumbs-down.png') . '" align="absmiddle" class="wc-vote-img-down" /></span>&nbsp;';
151
  }
152
 
153
  if (comments_open($comment->comment_post_ID) && $this->optionsSerialized->wordpressThreadComments) {
@@ -174,16 +180,18 @@ class WpdiscuzWalker extends Walker_Comment {
174
  $output .= '-&nbsp;&nbsp; <span class="wc-share-link" title="' . $shareText . '">' . $shareText . '</span> &nbsp;&nbsp;';
175
  $twitt_content = strip_tags($commentContent) . ' ' . $commentLink;
176
  $output .= '<span class="share_buttons_box">';
177
- $output .= in_array('fb', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://www.facebook.com/sharer.php" title="' . $this->optionsSerialized->phrases['wc_share_facebook'] . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/fb-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/fb-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/fb-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
178
- $output .= in_array('twitter', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="https://twitter.com/home?status=' . $twitt_content . '" title="' . $this->optionsSerialized->phrases['wc_share_twitter'] . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/twitter-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/twitter-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/twitter-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
179
- $output .= in_array('google', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="https://plus.google.com/share?url=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_google'] . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/google-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/google-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/google-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
180
- $output .= in_array('vk', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://vk.com/share.php?url=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_vk'] . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/vk-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/vk-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/vk-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
181
- $output .= in_array('ok', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_ok'] . '"><img src="' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/ok-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/ok-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/social-icons/ok-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
182
  $output .= '</span>';
183
  }
184
 
185
  if (current_user_can('edit_comment', $comment->comment_ID)) {
186
- $output .= '-&nbsp;&nbsp; <a href="' . get_edit_comment_link($comment->comment_ID) . '">' . __('Edit', 'default') . '</a>';
 
 
187
  } else {
188
  $isInRange = $this->helper->isContentInRange($commentContent);
189
  $isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
15
  $this->optimizationHelper = $optimizationHelper;
16
  $this->dbManager = $dbManager;
17
  $this->optionsSerialized = $optionsSerialized;
 
18
  }
19
 
20
  /** START_EL */
28
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
29
  $commentContent = $comment->comment_content;
30
  $commentWrapperClass = '';
31
+ if ($this->optionsSerialized->commentReadMoreLimit && count(explode(' ', strip_tags($commentContent))) > $this->optionsSerialized->commentReadMoreLimit) {
32
+ $commentContent = $this->helper->getCommentExcerpt($commentContent, $uniqueId);
 
33
  }
34
  $commentContent = wp_kses($commentContent, $this->helper->wc_allowed_tags);
35
  $commentContent = $this->helper->makeClickable($commentContent);
47
  $depth = $this->optimizationHelper->getCommentDepth($comment->comment_ID);
48
  }
49
  }
50
+
51
+ if ($comment->user_id) {
52
+ $user = get_user_by('id', $comment->user_id);
53
+ $authorAvatarField = $comment->user_id;
54
+ $profileUrl = in_array($comment->user_id, $args['posts_authors']) ? get_author_posts_url($comment->user_id) : '';
55
+ } else {
56
+ $user = null;
57
+ $authorAvatarField = $comment->comment_author_email;
58
+ $profileUrl = '';
59
+ }
60
+
61
  $commentAuthorUrl = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
62
  $commentAuthorUrl = esc_url($commentAuthorUrl, array('http', 'https'));
63
  $commentAuthorUrl = apply_filters('get_comment_author_url', $commentAuthorUrl, $comment->comment_ID, $comment);
99
  $authorName = $comment->comment_author ? $comment->comment_author : __('Anonymous', 'wpdiscuz');
100
  $authorName = apply_filters('wpdiscuz_comment_author', $authorName, $comment);
101
 
 
102
  $profileUrl = apply_filters('wpdiscuz_profile_url', $profileUrl, $user);
103
 
 
104
  $authorAvatar = $this->optionsSerialized->wordpressShowAvatars ? get_avatar($authorAvatarField) : '';
105
 
106
  if ($profileUrl) {
144
  $output .= '<div class="wc-comment-header">';
145
  $output .= '<div class="wc-comment-author">' . $authorName . '</div>';
146
  if (!$this->optionsSerialized->showHideCommentLink) {
147
+ $output .= '<div class="wc-comment-link"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/icon-link.gif') . '" class="wc-comment-img-link" title="&lt;input type=&quot;text&quot; class=&quot;wc-comment-link-input&quot; value=&quot;' . $commentLink . '&quot; /&gt;" /></div>';
148
  }
149
  $output .= '<div class="wc-comment-date">' . $posted_date . '</div><div style="clear:right"></div>';
150
  $output .= '</div>';
153
  $output .= '<div class="wc-comment-footer">';
154
  if (!$this->optionsSerialized->votingButtonsShowHide) {
155
  $output .= '<div class="wc-vote-result">' . $voteCount . '</div>';
156
+ $output .= ' <span class="wc-vote-link wc-up ' . $voteClass . '" title="' . $voteUp . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/thumbs-up.png') . '" align="absmiddle" class="wc-vote-img-up" /></span> &nbsp;|&nbsp; <span class="wc-vote-link wc-down ' . $voteClass . '" title="' . $voteDown . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/thumbs-down.png') . '" align="absmiddle" class="wc-vote-img-down" /></span>&nbsp;';
157
  }
158
 
159
  if (comments_open($comment->comment_post_ID) && $this->optionsSerialized->wordpressThreadComments) {
180
  $output .= '-&nbsp;&nbsp; <span class="wc-share-link" title="' . $shareText . '">' . $shareText . '</span> &nbsp;&nbsp;';
181
  $twitt_content = strip_tags($commentContent) . ' ' . $commentLink;
182
  $output .= '<span class="share_buttons_box">';
183
+ $output .= in_array('fb', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://www.facebook.com/sharer.php" title="' . $this->optionsSerialized->phrases['wc_share_facebook'] . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/fb-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/fb-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/fb-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
184
+ $output .= in_array('twitter', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="https://twitter.com/home?status=' . $twitt_content . '" title="' . $this->optionsSerialized->phrases['wc_share_twitter'] . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/twitter-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/twitter-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/twitter-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
185
+ $output .= in_array('google', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="https://plus.google.com/share?url=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_google'] . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/google-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/google-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/google-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
186
+ $output .= in_array('vk', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://vk.com/share.php?url=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_vk'] . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/vk-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/vk-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/vk-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
187
+ $output .= in_array('ok', $this->optionsSerialized->shareButtons) ? '<a class="wc_tooltipster" target="_blank" href="http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' . get_permalink($comment->comment_post_ID) . '" title="' . $this->optionsSerialized->phrases['wc_share_ok'] . '"><img src="' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/ok-18x18.png') . '" onmouseover="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/ok-18x18-orig.png') . '\'" onmouseout="this.src=\'' . plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/social-icons/ok-18x18.png') . '\'"/></a>&nbsp;&nbsp;' : '';
188
  $output .= '</span>';
189
  }
190
 
191
  if (current_user_can('edit_comment', $comment->comment_ID)) {
192
+ $output .= '<span class="wc_editable_comment">-&nbsp;&nbsp;' . $this->optionsSerialized->phrases['wc_edit_text'] . '</span>';
193
+ $output .= '<span class="wc_cancel_edit">-&nbsp;&nbsp;' . $this->optionsSerialized->phrases['wc_comment_edit_cancel_button'] . '</span>';
194
+ $output .= '<span class="wc_save_edited_comment" style="display:none;">&nbsp;&nbsp;-&nbsp;&nbsp;' . $this->optionsSerialized->phrases['wc_comment_edit_save_button'] . '</span>';
195
  } else {
196
  $isInRange = $this->helper->isContentInRange($commentContent);
197
  $isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
templates/comment/comment-form.php CHANGED
@@ -39,8 +39,7 @@ if (isset($_GET['wpdiscuzConfirmID']) && isset($_GET['wpdiscuzConfirmKey']) && i
39
  $wpdiscuz->dbManager->notificationConfirm($_GET['wpdiscuzConfirmID'], $_GET['wpdiscuzConfirmKey']);
40
  ?>
41
  <div id="wc_unsubscribe_message">
42
- <span
43
- class="wc_unsubscribe_message"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_comfirm_success_message']; ?></span>
44
  </div>
45
  <?php
46
  }
@@ -71,10 +70,8 @@ if (isset($_GET['subscriptionSuccess'])) {
71
  <?php
72
  if (comments_open($post->ID)) {
73
  $wpdiscuz->helper->superSocializerFix();
74
- if (comments_open($post->ID)) {
75
- ?>
76
- <h3 id="wc-comment-header"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_leave_a_reply_text']; ?></h3>
77
- <?php } ?>
78
  <?php
79
  if ($wpdiscuz->optionsSerialized->showHideLoggedInUsername) {
80
  if ($current_user->ID) {
@@ -113,7 +110,8 @@ if (comments_open($post->ID)) {
113
  ?>
114
  </div>
115
  <?php
116
- if ($wpdiscuz->optionsSerialized->showSubscriptionBar) {
 
117
  $subscriptionData = $wpdiscuz->dbManager->hasSubscription($post->ID, $current_user->user_email);
118
  $isConfirmed = $subscriptionData['confirm'];
119
  $subscriptionType = $subscriptionData['type'];
@@ -178,7 +176,7 @@ if (comments_open($post->ID)) {
178
  <div id="wpcomm" class="<?php echo ($current_user->ID) ? 'wpdiscuz_auth' : 'wpdiscuz_unauth'; ?>" style="border:none;">
179
  <?php } ?>
180
 
181
- <?php if ($commentsCount > 0 && $wpdiscuz->optionsSerialized->showSortingButtons && !$wpdiscuz->optionsSerialized->wordpressIsPaginate) { ?>
182
  <div class="wpdiscuz-front-actions">
183
  <div class="wpdiscuz-sort-buttons" style="font-size:14px;"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_sort_by']; ?>: &nbsp;
184
  <span class="wpdiscuz-sort-button wpdiscuz-date-sort-desc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_newest']; ?></span> |
@@ -209,8 +207,7 @@ if (comments_open($post->ID)) {
209
  }
210
 
211
  if ($wpdiscuz->optionsSerialized->showSortingButtons && $wpdiscuz->optionsSerialized->mostVotedByDefault) {
212
- $args['orderby'] = 'meta_value_num';
213
- $args['order'] = 'desc';
214
  }
215
  $commentData = $wpdiscuz->getWPComments($args);
216
  echo $commentData['comment_list'];
@@ -236,12 +233,12 @@ if (comments_open($post->ID)) {
236
  </div>
237
  </div>
238
  <div style="clear:both"></div>
239
- <?php if (comments_open($post->ID) && $commentsCount > 0) { ?>
240
  <?php if ($wpdiscuz->optionsSerialized->showPluginPoweredByLink) { ?>
241
  <div class="by-wpdiscuz">
242
  <span id="awpdiscuz" onclick='javascript:document.getElementById("bywpdiscuz").style.display = "inline";
243
  document.getElementById("awpdiscuz").style.display = "none";'>
244
- <img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/plugin-icon/icon_info.png'); ?>" align="absmiddle" class="wpdimg"/>
245
  </span>&nbsp;
246
  <a href="http://wpdiscuz.com/" id="bywpdiscuz" title="wpDiscuz v<?php echo get_option(WpdiscuzCore::OPTION_SLUG_VERSION); ?> - Supercharged native comments">wpDiscuz</a>
247
  </div>
@@ -249,7 +246,7 @@ if (comments_open($post->ID)) {
249
  <?php } ?>
250
  </div>
251
  </div>
252
- <div class="wpdiscuz-loading-bar <?php echo ($current_user->ID) ? 'wpdiscuz-loading-bar-auth' : 'wpdiscuz-loading-bar-unauth'; ?>"><img src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . '/assets/img/loading.gif'); ?>" /></div>
253
  <?php
254
 
255
  function wpdiscuz_close_divs($html) {
39
  $wpdiscuz->dbManager->notificationConfirm($_GET['wpdiscuzConfirmID'], $_GET['wpdiscuzConfirmKey']);
40
  ?>
41
  <div id="wc_unsubscribe_message">
42
+ <span class="wc_unsubscribe_message"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_comfirm_success_message']; ?></span>
 
43
  </div>
44
  <?php
45
  }
70
  <?php
71
  if (comments_open($post->ID)) {
72
  $wpdiscuz->helper->superSocializerFix();
73
+ ?>
74
+ <h3 id="wc-comment-header"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_leave_a_reply_text']; ?></h3>
 
 
75
  <?php
76
  if ($wpdiscuz->optionsSerialized->showHideLoggedInUsername) {
77
  if ($current_user->ID) {
110
  ?>
111
  </div>
112
  <?php
113
+ $isPostmaticActive = !class_exists('Prompt_Comment_Form_Handling') || (class_exists('Prompt_Comment_Form_Handling') && !$wpdiscuz->optionsSerialized->usePostmaticForCommentNotification);
114
+ if ($wpdiscuz->optionsSerialized->showSubscriptionBar && $isPostmaticActive) {
115
  $subscriptionData = $wpdiscuz->dbManager->hasSubscription($post->ID, $current_user->user_email);
116
  $isConfirmed = $subscriptionData['confirm'];
117
  $subscriptionType = $subscriptionData['type'];
176
  <div id="wpcomm" class="<?php echo ($current_user->ID) ? 'wpdiscuz_auth' : 'wpdiscuz_unauth'; ?>" style="border:none;">
177
  <?php } ?>
178
 
179
+ <?php if ($commentsCount && $wpdiscuz->optionsSerialized->showSortingButtons && !$wpdiscuz->optionsSerialized->wordpressIsPaginate) { ?>
180
  <div class="wpdiscuz-front-actions">
181
  <div class="wpdiscuz-sort-buttons" style="font-size:14px;"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_sort_by']; ?>: &nbsp;
182
  <span class="wpdiscuz-sort-button wpdiscuz-date-sort-desc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_newest']; ?></span> |
207
  }
208
 
209
  if ($wpdiscuz->optionsSerialized->showSortingButtons && $wpdiscuz->optionsSerialized->mostVotedByDefault) {
210
+ $args['orderby'] = 'by_vote';
 
211
  }
212
  $commentData = $wpdiscuz->getWPComments($args);
213
  echo $commentData['comment_list'];
233
  </div>
234
  </div>
235
  <div style="clear:both"></div>
236
+ <?php if (comments_open($post->ID) && $commentsCount) { ?>
237
  <?php if ($wpdiscuz->optionsSerialized->showPluginPoweredByLink) { ?>
238
  <div class="by-wpdiscuz">
239
  <span id="awpdiscuz" onclick='javascript:document.getElementById("bywpdiscuz").style.display = "inline";
240
  document.getElementById("awpdiscuz").style.display = "none";'>
241
+ <img alt="<?php _e('wpDiscuz', 'wpdiscuz'); ?>" src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/plugin-icon/icon_info.png'); ?>" align="absmiddle" class="wpdimg"/>
242
  </span>&nbsp;
243
  <a href="http://wpdiscuz.com/" id="bywpdiscuz" title="wpDiscuz v<?php echo get_option(WpdiscuzCore::OPTION_SLUG_VERSION); ?> - Supercharged native comments">wpDiscuz</a>
244
  </div>
246
  <?php } ?>
247
  </div>
248
  </div>
249
+ <div class="wpdiscuz-loading-bar <?php echo ($current_user->ID) ? 'wpdiscuz-loading-bar-auth' : 'wpdiscuz-loading-bar-unauth'; ?>"><img alt="<?php _e('wpDiscuz', 'wpdiscuz'); ?>" src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/loading.gif'); ?>" /></div>
250
  <?php
251
 
252
  function wpdiscuz_close_divs($html) {
utils/class.WpdiscuzHelper.php CHANGED
@@ -43,12 +43,15 @@ class WpdiscuzHelper {
43
  );
44
  private $captchaDir;
45
  private $captchaString;
46
- private $captchaFonth;
 
47
 
48
  function __construct($wpdiscuzOptionsSerialized, $dbManager) {
49
  $this->optionsSerialized = $wpdiscuzOptionsSerialized;
50
  $this->dbManager = $dbManager;
51
- $this->captchaDir = DIR_PATH . WPD_DS . 'utils' . WPD_DS . 'temp';
 
 
52
  }
53
 
54
  // Set timezone
@@ -199,48 +202,10 @@ class WpdiscuzHelper {
199
  return $new_array;
200
  }
201
 
202
- public function makeUrlClickable($matches) {
203
- $ret = '';
204
- $url = $matches[2];
205
-
206
- if (empty($url))
207
- return $matches[0];
208
- // removed trailing [.,;:] from URL
209
- if (in_array(substr($url, -1), array('.', ',', ';', ':')) === true) {
210
- $ret = substr($url, -1);
211
- $url = substr($url, 0, strlen($url) - 1);
212
- }
213
- return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret;
214
- }
215
-
216
- public function makeWebFtpClickable($matches) {
217
- $ret = '';
218
- $dest = $matches[2];
219
- $dest = 'http://' . $dest;
220
-
221
- if (empty($dest)) {
222
- return $matches[0];
223
- }
224
- if (in_array(substr($dest, -1), array('.', ',', ';', ':')) === true) {
225
- $ret = substr($dest, -1);
226
- $dest = substr($dest, 0, strlen($dest) - 1);
227
- }
228
- return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
229
- }
230
-
231
- public function makeEmailClickable($matches) {
232
- $email = $matches[2] . '@' . $matches[3];
233
- return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
234
- }
235
-
236
  public function makeClickable($ret) {
237
  $ret = ' ' . $ret;
238
  $ret = preg_replace('#[^\"|\'](https?:\/\/[^\s]+(\.jpe?g|\.png|\.gif|\.bmp))#i', '<a href="$1"><img src="$1" /></a>', $ret);
239
- // in testing, using arrays here was found to be faster
240
- $ret = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', array(&$this, 'makeUrlClickable'), $ret);
241
- $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', array(&$this, 'makeWebFtpClickable'), $ret);
242
- $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', array(&$this, 'makeEmailClickable'), $ret);
243
- // this one is not in an array because we need it to run last, for cleanup of accidental links within links
244
  $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
245
  $ret = trim($ret);
246
  return $ret;
@@ -271,13 +236,7 @@ class WpdiscuzHelper {
271
  $commentMaxLength = intval($this->optionsSerialized->commentTextMaxLength);
272
  $commentContent = trim(strip_tags($commentContent));
273
  $contentLength = function_exists('mb_strlen') ? mb_strlen($commentContent) : strlen($commentContent);
274
- return ($commentMinLength && $contentLength > $commentMinLength) && ($commentMaxLength == 0 || $contentLength < $commentMaxLength);
275
- }
276
-
277
- public function getCommentExcerpt($commentWordsLimit, $commentContent, $uniqueId) {
278
- array_splice($commentWordsLimit, $this->optionsSerialized->commentReadMoreLimit);
279
- $commentContent = implode(' ', $commentWordsLimit) . '<span id="wpdiscuz-readmore-' . $uniqueId . '"><span class="wpdiscuz-hellip">&hellip;&nbsp;</span><span class="wpdiscuz-readmore" title="' . $this->optionsSerialized->phrases['wc_read_more'] . '">' . $this->optionsSerialized->phrases['wc_read_more'] . '</span></span>';
280
- return $commentContent;
281
  }
282
 
283
  /**
@@ -363,19 +322,20 @@ class WpdiscuzHelper {
363
  <span class="wc-label wc-captcha-label">
364
  <?php
365
  $captchaData = $this->createCaptchaImage();
366
- $captchaFile = $captchaData['captcha'];
367
- $key = $captchaData['key'];
368
- $captchaFile = $captchaFile ? plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . WPD_DS . 'utils' . WPD_DS . 'temp' . WPD_DS . $captchaFile) : '';
 
369
  ?>
370
  <a class="wpdiscuz-nofollow" href="#" rel="nofollow">
371
- <img class="wc_captcha_img" src="<?php echo $captchaFile; ?>">
372
  </a>
373
  <a class="wpdiscuz-nofollow wc_captcha_refresh_img" href="#" rel="nofollow">
374
- <img class="" alt="<?php _e('Error', 'wpdiscuz'); ?>" src="<?php echo plugins_url(WpdiscuzCore::$PLUGIN_DIRECTORY . WPD_DS . 'assets' . WPD_DS . 'img' . WPD_DS . 'captcha-loading.png'); ?>">
375
  </a>
376
  <input type="hidden" id="<?php echo $key; ?>" class="wpdiscuz-cnonce" name="cnonce" value="<?php echo $key; ?>" />
377
  </span>
378
- <span class="captcha_msg"><?php echo $this->optionsSerialized->phrases['wc_captcha_text']; ?></span>
379
  </div>
380
  <?php
381
  }
@@ -394,14 +354,14 @@ class WpdiscuzHelper {
394
  $wpdiscuz_subscription_type = $this->dbManager->hasSubscription($post->ID, $current_user->user_email);
395
  }
396
  }
397
- $isShowSubscribeWrapper = ($wpdiscuz_subscription_type == '' || $wpdiscuz_subscription_type == 'comment') ? true : false;
398
  if ($isShowSubscribeWrapper) {
399
  ?>
400
  <div class="wc_notification_checkboxes" style="display:block">
401
  <?php
402
  if (class_exists('Prompt_Comment_Form_Handling') && $this->optionsSerialized->usePostmaticForCommentNotification) {
403
  ?>
404
- <input id="wc_notification_new_comment-<?php echo $uniqueId; ?>" class="wc_notification_new_comment-<?php echo $uniqueId; ?>" value="post" type="checkbox" name="wpdiscuz_notification_type"/> <label class="wc-label-comment-notify" for="wc_notification_new_comment-<?php echo $uniqueId; ?>"><?php _e('Participate in this discussion via email', 'wpdiscuz'); ?></label><br />
405
  <?php
406
  } else {
407
  ?>
@@ -478,50 +438,65 @@ class WpdiscuzHelper {
478
  }
479
  }
480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  public function generateCaptcha() {
482
  $messageArray = array();
483
  if (isset($_POST['wpdiscuzAjaxData'])) {
484
  parse_str($_POST['wpdiscuzAjaxData']);
485
  $uniqueId = trim($uniqueId);
486
  $captchaData = $this->createCaptchaImage();
487
- $messageArray['code'] = 1;
488
- $messageArray['message'] = $captchaData['captcha'];
489
- $messageArray['key'] = $captchaData['key'];
 
490
  wp_die(json_encode($messageArray));
491
  }
492
  }
493
 
494
- public function createCaptchaImage() {
495
- if (!$this->createTempDir()) {
496
- return '';
497
- }
498
-
499
  if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true) {
500
  $this->removeOldFiles();
501
  }
502
 
503
- $t = time();
504
  $captchaData = array();
505
- $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
506
- $randomString = '';
507
- $prefix = '';
508
- for ($i = 0; $i < WpdiscuzCore::CAPTCHA_LENGTH; $i++) {
509
- $randomString .= $chars[rand(0, strlen($chars) - 1)];
510
- $prefix .= $chars[rand(0, strlen($chars) - 1)];
511
- }
512
- $this->captchaString = $randomString;
513
- $filesPath = plugin_dir_path(__FILE__) . WPD_DS . 'captcha' . WPD_DS;
514
  $im = @imagecreatefrompng($filesPath . 'captcha_bg_easy.png');
515
- if ($im !== false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  $size = 16;
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
 
@@ -530,13 +505,13 @@ class WpdiscuzHelper {
530
  imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
531
  }
532
  $fileName = $prefix . '-' . $t . '.png';
533
- $filePath = $this->captchaDir . WPD_DS . $fileName;
534
  imagepng($im, $filePath, 0);
535
  imagedestroy($im);
536
- @chmod($filePath, 0444);
537
  $key = $this->createAnswer($prefix, $t);
538
- $captchaData['captcha'] = $fileName;
539
  $captchaData['key'] = $prefix . $key;
 
540
  }
541
  return $captchaData;
542
  }
@@ -545,16 +520,15 @@ class WpdiscuzHelper {
545
  $key = '';
546
  $dir = trailingslashit($this->captchaDir);
547
  $answerFileName = $prefix . '-' . $t . '.txt';
548
- $answerFile = $dir . WPD_DS . $answerFileName;
549
 
550
- if ($fh = @fopen($answerFile, 'w')) {
551
  $loweredString = strtolower($this->captchaString);
552
  $key = hash_hmac('sha256', $loweredString, time() . '');
553
  $hash = hash_hmac('sha256', $loweredString, $key);
554
- fwrite($fh, $key . '=' . $hash);
555
- fclose($fh);
556
  }
557
- @chmod($answerFile, 0440);
558
  return $key;
559
  }
560
 
@@ -564,11 +538,11 @@ class WpdiscuzHelper {
564
  }
565
  $captcha = strtolower($captcha);
566
  $file = $fileName . '.txt';
567
- $filePath = $this->captchaDir . WPD_DS . $file;
568
  $parts = explode('=', file_get_contents($filePath));
569
  $tKey = $parts[0];
570
  $tAnswer = $parts[1];
571
- return is_readable($filePath) && $tKey == $key && hash_hmac('sha256', $captcha, $key) == $tAnswer;
572
  }
573
 
574
  public function scheduleTask() {
@@ -580,13 +554,8 @@ class WpdiscuzHelper {
580
 
581
  public function unScheduleTask() {
582
  wp_clear_scheduled_hook('wpdiscuzRemoveOldFiles');
583
- if ($this->captchaDir && file_exists($this->captchaDir) && @chmod($this->captchaDir, 0777)) {
584
  $this->removeOldFiles(true);
585
- $htaccess = $this->captchaDir . WPD_DS . '.htaccess';
586
- if (@chmod($htaccess, 0777) && @chmod($this->captchaDir, 0777)) {
587
- unlink($htaccess);
588
- rmdir($this->captchaDir);
589
- }
590
  }
591
  }
592
 
@@ -596,11 +565,11 @@ class WpdiscuzHelper {
596
  if ($files && is_array($files)) {
597
  foreach ($files as $file) {
598
  if ($file != '.' && $file != '..' && $file != '.htaccess') {
599
- $fileName = $this->captchaDir . WPD_DS . $file;
600
  $fData = stat($fileName);
601
  if (is_file($fileName) && $fData) {
602
  $expired = $fData['mtime'] + (60 * 60 + 1000);
603
- if (@chmod($fileName, 0777) && ($expired < time() || $deactivate)) {
604
  unlink($fileName);
605
  }
606
  }
@@ -610,27 +579,6 @@ class WpdiscuzHelper {
610
  }
611
  }
612
 
613
- public function createTempDir() {
614
- if (!wp_mkdir_p($this->captchaDir)) {
615
- return false;
616
- }
617
-
618
- $htaccessFile = $this->captchaDir . WPD_DS . '.htaccess';
619
- if (file_exists($htaccessFile)) {
620
- return true;
621
- }
622
-
623
- if ($handle = @fopen($htaccessFile, 'w')) {
624
- fwrite($handle, 'Order deny,allow' . "\n");
625
- fwrite($handle, 'Deny from all' . "\n");
626
- fwrite($handle, '<Files ~ "^[0-9A-Za-z_\\-]+\\.(png)$">' . "\n");
627
- fwrite($handle, ' Allow from all' . "\n");
628
- fwrite($handle, '</Files>' . "\n");
629
- fclose($handle);
630
- }
631
- return true;
632
- }
633
-
634
  /**
635
  * check if the captcha field show or not
636
  * @return type boolean
@@ -644,5 +592,10 @@ class WpdiscuzHelper {
644
  return ((float) $pfx_usec + (float) $pfx_sec);
645
  }
646
 
 
 
 
 
 
647
  }
648
 
43
  );
44
  private $captchaDir;
45
  private $captchaString;
46
+ private $msgDirCreateError;
47
+ private $msgImgCreateError;
48
 
49
  function __construct($wpdiscuzOptionsSerialized, $dbManager) {
50
  $this->optionsSerialized = $wpdiscuzOptionsSerialized;
51
  $this->dbManager = $dbManager;
52
+ $this->captchaDir = WPDISCUZ_DIR_PATH . WPDISCUZ_DS . 'utils' . WPDISCUZ_DS . 'temp';
53
+ $this->msgDirCreateError = __('Cannot create temp directory', 'wpdiscuz');
54
+ $this->msgImgCreateError = __('Cannot create image file', 'wpdiscuz');
55
  }
56
 
57
  // Set timezone
202
  return $new_array;
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  public function makeClickable($ret) {
206
  $ret = ' ' . $ret;
207
  $ret = preg_replace('#[^\"|\'](https?:\/\/[^\s]+(\.jpe?g|\.png|\.gif|\.bmp))#i', '<a href="$1"><img src="$1" /></a>', $ret);
208
+ // this one is not in an array because we need it to run last, for cleanup of accidental links within links
 
 
 
 
209
  $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
210
  $ret = trim($ret);
211
  return $ret;
236
  $commentMaxLength = intval($this->optionsSerialized->commentTextMaxLength);
237
  $commentContent = trim(strip_tags($commentContent));
238
  $contentLength = function_exists('mb_strlen') ? mb_strlen($commentContent) : strlen($commentContent);
239
+ return ($commentMinLength && $contentLength >= $commentMinLength) && ($commentMaxLength == 0 || $contentLength <= $commentMaxLength);
 
 
 
 
 
 
240
  }
241
 
242
  /**
322
  <span class="wc-label wc-captcha-label">
323
  <?php
324
  $captchaData = $this->createCaptchaImage();
325
+ $msg = $this->getCaptchaMessage($captchaData);
326
+ $code = isset($msg['code']);
327
+ $key = isset($msg['key']);
328
+ $message = $code ? plugins_url(WPDISCUZ_DIR_NAME . WPDISCUZ_DS . 'utils' . WPDISCUZ_DS . 'temp' . WPDISCUZ_DS . $msg['message']) : $msg['message'];
329
  ?>
330
  <a class="wpdiscuz-nofollow" href="#" rel="nofollow">
331
+ <img class="wc_captcha_img" src="<?php echo $message; ?>">
332
  </a>
333
  <a class="wpdiscuz-nofollow wc_captcha_refresh_img" href="#" rel="nofollow">
334
+ <img class="" src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . WPDISCUZ_DS . 'assets' . WPDISCUZ_DS . 'img' . WPDISCUZ_DS . 'captcha-loading.png'); ?>">
335
  </a>
336
  <input type="hidden" id="<?php echo $key; ?>" class="wpdiscuz-cnonce" name="cnonce" value="<?php echo $key; ?>" />
337
  </span>
338
+ <span style="" class="captcha_msg"><?php echo $this->optionsSerialized->phrases['wc_captcha_text']; ?></span>
339
  </div>
340
  <?php
341
  }
354
  $wpdiscuz_subscription_type = $this->dbManager->hasSubscription($post->ID, $current_user->user_email);
355
  }
356
  }
357
+ $isShowSubscribeWrapper = (isset($wpdiscuz_subscription_type) && ($wpdiscuz_subscription_type == '' || $wpdiscuz_subscription_type == 'comment')) ? true : false;
358
  if ($isShowSubscribeWrapper) {
359
  ?>
360
  <div class="wc_notification_checkboxes" style="display:block">
361
  <?php
362
  if (class_exists('Prompt_Comment_Form_Handling') && $this->optionsSerialized->usePostmaticForCommentNotification) {
363
  ?>
364
+ <input id="wc_notification_new_comment-<?php echo $uniqueId; ?>" class="wc_notification_new_comment-<?php echo $uniqueId; ?>" value="post" type="checkbox" name="wpdiscuz_notification_type"/> <label class="wc-label-comment-notify" for="wc_notification_new_comment-<?php echo $uniqueId; ?>"><?php echo $this->optionsSerialized->phrases['wc_postmatic_subscription_label']; ?></label><br />
365
  <?php
366
  } else {
367
  ?>
438
  }
439
  }
440
 
441
+ private function getCaptchaMessage($captchaData) {
442
+ $msgArray = array();
443
+ if ($captchaData['code'] == 1) {
444
+ $msgArray['key'] = $captchaData['key'];
445
+ $msgArray['message'] = $captchaData['message'];
446
+ } else {
447
+ $msgArray['key'] = '';
448
+ $msgArray['message'] = $this->msgImgCreateError;
449
+ }
450
+ $msgArray['code'] = $captchaData['code'];
451
+ return $msgArray;
452
+ }
453
+
454
  public function generateCaptcha() {
455
  $messageArray = array();
456
  if (isset($_POST['wpdiscuzAjaxData'])) {
457
  parse_str($_POST['wpdiscuzAjaxData']);
458
  $uniqueId = trim($uniqueId);
459
  $captchaData = $this->createCaptchaImage();
460
+ $msg = $this->getCaptchaMessage($captchaData);
461
+ $messageArray['code'] = $captchaData['code'];
462
+ $messageArray['key'] = $msg['key'];
463
+ $messageArray['message'] = $msg['message'];
464
  wp_die(json_encode($messageArray));
465
  }
466
  }
467
 
468
+ private function createCaptchaImage() {
 
 
 
 
469
  if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true) {
470
  $this->removeOldFiles();
471
  }
472
 
 
473
  $captchaData = array();
474
+ $filesPath = plugin_dir_path(__FILE__) . WPDISCUZ_DS . 'captcha' . WPDISCUZ_DS;
 
 
 
 
 
 
 
 
475
  $im = @imagecreatefrompng($filesPath . 'captcha_bg_easy.png');
476
+ if ($im === false) {
477
+ $captchaData['code'] = 0;
478
+ $captchaData['key'] = '';
479
+ $captchaData['message'] = $this->msgImgCreateError;
480
+ } else {
481
+ $t = time();
482
+ $chars = '123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ';
483
+ $randomString = '';
484
+ $prefix = '';
485
+ for ($i = 0; $i < WpdiscuzCore::CAPTCHA_LENGTH; $i++) {
486
+ $randomString .= $chars[rand(0, strlen($chars) - 1)];
487
+ $prefix .= $chars[rand(0, strlen($chars) - 1)];
488
+ }
489
+ $this->captchaString = $randomString;
490
+
491
  $size = 16;
492
  $angle = 0;
493
  $x = 5;
494
  $y = 20;
495
+ $font = $filesPath . 'consolai.ttf';
496
  for ($i = 0; $i < strlen($randomString); $i++) {
497
  $color = imagecolorallocate($im, rand(0, 255), 0, rand(0, 255));
498
  $letter = substr($randomString, $i, 1);
499
+ imagettftext($im, $size, $angle, $x, $y, $color, $font, $letter);
500
  $x += 13;
501
  }
502
 
505
  imageline($im, rand(0, 20), rand(1, 50), rand(150, 180), rand(1, 50), $color);
506
  }
507
  $fileName = $prefix . '-' . $t . '.png';
508
+ $filePath = $this->captchaDir . WPDISCUZ_DS . $fileName;
509
  imagepng($im, $filePath, 0);
510
  imagedestroy($im);
 
511
  $key = $this->createAnswer($prefix, $t);
512
+ $captchaData['code'] = 1;
513
  $captchaData['key'] = $prefix . $key;
514
+ $captchaData['message'] = $fileName;
515
  }
516
  return $captchaData;
517
  }
520
  $key = '';
521
  $dir = trailingslashit($this->captchaDir);
522
  $answerFileName = $prefix . '-' . $t . '.txt';
523
+ $answerFile = $dir . WPDISCUZ_DS . $answerFileName;
524
 
525
+ if ($out = @fopen($answerFile, 'w')) {
526
  $loweredString = strtolower($this->captchaString);
527
  $key = hash_hmac('sha256', $loweredString, time() . '');
528
  $hash = hash_hmac('sha256', $loweredString, $key);
529
+ fwrite($out, $key . '=' . $hash);
530
+ fclose($out);
531
  }
 
532
  return $key;
533
  }
534
 
538
  }
539
  $captcha = strtolower($captcha);
540
  $file = $fileName . '.txt';
541
+ $filePath = $this->captchaDir . WPDISCUZ_DS . $file;
542
  $parts = explode('=', file_get_contents($filePath));
543
  $tKey = $parts[0];
544
  $tAnswer = $parts[1];
545
+ return is_readable($filePath) && $tKey == $key && $tAnswer == hash_hmac('sha256', $captcha, $key);
546
  }
547
 
548
  public function scheduleTask() {
554
 
555
  public function unScheduleTask() {
556
  wp_clear_scheduled_hook('wpdiscuzRemoveOldFiles');
557
+ if ($this->captchaDir && file_exists($this->captchaDir)) {
558
  $this->removeOldFiles(true);
 
 
 
 
 
559
  }
560
  }
561
 
565
  if ($files && is_array($files)) {
566
  foreach ($files as $file) {
567
  if ($file != '.' && $file != '..' && $file != '.htaccess') {
568
+ $fileName = $this->captchaDir . WPDISCUZ_DS . $file;
569
  $fData = stat($fileName);
570
  if (is_file($fileName) && $fData) {
571
  $expired = $fData['mtime'] + (60 * 60 + 1000);
572
+ if ($expired < time() || $deactivate) {
573
  unlink($fileName);
574
  }
575
  }
579
  }
580
  }
581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  /**
583
  * check if the captcha field show or not
584
  * @return type boolean
592
  return ((float) $pfx_usec + (float) $pfx_sec);
593
  }
594
 
595
+ public function getCommentExcerpt($commentContent, $uniqueId) {
596
+ $readMoreLink = '<span id="wpdiscuz-readmore-' . $uniqueId . '"><span class="wpdiscuz-hellip">&hellip;&nbsp;</span><span class="wpdiscuz-readmore" title="' . $this->optionsSerialized->phrases['wc_read_more'] . '">' . $this->optionsSerialized->phrases['wc_read_more'] . '</span></span>';
597
+ return wp_trim_words($commentContent, $this->optionsSerialized->commentReadMoreLimit, $readMoreLink);
598
+ }
599
+
600
  }
601
 
utils/class.WpdiscuzOptimizationHelper.php CHANGED
@@ -29,6 +29,7 @@ class WpdiscuzOptimizationHelper {
29
 
30
  /**
31
  * recursively get new comments tree
 
32
  */
33
  public function getTreeByParentId($commentId, &$tree) {
34
  $children = $this->dbManager->getCommentsByParentId($commentId);
@@ -43,6 +44,18 @@ class WpdiscuzOptimizationHelper {
43
  return $tree;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * get list of comments by parent ids
48
  * @param type $commentIds the parent comment ids
29
 
30
  /**
31
  * recursively get new comments tree
32
+ * return array of comments' ids
33
  */
34
  public function getTreeByParentId($commentId, &$tree) {
35
  $children = $this->dbManager->getCommentsByParentId($commentId);
44
  return $tree;
45
  }
46
 
47
+ public function isReplyInAuthorTree($commentId, $authorComments) {
48
+ $comment = get_comment($commentId);
49
+ if (in_array($comment->comment_parent, $authorComments)) {
50
+ return true;
51
+ }
52
+ if ($comment->comment_parent) {
53
+ return $this->isReplyInAuthorTree($comment->comment_parent, $authorComments);
54
+ } else {
55
+ return false;
56
+ }
57
+ }
58
+
59
  /**
60
  * get list of comments by parent ids
61
  * @param type $commentIds the parent comment ids
utils/temp/.htaccess ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ Order deny,allow
2
+ Deny from all
3
+ <Files ~ "^[0-9A-Za-z_\-]+\.(png)$">
4
+ Allow from all
5
+ </Files>