/*
Plugin Name: Akismet
Plugin URI: http://akismet.com/
-Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code><?php akismet_counter(); ?></code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.1.8
+Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code><?php akismet_counter(); ?></code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
+Version: 2.2.3
Author: Matt Mullenweg
Author URI: http://ma.tt/
*/
$akismet_api_port = 80;
add_action('admin_menu', 'akismet_config_page');
+ add_action('admin_menu', 'akismet_stats_page');
}
add_action('init', 'akismet_init');
+function akismet_admin_init() {
+ if ( function_exists( 'get_plugin_page_hook' ) )
+ $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
+ else
+ $hook = 'dashboard_page_akismet-stats-display';
+ add_action('admin_head-'.$hook, 'akismet_stats_script');
+}
+add_action('admin_init', 'akismet_admin_init');
+
if ( !function_exists('wp_nonce_field') ) {
function akismet_nonce_field($action = -1) { return; }
$akismet_nonce = -1;
<?php
}
+function akismet_stats_page() {
+ if ( function_exists('add_submenu_page') )
+ add_submenu_page('index.php', __('Akismet Stats'), __('Akismet Stats'), 'manage_options', 'akismet-stats-display', 'akismet_stats_display');
+
+}
+
+function akismet_stats_script() {
+ ?>
+<script type="text/javascript">
+function resizeIframe() {
+ var height = document.documentElement.clientHeight;
+ height -= document.getElementById('akismet-stats-frame').offsetTop;
+ height += 100; // magic padding
+
+ document.getElementById('akismet-stats-frame').style.height = height +"px";
+
+};
+function resizeIframeInit() {
+ document.getElementById('akismet-stats-frame').onload = resizeIframe;
+ window.onresize = resizeIframe;
+}
+addLoadEvent(resizeIframeInit);
+</script><?php
+}
+
+
+function akismet_stats_display() {
+ global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
+ $blog = urlencode( get_option('home') );
+ $url = "http://".get_option('wordpress_api_key').".web.akismet.com/1.0/user-stats.php?blog={$blog}";
+ ?>
+ <div class="wrap">
+ <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe>
+ </div>
+ <?php
+}
+
function akismet_verify_key( $key ) {
global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
$blog = urlencode( get_option('home') );
add_action('edit_comment', 'akismet_submit_spam_comment');
add_action('preprocess_comment', 'akismet_auto_check_comment', 1);
+function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); }
+add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' );
+
// Total spam in queue
// get_option( 'akismet_spam_count' ) is the total caught ever
function akismet_spam_count( $type = false ) {
// WP 2.5+
function akismet_rightnow() {
- global $submenu;
- if ( isset( $submenu['edit-comments.php'] ) )
- $link = 'edit-comments.php';
+ global $submenu, $wp_db_version;
+
+ if ( 8645 < $wp_db_version ) // 2.7
+ $link = 'edit-comments.php?comment_status=spam';
+ elseif ( isset( $submenu['edit-comments.php'] ) )
+ $link = 'edit-comments.php?page=akismet-admin';
else
- $link = 'edit.php';
+ $link = 'edit.php?page=akismet-admin';
if ( $count = get_option('akismet_spam_count') ) {
$intro = sprintf( __ngettext(
'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.',
'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.',
$queue_count
- ), number_format_i18n( $queue_count ), clean_url("$link?page=akismet-admin") );
+ ), number_format_i18n( $queue_count ), clean_url($link) );
} else {
- $queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), clean_url("$link?page=akismet-admin") );
+ $queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), clean_url($link) );
}
$text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text );