" . wp_trim_words($commentContent, $options->content["commentReadMoreLimit"], $readMoreLink) . "
" . $codeContent . "
~is', '', $content); $content = preg_replace('~<\/code>\s?~is', '', $content); return $content; } public static function isUserCanFollowOrSubscribe($email) { return !in_array(strstr($email, "@"), [ "@facebook.com", "@twitter.com", "@ok.ru", "@wechat.com", "@weibo.com", "@baidu.com", "@example.com", ]); } public function addRatingResetButton($postType, $post) { if (!$post || empty($post->ID)) { return; } $form = $this->wpdiscuzForm->getForm($post->ID); if ($form->getFormID() && ($form->getEnableRateOnPost() || $form->getRatingsExists())) { add_meta_box("wpd_reset_ratings", __("Reset Ratings", "wpdiscuz"), [ &$this, "resetRatingsButtons" ], $postType, "side", "low"); } } public function resetRatingsButtons($post) { $form = $this->wpdiscuzForm->getForm($post->ID); $ajax_nonce = wp_create_nonce("wpd-reset-rating"); if ($form->getFormID()) { if ($form->getEnableRateOnPost()) { ?> getRatingsExists()) { ?> options->thread_styles["theme"] === "wpd-dark"; $darkCommentAreaBG = $this->options->thread_styles["darkCommentAreaBG"] ? "background:" . $this->options->thread_styles["darkCommentAreaBG"] . ";" : ""; $darkCommentTextColor = $this->options->thread_styles["darkCommentTextColor"] ? "color:" . $this->options->thread_styles["darkCommentTextColor"] . ";" : ""; $darkCommentFieldsBG = $this->options->thread_styles["darkCommentFieldsBG"] ? "background:" . $this->options->thread_styles["darkCommentFieldsBG"] . ";" : ""; $darkCommentFieldsBorderColor = $this->options->thread_styles["darkCommentFieldsBorderColor"] ? "border: 1px solid " . $this->options->thread_styles["darkCommentFieldsBorderColor"] . ";" : ""; $darkCommentFieldsTextColor = $this->options->thread_styles["darkCommentFieldsTextColor"] ? "color:" . $this->options->thread_styles["darkCommentFieldsTextColor"] . ";" : ""; $darkCommentFieldsPlaceholderColor = $this->options->thread_styles["darkCommentFieldsPlaceholderColor"] ? "opacity:1;color:" . $this->options->thread_styles["darkCommentFieldsPlaceholderColor"] . ";" : ""; $defaultCommentAreaBG = $this->options->thread_styles["defaultCommentAreaBG"] ? "background:" . $this->options->thread_styles["defaultCommentAreaBG"] . ";" : ""; $defaultCommentTextColor = $this->options->thread_styles["defaultCommentTextColor"] ? "color:" . $this->options->thread_styles["defaultCommentTextColor"] . ";" : ""; $defaultCommentFieldsBG = $this->options->thread_styles["defaultCommentFieldsBG"] ? "background:" . $this->options->thread_styles["defaultCommentFieldsBG"] . ";" : ""; $defaultCommentFieldsBorderColor = $this->options->thread_styles["defaultCommentFieldsBorderColor"] ? "border: 1px solid " . $this->options->thread_styles["defaultCommentFieldsBorderColor"] . ";" : ""; $defaultCommentFieldsTextColor = $this->options->thread_styles["defaultCommentFieldsTextColor"] ? "color:" . $this->options->thread_styles["defaultCommentFieldsTextColor"] . ";" : ""; $defaultCommentFieldsPlaceholderColor = $this->options->thread_styles["defaultCommentFieldsPlaceholderColor"] ? "opacity:1;color:" . $this->options->thread_styles["defaultCommentFieldsPlaceholderColor"] . ";" : ""; if ($this->options->thread_styles["theme"] !== "wpd-minimal") { $blogRoles = $this->options->labels["blogRoles"]; if (!$blogRoles) { echo ".wc-comment-author a{color:#00B38F;} .wc-comment-label{background:#00B38F;}"; } foreach ($blogRoles as $role => $color) { echo "\r\n"; echo "#wpdcom .wpd-blog-" . esc_html($role) . " .wpd-comment-label{color: #ffffff; background-color: " . esc_html($color) . "; border: none;}\r\n"; echo "#wpdcom .wpd-blog-" . esc_html($role) . " .wpd-comment-author, #wpdcom .wpd-blog-" . esc_html($role) . " .wpd-comment-author a{color: " . esc_html($color) . ";}\r\n"; if ($role === "post_author") { echo "#wpdcom .wpd-blog-post_author .wpd-avatar img{border-color: " . esc_html($color) . ";}"; } if ($role !== "subscriber" && $role !== "guest") { echo "#wpdcom.wpd-layout-1 .wpd-comment .wpd-blog-" . esc_html($role) . " .wpd-avatar img{border-color: " . esc_html($color) . ";}\r\n"; } if ($role === "administrator" || $role === "editor" || $role === "post_author") { echo "#wpdcom.wpd-layout-2 .wpd-comment.wpd-reply .wpd-comment-wrap.wpd-blog-" . esc_html($role) . "{border-" . esc_html($left) . ": 3px solid " . esc_html($color) . ";}\r\n"; } if ($role !== "guest") { echo "#wpdcom.wpd-layout-2 .wpd-comment .wpd-blog-" . esc_html($role) . " .wpd-avatar img{border-bottom-color: " . esc_html($color) . ";}\r\n"; } echo "#wpdcom.wpd-layout-3 .wpd-blog-" . esc_html($role) . " .wpd-comment-subheader{border-top: 1px dashed " . esc_html($color) . ";}\r\n"; if ($role !== "subscriber" && $role !== "guest") { echo "#wpdcom.wpd-layout-3 .wpd-reply .wpd-blog-" . esc_html($role) . " .wpd-comment-right{border-" . esc_html($left) . ": 1px solid " . esc_html($color) . ";}\r\n"; } } ?> options->thread_styles["commentTextSize"] !== "14px") ? "#wpdcom .wpd-comment-text p{font-size:" . esc_html($this->options->thread_styles["commentTextSize"]) . ";}\r\n" : ""; ?> #comments, #respond, .comments-area, #wpdcom.wpd-dark{} #wpdcom .ql-editor > *{} #wpdcom .ql-editor::before{} #wpdcom .ql-toolbar{border-top:none;} #wpdcom .ql-container{border-bottom:none;} #wpdcom .wpd-form-row .wpdiscuz-item input[type="text"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="email"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="url"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="color"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="date"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="datetime"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="datetime-local"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="month"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="number"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="time"], #wpdcom textarea, #wpdcom select{} #wpdcom.wpd-dark .wpdiscuz-item.wpd-field-select select.wpdiscuz_select, #wpdcom.wpd-dark select{} #wpdcom .wpd-form-row .wpdiscuz-item textarea{} #wpdcom input::placeholder, #wpdcom textarea::placeholder, #wpdcom input::-moz-placeholder, #wpdcom textarea::-webkit-input-placeholder{} #wpdcom .wpd-comment-text{} .lity-wrap .wpd-item a{color: #666;} .lity-wrap .wpd-item a:hover{color: #222;} .wpd-inline-shortcode.wpd-active{background-color: #666;} #comments, #respond, .comments-area, #wpdcom{} #wpdcom .ql-editor > *{} #wpdcom .ql-editor::before{} #wpdcom .ql-toolbar{border-top:none;} #wpdcom .ql-container{border-bottom:none;} #wpdcom .wpd-form-row .wpdiscuz-item input[type="text"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="email"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="url"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="color"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="date"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="datetime"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="datetime-local"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="month"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="number"], #wpdcom .wpd-form-row .wpdiscuz-item input[type="time"], #wpdcom textarea, #wpdcom select{} #wpdcom .wpd-form-row .wpdiscuz-item textarea{} #wpdcom input::placeholder, #wpdcom textarea::placeholder, #wpdcom input::-moz-placeholder, #wpdcom textarea::-webkit-input-placeholder{} #wpdcom .wpd-comment-text{} #wpdcom .wpd-thread-head .wpd-thread-info{ border-bottom:2px solid options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-thread-head .wpd-thread-info.wpd-reviews-tab svg{fill: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-thread-head .wpdiscuz-user-settings{border-bottom: 2px solid options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-thread-head .wpdiscuz-user-settings:hover{color: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-comment .wpd-follow-link:hover{color: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-comment-status .wpd-sticky{color: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-thread-filter .wpdf-active{color: options->thread_styles["primaryColor"]); ?>; border-bottom-color:options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-comment-info-bar {border: 1px dashed colorBrightness($this->options->thread_styles["primaryColor"], '0.2')); ?>; background: colorBrightness($this->options->thread_styles["primaryColor"], '0.9')); ?>; } #wpdcom .wpd-comment-info-bar .wpd-current-view i{color: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpd-filter-view-all:hover{background: options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpdiscuz-item .wpdiscuz-rating > label {color: options->rating["ratingInactiveColor"]); ?>;} #wpdcom .wpdiscuz-item .wpdiscuz-rating:not(:checked) > label:hover, .wpdiscuz-rating:not(:checked) > label:hover ~ label {} #wpdcom .wpdiscuz-item .wpdiscuz-rating > input ~ label:hover, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:not(:checked) ~ label:hover ~ label, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:not(:checked) ~ label:hover ~ label{color: options->rating["ratingHoverColor"]); ?>;} #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:checked ~ label:hover, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:checked ~ label:hover, #wpdcom .wpdiscuz-item .wpdiscuz-rating > label:hover ~ input:checked ~ label, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:checked + label:hover ~ label, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:checked ~ label:hover ~ label, .wpd-custom-field .wcf-active-star, #wpdcom .wpdiscuz-item .wpdiscuz-rating > input:checked ~ label{ color:options->rating["ratingActiveColor"]); ?>;} #wpd-post-rating .wpd-rating-wrap .wpd-rating-stars svg .wpd-star{fill: options->rating["ratingInactiveColor"]); ?>;} #wpd-post-rating .wpd-rating-wrap .wpd-rating-stars svg .wpd-active{fill:options->rating["ratingActiveColor"]); ?>;} #wpd-post-rating .wpd-rating-wrap .wpd-rate-starts svg .wpd-star{fill:options->rating["ratingInactiveColor"]); ?>;} #wpd-post-rating .wpd-rating-wrap .wpd-rate-starts:hover svg .wpd-star{fill:options->rating["ratingHoverColor"]); ?>;} #wpd-post-rating.wpd-not-rated .wpd-rating-wrap .wpd-rate-starts svg:hover ~ svg .wpd-star{ fill:options->rating["ratingInactiveColor"]); ?>;} .wpdiscuz-post-rating-wrap .wpd-rating .wpd-rating-wrap .wpd-rating-stars svg .wpd-star{fill:options->rating["ratingInactiveColor"]); ?>;} .wpdiscuz-post-rating-wrap .wpd-rating .wpd-rating-wrap .wpd-rating-stars svg .wpd-active{fill:options->rating["ratingActiveColor"]); ?>;} #wpdcom .wpd-comment .wpd-follow-active{color:#ff7a00;} #wpdcom .page-numbers{color:#555;border:#555 1px solid;} #wpdcom span.current{background:#555;} #wpdcom.wpd-layout-1 .wpd-new-loaded-comment > .wpd-comment-wrap > .wpd-comment-right{background:options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom.wpd-layout-2 .wpd-new-loaded-comment.wpd-comment > .wpd-comment-wrap > .wpd-comment-right{background:options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom.wpd-layout-2 .wpd-new-loaded-comment.wpd-comment.wpd-reply > .wpd-comment-wrap > .wpd-comment-right{background:transparent;} #wpdcom.wpd-layout-2 .wpd-new-loaded-comment.wpd-comment.wpd-reply > .wpd-comment-wrap {background:options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom.wpd-layout-3 .wpd-new-loaded-comment.wpd-comment > .wpd-comment-wrap > .wpd-comment-right{background:options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom .wpd-follow:hover i, #wpdcom .wpd-unfollow:hover i, #wpdcom .wpd-comment .wpd-follow-active:hover i{color:options->thread_styles["primaryColor"]); ?>;} #wpdcom .wpdiscuz-readmore{cursor:pointer;color:options->thread_styles["primaryColor"]); ?>;} .wpd-custom-field .wcf-pasiv-star, #wpcomm .wpdiscuz-item .wpdiscuz-rating > label {color: options->rating["ratingInactiveColor"]); ?>;} .wpd-wrapper .wpd-list-item.wpd-active{border-top: 3px solid options->thread_styles["primaryColor"]); ?>;} #wpdcom.wpd-layout-2 .wpd-comment.wpd-reply.wpd-unapproved-comment .wpd-comment-wrap{border-: 3px solid options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom.wpd-layout-3 .wpd-comment.wpd-reply.wpd-unapproved-comment .wpd-comment-right{border-: 1px solid options->thread_styles["newLoadedCommentBGColor"]); ?>;} #wpdcom .wpd-prim-button{background-color: options->thread_styles["primaryButtonBG"]); ?>; color: options->thread_styles["primaryButtonColor"]); ?>;} #wpdcom .wpd_label__check i.wpdicon-on{color: options->thread_styles["primaryButtonBG"]); ?>; border: 1px solid colorBrightness($this->options->thread_styles["primaryButtonBG"], 0.5)); ?>;} #wpd-bubble-wrapper #wpd-bubble-all-comments-count{color:options->thread_styles["bubbleColors"]); ?>;} #wpd-bubble-wrapper > div{background-color:options->thread_styles["bubbleColors"]); ?>;} #wpd-bubble-wrapper > #wpd-bubble #wpd-bubble-add-message{background-color:options->thread_styles["bubbleColors"]); ?>;} #wpd-bubble-wrapper > #wpd-bubble #wpd-bubble-add-message::before{border-left-color:options->thread_styles["bubbleColors"]); ?>; border-right-color:options->thread_styles["bubbleColors"]); ?>;} #wpd-bubble-wrapper.wpd-right-corner > #wpd-bubble #wpd-bubble-add-message::before{border-left-color:options->thread_styles["bubbleColors"]); ?>; border-right-color:options->thread_styles["bubbleColors"]); ?>;} .wpd-inline-icon-wrapper path.wpd-inline-icon-first{fill:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-inline-icon-count{background-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-inline-icon-count::before{border--color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-inline-form-wrapper::before{border-bottom-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-inline-form-question{background-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-inline-form{background-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-last-inline-comments-wrapper{border-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-last-inline-comments-wrapper::before{border-bottom-color:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-last-inline-comments-wrapper .wpd-view-all-inline-comments{background:options->thread_styles["inlineFeedbackColors"]); ?>;} .wpd-last-inline-comments-wrapper .wpd-view-all-inline-comments:hover,.wpd-last-inline-comments-wrapper .wpd-view-all-inline-comments:active,.wpd-last-inline-comments-wrapper .wpd-view-all-inline-comments:focus{background-color:options->thread_styles["inlineFeedbackColors"]); ?>;} #wpdcom .ql-snow .ql-tooltip[data-mode="link"]::before{content:"";} #wpdcom .ql-snow .ql-tooltip.ql-editing a.ql-action::after{content:"";} options); if ($this->options->thread_styles["theme"] !== "wpd-minimal") { echo stripslashes($this->options->thread_styles["customCss"]); } $css = ob_get_clean(); /* xMinfy Star ********************************************************* */ if (apply_filters("wpdiscuz_minify_inline_css", true)) { $css = preg_replace('/\/\*((?!\*\/).)*\*\//', "", $css); $css = preg_replace('/\s{2,}/', " ", $css); $css = preg_replace('/\s*([:;{}])\s*/', "$1", $css); $css = preg_replace('/;}/', "}", $css); } /* xMinify End ********************************************************* */ return $css; } /** * Increases or decreases the brightness of a color by a percentage of the current brightness. * * @param string $hexCode Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF` * @param float $adjustPercent A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker. * * @return string */ public function colorBrightness($hexCode, $adjustPercent = 1) { if (!$hexCode) { return '#000'; } $hexCode = ltrim($hexCode, '#'); if (strlen($hexCode) == 3) { $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2]; } $hexCode = array_map('hexdec', str_split($hexCode, 2)); foreach ($hexCode as & $color) { $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color; $adjustAmount = ceil($adjustableLimit * $adjustPercent); $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT); } return '#' . implode($hexCode); } public static function sanitize($action, $variable_name, $filter, $default = "") { if ($filter === "FILTER_SANITIZE_STRING") { $glob = INPUT_POST === $action ? $_POST : $_GET; if (key_exists($variable_name, $glob)) { return sanitize_text_field($glob[$variable_name]); } else { return $default; } } $variable = filter_input($action, $variable_name, $filter); return $variable ? $variable : $default; } public function handleCommentSubmission($post, $comment_parent, $isNewComment = true) { if (!$post) { return new WP_Error("post_not_found", __("Current post doesn't found.", "wpdiscuz")); } $_post = get_post($post); if (!$_post) { return new WP_Error("post_not_found", __("Current post doesn't found.", "wpdiscuz")); } $comment_post_id = $_post->ID; if ($comment_parent) { $comment_parent = absint($comment_parent); $comment_parent_object = get_comment($comment_parent); if ( 0 !== $comment_parent && ( !$comment_parent_object instanceof WP_Comment || 0 === (int)$comment_parent_object->comment_approved ) ) { do_action("comment_reply_to_unapproved_comment", $comment_post_id, $comment_parent); return new WP_Error("comment_reply_to_unapproved_comment", __("Sorry, replies to unapproved comments are not allowed."), 403); } } if (empty($_post->comment_status)) { do_action("comment_id_not_found", $comment_post_id); return new WP_Error("comment_id_not_found", __("Current post doesn't found.", "wpdiscuz")); } $status = get_post_status($_post); if (("private" === $status) && !current_user_can("read_post", $comment_post_id)) { return new WP_Error("comment_id_not_found", __("Current post doesn't found.", "wpdiscuz")); } $status_obj = get_post_status_object($status); if (!comments_open($comment_post_id)) { do_action("comment_closed", $comment_post_id); return new WP_Error("comment_closed", __("Sorry, comments are closed for this item.", "wpdiscuz"), 403); } elseif ("trash" === $status) { do_action("comment_on_trash", $comment_post_id); return new WP_Error("comment_on_trash", __("Current post doesn't found.", "wpdiscuz")); } elseif (!$status_obj->public && !$status_obj->private) { do_action("comment_on_draft", $comment_post_id); if (current_user_can("read_post", $comment_post_id)) { return new WP_Error("comment_on_draft", __("Sorry, comments are not allowed for this item.", "wpdiscuz"), 403); } else { return new WP_Error('comment_on_draft', __("Current post doesn't found.", "wpdiscuz")); } } elseif (post_password_required($comment_post_id)) { do_action('comment_on_password_protected', $comment_post_id); return new WP_Error('comment_on_password_protected', __("Sorry, comments are not allowed for this item.", "wpdiscuz")); } if ($isNewComment) { do_action('pre_comment_on_post', $comment_post_id); } return true; } public function updatePostAuthorsTrs($post_id) { set_transient(self::TRS_POSTS_AUTHORS, null); $this->dbManager->getPostsAuthors(); } public static function getBPUserUrl($user_id) { return function_exists('bp_members_get_user_url') ? bp_members_get_user_url($user_id) : bp_core_get_user_domain($user_id); } }
', $content); $content = preg_replace('~<\/code>\s?~is', '
~is', '
', $content); return $content; } public static function isUserCanFollowOrSubscribe($email) { return !in_array(strstr($email, "@"), [ "@facebook.com", "@twitter.com", "@ok.ru", "@wechat.com", "@weibo.com", "@baidu.com", "@example.com", ]); } public function addRatingResetButton($postType, $post) { if (!$post || empty($post->ID)) { return; } $form = $this->wpdiscuzForm->getForm($post->ID); if ($form->getFormID() && ($form->getEnableRateOnPost() || $form->getRatingsExists())) { add_meta_box("wpd_reset_ratings", __("Reset Ratings", "wpdiscuz"), [ &$this, "resetRatingsButtons" ], $postType, "side", "low"); } } public function resetRatingsButtons($post) { $form = $this->wpdiscuzForm->getForm($post->ID); $ajax_nonce = wp_create_nonce("wpd-reset-rating"); if ($form->getFormID()) { if ($form->getEnableRateOnPost()) { ?>