Index: akismet.php =================================================================== --- akismet.php (revision 220471) +++ akismet.php (working copy) @@ -11,10 +11,7 @@ define('AKISMET_VERSION', '2.2.7'); // If you hardcode a WP.com API key here, all key config screens will be hidden -if ( defined('WPCOM_API_KEY') ) - $wpcom_api_key = constant('WPCOM_API_KEY'); -else - $wpcom_api_key = ''; +$wpcom_api_key = defined('WPCOM_API_KEY') ? WPCOM_API_KEY : ''; function akismet_init() { global $wpcom_api_key, $akismet_api_host, $akismet_api_port; @@ -52,6 +49,16 @@ function number_format_i18n( $number, $decimals = null ) { return number_format( $number, $decimals ); } } +if ( !function_exists('esc_url') ) { + function esc_url( $url ) { return clean_url( $url ); } +} +if ( !function_exists('esc_html') ) { + function esc_html( $html ) { return wp_specialchars( $html ); } +} +if ( !function_exists('esc_attr') ) { + function esc_attr( $attr ) { return attribute_escape( $attr ); } +} + 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'); @@ -61,6 +68,7 @@ function akismet_conf() { global $akismet_nonce, $wpcom_api_key; + $key_status = ''; if ( isset($_POST['submit']) ) { if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(__('Cheatin’ uh?')); @@ -142,7 +150,9 @@
(What is this?'); ?>)
- + @@ -707,7 +717,7 @@ echo ''.__('You can delete all of the spam from your database with a single click. This operation cannot be undone, so you may wish to check to ensure that no legitimate comments got through first. Spam is automatically deleted after 15 days, so don’t sweat it.').'
'; ?> - 50 ) { $total_pages = ceil( $total / 50 ); $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; - $r .= ''. __('« Previous Page') .'' . "\n"; + $r .= ''. __('« Previous Page') .'' . "\n"; } if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : @@ -790,7 +800,7 @@ $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? '' : $page_num; - $r .= '' . ( $page_num ) . "\n"; + $r .= '' . ( $page_num ) . "\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; @@ -801,13 +811,13 @@ } if ( ( $page ) * 50 < $total || -1 == $total ) { $args['apage'] = $page + 1; - $r .= ''. __('Next Page »') .'' . "\n"; + $r .= ''. __('Next Page »') .'' . "\n"; } echo "$r
"; ?> - @@ -885,10 +895,10 @@ - @@ -912,7 +922,7 @@ $link = 'edit-comments.php'; else $link = 'edit.php'; - echo ''.sprintf(__('Akismet has protected your site from %3$s spam comments.'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'
'; + echo ''.sprintf(__('Akismet has protected your site from %3$s spam comments.'), 'http://akismet.com/', esc_url("$link?page=akismet-admin"), number_format_i18n($count) ).'
'; } add_action('activity_box_end', 'akismet_stats'); @@ -943,12 +953,12 @@ 'and there\'s %1$s comment in your spam queue right now.', 'and there are %1$s comments in your spam queue right now.', $queue_count - ), number_format_i18n( $queue_count ), clean_url($link) ); + ), number_format_i18n( $queue_count ), esc_url($link) ); } else { - $queue_text = sprintf( __( "but there's nothing in your spam queue at the moment." ), clean_url($link) ); + $queue_text = sprintf( __( "but there's nothing in your spam queue at the moment." ), esc_url($link) ); } - $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text ); + $text = sprintf( function_exists( '_x' ) ? _x( '%1$s %2$s', 'akismet_rightnow' ) : _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text ); echo " \n"; } @@ -956,6 +966,7 @@ add_action('rightnow_end', 'akismet_rightnow'); // For WP <= 2.3.x +global $pagenow; if ( 'moderation.php' == $pagenow ) { function akismet_recheck_button( $page ) { global $submenu; @@ -1077,7 +1088,7 @@ function widget_akismet_control() { $options = $newoptions = get_option('widget_akismet'); - if ( $_POST["akismet-submit"] ) { + if ( !empty( $_POST['akismet-submit'] ) ) { $newoptions['title'] = strip_tags(stripslashes($_POST["akismet-title"])); if ( empty($newoptions['title']) ) $newoptions['title'] = 'Spam Blocked'; } @@ -1087,13 +1098,18 @@ } $title = htmlspecialchars($options['title'], ENT_QUOTES); ?> - + 75 ) ); + } else { + register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet'); + register_widget_control('Akismet', 'widget_akismet_control', null, 75, 'akismet'); + } if ( is_active_widget('widget_akismet') ) add_action('wp_head', 'widget_akismet_style'); endif;