/** * Inner function - Write manual moderation results to PHP sessions * @param string $hash Cleantalk comment hash * @param string $message comment_content * @param int $allow flag good comment (1) or bad (0) * @return string comment_content w\o cleantalk resume */ function ct_feedback($hash, $message = null, $allow) { global $ct_options, $ct_data; require_once 'cleantalk.class.php'; $config = get_option('cleantalk_server'); $ct = new Cleantalk(); $ct->work_url = $config['ct_work_url']; $ct->server_url = $ct_options['server']; $ct->server_ttl = $config['ct_server_ttl']; $ct->server_changed = $config['ct_server_changed']; if (empty($hash)) { $hash = $ct->getCleantalkCommentHash($message); } $resultMessage = null; if ($message !== null) { $resultMessage = $ct->delCleantalkComment($message); } $ct_feedback = $hash . ':' . $allow . ';'; if (empty($_SESSION['feedback_request'])) { $_SESSION['feedback_request'] = $ct_feedback; } else { $_SESSION['feedback_request'] .= $ct_feedback; } return $resultMessage; }