" name="fieldInputName); ?>[name]" id="fieldInputName); ?>[name]" required/>
" name="fieldInputName); ?>[desc]" id="fieldInputName); ?>[desc]"/>

exists()) { return; } $hasDesc = $args["desc"] ? true : false; $commenter = wp_get_current_commenter(); $consent = empty($commenter["comment_author_email"]) ? "" : " checked='checked'"; ?> cookiesConsent = filter_input(INPUT_POST, $fieldName, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $action = Sanitizer::sanitize(INPUT_POST, "action", "FILTER_SANITIZE_STRING"); if ($this->cookiesConsent === false && $action !== "wpdSaveEditedComment") { $past = time() - YEAR_IN_SECONDS; setcookie("comment_author_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); setcookie("comment_author_email_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); setcookie("comment_author_url_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); } } public function sanitizeFieldData($data) { $cleanData = []; $cleanData["type"] = sanitize_text_field($data["type"]); if (isset($data["name"])) { $name = sanitize_text_field(trim(strip_tags($data["name"]))); $cleanData["name"] = $name ? $name : $this->fieldDefaultData["name"]; } if (isset($data["desc"])) { $cleanData["desc"] = sanitize_text_field(trim($data["desc"])); } if (isset($data["label"])) { $cleanData["label"] = sanitize_text_field(trim($data["label"])); } return wp_parse_args($cleanData, $this->fieldDefaultData); } protected function initDefaultData() { $this->fieldDefaultData = [ "name" => "Cookies Consent", "label" => esc_html__("Save my data for the next time I comment"), "desc" => "Save my name, email, and website in this browser cookies for the next time I comment.", "required" => "0", "show_for_guests" => "1", "show_for_users" => "0", "is_show_on_comment" => "0", "is_show_sform" => "1", "no_insert_meta" => "1" ]; // add_action('wpdiscuz_before_save_commentmeta', [$this, 'beforeSaveCommentmeta']); } public function beforeSaveCommentmeta($comment) { if ($this->cookiesConsent === false) { $past = time() - YEAR_IN_SECONDS; setcookie("comment_author_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); setcookie("comment_author_email_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); setcookie("comment_author_url_" . COOKIEHASH, " ", $past, "/", COOKIE_DOMAIN); } } }