X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..784f914b1e4b1c62d6657e86397c2e83bcee4295:/wp-content/plugins/akismet/admin.php?page=akismet-key-config diff --git a/wp-content/plugins/akismet/admin.php b/wp-content/plugins/akismet/admin.php deleted file mode 100644 index aa30cde7..00000000 --- a/wp-content/plugins/akismet/admin.php +++ /dev/null @@ -1,850 +0,0 @@ -
".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'); - - return; - } - - 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_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_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; - - if ( isset($_POST['submit']) ) { - if ( function_exists('current_user_can') && !current_user_can('manage_options') ) - die(__('Cheatin’ uh?')); - - 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 ); - } - - if ( $key_status == 'valid' ) { - update_option('wordpress_api_key', $key); - $ms[] = 'new_key_valid'; - } else if ( $key_status == 'invalid' ) { - $ms[] = 'new_key_invalid'; - } else if ( $key_status == 'failed' ) { - $ms[] = 'new_key_failed'; - } - - if ( isset( $_POST['akismet_discard_month'] ) ) - 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); - } - - if ( empty( $key_status) || $key_status != 'valid' ) { - $key = get_option('wordpress_api_key'); - if ( empty( $key ) ) { - if ( empty( $key_status ) || $key_status != 'failed' ) { - if ( akismet_verify_key( '1234567890ab' ) == 'failed' ) - $ms[] = 'no_connection'; - else - $ms[] = 'key_empty'; - } - $key_status = 'empty'; - } else { - $key_status = akismet_verify_key( $key ); - } - if ( $key_status == 'valid' ) { - $ms[] = 'key_valid'; - } else if ( $key_status == 'invalid' ) { - $ms[] = 'key_invalid'; - } else if ( !empty($key) && $key_status == 'failed' ) { - $ms[] = 'key_failed'; - } - } - - $messages = array( - 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), - '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.' ); ?>
'.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) ).'
'; -} -add_action('activity_box_end', 'akismet_stats'); - -function akismet_admin_warnings() { - global $wpcom_api_key, $pagenow; - - if ( - $pagenow == 'edit-comments.php' - || ( !empty( $_GET['page'] ) && $_GET['page'] == 'akismet-key-config' ) - || ( !empty( $_GET['page'] ) && $_GET['page'] == 'akismet-stats-display' ) - ) { - if ( get_option( 'akismet_alert_code' ) ) { - function akismet_alert() { - $alert = array( - 'code' => (int) get_option( 'akismet_alert_code' ), - 'msg' => get_option( 'akismet_alert_msg' ) - ); - ?> -Akismet Error Code:
- -More information is available at https://akismet.com/errors/
-".__('Akismet is almost ready.')." ".sprintf(__('You must enter your Akismet API key for it to work.'), "admin.php?page=akismet-key-config")."
- "; - } - add_action('admin_notices', 'akismet_warning'); - return; - } elseif ( ( empty($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php' ) && wp_next_scheduled('akismet_schedule_cron_recheck') ) { - function akismet_warning() { - global $wpdb; - akismet_fix_scheduled_recheck(); - $waiting = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); - $next_check = wp_next_scheduled('akismet_schedule_cron_recheck'); - if ( $waiting > 0 && $next_check > time() ) - echo " - - "; - } - add_action('admin_notices', 'akismet_warning'); - return; - } -} - -// FIXME placeholder - -function akismet_comment_row_action( $a, $comment ) { - - // failsafe for old WP versions - if ( !function_exists('add_comment_meta') ) - return $a; - - $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); - $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true ); - $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true); - $comment_status = wp_get_comment_status( $comment->comment_ID ); - $desc = null; - if ( $akismet_error ) { - $desc = __( 'Awaiting spam check' ); - } elseif ( !$user_result || $user_result == $akismet_result ) { - // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same - if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' ) - $desc = __( 'Flagged as spam by Akismet' ); - elseif ( $akismet_result == 'false' && $comment_status == 'spam' ) - $desc = __( 'Cleared by Akismet' ); - } else { - $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true ); - if ( $user_result == 'true' ) - $desc = sprintf( __('Flagged as spam by %s'), $who ); - else - $desc = sprintf( __('Un-spammed by %s'), $who ); - } - - // add a History item to the hover links, just after Edit - if ( $akismet_result ) { - $b = array(); - foreach ( $a as $k => $item ) { - $b[ $k ] = $item; - if ( - $k == 'edit' - || ( $k == 'unspam' && $GLOBALS['wp_version'] >= 3.4 ) - ) { - $b['history'] = ' '. __('History') . ''; - } - } - - $a = $b; - } - - if ( $desc ) - echo ' '; - - if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) { - $comment_count = akismet_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); - $comment_count = intval( $comment_count ); - echo ' '; - } - - return $a; -} - -add_filter( 'comment_row_actions', 'akismet_comment_row_action', 10, 2 ); - -function akismet_comment_status_meta_box($comment) { - $history = akismet_get_comment_history( $comment->comment_ID ); - - if ( $history ) { - echo ' '; - - } -} - - -// add an extra column header to the comments screen -function akismet_comments_columns( $columns ) { - $columns[ 'akismet' ] = __( 'Akismet' ); - return $columns; -} - -#add_filter( 'manage_edit-comments_columns', 'akismet_comments_columns' ); - -// Show stuff in the extra column -function akismet_comment_column_row( $column, $comment_id ) { - if ( $column != 'akismet' ) - return; - - $history = akismet_get_comment_history( $comment_id ); - - if ( $history ) { - echo ' '; - } -} - -#add_action( 'manage_comments_custom_column', 'akismet_comment_column_row', 10, 2 ); - -// END FIXME - -// call out URLS in comments -function akismet_text_add_link_callback( $m ) { - - // bare link? - if ( $m[4] == $m[2] ) - return ''.$m[4].''; - else - return ''.$m[4].''; -} - -function akismet_text_add_link_class( $comment_text ) { - - return preg_replace_callback( '#]*)href="([^"]+)"([^>]*)>(.*?)#i', 'akismet_text_add_link_callback', $comment_text ); -} - -add_filter('comment_text', 'akismet_text_add_link_class'); - - -// WP 2.5+ -function akismet_rightnow() { - 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?page=akismet-admin'; - - if ( $count = get_option('akismet_spam_count') ) { - $intro = sprintf( _n( - 'Akismet has protected your site from %2$s spam comment already. ', - 'Akismet has protected your site from %2$s spam comments already. ', - $count - ), 'http://akismet.com/?return=true', number_format_i18n( $count ) ); - } else { - $intro = sprintf( __('Akismet blocks spam from getting to your blog. '), 'http://akismet.com/?return=true' ); - } - - $link = function_exists( 'esc_url' ) ? esc_url( $link ) : clean_url( $link ); - if ( $queue_count = akismet_spam_count() ) { - $queue_text = sprintf( _n( - 'There\'s %1$s comment in your spam queue right now.', - 'There are %1$s comments in your spam queue right now.', - $queue_count - ), number_format_i18n( $queue_count ), $link ); - } else { - $queue_text = sprintf( __( "There's nothing in your spam queue at the moment." ), $link ); - } - - $text = $intro . '