WordPress.org

Make WordPress Core

Ticket #2509: akismet.php.2.diff

File akismet.php.2.diff, 13.8 KB (added by Sewar, 8 years ago)
  • akismet.php

     
    77Author URI: http://photomatt.net/ 
    88*/ 
    99 
     10load_plugin_textdomain('akismet', 'wp-content/plugins/akismet'); 
     11 
    1012add_action('admin_menu', 'ksd_config_page'); 
    1113 
    1214if ( ! function_exists('wp_nonce_field') ) { 
     
    2426function ksd_config_page() { 
    2527        global $wpdb; 
    2628        if ( function_exists('add_submenu_page') ) 
    27                 add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); 
     29                add_submenu_page('plugins.php', __('Akismet Configuration', 'akismet'), __('Akismet Configuration', 'akismet'), 'manage_options', 'akismet-key-config', 'akismet_conf'); 
    2830} 
    2931 
    3032function akismet_conf() { 
     
    4547?> 
    4648 
    4749<div class="wrap"> 
    48 <h2><?php _e('Akismet Configuration'); ?></h2> 
    49         <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> 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 a WordPress.com account yet, you can get one at <a href="%2$s">WordPress.com</a>.'), 'http://akismet.com/', 'http://wordpress.com/api-keys/'); ?></p> 
     50<h2><?php _e('Akismet Configuration', 'akismet'); ?></h2> 
     51        <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> 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 a WordPress.com account yet, you can get one at <a href="%2$s">WordPress.com</a>.', 'akismet'), 'http://akismet.com/', 'http://wordpress.com/api-keys/'); ?></p> 
    5052 
    5153<form action="" method="post" id="akismet-conf" style="margin: auto; width: 25em; "> 
    5254<?php akismet_nonce_field($akismet_nonce) ?> 
    53 <h3><label for="key"><?php _e('WordPress.com API Key'); ?></label></h3> 
     55<h3><label for="key"><?php _e('WordPress.com API Key', 'akismet'); ?></label></h3> 
    5456<?php if ( $invalid_key ) { ?> 
    55         <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.'); ?></p> 
     57        <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.', 'akismet'); ?></p> 
    5658<?php } ?> 
    57 <p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://faq.wordpress.com/2005/10/19/api-key/">What is this?</a>'); ?>)</p> 
    58         <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;'); ?>" /></p> 
     59<p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://faq.wordpress.com/2005/10/19/api-key/">What is this?</a>', 'akismet'); ?>)</p> 
     60        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;', 'akismet'); ?>" /></p> 
    5961</form> 
    6062</div> 
    6163<?php 
     
    7476if ( !get_option('wordpress_api_key') && !isset($_POST['submit']) ) { 
    7577        function akismet_warning() { 
    7678                echo " 
    77                 <div id='akismet-warning' class='updated fade-ff0000'><p><strong>".__('Akismet is not active.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your WordPress.com API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div> 
     79                <div id='akismet-warning' class='updated fade-ff0000'><p><strong>".__('Akismet is not active.', 'akismet')."</strong> ".sprintf(__('You must <a href="%1$s">enter your WordPress.com API key</a> for it to work.', 'akismet'), "plugins.php?page=akismet-key-config")."</p></div> 
    7880                <style type='text/css'> 
    7981                #adminmenu { margin-bottom: 5em; } 
    8082                #akismet-warning { position: absolute; top: 7em; } 
     
    198200 
    199201function ksd_manage_page() { 
    200202        global $wpdb; 
    201         $count = sprintf(__('Akismet Spam (%s)'), ksd_spam_count()); 
     203        $count = sprintf(__('Akismet Spam (%s)', 'akismet'), ksd_spam_count()); 
    202204        if ( function_exists('add_management_page') ) 
    203                 add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught'); 
     205                add_management_page(__('Akismet Spam', 'akismet'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught'); 
    204206} 
    205207 
    206208function ksd_caught() { 
     
    208210         
    209211        if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { 
    210212                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) 
    211                         die(__('You do not have sufficient permission to moderate comments.')); 
     213                        die(__('You do not have sufficient permission to moderate comments.', 'akismet')); 
    212214                 
    213215                $i = 0; 
    214216                foreach ($_POST['not_spam'] as $comment): 
     
    220222                        ksd_submit_nonspam_comment($comment); 
    221223                        ++$i; 
    222224                endforeach; 
    223                 echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.'), $i) . "</p></div>"; 
     225                echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.', 'akismet'), $i) . "</p></div>"; 
    224226        } 
    225227        if ('delete' == $_POST['action']) { 
    226228                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) 
    227                         die(__('You do not have sufficient permission to moderate comments.')); 
     229                        die(__('You do not have sufficient permission to moderate comments.', 'akismet')); 
    228230 
    229231                $delete_time = addslashes( $_POST['display_time'] ); 
    230232                $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 
    231233                if (isset($nuked)) { 
    232234                        echo '<div class="updated"><p>'; 
    233235                        if ($nuked) { 
    234                                 _e('All spam deleted.'); 
     236                                _e('All spam deleted.', 'akismet'); 
    235237                        } 
    236238                        echo "</p></div>"; 
    237239                } 
    238240        } 
    239241?> 
    240242<div class="wrap"> 
    241 <h2><?php _e('Caught Spam') ?></h2> 
     243<h2><?php _e('Caught Spam', 'akismet') ?></h2> 
    242244<?php 
    243245$count = get_option('akismet_spam_count'); 
    244246if ( $count ) { 
    245247?> 
    246 <p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.'), number_format($count) ); ?></p> 
     248<p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.', 'akismet'), number_format($count) ); ?></p> 
    247249<?php 
    248250} 
    249251$spam_count = ksd_spam_count(); 
    250252if (0 == $spam_count) { 
    251         echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)').'</p>'; 
     253        echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)', 'akismet').'</p>'; 
    252254        echo '</div>'; 
    253255} else { 
    254         echo '<p>'.__('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&#8217;t sweat it.').'</p>'; 
     256        echo '<p>'.__('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&#8217;t sweat it.', 'akismet').'</p>'; 
    255257?> 
    256258<form method="post" action=""> 
    257259<input type="hidden" name="action" value="delete" /> 
    258 <?php printf(__('There are currently %1$s comments identified as spam.'), $spam_count); ?>&nbsp; &nbsp; <input type="submit" name="Submit" value="<?php _e('Delete all'); ?>" /> 
     260<?php printf(__('There are currently %1$s comments identified as spam.', 'akismet'), $spam_count); ?>&nbsp; &nbsp; <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 
    259261<input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /> 
    260262</form> 
    261263</div> 
    262264<div class="wrap"> 
    263 <h2><?php _e('Latest Spam'); ?></h2> 
    264 <?php echo '<p>'.__('These are the latest comments identified as spam by Akismet. If you see any mistakes, simply mark the comment as "not spam" and Akismet will learn from the submission. If you wish to recover a comment from spam, simply select the comment, and click Not Spam. After 15 days we clean out the junk for you.').'</p>'; ?> 
     265<h2><?php _e('Latest Spam', 'akismet'); ?></h2> 
     266<?php echo '<p>'.__('These are the latest comments identified as spam by Akismet. If you see any mistakes, simply mark the comment as "not spam" and Akismet will learn from the submission. If you wish to recover a comment from spam, simply select the comment, and click Not Spam. After 15 days we clean out the junk for you.', 'akismet').'</p>'; ?> 
    265267<?php 
    266268if ( isset( $_GET['apage'] ) ) 
    267269        $page = (int) $_GET['apage']; 
     
    280282$r = ''; 
    281283if ( 1 < $page ) { 
    282284        $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; 
    283         $r .=  '<a class="prev" href="' . add_query_arg( $args ) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
     285        $r .=  '<a class="prev" href="' . add_query_arg( $args ) . '">&laquo; '. __('Previous Page', 'akismet') .'</a>' . "\n"; 
    284286} 
    285287if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { 
    286288        for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 
     
    301303} 
    302304if ( ( $page ) * 50 < $total || -1 == $total ) { 
    303305        $args['apage'] = $page + 1; 
    304         $r .=  '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' &raquo;</a>' . "\n"; 
     306        $r .=  '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page', 'akismet') .' &raquo;</a>' . "\n"; 
    305307} 
    306308echo "<p>$r</p>"; 
    307309?> 
     
    329331 
    330332<p><label for="spam-<?php echo $comment->comment_ID; ?>"> 
    331333<input type="checkbox" id="spam-<?php echo $comment->comment_ID; ?>" name="not_spam[]" value="<?php echo $comment->comment_ID; ?>" /> 
    332 <?php _e('Not Spam') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [  
     334<?php _e('Not Spam', 'akismet') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [  
    333335<?php 
    334336$post = get_post($comment->comment_post_ID); 
    335337$post_title = wp_specialchars( $post->post_title, 'double' ); 
     
    344346?> 
    345347</ul> 
    346348<p class="submit">  
    347 <input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;'); ?>" /> 
     349<input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;', 'akismet'); ?>" /> 
    348350</p> 
    349 <p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.'); ?></p> 
     351<p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.', 'akismet'); ?></p> 
    350352</form> 
    351353<form method="post" action=""> 
    352354<p><input type="hidden" name="action" value="delete" /> 
    353 <?php printf(__('There are currently %1$s comments identified as spam.'), $spam_count); ?>&nbsp; &nbsp; <input type="submit" name="Submit" value="<?php _e('Delete all'); ?>" /> 
     355<?php printf(__('There are currently %1$s comments identified as spam.', 'akismet'), $spam_count); ?>&nbsp; &nbsp; <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 
    354356<input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p> 
    355357</form> 
    356358</div> 
     
    365367        if ( !$count ) 
    366368                return; 
    367369        $path = plugin_basename(__FILE__); 
    368         echo '<h3>'.__('Spam').'</h3>'; 
    369         echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', "edit.php?page=akismet-admin", number_format($count) ).'</p>'; 
     370        echo '<h3>'.__('Spam', 'akismet').'</h3>'; 
     371        echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', 'akismet'), 'http://akismet.com/', "edit.php?page=akismet-admin", number_format($count) ).'</p>'; 
    370372} 
    371373 
    372374add_action('activity_box_end', 'akismet_stats'); 
     
    377379                extract($args); 
    378380                $options = get_option('widget_akismet'); 
    379381                $count = number_format(get_option('akismet_spam_count')); 
    380                 $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.'); 
     382                $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.', 'akismet'); 
    381383                ?> 
    382384                        <?php echo $before_widget; ?> 
    383385                                <?php echo $before_title . $options['title'] . $after_title; ?> 
    384                                 <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div> 
     386                                <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments', 'akismet') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by', 'akismet') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div> 
    385387                        <?php echo $after_widget; ?> 
    386388        <?php 
    387389        } 
     
    489491<?php 
    490492$count = number_format(get_option('akismet_spam_count')); 
    491493?> 
    492 <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div> 
     494<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments', 'akismet') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by', 'akismet') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div> 
    493495<?php 
    494496} 
    495497