X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..a349837896628462bf8c9bdc27d1477a10fe03eb:/wp-content/plugins/akismet/admin.php diff --git a/wp-content/plugins/akismet/admin.php b/wp-content/plugins/akismet/admin.php index 481b0f3d..56d8c92d 100644 --- a/wp-content/plugins/akismet/admin.php +++ b/wp-content/plugins/akismet/admin.php @@ -39,13 +39,20 @@ function akismet_load_js_and_css() { 'plugins_page_akismet-key-config', 'jetpack_page_akismet-key-config', ) ) ) { - wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), '2.5.4.4' ); + wp_register_style( 'akismet.css', AKISMET_PLUGIN_URL . 'akismet.css', array(), AKISMET_VERSION ); wp_enqueue_style( 'akismet.css'); - wp_register_script( 'akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'), '2.5.4.6' ); + wp_register_script( 'akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'), AKISMET_VERSION ); wp_enqueue_script( 'akismet.js' ); wp_localize_script( 'akismet.js', 'WPAkismet', array( - 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ) + 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ), + 'strings' => array( + 'Remove this URL' => __( 'Remove this URL' ), + 'Removing...' => __( 'Removing...' ), + 'URL removed' => __( 'URL removed' ), + '(undo)' => __( '(undo)' ), + 'Re-adding...' => __( 'Re-adding...' ), + ) ) ); } } @@ -67,11 +74,14 @@ add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 ); function akismet_conf() { global $akismet_nonce, $current_user; - $new_key_link = 'https://akismet.com/get/'; - $api_key = akismet_get_key(); - $show_key_form = $api_key; - $key_status = 'empty'; - $saved_ok = false; + $new_key_link = 'https://akismet.com/get/'; + $config_link = esc_url( add_query_arg( array( 'page' => 'akismet-key-config', 'show' => 'enter-api-key' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'plugins.php' ) ) ); + $stats_link = esc_url( add_query_arg( array( 'page' => 'akismet-stats-display' ), class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'index.php' ) ) ); + $api_key = akismet_get_key(); + $show_key_form = $api_key; + $key_status = 'empty'; + $saved_ok = false; + $key_status_text = ''; $ms = array(); @@ -98,17 +108,17 @@ function akismet_conf() { $ms[] = 'key_empty'; } else - $key_status = akismet_verify_key( $key ); - + $key_status = akismet_verify_key( $key ); + if ( $key != $api_key && $key_status == 'valid' ) { - update_option('wordpress_api_key', $key); $ms[] = 'new_key_valid'; + update_option('wordpress_api_key', $key); } elseif ( $key_status == 'invalid' ) $ms[] = 'new_key_invalid'; elseif ( $key_status == 'failed' ) $ms[] = 'new_key_failed'; - + $api_key = $key_status == 'valid' ? $key : false; if ( isset( $_POST['akismet_discard_month'] ) ) @@ -130,6 +140,9 @@ function akismet_conf() { check_admin_referer( $akismet_nonce ); akismet_get_server_connectivity(0); } + elseif ( isset( $_GET['show'] ) && $_GET['show'] == 'enter-api-key' ) { + $show_key_form = true; + } if ( $show_key_form ) { //check current key status @@ -154,7 +167,14 @@ function akismet_conf() { elseif ( !empty( $key ) && $key_status == 'failed' ) $ms[] = 'key_failed'; } - } + } + + $key_status_strings = array( + 'empty' => __( 'Empty' ), + 'valid' => __( 'Valid' ), + 'invalid' => __( 'Invalid' ), + 'failed' => __( 'Failed' ), + ); $messages = array( 'new_key_empty' => array( 'class' => 'updated fade', 'text' => __('Your key has been cleared.' ) ), @@ -174,7 +194,7 @@ function akismet_conf() {
-create one here'), '#' );?>
enter your Akismet API key for it to work.' ), $config_link );?>
'.sprintf( _n( 'Akismet has protected your site from %3$s spam comments.', 'Akismet has protected your site from %3$s spam comments.', $count ), 'http://akismet.com/?return=true', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'
'; + echo ''.sprintf( _n( 'Akismet has protected your site from %3$s spam comments.', 'Akismet has protected your site from %3$s spam comments.', $count ), 'http://akismet.com/?return=true', esc_url( add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( isset( $submenu['edit-comments.php'] ) ? 'edit-comments.php' : 'edit.php' ) ) ), number_format_i18n($count) ).'
'; } add_action('activity_box_end', 'akismet_stats'); @@ -368,7 +385,7 @@ function akismet_admin_warnings() { -