public static function comment_status_meta_box($comment) { $history = Akismet::get_comment_history($comment->comment_ID); if ($history) { echo '<div class="akismet-history" style="margin: 13px;">'; foreach ($history as $row) { $time = date('D d M Y @ h:i:m a', $row['time']) . ' GMT'; echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf(esc_html__('%s ago', 'akismet'), human_time_diff($row['time'])) . '</span> - '; echo esc_html($row['message']) . '</div>'; } echo '</div>'; } }
function akismet_get_comment_history($comment_id) { return Akismet::get_comment_history($comment_id); }
function akismet_get_comment_history($comment_id) { _deprecated_function(__FUNCTION__, '3.0', 'Akismet::get_comment_history()'); return Akismet::get_comment_history($comment_id); }
public static function comment_status_meta_box($comment) { $history = Akismet::get_comment_history($comment->comment_ID); if ($history) { echo '<div class="akismet-history" style="margin: 13px;">'; foreach ($history as $row) { $time = date('D d M Y @ h:i:m a', $row['time']) . ' GMT'; $message = ''; if (!empty($row['message'])) { // Old versions of Akismet stored the message as a literal string in the commentmeta. // New versions don't do that for two reasons: // 1) Save space. // 2) The message can be translated into the current language of the blog, not stuck // in the language of the blog when the comment was made. $message = $row['message']; } // If possible, use a current translation. switch ($row['event']) { case 'recheck-spam': $message = __('Akismet re-checked and caught this comment as spam.', 'akismet'); break; case 'check-spam': $message = __('Akismet caught this comment as spam.', 'akismet'); break; case 'recheck-ham': $message = __('Akismet re-checked and cleared this comment.', 'akismet'); break; case 'check-ham': $message = __('Akismet cleared this comment.', 'akismet'); break; case 'wp-blacklisted': $message = __('Comment was caught by wp_blacklist_check.', 'akismet'); break; case 'report-spam': if (isset($row['user'])) { $message = sprintf(__('%s reported this comment as spam.', 'akismet'), $row['user']); } else { if (!$message) { $message = __('This comment was reported as spam.', 'akismet'); } } break; case 'report-ham': if (isset($row['user'])) { $message = sprintf(__('%s reported this comment as not spam.', 'akismet'), $row['user']); } else { if (!$message) { $message = __('This comment was reported as not spam.', 'akismet'); } } break; case 'cron-retry-spam': $message = __('Akismet caught this comment as spam during an automatic retry.', 'akismet'); break; case 'cron-retry-ham': $message = __('Akismet cleared this comment during an automatic retry.', 'akismet'); break; case 'check-error': if (isset($row['meta'], $row['meta']['response'])) { $message = sprintf(__('Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet'), $row['meta']['response']); } break; case 'recheck-error': if (isset($row['meta'], $row['meta']['response'])) { $message = sprintf(__('Akismet was unable to recheck this comment (response: %s).', 'akismet'), $row['meta']['response']); } break; default: if (preg_match('/^status-changed/', $row['event'])) { // Half of these used to be saved without the dash after 'status-changed'. // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk $new_status = preg_replace('/^status-changed-?/', '', $row['event']); $message = sprintf(__('Comment status was changed to %s', 'akismet'), $new_status); } else { if (preg_match('/^status-/', $row['event'])) { $new_status = preg_replace('/^status-/', '', $row['event']); if (isset($row['user'])) { $message = sprintf(__('%1$s changed the comment status to %2$s.', 'akismet'), $row['user'], $new_status); } } } break; } echo '<div style="margin-bottom: 13px;">'; echo '<span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf(esc_html__('%s ago', 'akismet'), human_time_diff($row['time'])) . '</span>'; echo ' - '; echo esc_html($message); echo '</div>'; } echo '</div>'; } }