本文整理汇总了PHP中Akismet::get_comment_history方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::get_comment_history方法的具体用法?PHP Akismet::get_comment_history怎么用?PHP Akismet::get_comment_history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akismet
的用法示例。
在下文中一共展示了Akismet::get_comment_history方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comment_status_meta_box
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>';
}
}
示例2: akismet_get_comment_history
function akismet_get_comment_history($comment_id)
{
return Akismet::get_comment_history($comment_id);
}
示例3: akismet_get_comment_history
function akismet_get_comment_history($comment_id)
{
_deprecated_function(__FUNCTION__, '3.0', 'Akismet::get_comment_history()');
return Akismet::get_comment_history($comment_id);
}
示例4: comment_status_meta_box
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>';
}
}