Version Description
- Added: Comment section reflects post password protection
- Added: Changing CAPTCHA generation type to "session" if temp directory is not writable
- Fixed Bug: Multiple voting issue on Google Chrome
- Fixed Bug: Comment author label issue with multiple user roles
- Fixed Bug: CAPTCHA image display issue on first load
- Fixed Bug: Form layout issue when avatars are disabled
- Fixed Bug: Incorrect comment escaping/slashing on some servers
IMPORTANT:
- If you have JetPack installed please deactivate Jetpack 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 | Comments – wpDiscuz |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.2.1 to 3.2.2
- assets/css/wpdiscuz-rtl.min.css +3 -1
- assets/css/wpdiscuz.min.css +5 -2
- assets/js/wpdiscuz.js +113 -45
- assets/js/wpdiscuz.min.js +1 -1
- class.WpdiscuzCore.php +279 -315
- includes/class.WpdiscuzCss.php +1 -1
- manager/class.WpdiscuzDBManager.php +1 -1
- options/class.WpdiscuzOptions.php +10 -2
- options/class.WpdiscuzOptionsSerialized.php +1 -5
- options/html-addons.php +2 -2
- options/options-layouts/settings-integrations.php +21 -22
- options/phrases-layouts/phrases-notification.php +1 -22
- readme.txt +21 -30
- templates/comment/class.WpdiscuzWalker.php +16 -4
- templates/comment/comment-form.php +220 -215
- utils/class.WpdiscuzEmailHelper.php +21 -23
- utils/class.WpdiscuzHelper.php +14 -9
- utils/class.WpdiscuzOptimizationHelper.php +1 -1
assets/css/wpdiscuz-rtl.min.css
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
#wpcomm .wc-form-wrapper .avatar{margin-top:0}
|
4 |
#wpcomm .wc-field-comment .wc-field-avatararea{float:right}
|
5 |
#wpcomm .wc-form-footer { margin-right: 65px; margin-left: 0px; }
|
|
|
6 |
#wpcomm .wc-author-data { float: right;text-align: right;}
|
7 |
#wpcomm .wc-form-submit { float: left;text-align: left;}
|
8 |
#wpcomm .wc-field-captcha{ float:right; text-align: left;}
|
@@ -34,7 +35,8 @@
|
|
34 |
#wpcomm .wc_comment_level-10 { margin-right: 40px!important; margin-left: 0px!important; }
|
35 |
@media screen and (max-width:600px){
|
36 |
#wpcomm .wc-field-comment .wc-field-textarea{ margin-right: 30px; }
|
37 |
-
#wpcomm .wc-form-footer{ margin-right:30px; }
|
|
|
38 |
#wpcomm .wc-reply{ margin-right:25px!important }
|
39 |
#wpcomm .wc_comment_level-3{ margin-right:0px!important; }
|
40 |
#wpcomm .wc_comment_level-4{ margin-right:0px!important; }
|
3 |
#wpcomm .wc-form-wrapper .avatar{margin-top:0}
|
4 |
#wpcomm .wc-field-comment .wc-field-avatararea{float:right}
|
5 |
#wpcomm .wc-form-footer { margin-right: 65px; margin-left: 0px; }
|
6 |
+
#wpcomm.wpdiscuz_no_avatar .wc-form-footer{ margin-right: 0px; margin-left: 0px; }
|
7 |
#wpcomm .wc-author-data { float: right;text-align: right;}
|
8 |
#wpcomm .wc-form-submit { float: left;text-align: left;}
|
9 |
#wpcomm .wc-field-captcha{ float:right; text-align: left;}
|
35 |
#wpcomm .wc_comment_level-10 { margin-right: 40px!important; margin-left: 0px!important; }
|
36 |
@media screen and (max-width:600px){
|
37 |
#wpcomm .wc-field-comment .wc-field-textarea{ margin-right: 30px; }
|
38 |
+
#wpcomm .wc-form-footer{ margin-right:30px; margin-left:0px; }
|
39 |
+
#wpcomm.wpdiscuz_no_avatar .wc-form-footer{ margin-right:0px; margin-left:0px; }
|
40 |
#wpcomm .wc-reply{ margin-right:25px!important }
|
41 |
#wpcomm .wc_comment_level-3{ margin-right:0px!important; }
|
42 |
#wpcomm .wc_comment_level-4{ margin-right:0px!important; }
|
assets/css/wpdiscuz.min.css
CHANGED
@@ -107,7 +107,7 @@
|
|
107 |
.wpdiscuz-nofollow, .wpdiscuz-nofollow:hover {text-decoration: none!important;}
|
108 |
#wpcomm .wc-field-comment textarea, #wpcomm .wc-comment .wc-comment-right textarea {display: inline;}
|
109 |
#wpcomm .input-text, #wpcomm input[type="text"], #wpcomm input[type="input"], #wpcomm input[type="password"], #wpcomm input[type="email"], #wpcomm input[type="number"], #wpcomm input[type="url"], #wpcomm input[type="tel"], #wpcomm input[type="search"], #wpcomm textarea, #wpcomm select {margin: 0px;}
|
110 |
-
.wc_msg_required_fields, .wc_invalid_field, .wc_invalid_captcha, .wc_error_url_text, .wc_error_email_text, .wpdiscuz-sendmail-error, .
|
111 |
.wc_held_for_moderate {background-color: #FCE6BF;font-size: 14px;text-align: center;color: #D3760C;border: #F9C975 1px solid;padding: 5px 10px;width: 100%;box-sizing: border-box;margin: 5px 0px;border-radius: 3px;}
|
112 |
.wpdiscuz-loading-bar {position: fixed;text-align: center;right: 0;width: 50px;border: none;background: transparent;z-index: 999999;display: none;}
|
113 |
.wpdiscuz-loading-bar-auth {top: 32px;}
|
@@ -134,6 +134,7 @@
|
|
134 |
#wpcomm span.current {color: #FFFFFF;}
|
135 |
|
136 |
#wpcomm .wc-form-footer {display: none;margin-left:65px;}
|
|
|
137 |
#wpcomm .wc-author-data {width: 48%;float: left;margin: 0;text-align: left;}
|
138 |
#wpcomm .wc-form-submit {width: 50%;float: right;margin: 0;text-align: right;padding:0px 0px 5px 0px; }
|
139 |
#wpcomm .wc-field-name {width: 100%;float: none;text-align: left;}
|
@@ -157,7 +158,8 @@
|
|
157 |
#wpcomm .wc-field-comment .wc-field-avatararea {width: 25px;}
|
158 |
#wpcomm .wc-field-comment .wc-field-avatararea .avatar {width: 25px;}
|
159 |
#wpcomm .wc-field-comment .wc-field-textarea {margin-left: 30px;}
|
160 |
-
#wpcomm .wc-form-footer{margin-left:
|
|
|
161 |
#wpcomm .wc-author-data{width: 100%;float:none;display:block;}
|
162 |
#wpcomm .wc-form-submit {width: 100%;float:none;display:block;padding: 0;}
|
163 |
#wpcomm .wc-field-submit input[type="button"] {max-width:200px;}
|
@@ -188,6 +190,7 @@
|
|
188 |
#wpcomm .wc-toggle {font-size: 11px;line-height: 12px;padding-top: 35px;padding-bottom: 5px;}
|
189 |
#wpcomm .wpdiscuz-sort-buttons, #wpcomm .wpdiscuz-sort-button {font-size: 11px!important;}
|
190 |
#wpcomm .wc-share-link {line-height: 30px;}
|
|
|
191 |
#wpcomm .wc-field-comment .wc-field-textarea {margin-left: 0px;}
|
192 |
#wpcomm .wc-field-comment .wc-field-avatararea .avatar {width: 0px;display: none;}
|
193 |
#wpcomm .wc-comment .wc-comment-left {float: none!important;margin-bottom: 8px;width: 100%!important;}
|
107 |
.wpdiscuz-nofollow, .wpdiscuz-nofollow:hover {text-decoration: none!important;}
|
108 |
#wpcomm .wc-field-comment textarea, #wpcomm .wc-comment .wc-comment-right textarea {display: inline;}
|
109 |
#wpcomm .input-text, #wpcomm input[type="text"], #wpcomm input[type="input"], #wpcomm input[type="password"], #wpcomm input[type="email"], #wpcomm input[type="number"], #wpcomm input[type="url"], #wpcomm input[type="tel"], #wpcomm input[type="search"], #wpcomm textarea, #wpcomm select {margin: 0px;}
|
110 |
+
.wc_msg_required_fields, .wc_invalid_field, .wc_invalid_captcha, .wc_error_url_text, .wc_error_email_text, .wpdiscuz-sendmail-error, .wc_msg_input_min_length, .wc_msg_input_max_length, .wc_login_to_vote, .wc_deny_voting_from_same_ip, .wc_self_vote, .wc_vote_only_one_time, .wc_voting_error, .wc_comment_edit_not_possible, .wc_comment_not_updated, .wc_comment_not_edited {background-color: #FCE8E8 !important;font-size: 14px;text-align: center;color: #CE4A66;border: #F2D3D2 1px solid;padding: 5px 10px;width: 100%;box-sizing: border-box;margin: 5px 0px;border-radius: 3px;}
|
111 |
.wc_held_for_moderate {background-color: #FCE6BF;font-size: 14px;text-align: center;color: #D3760C;border: #F9C975 1px solid;padding: 5px 10px;width: 100%;box-sizing: border-box;margin: 5px 0px;border-radius: 3px;}
|
112 |
.wpdiscuz-loading-bar {position: fixed;text-align: center;right: 0;width: 50px;border: none;background: transparent;z-index: 999999;display: none;}
|
113 |
.wpdiscuz-loading-bar-auth {top: 32px;}
|
134 |
#wpcomm span.current {color: #FFFFFF;}
|
135 |
|
136 |
#wpcomm .wc-form-footer {display: none;margin-left:65px;}
|
137 |
+
#wpcomm.wpdiscuz_no_avatar .wc-form-footer{ margin-left:0px; }
|
138 |
#wpcomm .wc-author-data {width: 48%;float: left;margin: 0;text-align: left;}
|
139 |
#wpcomm .wc-form-submit {width: 50%;float: right;margin: 0;text-align: right;padding:0px 0px 5px 0px; }
|
140 |
#wpcomm .wc-field-name {width: 100%;float: none;text-align: left;}
|
158 |
#wpcomm .wc-field-comment .wc-field-avatararea {width: 25px;}
|
159 |
#wpcomm .wc-field-comment .wc-field-avatararea .avatar {width: 25px;}
|
160 |
#wpcomm .wc-field-comment .wc-field-textarea {margin-left: 30px;}
|
161 |
+
#wpcomm .wc-form-footer{margin-left:30px;}
|
162 |
+
#wpcomm.wpdiscuz_no_avatar .wc-form-footer{ margin-left:0px; }
|
163 |
#wpcomm .wc-author-data{width: 100%;float:none;display:block;}
|
164 |
#wpcomm .wc-form-submit {width: 100%;float:none;display:block;padding: 0;}
|
165 |
#wpcomm .wc-field-submit input[type="button"] {max-width:200px;}
|
190 |
#wpcomm .wc-toggle {font-size: 11px;line-height: 12px;padding-top: 35px;padding-bottom: 5px;}
|
191 |
#wpcomm .wpdiscuz-sort-buttons, #wpcomm .wpdiscuz-sort-button {font-size: 11px!important;}
|
192 |
#wpcomm .wc-share-link {line-height: 30px;}
|
193 |
+
#wpcomm .wc-form-footer{margin-left:0px;}
|
194 |
#wpcomm .wc-field-comment .wc-field-textarea {margin-left: 0px;}
|
195 |
#wpcomm .wc-field-comment .wc-field-avatararea .avatar {width: 0px;display: none;}
|
196 |
#wpcomm .wc-comment .wc-comment-left {float: none!important;margin-bottom: 8px;width: 100%!important;}
|
assets/js/wpdiscuz.js
CHANGED
@@ -107,10 +107,12 @@ jQuery(document).ready(function ($) {
|
|
107 |
keyField.attr('id', uuId);
|
108 |
keyField.attr('value', uuId);
|
109 |
} else {
|
|
|
|
|
110 |
var isMain = form.hasClass('wc-secondary-form-wrapper') ? 0 : 1;
|
111 |
var uniqueId = getUniqueID(reloadImage, isMain);
|
112 |
-
|
113 |
-
var ajaxObject =
|
114 |
ajaxObject.done(function (response) {
|
115 |
try {
|
116 |
var obj = $.parseJSON(response);
|
@@ -159,28 +161,62 @@ jQuery(document).ready(function ($) {
|
|
159 |
}
|
160 |
|
161 |
if (wpdiscuzValidator.checkAll(wcForm)) {
|
162 |
-
var data =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
if (!wpdiscuzRecaptcha && (isShowCaptchaForGuests || isShowCaptchaForMembers) && !isCaptchaInSession) {
|
164 |
var image = $('.wc_captcha_img', wcForm);
|
165 |
var src = image.attr('src');
|
166 |
var lastIndex = src.lastIndexOf('/') + 1;
|
167 |
var fileName = src.substring(lastIndex);
|
168 |
-
data
|
169 |
}
|
170 |
|
171 |
if ($.cookie('wc_author_name') && !$('.wc_name', wcForm).val()) {
|
172 |
-
data
|
173 |
}
|
174 |
|
175 |
if ($.cookie('wc_author_email') && !$('.wc_email', wcForm).val()) {
|
176 |
-
data
|
177 |
}
|
178 |
|
179 |
if (wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs) {
|
180 |
-
data
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
var messageKey = '';
|
185 |
var message = '';
|
186 |
try {
|
@@ -229,8 +265,12 @@ jQuery(document).ready(function ($) {
|
|
229 |
|
230 |
function notifySubscribers(obj) {
|
231 |
if (!obj.held_moderate) {
|
232 |
-
var data =
|
233 |
-
|
|
|
|
|
|
|
|
|
234 |
ajaxObject.done(function (response) {
|
235 |
try {
|
236 |
obj = $.parseJSON(response);
|
@@ -243,8 +283,10 @@ jQuery(document).ready(function ($) {
|
|
243 |
|
244 |
function wpdiscuzRedirect(obj) {
|
245 |
if (obj.redirect > 0 && obj.new_comment_id) {
|
246 |
-
var data =
|
247 |
-
|
|
|
|
|
248 |
ajaxObject.done(function (response) {
|
249 |
obj = $.parseJSON(response);
|
250 |
if (obj.code == 1) {
|
@@ -300,9 +342,11 @@ jQuery(document).ready(function ($) {
|
|
300 |
var uniqueID = getUniqueID($(this), 0);
|
301 |
var commentID = getCommentID(uniqueID);
|
302 |
var editButton = $(this);
|
303 |
-
var data =
|
|
|
|
|
304 |
wcCommentTextBeforeEditing = $('#wc-comm-' + uniqueID + ' .wc-comment-text').html();
|
305 |
-
|
306 |
try {
|
307 |
var obj = $.parseJSON(response);
|
308 |
var message = '';
|
@@ -333,8 +377,11 @@ jQuery(document).ready(function ($) {
|
|
333 |
var commentContent = editableTextarea.val();
|
334 |
var saveButton = $(this);
|
335 |
if ($.trim(commentContent).length > 0) {
|
336 |
-
var data =
|
337 |
-
|
|
|
|
|
|
|
338 |
try {
|
339 |
var obj = $.parseJSON(response);
|
340 |
var messageKey = obj.code;
|
@@ -393,10 +440,14 @@ jQuery(document).ready(function ($) {
|
|
393 |
}
|
394 |
|
395 |
function wpdiscuzLoadComments() {
|
396 |
-
var data;
|
397 |
-
data
|
|
|
|
|
|
|
|
|
398 |
wpdiscuzLoadCount++;
|
399 |
-
|
400 |
try {
|
401 |
var obj = $.parseJSON(response);
|
402 |
$('.wpdiscuz-comment-pagination').before(obj.comment_list);
|
@@ -429,8 +480,9 @@ jQuery(document).ready(function ($) {
|
|
429 |
|
430 |
//============================== LOAD MORE ============================== //
|
431 |
//============================== VOTE ============================== //
|
432 |
-
$(document).delegate('.wc_vote', 'click', function () {
|
433 |
var currentVoteBtn = $(this);
|
|
|
434 |
var messageKey = '';
|
435 |
var message = '';
|
436 |
var commentID = $(this).parents('.wc-comment-right').attr('id');
|
@@ -441,9 +493,13 @@ jQuery(document).ready(function ($) {
|
|
441 |
} else {
|
442 |
voteType = -1;
|
443 |
}
|
444 |
-
var data = 'commentId=' + commentID + '&voteType=' + voteType;
|
445 |
|
446 |
-
|
|
|
|
|
|
|
|
|
|
|
447 |
try {
|
448 |
var obj = $.parseJSON(response);
|
449 |
messageKey = obj.code;
|
@@ -473,10 +529,14 @@ jQuery(document).ready(function ($) {
|
|
473 |
wpdiscuzCommentOrderBy = 'comment_date_gmt';
|
474 |
wpdiscuzCommentOrder = $(this).hasClass('wpdiscuz-date-sort-desc') ? 'desc' : 'asc';
|
475 |
}
|
476 |
-
var data =
|
|
|
|
|
|
|
|
|
477 |
var messageKey = '';
|
478 |
var message = '';
|
479 |
-
|
480 |
try {
|
481 |
var obj = $.parseJSON(response);
|
482 |
messageKey = obj.code;
|
@@ -516,8 +576,10 @@ jQuery(document).ready(function ($) {
|
|
516 |
if (matches !== null) {
|
517 |
var commentId = matches[1];
|
518 |
if (!$('#comment-' + commentId).length) {
|
519 |
-
var data =
|
520 |
-
|
|
|
|
|
521 |
ajaxObject.done(function (response) {
|
522 |
try {
|
523 |
var obj = $.parseJSON(response);
|
@@ -544,8 +606,12 @@ jQuery(document).ready(function ($) {
|
|
544 |
function liveUpdate() {
|
545 |
var visibleCommentIds = getVisibleCommentIds();
|
546 |
var email = ($.cookie('wc_author_email') != undefined && $.cookie('wc_author_email') != '') ? $.cookie('wc_author_email') : '';
|
547 |
-
var data =
|
548 |
-
|
|
|
|
|
|
|
|
|
549 |
ajaxObject.done(function (response) {
|
550 |
try {
|
551 |
var obj = $.parseJSON(response);
|
@@ -596,15 +662,16 @@ jQuery(document).ready(function ($) {
|
|
596 |
}
|
597 |
|
598 |
$(document).delegate('.wc-update-on-click', 'click', function () {
|
599 |
-
var data;
|
|
|
600 |
var clickedButton = $(this);
|
601 |
if (clickedButton.hasClass('wc_new_comment')) {
|
602 |
-
data
|
603 |
} else {
|
604 |
-
data
|
605 |
}
|
606 |
|
607 |
-
|
608 |
try {
|
609 |
var obj = $.parseJSON(response);
|
610 |
liveUpdateImmediately(obj);
|
@@ -627,8 +694,10 @@ jQuery(document).ready(function ($) {
|
|
627 |
$(document).delegate('.wpdiscuz-readmore', 'click', function () {
|
628 |
var uniqueId = getUniqueID($(this));
|
629 |
var commentId = getCommentID(uniqueId);
|
630 |
-
var data =
|
631 |
-
|
|
|
|
|
632 |
try {
|
633 |
var obj = $.parseJSON(response);
|
634 |
if (obj.code) {
|
@@ -785,23 +854,22 @@ jQuery(document).ready(function ($) {
|
|
785 |
* @param {type} data the request properties
|
786 |
* @returns {jqXHR}
|
787 |
*/
|
788 |
-
function
|
789 |
-
if (action !== 'liveUpdate') {
|
790 |
$('.wpdiscuz-loading-bar').show();
|
791 |
}
|
792 |
-
data
|
793 |
return $.ajax({
|
794 |
type: 'POST',
|
795 |
url: wpdiscuz_ajax_obj.url,
|
796 |
-
data:
|
797 |
-
|
798 |
-
|
799 |
-
}
|
800 |
});
|
801 |
}
|
802 |
|
803 |
function wpdiscuzReset() {
|
804 |
-
$('.wpdiscuz_reset').val(
|
805 |
-
}
|
806 |
//============================== FUNCTIONS ============================== //
|
807 |
});
|
107 |
keyField.attr('id', uuId);
|
108 |
keyField.attr('value', uuId);
|
109 |
} else {
|
110 |
+
var data = new FormData();
|
111 |
+
data.append('action', 'generateCaptcha');
|
112 |
var isMain = form.hasClass('wc-secondary-form-wrapper') ? 0 : 1;
|
113 |
var uniqueId = getUniqueID(reloadImage, isMain);
|
114 |
+
data.append('wpdiscuz_unique_id', uniqueId);
|
115 |
+
var ajaxObject = getAjaxObj(data);
|
116 |
ajaxObject.done(function (response) {
|
117 |
try {
|
118 |
var obj = $.parseJSON(response);
|
161 |
}
|
162 |
|
163 |
if (wpdiscuzValidator.checkAll(wcForm)) {
|
164 |
+
var data = new FormData();
|
165 |
+
data.append('action', 'addComment');
|
166 |
+
var inputs = $(':input:not([type="checkbox"])', wcForm);
|
167 |
+
inputs.each(function () {
|
168 |
+
data.append(this.name + '', $(this).val());
|
169 |
+
});
|
170 |
+
|
171 |
+
data.append('wc_comment_depth', depth);
|
172 |
+
if ($('input[name="wpdiscuz_notification_type"]', wcForm).is(':checked')) {
|
173 |
+
data.append('wpdiscuz_notification_type', $('input[name="wpdiscuz_notification_type"]', wcForm).val());
|
174 |
+
}
|
175 |
+
|
176 |
+
if (wpdiscuzUploader == 1) {
|
177 |
+
var images = $(wcForm).find('input.wu-image');
|
178 |
+
var videos = $(wcForm).find('input.wu-video');
|
179 |
+
var files = $(wcForm).find('input.wu-file');
|
180 |
+
$.each($(images), function (i, file) {
|
181 |
+
$.each(file.files, function (j, image) {
|
182 |
+
data.append('images[' + j + ']', image.name);
|
183 |
+
});
|
184 |
+
});
|
185 |
+
|
186 |
+
$.each($(videos), function (i, file) {
|
187 |
+
$.each(file.files, function (j, video) {
|
188 |
+
data.append('videos[' + j + ']', video.name);
|
189 |
+
});
|
190 |
+
});
|
191 |
+
|
192 |
+
$.each($(files), function (i, file) {
|
193 |
+
$.each(file.files, function (j, allFiles) {
|
194 |
+
data.append('files[' + j + ']', allFiles.name);
|
195 |
+
});
|
196 |
+
});
|
197 |
+
}
|
198 |
+
|
199 |
if (!wpdiscuzRecaptcha && (isShowCaptchaForGuests || isShowCaptchaForMembers) && !isCaptchaInSession) {
|
200 |
var image = $('.wc_captcha_img', wcForm);
|
201 |
var src = image.attr('src');
|
202 |
var lastIndex = src.lastIndexOf('/') + 1;
|
203 |
var fileName = src.substring(lastIndex);
|
204 |
+
data.append('fileName', fileName);
|
205 |
}
|
206 |
|
207 |
if ($.cookie('wc_author_name') && !$('.wc_name', wcForm).val()) {
|
208 |
+
data.append('wc_name', $.cookie('wc_author_name'));
|
209 |
}
|
210 |
|
211 |
if ($.cookie('wc_author_email') && !$('.wc_email', wcForm).val()) {
|
212 |
+
data.append('wc_email', $.cookie('wc_author_email'));
|
213 |
}
|
214 |
|
215 |
if (wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs) {
|
216 |
+
data.append('wpdiscuz_zs', wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs);
|
217 |
+
}
|
218 |
+
|
219 |
+
getAjaxObj(data).done(function (response) {
|
220 |
var messageKey = '';
|
221 |
var message = '';
|
222 |
try {
|
265 |
|
266 |
function notifySubscribers(obj) {
|
267 |
if (!obj.held_moderate) {
|
268 |
+
var data = new FormData();
|
269 |
+
data.append('action', 'checkNotificationType');
|
270 |
+
data.append('comment_id', obj.new_comment_id);
|
271 |
+
data.append('email', obj.user_email);
|
272 |
+
data.append('isParent', obj.is_main);
|
273 |
+
var ajaxObject = getAjaxObj(data);
|
274 |
ajaxObject.done(function (response) {
|
275 |
try {
|
276 |
obj = $.parseJSON(response);
|
283 |
|
284 |
function wpdiscuzRedirect(obj) {
|
285 |
if (obj.redirect > 0 && obj.new_comment_id) {
|
286 |
+
var data = new FormData();
|
287 |
+
data.append('action', 'redirect');
|
288 |
+
data.append('commentId', obj.new_comment_id);
|
289 |
+
var ajaxObject = getAjaxObj(data);
|
290 |
ajaxObject.done(function (response) {
|
291 |
obj = $.parseJSON(response);
|
292 |
if (obj.code == 1) {
|
342 |
var uniqueID = getUniqueID($(this), 0);
|
343 |
var commentID = getCommentID(uniqueID);
|
344 |
var editButton = $(this);
|
345 |
+
var data = new FormData();
|
346 |
+
data.append('action', 'editComment');
|
347 |
+
data.append('commentId', commentID);
|
348 |
wcCommentTextBeforeEditing = $('#wc-comm-' + uniqueID + ' .wc-comment-text').html();
|
349 |
+
getAjaxObj(data).done(function (response) {
|
350 |
try {
|
351 |
var obj = $.parseJSON(response);
|
352 |
var message = '';
|
377 |
var commentContent = editableTextarea.val();
|
378 |
var saveButton = $(this);
|
379 |
if ($.trim(commentContent).length > 0) {
|
380 |
+
var data = new FormData();
|
381 |
+
data.append('action', 'saveEditedComment');
|
382 |
+
data.append('commentId', commentID);
|
383 |
+
data.append('commentContent', commentContent);
|
384 |
+
getAjaxObj(data).done(function (response) {
|
385 |
try {
|
386 |
var obj = $.parseJSON(response);
|
387 |
var messageKey = obj.code;
|
440 |
}
|
441 |
|
442 |
function wpdiscuzLoadComments() {
|
443 |
+
var data = new FormData();
|
444 |
+
data.append('action', 'loadMoreComments');
|
445 |
+
data.append('offset', wpdiscuzLoadCount);
|
446 |
+
data.append('orderBy', wpdiscuzCommentOrderBy);
|
447 |
+
data.append('order', wpdiscuzCommentOrder);
|
448 |
+
data.append('lastParentId', getLastParentID());
|
449 |
wpdiscuzLoadCount++;
|
450 |
+
getAjaxObj(data).done(function (response) {
|
451 |
try {
|
452 |
var obj = $.parseJSON(response);
|
453 |
$('.wpdiscuz-comment-pagination').before(obj.comment_list);
|
480 |
|
481 |
//============================== LOAD MORE ============================== //
|
482 |
//============================== VOTE ============================== //
|
483 |
+
$(document).delegate('.wc_vote.wc_not_clicked', 'click', function () {
|
484 |
var currentVoteBtn = $(this);
|
485 |
+
$(currentVoteBtn).removeClass('wc_not_clicked');
|
486 |
var messageKey = '';
|
487 |
var message = '';
|
488 |
var commentID = $(this).parents('.wc-comment-right').attr('id');
|
493 |
} else {
|
494 |
voteType = -1;
|
495 |
}
|
|
|
496 |
|
497 |
+
var data = new FormData();
|
498 |
+
data.append('action', 'voteOnComment');
|
499 |
+
data.append('commentId', commentID);
|
500 |
+
data.append('voteType', voteType);
|
501 |
+
getAjaxObj(data).done(function (response) {
|
502 |
+
$(currentVoteBtn).addClass('wc_not_clicked');
|
503 |
try {
|
504 |
var obj = $.parseJSON(response);
|
505 |
messageKey = obj.code;
|
529 |
wpdiscuzCommentOrderBy = 'comment_date_gmt';
|
530 |
wpdiscuzCommentOrder = $(this).hasClass('wpdiscuz-date-sort-desc') ? 'desc' : 'asc';
|
531 |
}
|
532 |
+
var data = new FormData();
|
533 |
+
data.append('action', 'wpdiscuzSorting');
|
534 |
+
data.append('orderBy', wpdiscuzCommentOrderBy);
|
535 |
+
data.append('order', wpdiscuzCommentOrder);
|
536 |
+
|
537 |
var messageKey = '';
|
538 |
var message = '';
|
539 |
+
getAjaxObj(data).done(function (response) {
|
540 |
try {
|
541 |
var obj = $.parseJSON(response);
|
542 |
messageKey = obj.code;
|
576 |
if (matches !== null) {
|
577 |
var commentId = matches[1];
|
578 |
if (!$('#comment-' + commentId).length) {
|
579 |
+
var data = new FormData();
|
580 |
+
data.append('action', 'getSingleComment');
|
581 |
+
data.append('commentId', commentId);
|
582 |
+
var ajaxObject = getAjaxObj(data);
|
583 |
ajaxObject.done(function (response) {
|
584 |
try {
|
585 |
var obj = $.parseJSON(response);
|
606 |
function liveUpdate() {
|
607 |
var visibleCommentIds = getVisibleCommentIds();
|
608 |
var email = ($.cookie('wc_author_email') != undefined && $.cookie('wc_author_email') != '') ? $.cookie('wc_author_email') : '';
|
609 |
+
var data = new FormData();
|
610 |
+
data.append('action', 'updateAutomatically');
|
611 |
+
data.append('loadLastCommentId', loadLastCommentId);
|
612 |
+
data.append('visibleCommentIds', visibleCommentIds);
|
613 |
+
data.append('email', email);
|
614 |
+
var ajaxObject = getAjaxObj(data);
|
615 |
ajaxObject.done(function (response) {
|
616 |
try {
|
617 |
var obj = $.parseJSON(response);
|
662 |
}
|
663 |
|
664 |
$(document).delegate('.wc-update-on-click', 'click', function () {
|
665 |
+
var data = new FormData();
|
666 |
+
data.append('action', 'updateOnClick');
|
667 |
var clickedButton = $(this);
|
668 |
if (clickedButton.hasClass('wc_new_comment')) {
|
669 |
+
data.append('newCommentIds', wpdiscuzCommentArray.join());
|
670 |
} else {
|
671 |
+
data.append('newCommentIds', wpdiscuzReplyArray.join());
|
672 |
}
|
673 |
|
674 |
+
getAjaxObj(data).done(function (response) {
|
675 |
try {
|
676 |
var obj = $.parseJSON(response);
|
677 |
liveUpdateImmediately(obj);
|
694 |
$(document).delegate('.wpdiscuz-readmore', 'click', function () {
|
695 |
var uniqueId = getUniqueID($(this));
|
696 |
var commentId = getCommentID(uniqueId);
|
697 |
+
var data = new FormData();
|
698 |
+
data.append('action', 'readMore');
|
699 |
+
data.append('commentId', commentId);
|
700 |
+
getAjaxObj(data).done(function (response) {
|
701 |
try {
|
702 |
var obj = $.parseJSON(response);
|
703 |
if (obj.code) {
|
854 |
* @param {type} data the request properties
|
855 |
* @returns {jqXHR}
|
856 |
*/
|
857 |
+
function getAjaxObj(data) {
|
858 |
+
if (data.action !== 'liveUpdate') {
|
859 |
$('.wpdiscuz-loading-bar').show();
|
860 |
}
|
861 |
+
data.append('postId', wpdiscuzPostId);
|
862 |
return $.ajax({
|
863 |
type: 'POST',
|
864 |
url: wpdiscuz_ajax_obj.url,
|
865 |
+
data: data,
|
866 |
+
contentType: false,
|
867 |
+
processData: false,
|
|
|
868 |
});
|
869 |
}
|
870 |
|
871 |
function wpdiscuzReset() {
|
872 |
+
$('.wpdiscuz_reset').val("");
|
873 |
+
}
|
874 |
//============================== FUNCTIONS ============================== //
|
875 |
});
|
assets/js/wpdiscuz.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
|
2 |
-
jQuery(document).ready(function(I){I("body").addClass("wpdiscuz_"+wpdiscuz_ajax_obj.wpdiscuz_options.version);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_input_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_input_max_length;var W=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var u=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!W;var V=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members>0&&W;var C=wpdiscuz_ajax_obj.wpdiscuz_options.isCaptchaInSession;var G=wpdiscuz_ajax_obj.wpdiscuz_options.commentListLoadType;var aa=wpdiscuz_ajax_obj.wpdiscuz_options.wordpressIsPaginate;var r=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var m=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var k=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var B=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var X=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var M=wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;var E=wpdiscuz_ajax_obj.wpdiscuz_options.storeCommenterData;var b=1;var p="comment_date_gmt";var R=[];var y=[];var o=wpdiscuz_ajax_obj.wpdiscuz_options.wpDiscuzReCaptcha;var l=wpdiscuz_ajax_obj.wpdiscuz_options.uploader;J();h();f();if(M){I(".wpdiscuz-vote-sort-up").addClass("wpdiscuz-sort-button-active");p="by_vote"}else{I(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active")}I("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){I(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor")-1)});if(I(".wc_main_comm_form").length){e()}I(document).delegate(".wc-reply-link","click",function(){if(I(this).hasClass("wpdiscuz-clonned")){I("#wc-secondary-form-wrapper-"+q(I(this),0)).slideToggle(700)}else{j(I(this))}e()});I(document).delegate("textarea.wc_comment","focus",function(){if(!(I(this).next(".autogrow-textarea-mirror").length)){I(this).autoGrow()}var ad=I(this).parents(".wc-form-wrapper");I(".wc-form-footer",ad).slideDown(700)});I(document).delegate(".wc-share-link","click",function(){var ad=I(this).parents(".wc-comment-right");I(".share_buttons_box",ad).slideToggle(1000)});I(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(ad){ad.preventDefault()});I(document).delegate(".wc-toggle","click",function(){var ae=q(I(this),0);var ad=I(this);I("#wc-comm-"+ae+"> .wc-reply").slideToggle(700,function(){if(I(this).is(":hidden")){ad.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" ∨")}else{ad.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" ∧")}})});I(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(I(this).hasClass("wc-reply")){I(">.wc-comment-right",this).css("backgroundColor",wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color)}else{I(">.wc-comment-right",this).css("backgroundColor",wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color)}});I(document).delegate(".wc_captcha_refresh_img","click",function(){U(I(this))});function U(am){if(!o&&(u||V)){var ae=am.parents(".wc-form-wrapper");var ag=I(".wpdiscuz-cnonce",ae);if(C){var af=g();var an=I(am).prev().children(".wc_captcha_img");var ad=an.attr("src");var aj=ad.substring(0,ad.indexOf("=")+1);an.attr("src",aj+af+"&r="+Math.random());ag.attr("id",af);ag.attr("value",af)}else{var ak=ae.hasClass("wc-secondary-form-wrapper")?0:1;var ai=q(am,ak);var ah="uniqueId="+ai;var al=d("generateCaptcha",ah);al.done(function(ap){try{var au=I.parseJSON(ap);if(au.code==1){var ar=I(am).prev().children(".wc_captcha_img");var av=ar.attr("src");var ao=av.lastIndexOf("/")+1;var aq=av.substring(0,ao)+au.message;ar.attr("src",aq);ag.attr("id",au.key);ag.attr("value",au.key)}}catch(at){console.log(at)}I(".wpdiscuz-loading-bar").hide()})}}}function g(){var ad="123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var ae="c";for(i=0;i<13;i++){ae+=ad[Math.floor(Math.random()*(ad.length-1)+1)]}return ae}I(document).delegate(".wc_comm_submit","click",function(){var ah=1;var ae=I(this).parents("form");if(!ae.hasClass("wc_main_comm_form")){ah=H(I(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&I(".wc_email",ae).val()){I(".wc_email",ae).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(I(".wc_email",ae).val())){I(".wc_email",ae).removeAttr("required");I(".wc_email",ae).next(".alert").html("")}if(wpdiscuzValidator.checkAll(ae)){var ad=ae.serialize()+"&wc_comment_depth="+ah;if(!o&&(u||V)&&!C){var af=I(".wc_captcha_img",ae);var ag=af.attr("src");var aj=ag.lastIndexOf("/")+1;var ai=ag.substring(aj);ad+="&fileName="+ai}if(I.cookie("wc_author_name")&&!I(".wc_name",ae).val()){ad+="&wc_name="+I.cookie("wc_author_name")}if(I.cookie("wc_author_email")&&!I(".wc_email",ae).val()){ad+="&wc_email="+I.cookie("wc_author_email")}if(wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs){ad+="&wpdiscuz_zs="+wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs}d("addComment",ad).done(function(al){var am="";var an="";try{var ap=I.parseJSON(al);am=ap.code;if(parseInt(am)>=0){var ak=ap.is_main;an=ap.message;I(".wc_header_text_count").html(ap.wc_all_comments_count_new);if(ak){I(".wc-thread-wrapper").prepend(an)}else{I("#wc-secondary-form-wrapper-"+am).slideToggle(700);if(ap.is_in_same_container==1){I("#wc-secondary-form-wrapper-"+am).after(an)}else{I("#wc-secondary-form-wrapper-"+am).after(an.replace("wc-reply","wc-reply wc-no-left-margin"))}}s(ap);Z(ap);x(ae,ap);ae.get(0).reset();e();f();I(".wc_comment",ae).css("height","45.6px")}else{an=wpdiscuz_ajax_obj.wpdiscuz_options[am];w(ae,am,an,true)}}catch(ao){if(al.indexOf("<")>=0&&al.indexOf(">")>=0){an=ao}else{an=al}w(ae,"wc_invalid_field",an,true)}J();I(".wpdiscuz-loading-bar").hide()})}U(I(".wc_captcha_refresh_img",ae));Q()});function s(af){if(!af.held_moderate){var ae="comment_id="+af.new_comment_id+"&email="+af.user_email+"&isParent="+af.is_main;var ad=d("checkNotificationType",ae);ad.done(function(ag){try{af=I.parseJSON(ag)}catch(ah){console.log(ah)}})}}function Z(af){if(af.redirect>0&&af.new_comment_id){var ae="commentId="+af.new_comment_id;var ad=d("redirect",ae);ad.done(function(ag){af=I.parseJSON(ag);if(af.code==1){setTimeout(function(){window.location.href=af.redirect_to},5000)}})}}function e(){if(I.cookie("wc_author_name")&&I.cookie("wc_author_name").indexOf("Anonymous")<0){I(".wc_comm_form .wc_name").val(I.cookie("wc_author_name"))}if(I.cookie("wc_author_email")&&I.cookie("wc_author_email").indexOf("@example.com")<0){I(".wc_comm_form .wc_email").val(I.cookie("wc_author_email"))}if(I.cookie("wc_author_website")){I(".wc_comm_form .wc_website").val(I.cookie("wc_author_website"))}}function x(af,ag){var ae="";var ad="";if(I(".wc_email",af).val()){ae=I(".wc_email",af).val()}else{ae=ag.user_email}if(I(".wc_name",af).val()){ad=I(".wc_name",af).val()}else{ad=ag.user_name}if(E==null){I.cookie("wc_author_email",ae);I.cookie("wc_author_name",ad);I.cookie("wc_author_website",I(".wc_website",af).val())}else{E=parseInt(E);I.cookie("wc_author_email",ae,{expires:E,path:"/"});I.cookie("wc_author_name",ad,{expires:E,path:"/"});I.cookie("wc_author_website",I(".wc_website",af).val(),{expires:E,path:"/"})}}var Y;I(document).delegate(".wc_editable_comment","click",function(){var ag=q(I(this),0);var ad=ab(ag);var af=I(this);var ae="commentId="+ad;Y=I("#wc-comm-"+ag+" .wc-comment-text").html();d("editComment",ae).done(function(ai){try{var am=I.parseJSON(ai);var ak="";var aj=am.code;if(parseInt(aj)>=0){var ah='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+ag+'" style="min-height: 2em;">'+am.message+"</textarea>";I("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-text").replaceWith(ah);document.getElementById("wc_edit_comment-"+ag).focus();I("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ah="";I("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();I("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ak=wpdiscuz_ajax_obj.wpdiscuz_options[aj];w(af,aj,ak,false)}}catch(al){console.log(al)}I(".wpdiscuz-loading-bar").hide()})});I(document).delegate(".wc_save_edited_comment","click",function(){var ai=q(I(this));var ae=ab(ai);var ad=I("#wc-comm-"+ai+" textarea#wc_edit_comment-"+ai);var af=ad.val();var ah=I(this);if(I.trim(af).length>0){var ag="commentId="+ae+"&commentContent="+af;d("saveEditedComment",ag).done(function(aj){try{var an=I.parseJSON(aj);var ak=an.code;var al="";if(parseInt(ak)>=0){N(ai,an.message)}else{al=wpdiscuz_ajax_obj.wpdiscuz_options[ak];w(ah,ak,al,false)}ad="";af=""}catch(am){console.log(am)}I(".wpdiscuz-loading-bar").hide()})}});I(document).delegate(".wc_cancel_edit","click",function(){var ad=q(I(this));N(ad,Y)});function N(af,ae){I("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();I("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();I("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var ad='<div class="wc-comment-text">'+n(ae)+"</div>";I("#wc-comm-"+af+" #wc_edit_comment-"+af).replaceWith(ad)}function n(ag,af){var ae=(af||typeof af==="undefined")?"<br/>":"<br>";var ad=(ag+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+ae+"$2");return ad.replace("<br><br>","<br/>")}I(document).delegate(".wc-load-more-submit","click",function(){L()});var t=I("#wpdiscuzHasMoreComments").val();var K=false;if(G==2&&!aa){I(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide();I(window).scroll(function(){var ad=document.getElementById("wcThreadWrapper").scrollHeight;if(I(window).scrollTop()>=ad&&K===false&&t==1){K=true;L()}})}function L(){var ad;ad="offset="+b+"&orderBy="+p+"&order="+a+"&lastParentId="+z();b++;d("loadMoreComments",ad).done(function(ae){try{var ag=I.parseJSON(ae);I(".wpdiscuz-comment-pagination").before(ag.comment_list);v(ag);I(".wpdiscuz_single").remove();K=false;f()}catch(af){console.log(af)}J();I(".wpdiscuz-loading-bar").hide();I(".wc-load-more-submit").blur()})}function v(ae){var ad=0;if(ae.is_show_load_more==false){ad=0;t=0;I(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}else{T(ae.last_parent_id);t=1;ad=1}I("#wpdiscuzHasMoreComments").val(ad)}I(document).delegate(".wc_vote","click",function(){var ad=I(this);var ag="";var ah="";var ae=I(this).parents(".wc-comment-right").attr("id");ae=ae.substring(ae.lastIndexOf("-")+1);var af;if(I(this).hasClass("wc-up")){af=1}else{af=-1}var ai="commentId="+ae+"&voteType="+af;d("voteOnComment",ai).done(function(aj){try{var al=I.parseJSON(aj);ag=al.code;if(parseInt(ag)>=0){var am=I(".wc-comment-footer .wc-vote-result",I("#comment-"+ae));I(am).text(parseInt(I(am).text())+af)}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];w(ad,ag,ah,false)}}catch(ak){console.log(ak)}I(".wpdiscuz-loading-bar").hide()})});I(document).delegate(".wpdiscuz-sort-button","click",function(){t=I("#wpdiscuzHasMoreComments").val();if(!(I(this).hasClass("wpdiscuz-sort-button-active"))){var ag=I(this);if(I(this).hasClass("wpdiscuz-vote-sort-up")){p="by_vote";a="desc"}else{p="comment_date_gmt";a=I(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var af="orderBy="+p+"&order="+a;var ad="";var ae="";d("wpdiscuzSorting",af).done(function(ah){try{var aj=I.parseJSON(ah);ad=aj.code;ae=aj.message;if(parseInt(ad)>0){I("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){I(this).remove()});I("#wpcomm .wc-thread-wrapper").prepend(ae);b=parseInt(aj.loadCount)}else{}P(ag);v(aj)}catch(ai){console.log(ai)}f();J();I(".wpdiscuz-loading-bar").hide()})}});function P(ad){I(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){I(this).removeClass("wpdiscuz-sort-button-active")});ad.addClass("wpdiscuz-sort-button-active")}function ac(){var ah=location.href;var ag=ah.match(/#comment\-(\d+)/);if(ag!==null){var ae=ag[1];if(!I("#comment-"+ae).length){var af="commentId="+ae;var ad=d("getSingleComment",af);ad.done(function(ai){try{var ak=I.parseJSON(ai);I(".wc-thread-wrapper").prepend(ak.message);I("html, body").animate({scrollTop:I(".wc-thread-wrapper").offset().top},1000)}catch(aj){console.log(aj)}J();I(".wpdiscuz-loading-bar").hide()})}}}ac();if(m>0&&X&&(W||(!W&&!B))){setInterval(S,parseInt(k)*1000)}function S(){var ag=F();var ae=(I.cookie("wc_author_email")!=undefined&&I.cookie("wc_author_email")!="")?I.cookie("wc_author_email"):"";var af="loadLastCommentId="+X+"&visibleCommentIds="+ag+"&email="+ae;var ad=d("liveUpdate",af);ad.done(function(ai){try{var an=I.parseJSON(ai);if(an.code==1){if(m==1){D(an)}else{y=y.concat(an.message.comments);R=R.concat(an.message.author_replies);var aj=y.length;var ah=R.length;if(aj>0){var al=aj+" ";al+=aj>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;I(".wc_new_comment").html(al).show()}else{I(".wc_new_comment").hide()}if(ah>0){var ak=ah+" ";ak+=ah>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;I(".wc_new_reply").html(ak).show()}else{I(".wc_new_reply").hide()}}I(".wc_header_text_count").html(an.wc_all_comments_count_new);X=an.loadLastCommentId}}catch(am){console.log(am)}J();I(".wpdiscuz-loading-bar").hide()})}function D(ag){if(ag.message!==undefined){var ad;var af=ag.message;for(var ae=0;ae<af.length;ae++){ad=af[ae];A(ad.comment_parent,ad.comment_html)}f()}}I(document).delegate(".wc-update-on-click","click",function(){var ad;var ae=I(this);if(ae.hasClass("wc_new_comment")){ad="newCommentIds="+y.join()}else{ad="newCommentIds="+R.join()}d("updateOnClick",ad).done(function(af){try{var ah=I.parseJSON(af);D(ah);if(ae.hasClass("wc_new_comment")){y=[];I(".wc_new_comment").hide()}else{R=[];I(".wc_new_reply").hide()}}catch(ag){console.log(ag)}J();I(".wpdiscuz-loading-bar").hide()})});I(document).delegate(".wpdiscuz-readmore","click",function(){var af=q(I(this));var ad=ab(af);var ae="commentId="+ad;d("readMore",ae).done(function(ag){try{var ai=I.parseJSON(ag);if(ai.code){I("#comment-"+ad+" > .wc-comment-text").html(" "+ai.message);I("#wpdiscuz-readmore-"+af).remove()}}catch(ah){console.log(ah)}I(".wpdiscuz-loading-bar").hide()})});function w(ah,ae,ag,af){var ad;var ai;if(af){ai=ah.parents(".wc-form-wrapper")}else{ai=ah.closest(".wc-comment")}ad=ai.children(".wpdiscuz-comment-message");ad.addClass(ae);ad.html(ag);ad.show().delay(4000).fadeOut(1000,function(){ad.removeClass();ad.addClass("wpdiscuz-comment-message");ad.html("")})}function j(ae){var af=q(ae,0);I("#wpdiscuz_form_anchor-"+af).before(O(af));var ad=I("#wc-secondary-form-wrapper-"+af);ad.slideToggle(700,function(){ae.addClass("wpdiscuz-clonned")});U(I(".wc_captcha_refresh_img",ad))}function O(ae){var ad=I("#wpdiscuz_hidden_secondary_form").html();return ad.replace(/wpdiscuzuniqueid/g,ae)}function q(af,ae){var ad="";if(ae){ad=af.parents(".wc-main-form-wrapper").attr("id")}else{ad=af.parents(".wc-comment").attr("id")}var ag=ad.substring(ad.lastIndexOf("-")+1);return ag}function ab(ad){return ad.substring(0,ad.indexOf("_"))}function z(){var ad=I(".wc-load-more-link").attr("href");return ad.substring(ad.lastIndexOf("=")+1)}function T(ad){var ae=I(".wc-load-more-link").attr("href");I(".wc-load-more-link").attr("href",ae.replace(/[\d]+$/m,ad));if(G!=2){I(".wpdiscuz-comment-pagination").show()}}function H(af){var ae=af.attr("class");var ad=ae.split(" ");var ag="";I.each(ad,function(ah,ai){if("wc_comment_level"===c(ai,false)){ag=c(ai,true)}});return parseInt(ag)+1}function c(ad,ae){var af="";if(ae){af=ad.substring(ad.indexOf("-")+1)}else{af=ad.substring(0,ad.indexOf("-"))}return af}function A(af,ae){if(af==0){I(".wc-thread-wrapper").prepend(ae)}else{var ad=q(I("#comment-"+af),0);I("#wpdiscuz_form_anchor-"+ad).after(ae)}}function F(){var af;var ad;var ae="";I(".wc-comment-right").each(function(){af=q(I(this),0);ad=ab(af);ae+=ad+","});return ae}function J(){I(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});I(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function h(){if(I(".wc_social_plugin_wrapper .wp-social-login-provider-list").length){I(".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(I(".wc_social_plugin_wrapper .the_champ_login_container").length){I(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(I(".wc_social_plugin_wrapper .social_connect_form").length){I(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(I(".wc_social_plugin_wrapper .oneall_social_login_providers").length){I(".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(){I("#wcThreadWrapper .wc-comment").each(function(ad){if(I("> .wc-reply",this).length){I("> .wc-comment-right .wc-comment-footer .wc-toggle",this).removeClass("wpdiscuz-hidden")}})}function d(ae,ad){if(ae!=="liveUpdate"){I(".wpdiscuz-loading-bar").show()}ad+="&postId="+r;return I.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:ad,action:ae}})}function Q(){I(".wpdiscuz_reset").val("")}});
|
1 |
|
2 |
+
jQuery(document).ready(function(H){H("body").addClass("wpdiscuz_"+wpdiscuz_ajax_obj.wpdiscuz_options.version);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_input_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_input_max_length;var W=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var t=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!W;var V=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members>0&&W;var B=wpdiscuz_ajax_obj.wpdiscuz_options.isCaptchaInSession;var F=wpdiscuz_ajax_obj.wpdiscuz_options.commentListLoadType;var aa=wpdiscuz_ajax_obj.wpdiscuz_options.wordpressIsPaginate;var q=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var l=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var j=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var A=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var X=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var L=wpdiscuz_ajax_obj.wpdiscuz_options.commentsVoteOrder;var D=wpdiscuz_ajax_obj.wpdiscuz_options.storeCommenterData;var b=1;var o="comment_date_gmt";var Q=[];var x=[];var n=wpdiscuz_ajax_obj.wpdiscuz_options.wpDiscuzReCaptcha;var k=wpdiscuz_ajax_obj.wpdiscuz_options.uploader;I();g();e();if(L){H(".wpdiscuz-vote-sort-up").addClass("wpdiscuz-sort-button-active");o="by_vote"}else{H(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active")}H("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){H(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor")-1)});if(H(".wc_main_comm_form").length){d()}H(document).delegate(".wc-reply-link","click",function(){if(H(this).hasClass("wpdiscuz-clonned")){H("#wc-secondary-form-wrapper-"+p(H(this),0)).slideToggle(700)}else{h(H(this))}d()});H(document).delegate("textarea.wc_comment","focus",function(){if(!(H(this).next(".autogrow-textarea-mirror").length)){H(this).autoGrow()}var ad=H(this).parents(".wc-form-wrapper");H(".wc-form-footer",ad).slideDown(700)});H(document).delegate(".wc-share-link","click",function(){var ad=H(this).parents(".wc-comment-right");H(".share_buttons_box",ad).slideToggle(1000)});H(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(ad){ad.preventDefault()});H(document).delegate(".wc-toggle","click",function(){var ae=p(H(this),0);var ad=H(this);H("#wc-comm-"+ae+"> .wc-reply").slideToggle(700,function(){if(H(this).is(":hidden")){ad.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" ∨")}else{ad.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" ∧")}})});H(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(H(this).hasClass("wc-reply")){H(">.wc-comment-right",this).css("backgroundColor",wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color)}else{H(">.wc-comment-right",this).css("backgroundColor",wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color)}});H(document).delegate(".wc_captcha_refresh_img","click",function(){T(H(this))});function T(am){if(!n&&(t||V)){var ae=am.parents(".wc-form-wrapper");var ag=H(".wpdiscuz-cnonce",ae);if(B){var af=f();var an=H(am).prev().children(".wc_captcha_img");var ad=an.attr("src");var ak=ad.substring(0,ad.indexOf("=")+1);an.attr("src",ak+af+"&r="+Math.random());ag.attr("id",af);ag.attr("value",af)}else{var ah=new FormData();ah.append("action","generateCaptcha");var aj=ae.hasClass("wc-secondary-form-wrapper")?0:1;var ai=p(am,aj);ah.append("wpdiscuz_unique_id",ai);var al=U(ah);al.done(function(ap){try{var au=H.parseJSON(ap);if(au.code==1){var ar=H(am).prev().children(".wc_captcha_img");var av=ar.attr("src");var ao=av.lastIndexOf("/")+1;var aq=av.substring(0,ao)+au.message;ar.attr("src",aq);ag.attr("id",au.key);ag.attr("value",au.key)}}catch(at){console.log(at)}H(".wpdiscuz-loading-bar").hide()})}}}function f(){var ad="123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var ae="c";for(i=0;i<13;i++){ae+=ad[Math.floor(Math.random()*(ad.length-1)+1)]}return ae}H(document).delegate(".wc_comm_submit","click",function(){var aj=1;var ah=H(this).parents("form");if(!ah.hasClass("wc_main_comm_form")){aj=G(H(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&H(".wc_email",ah).val()){H(".wc_email",ah).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(H(".wc_email",ah).val())){H(".wc_email",ah).removeAttr("required");H(".wc_email",ah).next(".alert").html("")}if(wpdiscuzValidator.checkAll(ah)){var ak=new FormData();ak.append("action","addComment");var am=H(':input:not([type="checkbox"])',ah);am.each(function(){ak.append(this.name+"",H(this).val())});ak.append("wc_comment_depth",aj);if(H('input[name="wpdiscuz_notification_type"]',ah).is(":checked")){ak.append("wpdiscuz_notification_type",H('input[name="wpdiscuz_notification_type"]',ah).val())}if(k==1){var an=H(ah).find("input.wu-image");var ag=H(ah).find("input.wu-video");var ae=H(ah).find("input.wu-file");H.each(H(an),function(ap,ao){H.each(ao.files,function(aq,ar){ak.append("images["+aq+"]",ar.name)})});H.each(H(ag),function(ap,ao){H.each(ao.files,function(aq,ar){ak.append("videos["+aq+"]",ar.name)})});H.each(H(ae),function(ap,ao){H.each(ao.files,function(aq,ar){ak.append("files["+aq+"]",ar.name)})})}if(!n&&(t||V)&&!B){var af=H(".wc_captcha_img",ah);var ad=af.attr("src");var al=ad.lastIndexOf("/")+1;var ai=ad.substring(al);ak.append("fileName",ai)}if(H.cookie("wc_author_name")&&!H(".wc_name",ah).val()){ak.append("wc_name",H.cookie("wc_author_name"))}if(H.cookie("wc_author_email")&&!H(".wc_email",ah).val()){ak.append("wc_email",H.cookie("wc_author_email"))}if(wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs){ak.append("wpdiscuz_zs",wpdiscuz_ajax_obj.wpdiscuz_options.wpdiscuz_zs)}U(ak).done(function(ap){var aq="";var ar="";try{var au=H.parseJSON(ap);aq=au.code;if(parseInt(aq)>=0){var ao=au.is_main;ar=au.message;H(".wc_header_text_count").html(au.wc_all_comments_count_new);if(ao){H(".wc-thread-wrapper").prepend(ar)}else{H("#wc-secondary-form-wrapper-"+aq).slideToggle(700);if(au.is_in_same_container==1){H("#wc-secondary-form-wrapper-"+aq).after(ar)}else{H("#wc-secondary-form-wrapper-"+aq).after(ar.replace("wc-reply","wc-reply wc-no-left-margin"))}}r(au);Z(au);w(ah,au);ah.get(0).reset();d();e();H(".wc_comment",ah).css("height","45.6px")}else{ar=wpdiscuz_ajax_obj.wpdiscuz_options[aq];v(ah,aq,ar,true)}}catch(at){if(ap.indexOf("<")>=0&&ap.indexOf(">")>=0){ar=at}else{ar=ap}v(ah,"wc_invalid_field",ar,true)}I();H(".wpdiscuz-loading-bar").hide()})}T(H(".wc_captcha_refresh_img",ah));P()});function r(af){if(!af.held_moderate){var ae=new FormData();ae.append("action","checkNotificationType");ae.append("comment_id",af.new_comment_id);ae.append("email",af.user_email);ae.append("isParent",af.is_main);var ad=U(ae);ad.done(function(ag){try{af=H.parseJSON(ag)}catch(ah){console.log(ah)}})}}function Z(af){if(af.redirect>0&&af.new_comment_id){var ae=new FormData();ae.append("action","redirect");ae.append("commentId",af.new_comment_id);var ad=U(ae);ad.done(function(ag){af=H.parseJSON(ag);if(af.code==1){setTimeout(function(){window.location.href=af.redirect_to},5000)}})}}function d(){if(H.cookie("wc_author_name")&&H.cookie("wc_author_name").indexOf("Anonymous")<0){H(".wc_comm_form .wc_name").val(H.cookie("wc_author_name"))}if(H.cookie("wc_author_email")&&H.cookie("wc_author_email").indexOf("@example.com")<0){H(".wc_comm_form .wc_email").val(H.cookie("wc_author_email"))}if(H.cookie("wc_author_website")){H(".wc_comm_form .wc_website").val(H.cookie("wc_author_website"))}}function w(af,ag){var ae="";var ad="";if(H(".wc_email",af).val()){ae=H(".wc_email",af).val()}else{ae=ag.user_email}if(H(".wc_name",af).val()){ad=H(".wc_name",af).val()}else{ad=ag.user_name}if(D==null){H.cookie("wc_author_email",ae);H.cookie("wc_author_name",ad);H.cookie("wc_author_website",H(".wc_website",af).val())}else{D=parseInt(D);H.cookie("wc_author_email",ae,{expires:D,path:"/"});H.cookie("wc_author_name",ad,{expires:D,path:"/"});H.cookie("wc_author_website",H(".wc_website",af).val(),{expires:D,path:"/"})}}var Y;H(document).delegate(".wc_editable_comment","click",function(){var ag=p(H(this),0);var ad=ab(ag);var af=H(this);var ae=new FormData();ae.append("action","editComment");ae.append("commentId",ad);Y=H("#wc-comm-"+ag+" .wc-comment-text").html();U(ae).done(function(ai){try{var am=H.parseJSON(ai);var ak="";var aj=am.code;if(parseInt(aj)>=0){var ah='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+ag+'" style="min-height: 2em;">'+am.message+"</textarea>";H("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-text").replaceWith(ah);document.getElementById("wc_edit_comment-"+ag).focus();H("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ah="";H("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();H("#wc-comm-"+ag+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ak=wpdiscuz_ajax_obj.wpdiscuz_options[aj];v(af,aj,ak,false)}}catch(al){console.log(al)}H(".wpdiscuz-loading-bar").hide()})});H(document).delegate(".wc_save_edited_comment","click",function(){var ai=p(H(this));var ae=ab(ai);var ad=H("#wc-comm-"+ai+" textarea#wc_edit_comment-"+ai);var af=ad.val();var ah=H(this);if(H.trim(af).length>0){var ag=new FormData();ag.append("action","saveEditedComment");ag.append("commentId",ae);ag.append("commentContent",af);U(ag).done(function(aj){try{var an=H.parseJSON(aj);var ak=an.code;var al="";if(parseInt(ak)>=0){M(ai,an.message)}else{al=wpdiscuz_ajax_obj.wpdiscuz_options[ak];v(ah,ak,al,false)}ad="";af=""}catch(am){console.log(am)}H(".wpdiscuz-loading-bar").hide()})}});H(document).delegate(".wc_cancel_edit","click",function(){var ad=p(H(this));M(ad,Y)});function M(af,ae){H("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();H("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();H("#wc-comm-"+af+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var ad='<div class="wc-comment-text">'+m(ae)+"</div>";H("#wc-comm-"+af+" #wc_edit_comment-"+af).replaceWith(ad)}function m(ag,af){var ae=(af||typeof af==="undefined")?"<br/>":"<br>";var ad=(ag+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+ae+"$2");return ad.replace("<br><br>","<br/>")}H(document).delegate(".wc-load-more-submit","click",function(){K()});var s=H("#wpdiscuzHasMoreComments").val();var J=false;if(F==2&&!aa){H(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide();H(window).scroll(function(){var ad=document.getElementById("wcThreadWrapper").scrollHeight;if(H(window).scrollTop()>=ad&&J===false&&s==1){J=true;K()}})}function K(){var ad=new FormData();ad.append("action","loadMoreComments");ad.append("offset",b);ad.append("orderBy",o);ad.append("order",a);ad.append("lastParentId",y());b++;U(ad).done(function(ae){try{var ag=H.parseJSON(ae);H(".wpdiscuz-comment-pagination").before(ag.comment_list);u(ag);H(".wpdiscuz_single").remove();J=false;e()}catch(af){console.log(af)}I();H(".wpdiscuz-loading-bar").hide();H(".wc-load-more-submit").blur()})}function u(ae){var ad=0;if(ae.is_show_load_more==false){ad=0;s=0;H(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}else{S(ae.last_parent_id);s=1;ad=1}H("#wpdiscuzHasMoreComments").val(ad)}H(document).delegate(".wc_vote.wc_not_clicked","click",function(){var ad=H(this);H(ad).removeClass("wc_not_clicked");var ag="";var ah="";var ae=H(this).parents(".wc-comment-right").attr("id");ae=ae.substring(ae.lastIndexOf("-")+1);var af;if(H(this).hasClass("wc-up")){af=1}else{af=-1}var ai=new FormData();ai.append("action","voteOnComment");ai.append("commentId",ae);ai.append("voteType",af);U(ai).done(function(aj){H(ad).addClass("wc_not_clicked");try{var al=H.parseJSON(aj);ag=al.code;if(parseInt(ag)>=0){var am=H(".wc-comment-footer .wc-vote-result",H("#comment-"+ae));H(am).text(parseInt(H(am).text())+af)}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];v(ad,ag,ah,false)}}catch(ak){console.log(ak)}H(".wpdiscuz-loading-bar").hide()})});H(document).delegate(".wpdiscuz-sort-button","click",function(){s=H("#wpdiscuzHasMoreComments").val();if(!(H(this).hasClass("wpdiscuz-sort-button-active"))){var ag=H(this);if(H(this).hasClass("wpdiscuz-vote-sort-up")){o="by_vote";a="desc"}else{o="comment_date_gmt";a=H(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var af=new FormData();af.append("action","wpdiscuzSorting");af.append("orderBy",o);af.append("order",a);var ad="";var ae="";U(af).done(function(ah){try{var aj=H.parseJSON(ah);ad=aj.code;ae=aj.message;if(parseInt(ad)>0){H("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){H(this).remove()});H("#wpcomm .wc-thread-wrapper").prepend(ae);b=parseInt(aj.loadCount)}else{}O(ag);u(aj)}catch(ai){console.log(ai)}e();I();H(".wpdiscuz-loading-bar").hide()})}});function O(ad){H(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){H(this).removeClass("wpdiscuz-sort-button-active")});ad.addClass("wpdiscuz-sort-button-active")}function ac(){var ah=location.href;var ag=ah.match(/#comment\-(\d+)/);if(ag!==null){var ae=ag[1];if(!H("#comment-"+ae).length){var af=new FormData();af.append("action","getSingleComment");af.append("commentId",ae);var ad=U(af);ad.done(function(ai){try{var ak=H.parseJSON(ai);H(".wc-thread-wrapper").prepend(ak.message);H("html, body").animate({scrollTop:H(".wc-thread-wrapper").offset().top},1000)}catch(aj){console.log(aj)}I();H(".wpdiscuz-loading-bar").hide()})}}}ac();if(l>0&&X&&(W||(!W&&!A))){setInterval(R,parseInt(j)*1000)}function R(){var ag=E();var ae=(H.cookie("wc_author_email")!=undefined&&H.cookie("wc_author_email")!="")?H.cookie("wc_author_email"):"";var af=new FormData();af.append("action","updateAutomatically");af.append("loadLastCommentId",X);af.append("visibleCommentIds",ag);af.append("email",ae);var ad=U(af);ad.done(function(ai){try{var an=H.parseJSON(ai);if(an.code==1){if(l==1){C(an)}else{x=x.concat(an.message.comments);Q=Q.concat(an.message.author_replies);var aj=x.length;var ah=Q.length;if(aj>0){var al=aj+" ";al+=aj>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;H(".wc_new_comment").html(al).show()}else{H(".wc_new_comment").hide()}if(ah>0){var ak=ah+" ";ak+=ah>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;H(".wc_new_reply").html(ak).show()}else{H(".wc_new_reply").hide()}}H(".wc_header_text_count").html(an.wc_all_comments_count_new);X=an.loadLastCommentId}}catch(am){console.log(am)}I();H(".wpdiscuz-loading-bar").hide()})}function C(ag){if(ag.message!==undefined){var ad;var af=ag.message;for(var ae=0;ae<af.length;ae++){ad=af[ae];z(ad.comment_parent,ad.comment_html)}e()}}H(document).delegate(".wc-update-on-click","click",function(){var ad=new FormData();ad.append("action","updateOnClick");var ae=H(this);if(ae.hasClass("wc_new_comment")){ad.append("newCommentIds",x.join())}else{ad.append("newCommentIds",Q.join())}U(ad).done(function(af){try{var ah=H.parseJSON(af);C(ah);if(ae.hasClass("wc_new_comment")){x=[];H(".wc_new_comment").hide()}else{Q=[];H(".wc_new_reply").hide()}}catch(ag){console.log(ag)}I();H(".wpdiscuz-loading-bar").hide()})});H(document).delegate(".wpdiscuz-readmore","click",function(){var af=p(H(this));var ad=ab(af);var ae=new FormData();ae.append("action","readMore");ae.append("commentId",ad);U(ae).done(function(ag){try{var ai=H.parseJSON(ag);if(ai.code){H("#comment-"+ad+" > .wc-comment-text").html(" "+ai.message);H("#wpdiscuz-readmore-"+af).remove()}}catch(ah){console.log(ah)}H(".wpdiscuz-loading-bar").hide()})});function v(ah,ae,ag,af){var ad;var ai;if(af){ai=ah.parents(".wc-form-wrapper")}else{ai=ah.closest(".wc-comment")}ad=ai.children(".wpdiscuz-comment-message");ad.addClass(ae);ad.html(ag);ad.show().delay(4000).fadeOut(1000,function(){ad.removeClass();ad.addClass("wpdiscuz-comment-message");ad.html("")})}function h(ae){var af=p(ae,0);H("#wpdiscuz_form_anchor-"+af).before(N(af));var ad=H("#wc-secondary-form-wrapper-"+af);ad.slideToggle(700,function(){ae.addClass("wpdiscuz-clonned")});T(H(".wc_captcha_refresh_img",ad))}function N(ae){var ad=H("#wpdiscuz_hidden_secondary_form").html();return ad.replace(/wpdiscuzuniqueid/g,ae)}function p(af,ae){var ad="";if(ae){ad=af.parents(".wc-main-form-wrapper").attr("id")}else{ad=af.parents(".wc-comment").attr("id")}var ag=ad.substring(ad.lastIndexOf("-")+1);return ag}function ab(ad){return ad.substring(0,ad.indexOf("_"))}function y(){var ad=H(".wc-load-more-link").attr("href");return ad.substring(ad.lastIndexOf("=")+1)}function S(ad){var ae=H(".wc-load-more-link").attr("href");H(".wc-load-more-link").attr("href",ae.replace(/[\d]+$/m,ad));if(F!=2){H(".wpdiscuz-comment-pagination").show()}}function G(af){var ae=af.attr("class");var ad=ae.split(" ");var ag="";H.each(ad,function(ah,ai){if("wc_comment_level"===c(ai,false)){ag=c(ai,true)}});return parseInt(ag)+1}function c(ad,ae){var af="";if(ae){af=ad.substring(ad.indexOf("-")+1)}else{af=ad.substring(0,ad.indexOf("-"))}return af}function z(af,ae){if(af==0){H(".wc-thread-wrapper").prepend(ae)}else{var ad=p(H("#comment-"+af),0);H("#wpdiscuz_form_anchor-"+ad).after(ae)}}function E(){var af;var ad;var ae="";H(".wc-comment-right").each(function(){af=p(H(this),0);ad=ab(af);ae+=ad+","});return ae}function I(){H(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});H(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function g(){if(H(".wc_social_plugin_wrapper .wp-social-login-provider-list").length){H(".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(H(".wc_social_plugin_wrapper .the_champ_login_container").length){H(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(H(".wc_social_plugin_wrapper .social_connect_form").length){H(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(H(".wc_social_plugin_wrapper .oneall_social_login_providers").length){H(".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 e(){H("#wcThreadWrapper .wc-comment").each(function(ad){if(H("> .wc-reply",this).length){H("> .wc-comment-right .wc-comment-footer .wc-toggle",this).removeClass("wpdiscuz-hidden")}})}function U(ad){if(ad.action!=="liveUpdate"){H(".wpdiscuz-loading-bar").show()}ad.append("postId",q);return H.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:ad,contentType:false,processData:false,})}function P(){H(".wpdiscuz_reset").val("")}});
|
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.2.
|
7 |
* Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
|
8 |
* Author URI: http://gvectors.com/
|
9 |
* Plugin URI: http://wpdiscuz.com/
|
@@ -107,8 +107,8 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
107 |
add_action('wp_ajax_nopriv_saveEditedComment', array(&$this, 'saveEditedComment'));
|
108 |
}
|
109 |
if ($this->optionsSerialized->commentListUpdateType) {
|
110 |
-
add_action('
|
111 |
-
add_action('
|
112 |
add_action('wp_ajax_updateOnClick', array(&$this, 'updateOnClick'));
|
113 |
add_action('wp_ajax_nopriv_updateOnClick', array(&$this, 'updateOnClick'));
|
114 |
}
|
@@ -125,30 +125,23 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
125 |
load_plugin_textdomain('wpdiscuz', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
126 |
}
|
127 |
|
128 |
-
public function
|
129 |
-
$
|
130 |
-
if ($commentData) {
|
131 |
-
$this->updateAutomatically($commentData);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
private function updateAutomatically($commentData) {
|
136 |
-
global $current_user;
|
137 |
get_currentuserinfo();
|
138 |
$messageArray = array();
|
139 |
-
|
140 |
-
$
|
141 |
-
$
|
142 |
-
$
|
143 |
-
$email = $
|
144 |
-
if ($visibleCommentIds && $postId && $loadLastCommentId) {
|
145 |
$lastCommentId = $this->dbManager->getLastCommentId($postId);
|
146 |
if ($lastCommentId > $loadLastCommentId) {
|
147 |
$messageArray['code'] = 1;
|
148 |
$messageArray['loadLastCommentId'] = $lastCommentId;
|
149 |
$commentListArgs = $this->getCommentListArgs($postId);
|
150 |
$commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
|
151 |
-
$commentListArgs['current_user'] = $
|
152 |
if ($this->optionsSerialized->commentListUpdateType == 1) {
|
153 |
$visibleCommentIds = explode(',', $visibleCommentIds);
|
154 |
$newCommentIds = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email);
|
@@ -194,179 +187,172 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
194 |
}
|
195 |
|
196 |
public function updateOnClick() {
|
197 |
-
$
|
198 |
-
|
199 |
-
|
|
|
|
|
200 |
get_currentuserinfo();
|
201 |
-
|
202 |
-
$
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
$
|
210 |
-
$
|
211 |
-
$
|
212 |
-
|
213 |
-
$comment = get_comment($newCommentId);
|
214 |
-
$commentHtml = wp_list_comments($commentListArgs, array($comment));
|
215 |
-
$commentObject = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
|
216 |
-
$messageArray['message'][] = $commentObject;
|
217 |
-
}
|
218 |
-
wp_die(json_encode($messageArray));
|
219 |
}
|
|
|
220 |
}
|
221 |
wp_die();
|
222 |
}
|
223 |
|
224 |
public function addComment() {
|
225 |
$messageArray = array();
|
226 |
-
$commentData = filter_input(INPUT_POST, 'wpdiscuzAjaxData');
|
227 |
$isAnonymous = false;
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
234 |
}
|
235 |
-
$
|
236 |
-
$
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
$
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
$captcha = isset($data['wc_captcha']) ? $data['wc_captcha'] : '';
|
252 |
-
if ($this->optionsSerialized->isCaptchaInSession) {
|
253 |
-
$cnonce = isset($data['cnonce']) ? $data['cnonce'] : '';
|
254 |
-
$sCaptcha = session_start() && isset($_SESSION['wpdiscuzc'][$cnonce]) ? $_SESSION['wpdiscuzc'][$cnonce] : false;
|
255 |
-
if (!$sCaptcha || md5(strtolower(trim($captcha))) !== $sCaptcha) {
|
256 |
-
$messageArray['code'] = 'wc_invalid_captcha';
|
257 |
-
wp_die(json_encode($messageArray));
|
258 |
-
}
|
259 |
-
} else {
|
260 |
-
$key = isset($data['cnonce']) ? substr($data['cnonce'], self::CAPTCHA_LENGTH) : '';
|
261 |
-
$fileName = isset($data['fileName']) ? substr($data['fileName'], 0, strlen($data['fileName']) - 4) : '';
|
262 |
-
if (!($this->helper->checkCaptchaFile($key, $fileName, $captcha))) {
|
263 |
-
$messageArray['code'] = 'wc_invalid_captcha';
|
264 |
-
wp_die(json_encode($messageArray));
|
265 |
-
}
|
266 |
-
}
|
267 |
-
}
|
268 |
-
|
269 |
-
$website_url = '';
|
270 |
-
if ($current_user->ID) {
|
271 |
-
$user_id = $current_user->ID;
|
272 |
-
$user = $current_user;
|
273 |
-
$name = $current_user->display_name;
|
274 |
-
$email = $current_user->user_email;
|
275 |
-
} else {
|
276 |
-
$user_id = 0;
|
277 |
-
$name = isset($data['wc_name']) ? filter_var($data['wc_name']) : '';
|
278 |
-
$email = isset($data['wc_email']) ? trim($data['wc_email']) : '';
|
279 |
-
$website_url = isset($data['wc_website']) ? trim($data['wc_website']) : '';
|
280 |
-
|
281 |
-
if ($website_url != '' && (strpos($website_url, 'http://') !== '' && strpos($website_url, 'http://') !== 0) && (strpos($website_url, 'https://') !== '' && strpos($website_url, 'https://') !== 0)) {
|
282 |
-
$website_url = 'http://' . $website_url;
|
283 |
}
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
286 |
}
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
292 |
}
|
293 |
}
|
|
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
-
if ($
|
301 |
-
$
|
302 |
-
wp_die(json_encode($messageArray));
|
303 |
}
|
304 |
-
|
305 |
-
|
306 |
-
$commentMinLength = intval($this->optionsSerialized->commentTextMinLength);
|
307 |
-
$commentMaxLength = intval($this->optionsSerialized->commentTextMaxLength);
|
308 |
-
$contentLength = function_exists('mb_strlen') ? mb_strlen($comment_content) : strlen($comment_content);
|
309 |
-
if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
|
310 |
-
$messageArray['code'] = 'wc_msg_input_min_length';
|
311 |
-
wp_die(json_encode($messageArray));
|
312 |
}
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
|
|
317 |
}
|
|
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
$wc_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
324 |
-
$new_commentdata = array(
|
325 |
-
'user_id' => $user_id,
|
326 |
-
'comment_post_ID' => $postId,
|
327 |
-
'comment_parent' => $comment_parent,
|
328 |
-
'comment_author' => $name,
|
329 |
-
'comment_author_email' => $email,
|
330 |
-
'comment_content' => $comment_content,
|
331 |
-
'comment_author_url' => $website_url,
|
332 |
-
'comment_author_IP' => $author_ip,
|
333 |
-
'comment_agent' => $wc_user_agent,
|
334 |
-
'comment_type' => ''
|
335 |
-
);
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
-
$messageArray['code'] = $wpdiscuz_unique_id;
|
355 |
-
$messageArray['redirect'] = $this->optionsSerialized->redirectPage;
|
356 |
-
$messageArray['new_comment_id'] = $new_comment_id;
|
357 |
-
$messageArray['user_name'] = $name;
|
358 |
-
$messageArray['user_email'] = $email;
|
359 |
-
$messageArray['is_main'] = $comment_parent ? 0 : 1;
|
360 |
-
$messageArray['held_moderate'] = $held_moderate;
|
361 |
-
$messageArray['is_in_same_container'] = $isInSameContainer;
|
362 |
-
$messageArray['wc_all_comments_count_new'] = $this->dbManager->getCommentsCount($postId);
|
363 |
-
$commentListArgs = $this->getCommentListArgs($postId);
|
364 |
-
$commentListArgs['current_user'] = $current_user;
|
365 |
-
$commentListArgs['addComment'] = $wc_comment_depth;
|
366 |
-
$messageArray['message'] = wp_list_comments($commentListArgs, array($newComment));
|
367 |
-
} else {
|
368 |
-
$messageArray['code'] = 'wc_invalid_field';
|
369 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
} else {
|
371 |
$messageArray['code'] = 'wc_invalid_field';
|
372 |
}
|
@@ -380,52 +366,45 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
380 |
* get comment text from db
|
381 |
*/
|
382 |
public function editComment() {
|
383 |
-
$
|
384 |
-
$
|
385 |
-
if ($
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
394 |
} else {
|
395 |
-
$
|
396 |
-
$isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
|
397 |
-
if (isset($current_user) && $comment->user_id == $current_user->ID && $isEditable) {
|
398 |
-
$message_array['code'] = 1;
|
399 |
-
$message_array['message'] = $comment->comment_content;
|
400 |
-
} else {
|
401 |
-
$message_array['code'] = 'wc_comment_edit_not_possible';
|
402 |
-
}
|
403 |
}
|
404 |
-
} else {
|
405 |
-
$message_array['code'] = 'wc_comment_edit_not_possible';
|
406 |
}
|
407 |
} else {
|
408 |
-
$
|
409 |
}
|
410 |
-
|
|
|
411 |
}
|
412 |
|
413 |
/**
|
414 |
* save edited comment via ajax
|
415 |
*/
|
416 |
public function saveEditedComment() {
|
417 |
-
$
|
418 |
-
$
|
419 |
-
|
420 |
-
|
421 |
-
$commentId = intval($data['commentId']);
|
422 |
$comment = get_comment($commentId);
|
423 |
$current_user = wp_get_current_user();
|
424 |
-
$trimmedCommentContent = trim($data['commentContent']);
|
425 |
$isCurrentUserCanEdit = isset($current_user) && ($comment->user_id == $current_user->ID || current_user_can('edit_comment', $comment->comment_ID));
|
426 |
-
if ($
|
427 |
-
if ($
|
428 |
-
$commentContent = wp_kses($
|
429 |
$author_ip = $this->helper->getRealIPAddr();
|
430 |
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
431 |
$commentarr = array(
|
@@ -437,53 +416,48 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
437 |
);
|
438 |
if (wp_update_comment(wp_slash($commentarr))) {
|
439 |
$uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
|
440 |
-
$
|
441 |
if ($this->optionsSerialized->commentReadMoreLimit && count(explode(' ', strip_tags($commentContent))) > $this->optionsSerialized->commentReadMoreLimit) {
|
442 |
$commentContent = $this->helper->getCommentExcerpt($commentContent, $uniqueId);
|
443 |
}
|
444 |
$commentContent = apply_filters('comment_text', $commentContent);
|
445 |
$commentContent = $this->helper->makeClickable($commentContent);
|
446 |
-
$
|
447 |
} else {
|
448 |
-
$
|
449 |
}
|
450 |
} else {
|
451 |
-
$
|
452 |
}
|
453 |
} else {
|
454 |
-
$
|
455 |
}
|
456 |
-
} else {
|
457 |
-
$message_array['code'] = 'wc_comment_edit_not_possible';
|
458 |
}
|
459 |
-
wp_die(json_encode($
|
460 |
}
|
461 |
|
462 |
public function getSingleComment() {
|
463 |
global $current_user;
|
464 |
get_currentuserinfo();
|
465 |
$messageArray = array();
|
466 |
-
$
|
467 |
-
|
468 |
-
|
469 |
-
$
|
470 |
-
$
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
$commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
|
481 |
-
$commentListArgs['current_user'] = $current_user;
|
482 |
-
$messageArray['message'] = wp_list_comments($commentListArgs, $comments);
|
483 |
-
}
|
484 |
$this->commentsArgs['caller'] = '';
|
485 |
wp_die(json_encode($messageArray));
|
486 |
}
|
|
|
487 |
}
|
488 |
|
489 |
/**
|
@@ -491,17 +465,14 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
491 |
*/
|
492 |
public function redirect() {
|
493 |
$messageArray = array();
|
494 |
-
|
495 |
-
|
496 |
-
$
|
497 |
-
if ($
|
498 |
-
$
|
499 |
-
if ($
|
500 |
-
$
|
501 |
-
|
502 |
-
$messageArray['code'] = 1;
|
503 |
-
$messageArray['redirect_to'] = get_permalink($this->optionsSerialized->redirectPage);
|
504 |
-
}
|
505 |
}
|
506 |
}
|
507 |
}
|
@@ -510,23 +481,22 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
510 |
}
|
511 |
|
512 |
public function loadMoreComments() {
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
$limit = ($this->optionsSerialized->commentListLoadType == 1) ? 0 : $this->optionsSerialized->wordpressCommentPerPage;
|
517 |
$args = array('limit' => $limit);
|
518 |
-
$orderBy = trim($
|
519 |
-
$args['offset'] = isset($
|
520 |
if ($orderBy == 'by_vote') {
|
521 |
$args['orderby'] = $orderBy;
|
522 |
} else {
|
523 |
-
$order = trim($
|
524 |
-
$args['
|
525 |
-
$args['last_parent_id'] = intval($data['lastParentId']);
|
526 |
}
|
527 |
$args['post_id'] = $postId;
|
528 |
-
$
|
529 |
-
wp_die(json_encode($
|
530 |
}
|
531 |
}
|
532 |
|
@@ -535,49 +505,45 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
535 |
wp_die();
|
536 |
}
|
537 |
$messageArray = array();
|
538 |
-
$commentId = '';
|
539 |
$isUserLoggedIn = is_user_logged_in();
|
540 |
if (!$this->optionsSerialized->isGuestCanVote && !$isUserLoggedIn) {
|
541 |
$messageArray['code'] = 'wc_login_to_vote';
|
542 |
wp_die(json_encode($messageArray));
|
543 |
}
|
544 |
-
if (isset($_POST['wpdiscuzAjaxData'])) {
|
545 |
-
parse_str($_POST['wpdiscuzAjaxData'], $data);
|
546 |
-
$commentId = intval($data['commentId']);
|
547 |
-
$voteType = intval($data['voteType']);
|
548 |
-
if ($commentId && $voteType) {
|
549 |
-
$userIdOrIp = $isUserLoggedIn ? get_current_user_id() : $this->helper->getRealIPAddr();
|
550 |
-
$isUserVoted = $this->dbManager->isUserVoted($userIdOrIp, $commentId);
|
551 |
-
$comment = get_comment($commentId);
|
552 |
-
if (!$isUserLoggedIn && $comment->comment_author_IP == $userIdOrIp) {
|
553 |
-
$messageArray['code'] = 'wc_deny_voting_from_same_ip';
|
554 |
-
wp_die(json_encode($messageArray));
|
555 |
-
}
|
556 |
-
if ($comment->user_id == $userIdOrIp) {
|
557 |
-
$messageArray['code'] = 'wc_self_vote';
|
558 |
-
wp_die(json_encode($messageArray));
|
559 |
-
}
|
560 |
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
$voteCount = intval(get_comment_meta($commentId, self::META_KEY_VOTES, true)) + $voteType;
|
575 |
update_comment_meta($commentId, self::META_KEY_VOTES, '' . $voteCount);
|
576 |
-
do_action('
|
577 |
$messageArray['code'] = 1;
|
|
|
|
|
578 |
}
|
579 |
} else {
|
580 |
-
$
|
|
|
|
|
|
|
|
|
581 |
}
|
582 |
} else {
|
583 |
$messageArray['code'] = 'wc_voting_error';
|
@@ -587,26 +553,24 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
587 |
|
588 |
public function wpdiscuzSorting() {
|
589 |
$messageArray = array();
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
$args['orderby'] = 'comment_date_gmt';
|
601 |
-
}
|
602 |
-
$data = $this->getWPComments($args);
|
603 |
-
$messageArray['code'] = 1;
|
604 |
-
$messageArray['loadCount'] = 1;
|
605 |
-
$messageArray['last_parent_id'] = $data['last_parent_id'];
|
606 |
-
$messageArray['is_show_load_more'] = $data['is_show_load_more'];
|
607 |
-
$messageArray['message'] = $data['comment_list'];
|
608 |
-
wp_die(json_encode($messageArray));
|
609 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
}
|
611 |
wp_die();
|
612 |
}
|
@@ -616,18 +580,15 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
616 |
*/
|
617 |
public function readMore() {
|
618 |
$messageArray = array();
|
619 |
-
|
620 |
-
|
621 |
-
$commentId = intval(trim($data['commentId']));
|
622 |
$comment = get_comment($commentId);
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
wp_die(json_encode($messageArray));
|
630 |
-
}
|
631 |
}
|
632 |
$messageArray['code'] = 0;
|
633 |
$messageArray['message'] = 'error';
|
@@ -761,7 +722,6 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
761 |
public function frontEndStylesScripts() {
|
762 |
global $post;
|
763 |
if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && (is_singular() || is_front_page()) && post_type_supports($post->post_type, 'comments')) {
|
764 |
-
|
765 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
766 |
wp_register_style('wpdiscuz-frontend-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/wpdiscuz.min.css'), null, $this->version);
|
767 |
wp_enqueue_style('wpdiscuz-frontend-css');
|
@@ -791,6 +751,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
791 |
$this->wpdiscuzOptionsJs['version'] = $this->version;
|
792 |
$this->wpdiscuzOptionsJs['wc_post_id'] = $post->ID;
|
793 |
$this->wpdiscuzOptionsJs['loadLastCommentId'] = $this->dbManager->getLastCommentId($post->ID);
|
|
|
794 |
wp_register_script('wpdiscuz-ajax-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/wpdiscuz.min.js'), array('jquery'), $this->version);
|
795 |
wp_enqueue_script('wpdiscuz-ajax-js');
|
796 |
wp_localize_script('wpdiscuz-ajax-js', 'wpdiscuz_ajax_obj', array('url' => admin_url('admin-ajax.php'), 'wpdiscuz_options' => $this->wpdiscuzOptionsJs));
|
@@ -800,10 +761,9 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
800 |
|
801 |
public function pluginNewVersion() {
|
802 |
$this->dbManager->createEmailNotificationTable();
|
803 |
-
$wc_plugin_data = get_plugin_data(__FILE__);
|
804 |
if (version_compare($wc_plugin_data['Version'], $this->version, '>')) {
|
805 |
-
$options = get_option(self::OPTION_SLUG_OPTIONS);
|
806 |
-
$this->changeOldOptions($options);
|
807 |
$this->addNewOptions($options);
|
808 |
$this->addNewPhrases();
|
809 |
if ($this->version === '1.0.0') {
|
@@ -862,8 +822,12 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
862 |
$this->optionsSerialized->commentListLoadType = 1;
|
863 |
}
|
864 |
if (!@is_writable($this->helper->captchaDir)) {
|
865 |
-
$this->optionsSerialized->isCaptchaInSession
|
|
|
|
|
|
|
866 |
}
|
|
|
867 |
}
|
868 |
|
869 |
// Add settings link on plugin page
|
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.2.2
|
7 |
* Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
|
8 |
* Author URI: http://gvectors.com/
|
9 |
* Plugin URI: http://wpdiscuz.com/
|
107 |
add_action('wp_ajax_nopriv_saveEditedComment', array(&$this, 'saveEditedComment'));
|
108 |
}
|
109 |
if ($this->optionsSerialized->commentListUpdateType) {
|
110 |
+
add_action('wp_ajax_updateAutomatically', array(&$this, 'updateAutomatically'));
|
111 |
+
add_action('wp_ajax_nopriv_updateAutomatically', array(&$this, 'updateAutomatically'));
|
112 |
add_action('wp_ajax_updateOnClick', array(&$this, 'updateOnClick'));
|
113 |
add_action('wp_ajax_nopriv_updateOnClick', array(&$this, 'updateOnClick'));
|
114 |
}
|
125 |
load_plugin_textdomain('wpdiscuz', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
126 |
}
|
127 |
|
128 |
+
public function updateAutomatically() {
|
129 |
+
global $currentUser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
get_currentuserinfo();
|
131 |
$messageArray = array();
|
132 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
133 |
+
$loadLastCommentId = isset($_POST['loadLastCommentId']) ? intval($_POST['loadLastCommentId']) : 0;
|
134 |
+
$visibleCommentIds = isset($_POST['visibleCommentIds']) ? trim($_POST['visibleCommentIds'], ',') : '';
|
135 |
+
$sentEmail = isset($_POST['email']) ? trim($_POST['email']) : '';
|
136 |
+
$email = $currentUser->ID ? $currentUser->user_email : $sentEmail;
|
137 |
+
if ($visibleCommentIds && $postId && $loadLastCommentId && $email) {
|
138 |
$lastCommentId = $this->dbManager->getLastCommentId($postId);
|
139 |
if ($lastCommentId > $loadLastCommentId) {
|
140 |
$messageArray['code'] = 1;
|
141 |
$messageArray['loadLastCommentId'] = $lastCommentId;
|
142 |
$commentListArgs = $this->getCommentListArgs($postId);
|
143 |
$commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
|
144 |
+
$commentListArgs['current_user'] = $currentUser;
|
145 |
if ($this->optionsSerialized->commentListUpdateType == 1) {
|
146 |
$visibleCommentIds = explode(',', $visibleCommentIds);
|
147 |
$newCommentIds = $this->dbManager->getNewCommentIds($postId, $loadLastCommentId, $email);
|
187 |
}
|
188 |
|
189 |
public function updateOnClick() {
|
190 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
191 |
+
$newCommentIds = isset($_POST['newCommentIds']) ? trim($_POST['newCommentIds']) : '';
|
192 |
+
|
193 |
+
if ($postId && $newCommentIds) {
|
194 |
+
global $currentUser;
|
195 |
get_currentuserinfo();
|
196 |
+
$messageArray['code'] = 1;
|
197 |
+
$newCommentIds = explode(',', trim($newCommentIds, ','));
|
198 |
+
$postId = trim(intval($postId));
|
199 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
200 |
+
$commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
|
201 |
+
$commentListArgs['current_user'] = $currentUser;
|
202 |
+
$messageArray['message'] = array();
|
203 |
+
foreach ($newCommentIds as $newCommentId) {
|
204 |
+
$comment = get_comment($newCommentId);
|
205 |
+
$commentHtml = wp_list_comments($commentListArgs, array($comment));
|
206 |
+
$commentObject = array('comment_parent' => $comment->comment_parent, 'comment_html' => $commentHtml);
|
207 |
+
$messageArray['message'][] = $commentObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
209 |
+
wp_die(json_encode($messageArray));
|
210 |
}
|
211 |
wp_die();
|
212 |
}
|
213 |
|
214 |
public function addComment() {
|
215 |
$messageArray = array();
|
|
|
216 |
$isAnonymous = false;
|
217 |
+
$uniqueId = isset($_POST['wpdiscuz_unique_id']) ? trim($_POST['wpdiscuz_unique_id']) : '';
|
218 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : '';
|
219 |
+
$formNonce = isset($_POST['wpdiscuz_comment_form_nonce']) ? trim($_POST['wpdiscuz_comment_form_nonce']) : '';
|
220 |
+
if ($uniqueId && $postId && wp_verify_nonce($formNonce, self::ACTION_FORM_NONCE)) {
|
221 |
+
do_action('wpdiscuz_add_comment');
|
222 |
+
if (function_exists('zerospam_get_key') && isset($_POST['wpdiscuz_zs']) && $wpdiscuzZS = $_POST['wpdiscuz_zs']) {
|
223 |
+
$_POST['zerospam_key'] = $wpdiscuzZS == md5(zerospam_get_key()) ? zerospam_get_key() : '';
|
224 |
}
|
225 |
+
$commentDepth = isset($_POST['wc_comment_depth']) && intval($_POST['wc_comment_depth']) ? intval($_POST['wc_comment_depth']) : 1;
|
226 |
+
$isInSameContainer = '1';
|
227 |
+
global $current_user;
|
228 |
+
get_currentuserinfo();
|
229 |
+
if ($commentDepth > $this->optionsSerialized->wordpressThreadCommentsDepth) {
|
230 |
+
$commentDepth = $this->optionsSerialized->wordpressThreadCommentsDepth;
|
231 |
+
$isInSameContainer = '0';
|
232 |
+
} else if (!$this->optionsSerialized->wordpressThreadComments) {
|
233 |
+
$isInSameContainer = '0';
|
234 |
+
}
|
235 |
+
$notificationType = isset($_POST['wpdiscuz_notification_type']) ? $_POST['wpdiscuz_notification_type'] : '';
|
236 |
+
if ($this->helper->isShowCaptcha($current_user->ID) && !class_exists("wpDiscuzReCaptcha")) {
|
237 |
+
$captcha = isset($_POST['wc_captcha']) ? trim($_POST['wc_captcha']) : '';
|
238 |
+
if ($this->optionsSerialized->isCaptchaInSession) {
|
239 |
+
if (!session_id()) {
|
240 |
+
session_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
+
$cnonce = isset($_POST['cnonce']) ? trim($_POST['cnonce']) : '';
|
243 |
+
$sCaptcha = isset($_SESSION['wpdiscuzc'][$cnonce]) ? $_SESSION['wpdiscuzc'][$cnonce] : false;
|
244 |
+
if (!$sCaptcha || md5(strtolower($captcha)) !== $sCaptcha) {
|
245 |
+
$messageArray['code'] = 'wc_invalid_captcha';
|
246 |
+
wp_die(json_encode($messageArray));
|
247 |
}
|
248 |
+
} else {
|
249 |
+
$key = isset($_POST['cnonce']) ? substr(trim($_POST['cnonce']), self::CAPTCHA_LENGTH) : '';
|
250 |
+
$fileName = isset($_POST['fileName']) ? substr(trim($_POST['fileName']), 0, strlen(trim($_POST['fileName'])) - 4) : '';
|
251 |
+
if (!($this->helper->checkCaptchaFile($key, $fileName, $captcha))) {
|
252 |
+
$messageArray['code'] = 'wc_invalid_captcha';
|
253 |
+
wp_die(json_encode($messageArray));
|
254 |
}
|
255 |
}
|
256 |
+
}
|
257 |
|
258 |
+
$website_url = '';
|
259 |
+
if ($current_user->ID) {
|
260 |
+
$user_id = $current_user->ID;
|
261 |
+
$user = $current_user;
|
262 |
+
$name = $current_user->display_name;
|
263 |
+
$email = $current_user->user_email;
|
264 |
+
} else {
|
265 |
+
$user_id = 0;
|
266 |
+
$name = isset($_POST['wc_name']) ? filter_var($_POST['wc_name']) : '';
|
267 |
+
$email = isset($_POST['wc_email']) ? trim($_POST['wc_email']) : '';
|
268 |
+
$website_url = isset($_POST['wc_website']) ? trim($_POST['wc_website']) : '';
|
269 |
|
270 |
+
if ($website_url != '' && (strpos($website_url, 'http://') !== '' && strpos($website_url, 'http://') !== 0) && (strpos($website_url, 'https://') !== '' && strpos($website_url, 'https://') !== 0)) {
|
271 |
+
$website_url = 'http://' . $website_url;
|
|
|
272 |
}
|
273 |
+
if (!$this->optionsSerialized->isNameFieldRequired) {
|
274 |
+
$name = !($name) ? __('Anonymous', 'wpdiscuz') : $name;
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
}
|
276 |
+
if (!$this->optionsSerialized->isEmailFieldRequired) {
|
277 |
+
if (!$email) {
|
278 |
+
$email = uniqid() . '@example.com';
|
279 |
+
$isAnonymous = true;
|
280 |
+
}
|
281 |
}
|
282 |
+
}
|
283 |
|
284 |
+
if ($website_url != '' && (filter_var($website_url, FILTER_VALIDATE_URL) === false)) {
|
285 |
+
$messageArray['code'] = 'wc_error_url_text';
|
286 |
+
wp_die(json_encode($messageArray));
|
287 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
289 |
+
if ($email != '' && filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
|
290 |
+
$messageArray['code'] = 'wc_error_email_text';
|
291 |
+
wp_die(json_encode($messageArray));
|
292 |
+
}
|
293 |
+
|
294 |
+
$comment_content = wp_kses(stripslashes(trim($_POST['wc_comment'])), $this->helper->wc_allowed_tags);
|
295 |
+
$commentMinLength = intval($this->optionsSerialized->commentTextMinLength);
|
296 |
+
$commentMaxLength = intval($this->optionsSerialized->commentTextMaxLength);
|
297 |
+
$contentLength = function_exists('mb_strlen') ? mb_strlen($comment_content) : strlen($comment_content);
|
298 |
+
if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
|
299 |
+
$messageArray['code'] = 'wc_msg_input_min_length';
|
300 |
+
wp_die(json_encode($messageArray));
|
301 |
+
}
|
302 |
+
|
303 |
+
if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
|
304 |
+
$messageArray['code'] = 'wc_msg_input_max_length';
|
305 |
+
wp_die(json_encode($messageArray));
|
306 |
+
}
|
307 |
+
|
308 |
+
if ($name && $email && $comment_content) {
|
309 |
+
$author_ip = $this->helper->getRealIPAddr();
|
310 |
+
$uid_data = $this->helper->getUIDData($uniqueId);
|
311 |
+
$comment_parent = $uid_data[0];
|
312 |
+
$wc_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
313 |
+
$new_commentdata = array(
|
314 |
+
'user_id' => $user_id,
|
315 |
+
'comment_post_ID' => $postId,
|
316 |
+
'comment_parent' => $comment_parent,
|
317 |
+
'comment_author' => $name,
|
318 |
+
'comment_author_email' => $email,
|
319 |
+
'comment_content' => $comment_content,
|
320 |
+
'comment_author_url' => $website_url,
|
321 |
+
'comment_author_IP' => $author_ip,
|
322 |
+
'comment_agent' => $wc_user_agent,
|
323 |
+
'comment_type' => ''
|
324 |
+
);
|
325 |
+
|
326 |
+
$new_comment_id = wp_new_comment(wp_slash($new_commentdata));
|
327 |
+
$newComment = get_comment($new_comment_id);
|
328 |
+
$held_moderate = 1;
|
329 |
+
if ($newComment->comment_approved) {
|
330 |
+
$held_moderate = 0;
|
331 |
+
}
|
332 |
+
if ($notificationType == WpdiscuzCore::SUBSCRIPTION_POST && class_exists('Prompt_Comment_Form_Handling') && $this->optionsSerialized->usePostmaticForCommentNotification) {
|
333 |
+
$_POST[Prompt_Comment_Form_Handling::SUBSCRIBE_CHECKBOX_NAME] = 1;
|
334 |
+
Prompt_Comment_Form_Handling::handle_form($new_comment_id, $newComment->comment_approved);
|
335 |
+
} else if (!$isAnonymous && $notificationType) {
|
336 |
+
if ($current_user->ID && $this->optionsSerialized->disableMemberConfirm) {
|
337 |
+
$this->dbManager->addEmailNotification($new_comment_id, $postId, $email, self::SUBSCRIPTION_COMMENT, 1);
|
338 |
+
} else {
|
339 |
+
$this->dbManager->addEmailNotification($new_comment_id, $postId, $email, self::SUBSCRIPTION_COMMENT);
|
340 |
+
$this->emailHelper->confirmEmailSender($postId, $email);
|
341 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
+
$messageArray['code'] = $uniqueId;
|
344 |
+
$messageArray['redirect'] = $this->optionsSerialized->redirectPage;
|
345 |
+
$messageArray['new_comment_id'] = $new_comment_id;
|
346 |
+
$messageArray['user_name'] = $name;
|
347 |
+
$messageArray['user_email'] = $email;
|
348 |
+
$messageArray['is_main'] = $comment_parent ? 0 : 1;
|
349 |
+
$messageArray['held_moderate'] = $held_moderate;
|
350 |
+
$messageArray['is_in_same_container'] = $isInSameContainer;
|
351 |
+
$messageArray['wc_all_comments_count_new'] = $this->dbManager->getCommentsCount($postId);
|
352 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
353 |
+
$commentListArgs['current_user'] = $current_user;
|
354 |
+
$commentListArgs['addComment'] = $commentDepth;
|
355 |
+
$messageArray['message'] = wp_list_comments($commentListArgs, array($newComment));
|
356 |
} else {
|
357 |
$messageArray['code'] = 'wc_invalid_field';
|
358 |
}
|
366 |
* get comment text from db
|
367 |
*/
|
368 |
public function editComment() {
|
369 |
+
$messageArray = array();
|
370 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
371 |
+
if ($commentId) {
|
372 |
+
$comment = get_comment($commentId);
|
373 |
+
if (current_user_can('edit_comment', $comment->comment_ID)) {
|
374 |
+
$messageArray['code'] = 1;
|
375 |
+
$messageArray['message'] = $comment->comment_content;
|
376 |
+
} else {
|
377 |
+
$current_user = wp_get_current_user();
|
378 |
+
$isInRange = $this->helper->isContentInRange($comment->comment_content);
|
379 |
+
$isEditable = $this->optionsSerialized->commentEditableTime == 'unlimit' ? true && $isInRange : $this->helper->isCommentEditable($comment) && $isInRange;
|
380 |
+
if (isset($current_user) && $comment->user_id == $current_user->ID && $isEditable) {
|
381 |
+
$messageArray['code'] = 1;
|
382 |
+
$messageArray['message'] = $comment->comment_content;
|
383 |
} else {
|
384 |
+
$messageArray['code'] = 'wc_comment_edit_not_possible';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
}
|
|
|
|
|
386 |
}
|
387 |
} else {
|
388 |
+
$messageArray['code'] = 'wc_comment_edit_not_possible';
|
389 |
}
|
390 |
+
|
391 |
+
wp_die(json_encode($messageArray));
|
392 |
}
|
393 |
|
394 |
/**
|
395 |
* save edited comment via ajax
|
396 |
*/
|
397 |
public function saveEditedComment() {
|
398 |
+
$messageArray = array();
|
399 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
400 |
+
$trimmedContent = isset($_POST['commentContent']) ? trim($_POST['commentContent']) : '';
|
401 |
+
if ($commentId && $trimmedContent) {
|
|
|
402 |
$comment = get_comment($commentId);
|
403 |
$current_user = wp_get_current_user();
|
|
|
404 |
$isCurrentUserCanEdit = isset($current_user) && ($comment->user_id == $current_user->ID || current_user_can('edit_comment', $comment->comment_ID));
|
405 |
+
if ($this->helper->isContentInRange($trimmedContent) && $isCurrentUserCanEdit) {
|
406 |
+
if ($trimmedContent != $comment->comment_content) {
|
407 |
+
$commentContent = wp_kses(stripslashes($trimmedContent), $this->helper->wc_allowed_tags);
|
408 |
$author_ip = $this->helper->getRealIPAddr();
|
409 |
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
410 |
$commentarr = array(
|
416 |
);
|
417 |
if (wp_update_comment(wp_slash($commentarr))) {
|
418 |
$uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
|
419 |
+
$messageArray['code'] = 1;
|
420 |
if ($this->optionsSerialized->commentReadMoreLimit && count(explode(' ', strip_tags($commentContent))) > $this->optionsSerialized->commentReadMoreLimit) {
|
421 |
$commentContent = $this->helper->getCommentExcerpt($commentContent, $uniqueId);
|
422 |
}
|
423 |
$commentContent = apply_filters('comment_text', $commentContent);
|
424 |
$commentContent = $this->helper->makeClickable($commentContent);
|
425 |
+
$messageArray['message'] = $commentContent;
|
426 |
} else {
|
427 |
+
$messageArray['code'] = 'wc_comment_not_updated';
|
428 |
}
|
429 |
} else {
|
430 |
+
$messageArray['code'] = 'wc_comment_not_edited';
|
431 |
}
|
432 |
} else {
|
433 |
+
$messageArray['code'] = 'wc_comment_edit_not_possible';
|
434 |
}
|
|
|
|
|
435 |
}
|
436 |
+
wp_die(json_encode($messageArray));
|
437 |
}
|
438 |
|
439 |
public function getSingleComment() {
|
440 |
global $current_user;
|
441 |
get_currentuserinfo();
|
442 |
$messageArray = array();
|
443 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
444 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
445 |
+
if ($commentId && $postId) {
|
446 |
+
$parentComment = $this->optimizationHelper->getCommentRoot($commentId);
|
447 |
+
$tree = array();
|
448 |
+
$tree = $this->optimizationHelper->getTreeByParentId($parentComment->comment_ID, $tree);
|
449 |
+
$this->commentsArgs = $this->getDefaultCommentsArgs();
|
450 |
+
$this->commentsArgs['wc_comments'] = array_merge(array($parentComment->comment_ID), $tree);
|
451 |
+
$comments = get_comments($this->commentsArgs);
|
452 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
453 |
+
$commentListArgs['isSingle'] = true;
|
454 |
+
$commentListArgs['new_loaded_class'] = 'wc-new-loaded-comment';
|
455 |
+
$commentListArgs['current_user'] = $current_user;
|
456 |
+
$messageArray['message'] = wp_list_comments($commentListArgs, $comments);
|
|
|
|
|
|
|
|
|
457 |
$this->commentsArgs['caller'] = '';
|
458 |
wp_die(json_encode($messageArray));
|
459 |
}
|
460 |
+
wp_die();
|
461 |
}
|
462 |
|
463 |
/**
|
465 |
*/
|
466 |
public function redirect() {
|
467 |
$messageArray = array();
|
468 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
469 |
+
if ($this->optionsSerialized->redirectPage && $commentId) {
|
470 |
+
$comment = get_comment($commentId);
|
471 |
+
if ($comment->comment_ID) {
|
472 |
+
$userCommentCount = get_comments(array('author_email' => $comment->comment_author_email, 'count' => true));
|
473 |
+
if ($userCommentCount == 1) {
|
474 |
+
$messageArray['code'] = 1;
|
475 |
+
$messageArray['redirect_to'] = get_permalink($this->optionsSerialized->redirectPage);
|
|
|
|
|
|
|
476 |
}
|
477 |
}
|
478 |
}
|
481 |
}
|
482 |
|
483 |
public function loadMoreComments() {
|
484 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
485 |
+
$lastParentId = isset($_POST['lastParentId']) ? intval($_POST['lastParentId']) : 0;
|
486 |
+
if ($lastParentId && $postId) {
|
487 |
$limit = ($this->optionsSerialized->commentListLoadType == 1) ? 0 : $this->optionsSerialized->wordpressCommentPerPage;
|
488 |
$args = array('limit' => $limit);
|
489 |
+
$orderBy = isset($_POST['orderBy']) ? trim($_POST['orderBy']) : '';
|
490 |
+
$args['offset'] = isset($_POST['offset']) && trim($_POST['offset']) ? intval($_POST['offset']) * $this->optionsSerialized->wordpressCommentPerPage : 0;
|
491 |
if ($orderBy == 'by_vote') {
|
492 |
$args['orderby'] = $orderBy;
|
493 |
} else {
|
494 |
+
$args['order'] = isset($_POST['order']) && trim($_POST['order']) ? trim($_POST['order']) : $this->optionsSerialized->wordpressCommentOrder;
|
495 |
+
$args['last_parent_id'] = $lastParentId;
|
|
|
496 |
}
|
497 |
$args['post_id'] = $postId;
|
498 |
+
$commentData = $this->getWPComments($args);
|
499 |
+
wp_die(json_encode($commentData));
|
500 |
}
|
501 |
}
|
502 |
|
505 |
wp_die();
|
506 |
}
|
507 |
$messageArray = array();
|
|
|
508 |
$isUserLoggedIn = is_user_logged_in();
|
509 |
if (!$this->optionsSerialized->isGuestCanVote && !$isUserLoggedIn) {
|
510 |
$messageArray['code'] = 'wc_login_to_vote';
|
511 |
wp_die(json_encode($messageArray));
|
512 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
515 |
+
$voteType = isset($_POST['voteType']) ? intval($_POST['voteType']) : 0;
|
516 |
+
|
517 |
+
if ($commentId && $voteType) {
|
518 |
+
$userIdOrIp = $isUserLoggedIn ? get_current_user_id() : $this->helper->getRealIPAddr();
|
519 |
+
$isUserVoted = $this->dbManager->isUserVoted($userIdOrIp, $commentId);
|
520 |
+
$comment = get_comment($commentId);
|
521 |
+
if (!$isUserLoggedIn && $comment->comment_author_IP == $userIdOrIp) {
|
522 |
+
$messageArray['code'] = 'wc_deny_voting_from_same_ip';
|
523 |
+
wp_die(json_encode($messageArray));
|
524 |
+
}
|
525 |
+
if ($comment->user_id == $userIdOrIp) {
|
526 |
+
$messageArray['code'] = 'wc_self_vote';
|
527 |
+
wp_die(json_encode($messageArray));
|
528 |
+
}
|
529 |
+
|
530 |
+
if ($isUserVoted != '') {
|
531 |
+
$vote = intval($isUserVoted) + $voteType;
|
532 |
+
if ($vote >= -1 && $vote <= 1) {
|
533 |
+
$this->dbManager->updateVoteType($userIdOrIp, $commentId, $vote);
|
534 |
$voteCount = intval(get_comment_meta($commentId, self::META_KEY_VOTES, true)) + $voteType;
|
535 |
update_comment_meta($commentId, self::META_KEY_VOTES, '' . $voteCount);
|
536 |
+
do_action('wpdiscuz_update_vote', $voteType, $isUserVoted, $comment);
|
537 |
$messageArray['code'] = 1;
|
538 |
+
} else {
|
539 |
+
$messageArray['code'] = 'wc_vote_only_one_time';
|
540 |
}
|
541 |
} else {
|
542 |
+
$this->dbManager->addVoteType($userIdOrIp, $commentId, $voteType, intval($isUserLoggedIn));
|
543 |
+
$voteCount = intval(get_comment_meta($commentId, self::META_KEY_VOTES, true)) + $voteType;
|
544 |
+
update_comment_meta($commentId, self::META_KEY_VOTES, '' . $voteCount);
|
545 |
+
do_action('wpdiscuz_add_vote', $voteType, $comment);
|
546 |
+
$messageArray['code'] = 1;
|
547 |
}
|
548 |
} else {
|
549 |
$messageArray['code'] = 'wc_voting_error';
|
553 |
|
554 |
public function wpdiscuzSorting() {
|
555 |
$messageArray = array();
|
556 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
557 |
+
$orderBy = isset($_POST['orderBy']) ? trim($_POST['orderBy']) : '';
|
558 |
+
$order = isset($_POST['order']) ? trim($_POST['order']) : '';
|
559 |
+
|
560 |
+
if ($postId && $orderBy && $order) {
|
561 |
+
$args = array('order' => $order, 'post_id' => $postId);
|
562 |
+
if (in_array($orderBy, array('by_vote', 'comment_date_gmt'))) {
|
563 |
+
$args['orderby'] = $orderBy;
|
564 |
+
} else {
|
565 |
+
$args['orderby'] = 'comment_date_gmt';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
+
$commentData = $this->getWPComments($args);
|
568 |
+
$messageArray['code'] = 1;
|
569 |
+
$messageArray['loadCount'] = 1;
|
570 |
+
$messageArray['last_parent_id'] = $commentData['last_parent_id'];
|
571 |
+
$messageArray['is_show_load_more'] = $commentData['is_show_load_more'];
|
572 |
+
$messageArray['message'] = $commentData['comment_list'];
|
573 |
+
wp_die(json_encode($messageArray));
|
574 |
}
|
575 |
wp_die();
|
576 |
}
|
580 |
*/
|
581 |
public function readMore() {
|
582 |
$messageArray = array();
|
583 |
+
$commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
|
584 |
+
if ($commentId) {
|
|
|
585 |
$comment = get_comment($commentId);
|
586 |
+
$commentContent = wp_kses($comment->comment_content, $this->helper->wc_allowed_tags);
|
587 |
+
$commentContent = apply_filters('comment_text', $commentContent);
|
588 |
+
$commentContent = $this->helper->makeClickable($commentContent);
|
589 |
+
$messageArray['code'] = 1;
|
590 |
+
$messageArray['message'] = $commentContent;
|
591 |
+
wp_die(json_encode($messageArray));
|
|
|
|
|
592 |
}
|
593 |
$messageArray['code'] = 0;
|
594 |
$messageArray['message'] = 'error';
|
722 |
public function frontEndStylesScripts() {
|
723 |
global $post;
|
724 |
if ($post && in_array($post->post_type, $this->optionsSerialized->postTypes) && (is_singular() || is_front_page()) && post_type_supports($post->post_type, 'comments')) {
|
|
|
725 |
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
726 |
wp_register_style('wpdiscuz-frontend-css', plugins_url(WPDISCUZ_DIR_NAME . '/assets/css/wpdiscuz.min.css'), null, $this->version);
|
727 |
wp_enqueue_style('wpdiscuz-frontend-css');
|
751 |
$this->wpdiscuzOptionsJs['version'] = $this->version;
|
752 |
$this->wpdiscuzOptionsJs['wc_post_id'] = $post->ID;
|
753 |
$this->wpdiscuzOptionsJs['loadLastCommentId'] = $this->dbManager->getLastCommentId($post->ID);
|
754 |
+
wp_enqueue_script('jquery-form');
|
755 |
wp_register_script('wpdiscuz-ajax-js', plugins_url(WPDISCUZ_DIR_NAME . '/assets/js/wpdiscuz.min.js'), array('jquery'), $this->version);
|
756 |
wp_enqueue_script('wpdiscuz-ajax-js');
|
757 |
wp_localize_script('wpdiscuz-ajax-js', 'wpdiscuz_ajax_obj', array('url' => admin_url('admin-ajax.php'), 'wpdiscuz_options' => $this->wpdiscuzOptionsJs));
|
761 |
|
762 |
public function pluginNewVersion() {
|
763 |
$this->dbManager->createEmailNotificationTable();
|
764 |
+
$wc_plugin_data = get_plugin_data(__FILE__);
|
765 |
if (version_compare($wc_plugin_data['Version'], $this->version, '>')) {
|
766 |
+
$options = $this->changeOldOptions(get_option(self::OPTION_SLUG_OPTIONS));
|
|
|
767 |
$this->addNewOptions($options);
|
768 |
$this->addNewPhrases();
|
769 |
if ($this->version === '1.0.0') {
|
822 |
$this->optionsSerialized->commentListLoadType = 1;
|
823 |
}
|
824 |
if (!@is_writable($this->helper->captchaDir)) {
|
825 |
+
if (isset($this->optionsSerialized->isCaptchaInSession)) {
|
826 |
+
$this->optionsSerialized->isCaptchaInSession = 1;
|
827 |
+
$oldOptions['isCaptchaInSession'] = 1;
|
828 |
+
}
|
829 |
}
|
830 |
+
return $oldOptions;
|
831 |
}
|
832 |
|
833 |
// Add settings link on plugin page
|
includes/class.WpdiscuzCss.php
CHANGED
@@ -19,7 +19,7 @@ class WpdiscuzCss {
|
|
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; ?>;}
|
23 |
<?php
|
24 |
}
|
25 |
}
|
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; ?>;}<?php do_action('wpdiscuz_dynamic_css'); ?></style>
|
23 |
<?php
|
24 |
}
|
25 |
}
|
manager/class.WpdiscuzDBManager.php
CHANGED
@@ -111,7 +111,7 @@ class WpdiscuzDBManager {
|
|
111 |
* add vote type
|
112 |
*/
|
113 |
public function addVoteType($userId, $commentId, $voteType, $isUserLoggedIn) {
|
114 |
-
$sql = $this->db->prepare("INSERT INTO `" . $this->users_voted . "`(`user_id`, `comment_id`, `vote_type`,`is_guest`)VALUES(%s,%d,%d,%d);", $userId, $commentId, $voteType,
|
115 |
return $this->db->query($sql);
|
116 |
}
|
117 |
|
111 |
* add vote type
|
112 |
*/
|
113 |
public function addVoteType($userId, $commentId, $voteType, $isUserLoggedIn) {
|
114 |
+
$sql = $this->db->prepare("INSERT INTO `" . $this->users_voted . "`(`user_id`, `comment_id`, `vote_type`,`is_guest`)VALUES(%s,%d,%d,%d);", $userId, $commentId, $voteType, !$isUserLoggedIn);
|
115 |
return $this->db->query($sql);
|
116 |
}
|
117 |
|
options/class.WpdiscuzOptions.php
CHANGED
@@ -189,8 +189,6 @@ class WpdiscuzOptions {
|
|
189 |
$this->optionsSerialized->phrases['wc_comment_not_edited'] = $_POST['wc_comment_not_edited'];
|
190 |
$this->optionsSerialized->phrases['wc_comment_edit_save_button'] = $_POST['wc_comment_edit_save_button'];
|
191 |
$this->optionsSerialized->phrases['wc_comment_edit_cancel_button'] = $_POST['wc_comment_edit_cancel_button'];
|
192 |
-
$this->optionsSerialized->phrases['wc_msg_comment_text_min_length'] = $_POST['wc_msg_comment_text_min_length'];
|
193 |
-
$this->optionsSerialized->phrases['wc_msg_comment_text_max_length'] = $_POST['wc_msg_comment_text_max_length'];
|
194 |
$this->optionsSerialized->phrases['wc_msg_input_min_length'] = $_POST['wc_msg_input_min_length'];
|
195 |
$this->optionsSerialized->phrases['wc_msg_input_max_length'] = $_POST['wc_msg_input_max_length'];
|
196 |
$this->optionsSerialized->phrases['wc_read_more'] = $_POST['wc_read_more'];
|
@@ -278,5 +276,15 @@ class WpdiscuzOptions {
|
|
278 |
$hash = $viewed;
|
279 |
return $hash;
|
280 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
}
|
189 |
$this->optionsSerialized->phrases['wc_comment_not_edited'] = $_POST['wc_comment_not_edited'];
|
190 |
$this->optionsSerialized->phrases['wc_comment_edit_save_button'] = $_POST['wc_comment_edit_save_button'];
|
191 |
$this->optionsSerialized->phrases['wc_comment_edit_cancel_button'] = $_POST['wc_comment_edit_cancel_button'];
|
|
|
|
|
192 |
$this->optionsSerialized->phrases['wc_msg_input_min_length'] = $_POST['wc_msg_input_min_length'];
|
193 |
$this->optionsSerialized->phrases['wc_msg_input_max_length'] = $_POST['wc_msg_input_max_length'];
|
194 |
$this->optionsSerialized->phrases['wc_read_more'] = $_POST['wc_read_more'];
|
276 |
$hash = $viewed;
|
277 |
return $hash;
|
278 |
}
|
279 |
+
|
280 |
+
public function refreshAddonPage(){
|
281 |
+
$lastHash = get_option('wpdiscuz-addon-note-dismissed');
|
282 |
+
$currentHash = $this->addonHash();
|
283 |
+
if ($lastHash != $currentHash) {
|
284 |
+
?>
|
285 |
+
<script language="javascript">jQuery(document).ready(function () { location.reload(); });</script>
|
286 |
+
<?php
|
287 |
+
}
|
288 |
+
}
|
289 |
|
290 |
}
|
options/class.WpdiscuzOptionsSerialized.php
CHANGED
@@ -588,10 +588,6 @@ class WpdiscuzOptionsSerialized {
|
|
588 |
'wc_comment_not_edited' => __('You\'ve not made any changes', 'wpdiscuz'),
|
589 |
'wc_comment_edit_save_button' => __('Save', 'wpdiscuz'),
|
590 |
'wc_comment_edit_cancel_button' => __('Cancel', 'wpdiscuz'),
|
591 |
-
/* <!-- remove in next versions */
|
592 |
-
'wc_msg_comment_text_min_length' => __('Comment text is too short (minimum %d% characters)', 'wpdiscuz'),
|
593 |
-
'wc_msg_comment_text_max_length' => __('Comment text is too long (maximum %d% characters allowed)', 'wpdiscuz'),
|
594 |
-
/* --> Use messages below instead */
|
595 |
'wc_msg_input_min_length' => __('Input is too short', 'wpdiscuz'),
|
596 |
'wc_msg_input_max_length' => __('Input is too long', 'wpdiscuz'),
|
597 |
'wc_read_more' => __('Read more »', 'wpdiscuz'),
|
@@ -710,7 +706,7 @@ class WpdiscuzOptionsSerialized {
|
|
710 |
'wc_comment_text_max_length' => '',
|
711 |
'commentWordsLimit' => '100',
|
712 |
'showHideCommentLink' => '0',
|
713 |
-
'isCaptchaInSession' => '
|
714 |
'isUserByEmail' => '0',
|
715 |
'commenterNameMinLength' => '3',
|
716 |
'commenterNameMaxLength' => '50',
|
588 |
'wc_comment_not_edited' => __('You\'ve not made any changes', 'wpdiscuz'),
|
589 |
'wc_comment_edit_save_button' => __('Save', 'wpdiscuz'),
|
590 |
'wc_comment_edit_cancel_button' => __('Cancel', 'wpdiscuz'),
|
|
|
|
|
|
|
|
|
591 |
'wc_msg_input_min_length' => __('Input is too short', 'wpdiscuz'),
|
592 |
'wc_msg_input_max_length' => __('Input is too long', 'wpdiscuz'),
|
593 |
'wc_read_more' => __('Read more »', 'wpdiscuz'),
|
706 |
'wc_comment_text_max_length' => '',
|
707 |
'commentWordsLimit' => '100',
|
708 |
'showHideCommentLink' => '0',
|
709 |
+
'isCaptchaInSession' => '1',
|
710 |
'isUserByEmail' => '0',
|
711 |
'commenterNameMinLength' => '3',
|
712 |
'commenterNameMaxLength' => '50',
|
options/html-addons.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php $this->dismissAddonNoteOnPage(); ?>
|
2 |
<div class="wrap wpdiscuz_addons_page">
|
3 |
<div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
|
4 |
<img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>" style="border:2px solid #fff;"/>
|
@@ -69,7 +69,7 @@
|
|
69 |
<div class="addon-desc"><?php echo $addon['desc']; ?></div>
|
70 |
</div>
|
71 |
</div>
|
72 |
-
<script>jQuery(document).ready(function ($) { $('#wpdiscuz-addon-<?php echo $key ?>').contenthover({ overlay_width:290, overlay_height:<?php echo ($installed) ? '100' : '180'; ?>, effect:'slide', slide_direction:'right', overlay_x_position:'right', overlay_y_position:'center', overlay_background:'#e5e5e5', overlay_opacity:0.9}); });</script>
|
73 |
<?php } ?>
|
74 |
</div>
|
75 |
<div style="clear:both;"></div>
|
1 |
+
<?php $this->refreshAddonPage(); $this->dismissAddonNoteOnPage(); ?>
|
2 |
<div class="wrap wpdiscuz_addons_page">
|
3 |
<div style="float:left; width:50px; height:55px; margin:10px 10px 20px 0px;">
|
4 |
<img src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/plugin-icon/plugin-icon-48.png'); ?>" style="border:2px solid #fff;"/>
|
69 |
<div class="addon-desc"><?php echo $addon['desc']; ?></div>
|
70 |
</div>
|
71 |
</div>
|
72 |
+
<script language="javascript">jQuery(document).ready(function ($) { $('#wpdiscuz-addon-<?php echo $key ?>').contenthover({ overlay_width:290, overlay_height:<?php echo ($installed) ? '100' : '180'; ?>, effect:'slide', slide_direction:'right', overlay_x_position:'right', overlay_y_position:'center', overlay_background:'#e5e5e5', overlay_opacity:0.9}); });</script>
|
73 |
<?php } ?>
|
74 |
</div>
|
75 |
<div style="clear:both;"></div>
|
options/options-layouts/settings-integrations.php
CHANGED
@@ -28,10 +28,8 @@ if (!defined('ABSPATH')) {
|
|
28 |
////////////////////////////////////////////////////////////////////////
|
29 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_bp_profile_url', 10, 2);
|
30 |
function wpdiscuz_bp_profile_url($profile_url, $user) {
|
31 |
-
if ($user) {
|
32 |
-
|
33 |
-
$profile_url = bp_core_get_user_domain($user->ID);
|
34 |
-
}
|
35 |
}
|
36 |
return $profile_url;
|
37 |
}
|
@@ -48,10 +46,8 @@ function wpdiscuz_bp_profile_url($profile_url, $user) {
|
|
48 |
////////////////////////////////////////////////////////////////////////
|
49 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_uu_profile_url', 10, 2);
|
50 |
function wpdiscuz_uu_profile_url($profile_url, $user) {
|
51 |
-
if ($user) {
|
52 |
-
|
53 |
-
global $xoouserultra; $profile_url = $xoouserultra->userpanel->get_user_profile_permalink($user->ID);
|
54 |
-
}
|
55 |
}
|
56 |
return $profile_url;
|
57 |
}
|
@@ -68,13 +64,22 @@ function wpdiscuz_uu_profile_url($profile_url, $user) {
|
|
68 |
////////////////////////////////////////////////////////////////////////
|
69 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_up_profile_url', 10, 2);
|
70 |
function wpdiscuz_up_profile_url($profile_url, $user) {
|
71 |
-
if ($user) {
|
72 |
-
|
73 |
-
global $userpro; $profile_url = $userpro->permalink($user->ID);
|
74 |
-
}
|
75 |
}
|
76 |
return $profile_url;
|
77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
</pre>
|
79 |
</div>
|
80 |
</div>
|
@@ -105,10 +110,8 @@ function wpdiscuz_um_author($author_name, $comment) {
|
|
105 |
////////////////////////////////////////////////////////////////////////
|
106 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_um_profile_url', 10, 2);
|
107 |
function wpdiscuz_um_profile_url($profile_url, $user) {
|
108 |
-
if ($user) {
|
109 |
-
|
110 |
-
um_fetch_user($user->ID); $profile_url = um_user_profile_url();
|
111 |
-
}
|
112 |
}
|
113 |
return $profile_url;
|
114 |
}
|
@@ -127,7 +130,6 @@ function wpdiscuz_um_profile_url($profile_url, $user) {
|
|
127 |
add_filter('wpdiscuz_after_label', 'wpdiscuz_mc_after_label_html', 110, 2);
|
128 |
function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
|
129 |
if ($comment->user_id) {
|
130 |
-
// keep your preffered profile plugin and remove others...
|
131 |
if (function_exists('mycred_get_users_rank')) { //User Rank
|
132 |
$afterLabelHtml .= mycred_get_users_rank($comment->user_id, 'logo', 'post-thumbnail', array('class' => 'mycred-rank'));
|
133 |
}
|
@@ -136,13 +138,10 @@ function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
|
|
136 |
if (!empty($users_badges)) {
|
137 |
foreach ($users_badges as $badge_id => $level) {
|
138 |
$imageKey = ( $level > 0 ) ? 'level_image' . $level : 'main_image';
|
139 |
-
$afterLabelHtml .= '
|
140 |
}
|
141 |
}
|
142 |
-
}
|
143 |
-
if (class_exists('userpro_api')) { // userpro user badges
|
144 |
-
$afterLabelHtml .= userpro_show_badges($comment->user_id, $inline = true);
|
145 |
-
}
|
146 |
}
|
147 |
return $afterLabelHtml;
|
148 |
}
|
28 |
////////////////////////////////////////////////////////////////////////
|
29 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_bp_profile_url', 10, 2);
|
30 |
function wpdiscuz_bp_profile_url($profile_url, $user) {
|
31 |
+
if ($user && class_exists('BuddyPress')) {
|
32 |
+
$profile_url = bp_core_get_user_domain($user->ID);
|
|
|
|
|
33 |
}
|
34 |
return $profile_url;
|
35 |
}
|
46 |
////////////////////////////////////////////////////////////////////////
|
47 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_uu_profile_url', 10, 2);
|
48 |
function wpdiscuz_uu_profile_url($profile_url, $user) {
|
49 |
+
if ($user && class_exists('XooUserUltra')) {
|
50 |
+
global $xoouserultra; $profile_url = $xoouserultra->userpanel->get_user_profile_permalink($user->ID);
|
|
|
|
|
51 |
}
|
52 |
return $profile_url;
|
53 |
}
|
64 |
////////////////////////////////////////////////////////////////////////
|
65 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_up_profile_url', 10, 2);
|
66 |
function wpdiscuz_up_profile_url($profile_url, $user) {
|
67 |
+
if ($user && class_exists('userpro_api')) {
|
68 |
+
global $userpro; $profile_url = $userpro->permalink($user->ID);
|
|
|
|
|
69 |
}
|
70 |
return $profile_url;
|
71 |
}
|
72 |
+
|
73 |
+
////////////////////////////////////////////////////////////////////////
|
74 |
+
// User Pro Badges Integration ////////////////////////////
|
75 |
+
////////////////////////////////////////////////////////////////////////
|
76 |
+
add_filter('wpdiscuz_after_label', 'wpdiscuz_up_after_label_html', 110, 2);
|
77 |
+
function wpdiscuz_up_after_label_html($afterLabelHtml, $comment) {
|
78 |
+
if ($comment->user_id && class_exists('userpro_api')) {
|
79 |
+
$afterLabelHtml .= userpro_show_badges($comment->user_id, $inline = true);
|
80 |
+
}
|
81 |
+
return $afterLabelHtml;
|
82 |
+
}
|
83 |
</pre>
|
84 |
</div>
|
85 |
</div>
|
110 |
////////////////////////////////////////////////////////////////////////
|
111 |
add_filter('wpdiscuz_profile_url', 'wpdiscuz_um_profile_url', 10, 2);
|
112 |
function wpdiscuz_um_profile_url($profile_url, $user) {
|
113 |
+
if ($user && class_exists('UM_API')) {
|
114 |
+
um_fetch_user($user->ID); $profile_url = um_user_profile_url();
|
|
|
|
|
115 |
}
|
116 |
return $profile_url;
|
117 |
}
|
130 |
add_filter('wpdiscuz_after_label', 'wpdiscuz_mc_after_label_html', 110, 2);
|
131 |
function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
|
132 |
if ($comment->user_id) {
|
|
|
133 |
if (function_exists('mycred_get_users_rank')) { //User Rank
|
134 |
$afterLabelHtml .= mycred_get_users_rank($comment->user_id, 'logo', 'post-thumbnail', array('class' => 'mycred-rank'));
|
135 |
}
|
138 |
if (!empty($users_badges)) {
|
139 |
foreach ($users_badges as $badge_id => $level) {
|
140 |
$imageKey = ( $level > 0 ) ? 'level_image' . $level : 'main_image';
|
141 |
+
$afterLabelHtml .= '<img src="' . get_post_meta($badge_id, $imageKey, true) . '" width="22" height="22" class="mycred-badge earned" alt="' . get_the_title($badge_id) . '" title="' . get_the_title($badge_id) . '" />';
|
142 |
}
|
143 |
}
|
144 |
+
}
|
|
|
|
|
|
|
145 |
}
|
146 |
return $afterLabelHtml;
|
147 |
}
|
options/phrases-layouts/phrases-notification.php
CHANGED
@@ -218,28 +218,7 @@ if (!defined('ABSPATH')) {
|
|
218 |
<input type="text" value="<?php echo $this->optionsSerialized->phrases['wc_held_for_moderate']; ?>" name="wc_held_for_moderate" id="wc_held_for_moderate" />
|
219 |
</label>
|
220 |
</td>
|
221 |
-
</tr>
|
222 |
-
<tr valign="top">
|
223 |
-
<th scope="row">
|
224 |
-
<?php _e('Message if comment content length is too short', 'wpdiscuz'); ?>
|
225 |
-
</th>
|
226 |
-
<td colspan="3">
|
227 |
-
<label for="wc_msg_comment_text_min_length">
|
228 |
-
<input type="text" value="<?php echo $this->optionsSerialized->phrases['wc_msg_comment_text_min_length']; ?>" name="wc_msg_comment_text_min_length" id="wc_msg_comment_text_min_length" />
|
229 |
-
</label>
|
230 |
-
</td>
|
231 |
-
</tr>
|
232 |
-
<tr valign="top">
|
233 |
-
<th scope="row">
|
234 |
-
<?php _e('Message if comment content length is too long', 'wpdiscuz'); ?>
|
235 |
-
</th>
|
236 |
-
<td colspan="3">
|
237 |
-
<label for="wc_msg_comment_text_max_length">
|
238 |
-
<input type="text" value="<?php echo $this->optionsSerialized->phrases['wc_msg_comment_text_max_length']; ?>" name="wc_msg_comment_text_max_length" id="wc_msg_comment_text_max_length" />
|
239 |
-
</label>
|
240 |
-
</td>
|
241 |
-
</tr>
|
242 |
-
|
243 |
<tr valign="top">
|
244 |
<th scope="row">
|
245 |
<?php _e('Message if input text length is too short', 'wpdiscuz'); ?>
|
218 |
<input type="text" value="<?php echo $this->optionsSerialized->phrases['wc_held_for_moderate']; ?>" name="wc_held_for_moderate" id="wc_held_for_moderate" />
|
219 |
</label>
|
220 |
</td>
|
221 |
+
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
<tr valign="top">
|
223 |
<th scope="row">
|
224 |
<?php _e('Message if input text length is too short', 'wpdiscuz'); ?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: wordpress comments, ajax comments, ajax, live update, live comments, realtime chat, chat, realtime commenting, Lazy load, Lazy load comments, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jetpack 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.4.1
|
7 |
-
Stable tag: 3.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,8 +20,6 @@ wpDiscuz 3 and all future 3.x versions have been named as Supercharged. It's sup
|
|
20 |
* wpDiscuz Demo: http://wpdiscuz.com/wpdiscuz-3-0-0/
|
21 |
* wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
|
22 |
|
23 |
-
**wpDiscuz Features:**
|
24 |
-
|
25 |
Integration with User Profile Plugins - Please read the [Integrations] Tab in wpDiscuz Settings admin page
|
26 |
|
27 |
* BuddyPress - Avatar, Profile page
|
@@ -30,7 +28,7 @@ Integration with User Profile Plugins - Please read the [Integrations] Tab in wp
|
|
30 |
* UserPro - Avatar, Badges, Profile page
|
31 |
|
32 |
|
33 |
-
|
34 |
|
35 |
* | Adds interactive comment box on posts and other content types
|
36 |
* | Responsive comments form and comment threads design
|
@@ -62,28 +60,11 @@ Integration with User Profile Plugins - Please read the [Integrations] Tab in wp
|
|
62 |
* | Post sharing options: Facebook, Twitter and Google+
|
63 |
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
* | Option to display comment form for certain post types
|
68 |
-
* | Option to show the latest comments on top or bottom of threads
|
69 |
-
* | Option to set Live Update mode (auto or notifier buttons) and update period
|
70 |
-
* | Options to turn On/Off Comment Voting and Sharing features
|
71 |
-
* | Option to allow guests vote for comments
|
72 |
-
* | Option to hide/show CAPTCHA field on comment form
|
73 |
-
* | Option for "User Must be registered to comment"
|
74 |
-
* | Option to held new comments for moderation
|
75 |
-
* | Option to hide user labels/titles
|
76 |
-
* | Option to set number of comment threads per page
|
77 |
-
* | Option to set nested comments maximum depth level
|
78 |
-
* | Option to manage (hide/show) email notification checkboxes
|
79 |
-
* | Option to notify administrators and comment authors on new comment/reply
|
80 |
-
* | Option to keep ON the email notification options on comment form by default
|
81 |
-
* | Option to manage font color
|
82 |
-
* | Option to manage comment/reply background colors
|
83 |
-
* | Option to manage author name and label color
|
84 |
-
* | Option to manage reply/share/vote link colors
|
85 |
-
* | Front-end phrase managing options, you'll be able to translate or change all phrases
|
86 |
|
|
|
|
|
|
|
87 |
|
88 |
|
89 |
This comment system is also available for WooCommerce, Plugin name is WooDiscuz:
|
@@ -145,6 +126,21 @@ Support Forum: http://gvectors.com/forum/
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
= 3.2.1 =
|
149 |
|
150 |
* Fixed Bug: Notice Error Message - wp_register_script was called incorrectly.
|
@@ -154,11 +150,6 @@ Support Forum: http://gvectors.com/forum/
|
|
154 |
* Fixed Bug: Form CSS issue
|
155 |
* Added: New Addon/Feature notifier.
|
156 |
|
157 |
-
IMPORTANT:
|
158 |
-
|
159 |
-
- If you have JetPack installed please deactivate Jetpack comments, it affects wpDiscuz
|
160 |
-
- If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
|
161 |
-
|
162 |
= 3.2.0 =
|
163 |
|
164 |
* Added: Simple CAPTCHA generation and storage types (file system or sessions)
|
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, Jetpack 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.4.1
|
7 |
+
Stable tag: 3.2.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
20 |
* wpDiscuz Demo: http://wpdiscuz.com/wpdiscuz-3-0-0/
|
21 |
* wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
|
22 |
|
|
|
|
|
23 |
Integration with User Profile Plugins - Please read the [Integrations] Tab in wpDiscuz Settings admin page
|
24 |
|
25 |
* BuddyPress - Avatar, Profile page
|
28 |
* UserPro - Avatar, Badges, Profile page
|
29 |
|
30 |
|
31 |
+
= wpDiscuz Features: =
|
32 |
|
33 |
* | Adds interactive comment box on posts and other content types
|
34 |
* | Responsive comments form and comment threads design
|
60 |
* | Post sharing options: Facebook, Twitter and Google+
|
61 |
|
62 |
|
63 |
+
= Add-ons =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
* | [wpDiscuz - Google ReCaptcha](http://gvectors.com/product/wpdiscuz-recaptcha/)
|
66 |
+
* | [wpDiscuz - myCRED Integration](http://gvectors.com/product/wpdiscuz-mycred/)
|
67 |
+
* | [wpDiscuz - Comment Censure](http://gvectors.com/product/comment-censure/)
|
68 |
|
69 |
|
70 |
This comment system is also available for WooCommerce, Plugin name is WooDiscuz:
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
+
= 3.2.2 =
|
130 |
+
|
131 |
+
* Added: Comment section reflects post password protection
|
132 |
+
* Added: Changing CAPTCHA generation type to "session" if temp directory is not writable
|
133 |
+
* Fixed Bug: Multiple voting issue on Google Chrome
|
134 |
+
* Fixed Bug: Comment author label issue with multiple user roles
|
135 |
+
* Fixed Bug: CAPTCHA image display issue on first load
|
136 |
+
* Fixed Bug: Form layout issue when avatars are disabled
|
137 |
+
* Fixed Bug: Incorrect comment escaping/slashing on some servers
|
138 |
+
|
139 |
+
IMPORTANT:
|
140 |
+
|
141 |
+
- If you have JetPack installed please deactivate Jetpack comments, it affects wpDiscuz
|
142 |
+
- If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
|
143 |
+
|
144 |
= 3.2.1 =
|
145 |
|
146 |
* Fixed Bug: Notice Error Message - wp_register_script was called incorrectly.
|
150 |
* Fixed Bug: Form CSS issue
|
151 |
* Added: New Addon/Feature notifier.
|
152 |
|
|
|
|
|
|
|
|
|
|
|
153 |
= 3.2.0 =
|
154 |
|
155 |
* Added: Simple CAPTCHA generation and storage types (file system or sessions)
|
templates/comment/class.WpdiscuzWalker.php
CHANGED
@@ -67,8 +67,20 @@ class WpdiscuzWalker extends Walker_Comment {
|
|
67 |
$authorClass = 'wc-blog-post_author';
|
68 |
$author_title = $this->optionsSerialized->phrases['wc_blog_role_post_author'];
|
69 |
} else {
|
70 |
-
$authorClass = 'wc-blog-'
|
71 |
-
$author_title = $this->optionsSerialized->phrases['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
} else {
|
74 |
$authorName = $comment->comment_author ? $comment->comment_author : __('Anonymous', 'wpdiscuz');
|
@@ -97,7 +109,7 @@ class WpdiscuzWalker extends Walker_Comment {
|
|
97 |
} else {
|
98 |
$commentWrapperClass .= ($comment->comment_parent && $this->optionsSerialized->wordpressThreadComments) ? 'wc-comment wc-reply' : 'wc-comment';
|
99 |
}
|
100 |
-
|
101 |
$voteCount = isset($comment->meta_value) ? $comment->meta_value : get_comment_meta($comment->comment_ID, WpdiscuzCore::META_KEY_VOTES, true);
|
102 |
$authorName = apply_filters('wpdiscuz_comment_author', $authorName, $comment);
|
103 |
$profileUrl = apply_filters('wpdiscuz_profile_url', $profileUrl, $user);
|
@@ -122,7 +134,7 @@ class WpdiscuzWalker extends Walker_Comment {
|
|
122 |
$voteUp = $voteTitleText;
|
123 |
$voteDown = $voteTitleText;
|
124 |
} else {
|
125 |
-
$voteClass = ' wc_vote wc_tooltipster';
|
126 |
$voteUp = $this->optionsSerialized->phrases['wc_vote_up'];
|
127 |
$voteDown = $this->optionsSerialized->phrases['wc_vote_down'];
|
128 |
}
|
67 |
$authorClass = 'wc-blog-post_author';
|
68 |
$author_title = $this->optionsSerialized->phrases['wc_blog_role_post_author'];
|
69 |
} else {
|
70 |
+
$authorClass = 'wc-blog-guest';
|
71 |
+
$author_title = $this->optionsSerialized->phrases['wc_blog_role_guest'];
|
72 |
+
$blogRoles = $this->optionsSerialized->blogRoles;
|
73 |
+
if ($blogRoles) {
|
74 |
+
if ($user->roles && is_array($user->roles)) {
|
75 |
+
foreach ($user->roles as $role) {
|
76 |
+
if (array_key_exists($role, $blogRoles)) {
|
77 |
+
$authorClass = 'wc-blog-' . $role;
|
78 |
+
$author_title = $this->optionsSerialized->phrases['wc_blog_role_' . $role];
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
}
|
85 |
} else {
|
86 |
$authorName = $comment->comment_author ? $comment->comment_author : __('Anonymous', 'wpdiscuz');
|
109 |
} else {
|
110 |
$commentWrapperClass .= ($comment->comment_parent && $this->optionsSerialized->wordpressThreadComments) ? 'wc-comment wc-reply' : 'wc-comment';
|
111 |
}
|
112 |
+
|
113 |
$voteCount = isset($comment->meta_value) ? $comment->meta_value : get_comment_meta($comment->comment_ID, WpdiscuzCore::META_KEY_VOTES, true);
|
114 |
$authorName = apply_filters('wpdiscuz_comment_author', $authorName, $comment);
|
115 |
$profileUrl = apply_filters('wpdiscuz_profile_url', $profileUrl, $user);
|
134 |
$voteUp = $voteTitleText;
|
135 |
$voteDown = $voteTitleText;
|
136 |
} else {
|
137 |
+
$voteClass = ' wc_vote wc_not_clicked wc_tooltipster';
|
138 |
$voteUp = $this->optionsSerialized->phrases['wc_vote_up'];
|
139 |
$voteDown = $this->optionsSerialized->phrases['wc_vote_down'];
|
140 |
}
|
templates/comment/comment-form.php
CHANGED
@@ -3,251 +3,256 @@ if (!defined('ABSPATH')) {
|
|
3 |
exit();
|
4 |
}
|
5 |
global $wpdiscuz, $post, $current_user;
|
6 |
-
|
7 |
-
|
8 |
-
$
|
9 |
-
$
|
10 |
-
$header_text
|
11 |
-
$header_text .=
|
12 |
-
$header_text .= '
|
|
|
13 |
|
14 |
-
$wc_is_name_field_required = ($wpdiscuz->optionsSerialized->isNameFieldRequired) ? 'required="required"' : '';
|
15 |
-
$wc_is_email_field_required = ($wpdiscuz->optionsSerialized->isEmailFieldRequired) ? 'required="required"' : '';
|
|
|
|
|
|
|
16 |
|
17 |
-
$ob_stat = ini_get('output_buffering');
|
18 |
-
if ($ob_stat || $ob_stat === '') {
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
} else {
|
26 |
-
|
27 |
-
}
|
28 |
|
29 |
-
if (isset($_GET['wpdiscuzSubscribeID']) && isset($_GET['key'])) {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
}
|
37 |
|
38 |
-
if (isset($_GET['wpdiscuzConfirmID']) && isset($_GET['wpdiscuzConfirmKey']) && isset($_GET['wpDiscuzComfirm'])) {
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
|
47 |
-
if (isset($_GET['subscriptionSuccess'])) {
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
} else {
|
54 |
-
if ($current_user->ID && $wpdiscuz->optionsSerialized->disableMemberConfirm) {
|
55 |
-
$subscriptionMsg = $wpdiscuz->optionsSerialized->phrases['wc_subscribe_message'];
|
56 |
} else {
|
57 |
-
$
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
?>
|
62 |
-
<div id="wc_unsubscribe_message" class="<?php echo $errorClass; ?>">
|
63 |
-
<span class="wc_unsubscribe_message"><?php echo $subscriptionMsg; ?></span>
|
64 |
-
</div>
|
65 |
-
<?php
|
66 |
-
}
|
67 |
-
?>
|
68 |
|
69 |
-
<div class="wpdiscuz_top_clearing"></div>
|
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 ($
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
<div id="wc_show_hide_loggedin_username">
|
81 |
-
<span class="wc_show_hide_loggedin_username">
|
82 |
-
<?php
|
83 |
-
$logout = wp_loginout(get_permalink(), false);
|
84 |
-
$logout = preg_replace('!>([^<]+)!is', '>' . $wpdiscuz->optionsSerialized->phrases['wc_log_out'], $logout);
|
85 |
-
echo $wpdiscuz->optionsSerialized->phrases['wc_logged_in_as'] . ' <a href="' . $user_url . '">' . $current_user->display_name . '</a> | ' . $logout;
|
86 |
-
?>
|
87 |
-
</span>
|
88 |
-
</div>
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
}
|
92 |
-
?>
|
93 |
-
<div id="wpcomm" class="<?php echo ($current_user->ID) ? 'wpdiscuz_auth' : 'wpdiscuz_unauth'; ?>">
|
94 |
-
<?php if (!$wpdiscuz->optionsSerialized->headerTextShowHide) { ?>
|
95 |
-
<div class="wc-comment-bar">
|
96 |
-
<p class="wc-comment-title">
|
97 |
-
<?php echo ($commentsCount) ? $header_text : $wpdiscuz->optionsSerialized->phrases['wc_be_the_first_text']; ?>
|
98 |
-
</p>
|
99 |
-
<div class="wpdiscuz_clear"></div>
|
100 |
-
</div>
|
101 |
-
<?php } ?>
|
102 |
-
<?php do_action('comment_form_before'); ?>
|
103 |
-
<div class="wc_social_plugin_wrapper">
|
104 |
-
<?php
|
105 |
-
if ($wc_ob_allowed) {
|
106 |
-
echo $wc_comment_form_top_content;
|
107 |
-
} else {
|
108 |
-
do_action('comment_form_top');
|
109 |
-
}
|
110 |
-
?>
|
111 |
-
</div>
|
112 |
<?php
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
$isConfirmed = $subscriptionData['confirm'];
|
117 |
-
$subscriptionType = $subscriptionData['type'];
|
118 |
-
if ($subscriptionType == WpdiscuzCore::SUBSCRIPTION_POST || $subscriptionType == WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT) {
|
119 |
-
$unsubscribeLink = $wpdiscuz->dbManager->unsubscribeLink($post->ID, $current_user->user_email);
|
120 |
-
}
|
121 |
-
?>
|
122 |
-
<div class="wpdiscuz-subscribe-bar">
|
123 |
-
<?php
|
124 |
-
if ($subscriptionType != WpdiscuzCore::SUBSCRIPTION_POST) {
|
125 |
-
?>
|
126 |
-
<form action="<?php echo admin_url('admin-ajax.php') . '?action=addSubscription'; ?>" method="post" id="wpdiscuz-subscribe-form">
|
127 |
-
<div class="wpdiscuz-subscribe-form-intro"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_of']; ?> </div>
|
128 |
-
<div class="wpdiscuz-subscribe-form-option" style="width:<?php echo (!$current_user->ID) ? '40%' : '65%'; ?>;">
|
129 |
-
<select class="wpdiscuz_select" name="wpdiscuzSubscriptionType" >
|
130 |
-
<option value="<?php echo WpdiscuzCore::SUBSCRIPTION_POST; ?>"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_on_new_comment']; ?></option>
|
131 |
-
<option value="<?php echo WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT; ?>" <?php echo (isset($unsubscribeLink) || !$wpdiscuz->optionsSerialized->wordpressThreadComments) ? 'disabled' : ''; ?>><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_on_all_new_reply']; ?></option>
|
132 |
-
</select>
|
133 |
-
</div>
|
134 |
-
<?php if (!$current_user->ID) { ?>
|
135 |
-
<div class="wpdiscuz-item wpdiscuz-subscribe-form-email">
|
136 |
-
<input id="" class="email" type="email" name="wpdiscuzSubscriptionEmail" required="required" value="" placeholder="<?php echo $wpdiscuz->optionsSerialized->phrases['wc_email_text']; ?>"/>
|
137 |
-
</div>
|
138 |
-
<?php } ?>
|
139 |
-
<div class="wpdiscuz-subscribe-form-button">
|
140 |
-
<input id="wpdiscuz_subscription_button" type="submit" value="›" name="wpdiscuz_subscription_button" />
|
141 |
-
</div>
|
142 |
-
<?php wp_nonce_field('wpdiscuz_subscribe_form_nonce_action', 'wpdiscuz_subscribe_form_nonce'); ?>
|
143 |
-
<input type="hidden" value="<?php echo $post->ID; ?>" name="wpdiscuzSubscriptionPostId" />
|
144 |
-
</form>
|
145 |
-
<?php } ?>
|
146 |
-
<div class="wpdiscuz_clear"></div>
|
147 |
-
<?php
|
148 |
-
if (isset($unsubscribeLink)) {
|
149 |
-
$subscribeMessage = $isConfirmed ? $wpdiscuz->optionsSerialized->phrases['wc_unsubscribe'] : $wpdiscuz->optionsSerialized->phrases['wc_ignore_subscription'];
|
150 |
-
if ($subscriptionType == 'all_comment')
|
151 |
-
$introText = $wpdiscuz->optionsSerialized->phrases['wc_subscribed_to'] . ' ' . $wpdiscuz->optionsSerialized->phrases['wc_notify_on_all_new_reply'];
|
152 |
-
elseif ($subscriptionType == 'post')
|
153 |
-
$introText = $wpdiscuz->optionsSerialized->phrases['wc_subscribed_to'] . ' ' . $wpdiscuz->optionsSerialized->phrases['wc_notify_on_new_comment'];
|
154 |
-
echo '<div class="wpdiscuz_subscribe_status">' . $introText . " | <a href='$unsubscribeLink'>" . $subscribeMessage . "</a></div>";
|
155 |
-
}
|
156 |
?>
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
<?php } else { ?>
|
167 |
-
<?php
|
168 |
-
if ($commentsCount > 0) {
|
169 |
-
$wpdiscuz->helper->superSocializerFix();
|
170 |
-
} else {
|
171 |
-
?>
|
172 |
-
<div id="comments" class="comments-area" style="display:none">
|
173 |
-
<div id="respond"></div>
|
174 |
-
<?php } ?>
|
175 |
-
<?php do_action('comment_form_closed'); ?>
|
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']; ?>:
|
182 |
-
<span class="wpdiscuz-sort-button wpdiscuz-date-sort-desc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_newest']; ?></span> |
|
183 |
-
<span class="wpdiscuz-sort-button wpdiscuz-date-sort-asc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_oldest']; ?></span> |
|
184 |
-
<span class="wpdiscuz-sort-button wpdiscuz-vote-sort-up"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_most_voted']; ?></span>
|
185 |
-
</div>
|
186 |
</div>
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
193 |
<div class="wpdiscuz_clear"></div>
|
194 |
</div>
|
195 |
-
<div class="wpdiscuz_clear"></div>
|
196 |
<?php } ?>
|
197 |
-
|
|
|
198 |
<?php
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$lastParentId = isset($query_array['parentId']) ? intval($query_array['parentId']) : 0;
|
204 |
-
if ($lastParentId) {
|
205 |
-
$args['last_parent_id'] = $lastParentId--;
|
206 |
-
}
|
207 |
}
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
-
|
213 |
-
|
214 |
-
?>
|
215 |
-
<div class="wpdiscuz-comment-pagination">
|
216 |
<?php
|
217 |
-
if (
|
218 |
-
$loadMoreButtonText = ($wpdiscuz->optionsSerialized->commentListLoadType == 1) ? $wpdiscuz->optionsSerialized->phrases['wc_load_rest_comments_submit_text'] : $wpdiscuz->optionsSerialized->phrases['wc_load_more_submit_text'];
|
219 |
?>
|
220 |
-
<
|
221 |
-
<
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
?>
|
233 |
</div>
|
|
|
|
|
|
|
|
|
234 |
</div>
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
</div>
|
245 |
<?php } ?>
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
</div>
|
248 |
-
</div>
|
249 |
<div class="wpdiscuz-loading-bar <?php echo ($current_user->ID) ? 'wpdiscuz-loading-bar-auth' : 'wpdiscuz-loading-bar-unauth'; ?>"><img class="wpdiscuz-loading-bar-img" alt="<?php _e('wpDiscuz', 'wpdiscuz'); ?>" src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/loading.gif'); ?>" width="32" height="25" /></div>
|
250 |
-
|
|
|
251 |
|
252 |
function wpdiscuz_close_divs($html) {
|
253 |
global $wpdiscuz;
|
3 |
exit();
|
4 |
}
|
5 |
global $wpdiscuz, $post, $current_user;
|
6 |
+
if (!trim($post->post_password)) {
|
7 |
+
get_currentuserinfo();
|
8 |
+
$wpdiscuz->dbManager->checkVoteData($post->ID);
|
9 |
+
$commentsCount = $wpdiscuz->dbManager->getCommentsCount($post->ID);
|
10 |
+
$header_text = '<span class="wc_header_text_count">' . $commentsCount . '</span> ';
|
11 |
+
$header_text .= ($commentsCount > 1) ? $wpdiscuz->optionsSerialized->phrases['wc_header_text_plural'] : $wpdiscuz->optionsSerialized->phrases['wc_header_text'];
|
12 |
+
$header_text .= ' ' . $wpdiscuz->optionsSerialized->phrases['wc_header_on_text'];
|
13 |
+
$header_text .= ' "' . get_the_title($post) . '"';
|
14 |
|
15 |
+
$wc_is_name_field_required = ($wpdiscuz->optionsSerialized->isNameFieldRequired) ? 'required="required"' : '';
|
16 |
+
$wc_is_email_field_required = ($wpdiscuz->optionsSerialized->isEmailFieldRequired) ? 'required="required"' : '';
|
17 |
+
|
18 |
+
$wpCommClasses = $current_user->ID ? 'wpdiscuz_auth' : 'wpdiscuz_unauth';
|
19 |
+
$wpCommClasses .= $wpdiscuz->optionsSerialized->wordpressShowAvatars ? '' : ' wpdiscuz_no_avatar';
|
20 |
|
21 |
+
$ob_stat = ini_get('output_buffering');
|
22 |
+
if ($ob_stat || $ob_stat === '') {
|
23 |
+
$wc_ob_allowed = true;
|
24 |
+
ob_start();
|
25 |
+
do_action('comment_form_top');
|
26 |
+
$wc_comment_form_top_content = ob_get_contents();
|
27 |
+
ob_clean();
|
28 |
+
$wc_comment_form_top_content = wpdiscuz_close_divs($wc_comment_form_top_content);
|
29 |
+
} else {
|
30 |
+
$wc_ob_allowed = false;
|
31 |
+
}
|
32 |
|
33 |
+
if (isset($_GET['wpdiscuzSubscribeID']) && isset($_GET['key'])) {
|
34 |
+
$wpdiscuz->dbManager->unsubscribe($_GET['wpdiscuzSubscribeID'], $_GET['key']);
|
35 |
+
?>
|
36 |
+
<div id="wc_unsubscribe_message">
|
37 |
+
<span class="wc_unsubscribe_message"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_unsubscribe_message']; ?></span>
|
38 |
+
</div>
|
39 |
+
<?php
|
40 |
+
}
|
41 |
|
42 |
+
if (isset($_GET['wpdiscuzConfirmID']) && isset($_GET['wpdiscuzConfirmKey']) && isset($_GET['wpDiscuzComfirm'])) {
|
43 |
+
$wpdiscuz->dbManager->notificationConfirm($_GET['wpdiscuzConfirmID'], $_GET['wpdiscuzConfirmKey']);
|
44 |
+
?>
|
45 |
+
<div id="wc_unsubscribe_message">
|
46 |
+
<span class="wc_unsubscribe_message"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_comfirm_success_message']; ?></span>
|
47 |
+
</div>
|
48 |
+
<?php
|
49 |
+
}
|
50 |
|
51 |
+
if (isset($_GET['subscriptionSuccess'])) {
|
52 |
+
$errorClass = 'wpdiscuz-sendmail-error';
|
53 |
+
if ($_GET['subscriptionSuccess'] == -1) {
|
54 |
+
$subscriptionMsg = __('Unable to send an email', 'wpdiscuz');
|
55 |
+
} elseif (!$_GET['subscriptionSuccess']) {
|
56 |
+
$subscriptionMsg = __('Subscription not successed', 'wpdiscuz');
|
|
|
|
|
|
|
57 |
} else {
|
58 |
+
if ($current_user->ID && $wpdiscuz->optionsSerialized->disableMemberConfirm) {
|
59 |
+
$subscriptionMsg = $wpdiscuz->optionsSerialized->phrases['wc_subscribe_message'];
|
60 |
+
} else {
|
61 |
+
$subscriptionMsg = $wpdiscuz->optionsSerialized->phrases['wc_confirm_email'];
|
62 |
+
}
|
63 |
+
$errorClass = '';
|
64 |
}
|
65 |
+
?>
|
66 |
+
<div id="wc_unsubscribe_message" class="<?php echo $errorClass; ?>">
|
67 |
+
<span class="wc_unsubscribe_message"><?php echo $subscriptionMsg; ?></span>
|
68 |
+
</div>
|
69 |
+
<?php
|
70 |
}
|
71 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
<div class="wpdiscuz_top_clearing"></div>
|
|
|
|
|
|
|
|
|
|
|
74 |
<?php
|
75 |
+
if ($post->comment_status == 'open') {
|
76 |
+
$wpdiscuz->helper->superSocializerFix();
|
77 |
+
?>
|
78 |
+
<h3 id="wc-comment-header"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_leave_a_reply_text']; ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
<?php
|
80 |
+
if ($wpdiscuz->optionsSerialized->showHideLoggedInUsername) {
|
81 |
+
if ($current_user->ID) {
|
82 |
+
$user_url = get_author_posts_url($current_user->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
?>
|
84 |
+
<div id="wc_show_hide_loggedin_username">
|
85 |
+
<span class="wc_show_hide_loggedin_username">
|
86 |
+
<?php
|
87 |
+
$logout = wp_loginout(get_permalink(), false);
|
88 |
+
$logout = preg_replace('!>([^<]+)!is', '>' . $wpdiscuz->optionsSerialized->phrases['wc_log_out'], $logout);
|
89 |
+
echo $wpdiscuz->optionsSerialized->phrases['wc_logged_in_as'] . ' <a href="' . $user_url . '">' . $current_user->display_name . '</a> | ' . $logout;
|
90 |
+
?>
|
91 |
+
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
</div>
|
93 |
+
<?php
|
94 |
+
}
|
95 |
+
}
|
96 |
+
?>
|
97 |
+
<div id="wpcomm" class="<?php echo $wpCommClasses; ?>">
|
98 |
+
<?php if (!$wpdiscuz->optionsSerialized->headerTextShowHide) { ?>
|
99 |
+
<div class="wc-comment-bar">
|
100 |
+
<p class="wc-comment-title">
|
101 |
+
<?php echo ($commentsCount) ? $header_text : $wpdiscuz->optionsSerialized->phrases['wc_be_the_first_text']; ?>
|
102 |
+
</p>
|
103 |
<div class="wpdiscuz_clear"></div>
|
104 |
</div>
|
|
|
105 |
<?php } ?>
|
106 |
+
<?php do_action('comment_form_before'); ?>
|
107 |
+
<div class="wc_social_plugin_wrapper">
|
108 |
<?php
|
109 |
+
if ($wc_ob_allowed) {
|
110 |
+
echo $wc_comment_form_top_content;
|
111 |
+
} else {
|
112 |
+
do_action('comment_form_top');
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
+
?>
|
115 |
+
</div>
|
116 |
+
<?php
|
117 |
+
$isPostmaticActive = !class_exists('Prompt_Comment_Form_Handling') || (class_exists('Prompt_Comment_Form_Handling') && !$wpdiscuz->optionsSerialized->usePostmaticForCommentNotification);
|
118 |
+
if ($wpdiscuz->optionsSerialized->showSubscriptionBar && $isPostmaticActive) {
|
119 |
+
$subscriptionData = $wpdiscuz->dbManager->hasSubscription($post->ID, $current_user->user_email);
|
120 |
+
$isConfirmed = $subscriptionData['confirm'];
|
121 |
+
$subscriptionType = $subscriptionData['type'];
|
122 |
+
if ($subscriptionType == WpdiscuzCore::SUBSCRIPTION_POST || $subscriptionType == WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT) {
|
123 |
+
$unsubscribeLink = $wpdiscuz->dbManager->unsubscribeLink($post->ID, $current_user->user_email);
|
124 |
}
|
125 |
+
?>
|
126 |
+
<div class="wpdiscuz-subscribe-bar">
|
|
|
|
|
127 |
<?php
|
128 |
+
if ($subscriptionType != WpdiscuzCore::SUBSCRIPTION_POST) {
|
|
|
129 |
?>
|
130 |
+
<form action="<?php echo admin_url('admin-ajax.php') . '?action=addSubscription'; ?>" method="post" id="wpdiscuz-subscribe-form">
|
131 |
+
<div class="wpdiscuz-subscribe-form-intro"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_of']; ?> </div>
|
132 |
+
<div class="wpdiscuz-subscribe-form-option" style="width:<?php echo (!$current_user->ID) ? '40%' : '65%'; ?>;">
|
133 |
+
<select class="wpdiscuz_select" name="wpdiscuzSubscriptionType" >
|
134 |
+
<option value="<?php echo WpdiscuzCore::SUBSCRIPTION_POST; ?>"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_on_new_comment']; ?></option>
|
135 |
+
<option value="<?php echo WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT; ?>" <?php echo (isset($unsubscribeLink) || !$wpdiscuz->optionsSerialized->wordpressThreadComments) ? 'disabled' : ''; ?>><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_on_all_new_reply']; ?></option>
|
136 |
+
</select>
|
137 |
+
</div>
|
138 |
+
<?php if (!$current_user->ID) { ?>
|
139 |
+
<div class="wpdiscuz-item wpdiscuz-subscribe-form-email">
|
140 |
+
<input id="" class="email" type="email" name="wpdiscuzSubscriptionEmail" required="required" value="" placeholder="<?php echo $wpdiscuz->optionsSerialized->phrases['wc_email_text']; ?>"/>
|
141 |
+
</div>
|
142 |
+
<?php } ?>
|
143 |
+
<div class="wpdiscuz-subscribe-form-button">
|
144 |
+
<input id="wpdiscuz_subscription_button" type="submit" value="›" name="wpdiscuz_subscription_button" />
|
145 |
+
</div>
|
146 |
+
<?php wp_nonce_field('wpdiscuz_subscribe_form_nonce_action', 'wpdiscuz_subscribe_form_nonce'); ?>
|
147 |
+
<input type="hidden" value="<?php echo $post->ID; ?>" name="wpdiscuzSubscriptionPostId" />
|
148 |
+
</form>
|
149 |
+
<?php } ?>
|
150 |
+
<div class="wpdiscuz_clear"></div>
|
151 |
+
<?php
|
152 |
+
if (isset($unsubscribeLink)) {
|
153 |
+
$subscribeMessage = $isConfirmed ? $wpdiscuz->optionsSerialized->phrases['wc_unsubscribe'] : $wpdiscuz->optionsSerialized->phrases['wc_ignore_subscription'];
|
154 |
+
if ($subscriptionType == 'all_comment')
|
155 |
+
$introText = $wpdiscuz->optionsSerialized->phrases['wc_subscribed_to'] . ' ' . $wpdiscuz->optionsSerialized->phrases['wc_notify_on_all_new_reply'];
|
156 |
+
elseif ($subscriptionType == 'post')
|
157 |
+
$introText = $wpdiscuz->optionsSerialized->phrases['wc_subscribed_to'] . ' ' . $wpdiscuz->optionsSerialized->phrases['wc_notify_on_new_comment'];
|
158 |
+
echo '<div class="wpdiscuz_subscribe_status">' . $introText . " | <a href='$unsubscribeLink'>" . $subscribeMessage . "</a></div>";
|
159 |
}
|
160 |
?>
|
161 |
</div>
|
162 |
+
<?php } ?>
|
163 |
+
<?php $wpdiscuz->helper->formBuilder('main', '0_0', $commentsCount, $current_user); ?>
|
164 |
+
<div id="wpdiscuz_hidden_secondary_form" style="display: none;">
|
165 |
+
<?php $wpdiscuz->helper->formBuilder(0, 'wpdiscuzuniqueid', $commentsCount, $current_user); ?>
|
166 |
</div>
|
167 |
+
<?php do_action('comment_form_after'); ?>
|
168 |
+
<hr>
|
169 |
+
|
170 |
+
<?php } else { ?>
|
171 |
+
<?php
|
172 |
+
if ($commentsCount > 0) {
|
173 |
+
$wpdiscuz->helper->superSocializerFix();
|
174 |
+
} else {
|
175 |
+
?>
|
176 |
+
<div id="comments" class="comments-area" style="display:none">
|
177 |
+
<div id="respond"></div>
|
178 |
+
<?php } ?>
|
179 |
+
<?php do_action('comment_form_closed'); ?>
|
180 |
+
<div id="wpcomm" class="<?php echo $wpCommClasses; ?>" style="border:none;">
|
181 |
+
<?php } ?>
|
182 |
+
|
183 |
+
<?php if ($commentsCount && $wpdiscuz->optionsSerialized->showSortingButtons && !$wpdiscuz->optionsSerialized->wordpressIsPaginate) { ?>
|
184 |
+
<div class="wpdiscuz-front-actions">
|
185 |
+
<div class="wpdiscuz-sort-buttons" style="font-size:14px;"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_sort_by']; ?>:
|
186 |
+
<span class="wpdiscuz-sort-button wpdiscuz-date-sort-desc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_newest']; ?></span> |
|
187 |
+
<span class="wpdiscuz-sort-button wpdiscuz-date-sort-asc"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_oldest']; ?></span> |
|
188 |
+
<span class="wpdiscuz-sort-button wpdiscuz-vote-sort-up"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_most_voted']; ?></span>
|
189 |
+
</div>
|
190 |
</div>
|
191 |
<?php } ?>
|
192 |
+
|
193 |
+
<?php if ($wpdiscuz->optionsSerialized->commentListUpdateType == 2) { ?>
|
194 |
+
<div class="wc_new_comment_and_replies">
|
195 |
+
<div class="wc_new_comment wc-update-on-click"></div>
|
196 |
+
<div class="wc_new_reply wc-update-on-click"></div>
|
197 |
+
<div class="wpdiscuz_clear"></div>
|
198 |
+
</div>
|
199 |
+
<div class="wpdiscuz_clear"></div>
|
200 |
+
<?php } ?>
|
201 |
+
<div id="wcThreadWrapper" class="wc-thread-wrapper">
|
202 |
+
<?php
|
203 |
+
$args = array();
|
204 |
+
$showLoadeMore = 1;
|
205 |
+
if (isset($_GET['_escaped_fragment_'])) {
|
206 |
+
parse_str($_GET['_escaped_fragment_'], $query_array);
|
207 |
+
$lastParentId = isset($query_array['parentId']) ? intval($query_array['parentId']) : 0;
|
208 |
+
if ($lastParentId) {
|
209 |
+
$args['last_parent_id'] = $lastParentId--;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
if ($wpdiscuz->optionsSerialized->showSortingButtons && $wpdiscuz->optionsSerialized->mostVotedByDefault) {
|
214 |
+
$args['orderby'] = 'by_vote';
|
215 |
+
}
|
216 |
+
$commentData = $wpdiscuz->getWPComments($args);
|
217 |
+
echo $commentData['comment_list'];
|
218 |
+
?>
|
219 |
+
<div class="wpdiscuz-comment-pagination">
|
220 |
+
<?php
|
221 |
+
if (!$wpdiscuz->optionsSerialized->wordpressIsPaginate && $commentData['is_show_load_more']) {
|
222 |
+
$loadMoreButtonText = ($wpdiscuz->optionsSerialized->commentListLoadType == 1) ? $wpdiscuz->optionsSerialized->phrases['wc_load_rest_comments_submit_text'] : $wpdiscuz->optionsSerialized->phrases['wc_load_more_submit_text'];
|
223 |
+
?>
|
224 |
+
<div class="wc-load-more-submit-wrap">
|
225 |
+
<a class="wc-load-more-link" href="<?php echo get_permalink($post->ID) . '#!parentId=' . $commentData['last_parent_id']; ?>">
|
226 |
+
<button name="submit" class="wc-load-more-submit button">
|
227 |
+
<?php echo $loadMoreButtonText; ?>
|
228 |
+
</button>
|
229 |
+
</a>
|
230 |
+
</div>
|
231 |
+
<input id="wpdiscuzHasMoreComments" type="hidden" value="<?php echo $commentData['is_show_load_more']; ?>" />
|
232 |
+
<?php
|
233 |
+
} else {
|
234 |
+
paginate_comments_links();
|
235 |
+
}
|
236 |
+
?>
|
237 |
+
</div>
|
238 |
+
</div>
|
239 |
+
<div class="wpdiscuz_clear"></div>
|
240 |
+
<?php if ($commentsCount) { ?>
|
241 |
+
<?php if ($wpdiscuz->optionsSerialized->showPluginPoweredByLink) { ?>
|
242 |
+
<div class="by-wpdiscuz">
|
243 |
+
<span id="awpdiscuz" onclick='javascript:document.getElementById("bywpdiscuz").style.display = "inline";
|
244 |
+
document.getElementById("awpdiscuz").style.display = "none";'>
|
245 |
+
<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"/>
|
246 |
+
</span>
|
247 |
+
<a href="http://wpdiscuz.com/" target="_blank" id="bywpdiscuz" title="wpDiscuz v<?php echo get_option(WpdiscuzCore::OPTION_SLUG_VERSION); ?> - Supercharged native comments">wpDiscuz</a>
|
248 |
+
</div>
|
249 |
+
<?php } ?>
|
250 |
+
<?php } ?>
|
251 |
+
</div>
|
252 |
</div>
|
|
|
253 |
<div class="wpdiscuz-loading-bar <?php echo ($current_user->ID) ? 'wpdiscuz-loading-bar-auth' : 'wpdiscuz-loading-bar-unauth'; ?>"><img class="wpdiscuz-loading-bar-img" alt="<?php _e('wpDiscuz', 'wpdiscuz'); ?>" src="<?php echo plugins_url(WPDISCUZ_DIR_NAME . '/assets/img/loading.gif'); ?>" width="32" height="25" /></div>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
|
257 |
function wpdiscuz_close_divs($html) {
|
258 |
global $wpdiscuz;
|
utils/class.WpdiscuzEmailHelper.php
CHANGED
@@ -11,7 +11,7 @@ class WpdiscuzEmailHelper {
|
|
11 |
}
|
12 |
|
13 |
public function addSubscription() {
|
14 |
-
global $wp_rewrite
|
15 |
get_currentuserinfo();
|
16 |
$subscribeFormNonce = filter_input(INPUT_POST, 'wpdiscuz_subscribe_form_nonce');
|
17 |
$httpReferer = filter_input(INPUT_POST, '_wp_http_referer');
|
@@ -96,31 +96,28 @@ class WpdiscuzEmailHelper {
|
|
96 |
* Check notification type and send email to post new comments subscribers
|
97 |
*/
|
98 |
public function checkNotificationType() {
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
if (
|
110 |
-
$
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$
|
116 |
-
|
117 |
-
$this->notifyAllCommentSubscribers($postId, $comment_id, $email);
|
118 |
-
$this->notifyCommentSubscribers($parent_comment_id, $comment->comment_ID, $email);
|
119 |
-
}
|
120 |
}
|
121 |
}
|
122 |
-
wp_die();
|
123 |
}
|
|
|
124 |
}
|
125 |
|
126 |
/**
|
@@ -177,4 +174,5 @@ class WpdiscuzEmailHelper {
|
|
177 |
}
|
178 |
}
|
179 |
}
|
|
|
180 |
}
|
11 |
}
|
12 |
|
13 |
public function addSubscription() {
|
14 |
+
global $wp_rewrite, $current_user;
|
15 |
get_currentuserinfo();
|
16 |
$subscribeFormNonce = filter_input(INPUT_POST, 'wpdiscuz_subscribe_form_nonce');
|
17 |
$httpReferer = filter_input(INPUT_POST, '_wp_http_referer');
|
96 |
* Check notification type and send email to post new comments subscribers
|
97 |
*/
|
98 |
public function checkNotificationType() {
|
99 |
+
$postId = isset($_POST['postId']) ? intval($_POST['postId']) : 0;
|
100 |
+
$comment_id = isset($_POST['comment_id']) ? intval($_POST['comment_id']) : 0;
|
101 |
+
$email = isset($_POST['email']) ? trim($_POST['email']) : '';
|
102 |
+
$isParent = isset($_POST['isParent']) ? intval($_POST['isParent']) : '';
|
103 |
+
$current_user = wp_get_current_user();
|
104 |
+
if ($current_user->user_email) {
|
105 |
+
$email = $current_user->user_email;
|
106 |
+
}
|
107 |
+
if ($comment_id && $email && $postId) {
|
108 |
+
$this->notifyPostSubscribers($postId, $comment_id, $email);
|
109 |
+
if (!$isParent) {
|
110 |
+
$comment = get_comment($comment_id);
|
111 |
+
$parent_comment_id = $comment->comment_parent;
|
112 |
+
$parent_comment = get_comment($parent_comment_id);
|
113 |
+
$parent_comment_email = $parent_comment->comment_author_email;
|
114 |
+
if ($parent_comment_email != $email) {
|
115 |
+
$this->notifyAllCommentSubscribers($postId, $comment_id, $email);
|
116 |
+
$this->notifyCommentSubscribers($parent_comment_id, $comment->comment_ID, $email);
|
|
|
|
|
|
|
117 |
}
|
118 |
}
|
|
|
119 |
}
|
120 |
+
wp_die();
|
121 |
}
|
122 |
|
123 |
/**
|
174 |
}
|
175 |
}
|
176 |
}
|
177 |
+
|
178 |
}
|
utils/class.WpdiscuzHelper.php
CHANGED
@@ -377,7 +377,7 @@ class WpdiscuzHelper {
|
|
377 |
</div>
|
378 |
<div class="clearfix"></div>
|
379 |
<?php wp_nonce_field(WpDiscuzConstants::ACTION_FORM_NONCE, 'wpdiscuz_comment_form_nonce'); ?>
|
380 |
-
<input type="hidden"
|
381 |
</form>
|
382 |
<?php } else { ?>
|
383 |
<p class="wc-must-login">
|
@@ -439,9 +439,8 @@ class WpdiscuzHelper {
|
|
439 |
|
440 |
public function generateCaptcha() {
|
441 |
$messageArray = array();
|
442 |
-
if (isset($_POST['
|
443 |
-
|
444 |
-
$uniqueId = trim($data['uniqueId']);
|
445 |
$cData = $this->createCaptchaImage();
|
446 |
$messageArray['code'] = $cData['code'];
|
447 |
$messageArray['key'] = $cData['key'];
|
@@ -510,6 +509,11 @@ class WpdiscuzHelper {
|
|
510 |
}
|
511 |
$fileName = $prefix . '-' . $t . '.png';
|
512 |
$filePath = $this->captchaDir . WPDISCUZ_DS . $fileName;
|
|
|
|
|
|
|
|
|
|
|
513 |
if (imagepng($im, $filePath, 5)) {
|
514 |
$captchaData['code'] = 1;
|
515 |
$captchaData['message'] = $fileName;
|
@@ -556,17 +560,17 @@ class WpdiscuzHelper {
|
|
556 |
|
557 |
public function removeOldFiles($minutes = 30, $deactivate = false) {
|
558 |
$minutes = apply_filters('wpdiscuz_captcha_expired', $minutes);
|
559 |
-
if ($this->captchaDir && file_exists($this->captchaDir) &&
|
560 |
-
$files = scandir($this->captchaDir);
|
561 |
if ($files && is_array($files)) {
|
562 |
foreach ($files as $file) {
|
563 |
if ($file != '.' && $file != '..' && $file != '.htaccess') {
|
564 |
$fileName = $this->captchaDir . WPDISCUZ_DS . $file;
|
565 |
$mTime = substr($file, WpdiscuzCore::CAPTCHA_LENGTH + 1, 10);
|
566 |
-
if (is_file($fileName) && $mTime) {
|
567 |
$expired = $mTime + ($minutes * 60);
|
568 |
if ($expired < time() || $deactivate) {
|
569 |
-
unlink($fileName);
|
570 |
}
|
571 |
}
|
572 |
}
|
@@ -624,4 +628,5 @@ class WpdiscuzHelper {
|
|
624 |
<?php
|
625 |
}
|
626 |
|
627 |
-
}
|
|
377 |
</div>
|
378 |
<div class="clearfix"></div>
|
379 |
<?php wp_nonce_field(WpDiscuzConstants::ACTION_FORM_NONCE, 'wpdiscuz_comment_form_nonce'); ?>
|
380 |
+
<input type="hidden" class="wpdiscuz_unique_id" value="<?php echo $uniqueId; ?>" name="wpdiscuz_unique_id">
|
381 |
</form>
|
382 |
<?php } else { ?>
|
383 |
<p class="wc-must-login">
|
439 |
|
440 |
public function generateCaptcha() {
|
441 |
$messageArray = array();
|
442 |
+
if (isset($_POST['wpdiscuz_unique_id'])) {
|
443 |
+
$uniqueId = trim($_POST['wpdiscuz_unique_id']);
|
|
|
444 |
$cData = $this->createCaptchaImage();
|
445 |
$messageArray['code'] = $cData['code'];
|
446 |
$messageArray['key'] = $cData['key'];
|
509 |
}
|
510 |
$fileName = $prefix . '-' . $t . '.png';
|
511 |
$filePath = $this->captchaDir . WPDISCUZ_DS . $fileName;
|
512 |
+
header("Expires: Tue, 01 Jan 2014 00:00:00 GMT");
|
513 |
+
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
514 |
+
header("Cache-Control: no-store, no-cache, must-revalidate");
|
515 |
+
header("Cache-Control: post-check=0, pre-check=0", false);
|
516 |
+
header("Pragma: no-cache");
|
517 |
if (imagepng($im, $filePath, 5)) {
|
518 |
$captchaData['code'] = 1;
|
519 |
$captchaData['message'] = $fileName;
|
560 |
|
561 |
public function removeOldFiles($minutes = 30, $deactivate = false) {
|
562 |
$minutes = apply_filters('wpdiscuz_captcha_expired', $minutes);
|
563 |
+
if ($this->captchaDir && file_exists($this->captchaDir) && floatval($minutes)) {
|
564 |
+
$files = function_exists('scandir') ? scandir($this->captchaDir) : false;
|
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 |
$mTime = substr($file, WpdiscuzCore::CAPTCHA_LENGTH + 1, 10);
|
570 |
+
if (file_exists($fileName) && is_file($fileName) && $mTime) {
|
571 |
$expired = $mTime + ($minutes * 60);
|
572 |
if ($expired < time() || $deactivate) {
|
573 |
+
@unlink($fileName);
|
574 |
}
|
575 |
}
|
576 |
}
|
628 |
<?php
|
629 |
}
|
630 |
|
631 |
+
}
|
632 |
+
|
utils/class.WpdiscuzOptimizationHelper.php
CHANGED
@@ -183,7 +183,7 @@ class WpdiscuzOptimizationHelper {
|
|
183 |
*/
|
184 |
public function getCommentRoot($commentId) {
|
185 |
$comment = get_comment($commentId);
|
186 |
-
if ($comment->comment_parent) {
|
187 |
return $this->getCommentRoot($comment->comment_parent);
|
188 |
} else {
|
189 |
return $comment;
|
183 |
*/
|
184 |
public function getCommentRoot($commentId) {
|
185 |
$comment = get_comment($commentId);
|
186 |
+
if ($comment && $comment->comment_parent) {
|
187 |
return $this->getCommentRoot($comment->comment_parent);
|
188 |
} else {
|
189 |
return $comment;
|