mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Options cleanup and some styling changes.
git-svn-id: https://develop.svn.wordpress.org/trunk@4196 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1,77 +1,5 @@
|
||||
<?php
|
||||
|
||||
class retrospam_mgr {
|
||||
var $spam_words;
|
||||
var $comments_list;
|
||||
var $found_comments;
|
||||
|
||||
function retrospam_mgr() {
|
||||
global $wpdb;
|
||||
|
||||
$list = explode("\n", get_option('moderation_keys') );
|
||||
$list = array_unique( $list );
|
||||
$this->spam_words = $list;
|
||||
|
||||
$this->comment_list = $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC");
|
||||
} // End of class constructor
|
||||
|
||||
function move_spam( $id_list ) {
|
||||
global $wpdb;
|
||||
$cnt = 0;
|
||||
$id_list = explode( ',', $id_list );
|
||||
|
||||
foreach ( $id_list as $comment ) {
|
||||
if ( $wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) {
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
echo "<div class='updated'><p> ";
|
||||
printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
|
||||
echo "</p></div>\n";
|
||||
} // End function move_spam
|
||||
|
||||
function find_spam() {
|
||||
$in_queue = 0;
|
||||
|
||||
foreach( $this->comment_list as $comment ) {
|
||||
if( $comment->approved == 1 ) {
|
||||
foreach( $this->spam_words as $word ) {
|
||||
$word = trim($word);
|
||||
if ( empty( $word ) )
|
||||
continue;
|
||||
$fulltext = strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text);
|
||||
if( false !== strpos( $fulltext, strtolower($word) ) ) {
|
||||
$this->found_comments[] = $comment->ID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$in_queue++;
|
||||
}
|
||||
}
|
||||
return array( 'found' => $this->found_comments, 'in_queue' => $in_queue );
|
||||
} // End function find_spam
|
||||
|
||||
function display_edit_form( $counters ) {
|
||||
$numfound = count($counters[found]);
|
||||
$numqueue = $counters[in_queue];
|
||||
|
||||
$body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
|
||||
|
||||
if ( count($counters[found]) > 0 ) {
|
||||
$id_list = implode( ',', $counters[found] );
|
||||
$body .= '<p><a href="options-discussion.php?action=retrospam&move=true&ids='.$id_list.'">'. __('Move suspect comments to moderation queue »') . '</a></p>';
|
||||
|
||||
}
|
||||
$head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
|
||||
|
||||
$foot .= '<p><a href="options-discussion.php">' . __('« Return to Discussion Options page.') . '</a></p></div>';
|
||||
|
||||
return $head . $body . $foot;
|
||||
} // End function display_edit_form
|
||||
|
||||
}
|
||||
|
||||
class WP {
|
||||
var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user