X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/d954c87a1e3f0e671855614661da9e5825279134..refs/tags/wordpress-3.4:/wp-content/plugins/akismet/admin.php diff --git a/wp-content/plugins/akismet/admin.php b/wp-content/plugins/akismet/admin.php index a1954039..aa30cde7 100644 --- a/wp-content/plugins/akismet/admin.php +++ b/wp-content/plugins/akismet/admin.php @@ -1,17 +1,17 @@

".sprintf(__('Akismet %s required WordPress 3.0 or higher.'), AKISMET_VERSION) ." ".sprintf(__('Please upgrade WordPress to a current version, or downgrade to version 2.4 of the Akismet plugin.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "

+

".sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) ." ".sprintf(__('Please upgrade WordPress to a current version, or downgrade to version 2.4 of the Akismet plugin.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "

"; } add_action('admin_notices', 'akismet_version_warning'); @@ -24,19 +24,46 @@ function akismet_admin_init() { else $hook = 'dashboard_page_akismet-stats-display'; add_action('admin_head-'.$hook, 'akismet_stats_script'); - add_meta_box('akismet-status', __('Akismet Status'), 'akismet_comment_status_meta_box', 'comment', 'normal'); + add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal'); } add_action('admin_init', 'akismet_admin_init'); +add_action( 'admin_enqueue_scripts', 'akismet_load_js_and_css' ); +function akismet_load_js_and_css() { + global $hook_suffix; + + if ( + $hook_suffix == 'index.php' # dashboard + || $hook_suffix == 'edit-comments.php' + || $hook_suffix == 'comment.php' + || $hook_suffix == 'post.php' + || $hook_suffix == 'plugins_page_akismet-key-config' + ) { + wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), '2.5.4.4' ); + wp_enqueue_style( 'akismet.css'); + + wp_register_script( 'akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'), '2.5.4.6' ); + wp_enqueue_script( 'akismet.js' ); + wp_localize_script( 'akismet.js', 'WPAkismet', array( + 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ) + ) ); + } +} + + function akismet_nonce_field($action = -1) { return wp_nonce_field($action); } $akismet_nonce = 'akismet-update-key'; -function akismet_config_page() { - if ( function_exists('add_submenu_page') ) - add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); +function akismet_plugin_action_links( $links, $file ) { + if ( $file == plugin_basename( dirname(__FILE__).'/akismet.php' ) ) { + $links[] = ''.__('Settings').''; + } + return $links; } +add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 ); + function akismet_conf() { global $akismet_nonce, $wpcom_api_key; @@ -46,11 +73,15 @@ function akismet_conf() { check_admin_referer( $akismet_nonce ); $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); + $home_url = parse_url( get_bloginfo('url') ); if ( empty($key) ) { $key_status = 'empty'; $ms[] = 'new_key_empty'; delete_option('wordpress_api_key'); + } elseif ( empty($home_url['host']) ) { + $key_status = 'empty'; + $ms[] = 'bad_home_url'; } else { $key_status = akismet_verify_key( $key ); } @@ -68,6 +99,12 @@ function akismet_conf() { update_option( 'akismet_discard_month', 'true' ); else update_option( 'akismet_discard_month', 'false' ); + + if ( isset( $_POST['akismet_show_user_comments_approved'] ) ) + update_option( 'akismet_show_user_comments_approved', 'true' ); + else + update_option( 'akismet_show_user_comments_approved', 'false' ); + } elseif ( isset($_POST['check']) ) { akismet_get_server_connectivity(0); } @@ -88,8 +125,7 @@ function akismet_conf() { if ( $key_status == 'valid' ) { $ms[] = 'key_valid'; } else if ( $key_status == 'invalid' ) { - delete_option('wordpress_api_key'); - $ms[] = 'key_empty'; + $ms[] = 'key_invalid'; } else if ( !empty($key) && $key_status == 'failed' ) { $ms[] = 'key_failed'; } @@ -97,36 +133,43 @@ function akismet_conf() { $messages = array( 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), - 'new_key_valid' => array('color' => '2d2', 'text' => __('Your key has been verified. Happy blogging!')), - 'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please double-check it.')), - 'new_key_failed' => array('color' => 'd22', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), - 'no_connection' => array('color' => 'd22', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), - 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (Get your key.)'), 'http://akismet.com/get/')), - 'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')), - 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.'))); + 'new_key_valid' => array('color' => '4AB915', 'text' => __('Your key has been verified. Happy blogging!')), + 'new_key_invalid' => array('color' => '888', 'text' => __('The key you entered is invalid. Please double-check it.')), + 'new_key_failed' => array('color' => '888', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), + 'no_connection' => array('color' => '888', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), + 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (Get your key.)'), 'http://akismet.com/get/?return=true')), + 'key_valid' => array('color' => '4AB915', 'text' => __('This key is valid.')), + 'key_invalid' => array('color' => '888', 'text' => __('This key is invalid.')), + 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')), + 'bad_home_url' => array('color' => '888', 'text' => sprintf( __('Your WordPress home URL %s is invalid. Please fix the home option.'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) ), + ); ?>

+ +

Sign up success! Please check your email for your Akismet API Key and enter it below.' ); ?>

+
-

Akismet will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at Akismet.com.'), 'http://akismet.com/', 'http://akismet.com/get/'); ?>

+

Akismet will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at Akismet.com.'), 'http://akismet.com/?return=true', 'http://akismet.com/get/?return=true'); ?>

-

(What is this?'); ?>)

+

(What is this?'); ?>)

-

+

+

@@ -136,7 +179,7 @@ function akismet_conf() { -

+

fsockopen or gethostbynamel functions. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet\'s system requirements.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

0 ) { ?> -

+

Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

-

+

-

+

Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

$status ) { - $color = ( $status ? '#2d2' : '#d22'); + $color = ( $status ? '#4AB915' : '#888'); ?> - +

+

Click here to confirm that Akismet.com is up.'), 'http://status.automattic.com/9931/136079/Akismet-API', 'http://status.automattic.com/9931/136079/Akismet-API' ); ?>

@@ -196,21 +240,12 @@ function akismet_conf() {