Make WordPress Core

Ticket #2509: akismet.php.3.diff

File akismet.php.3.diff, 14.8 KB (added by Sewar, 18 years ago)
  • akismet.php

     
    88Author URI: http://photomatt.net/
    99*/
    1010
     11load_plugin_textdomain('akismet', 'wp-content/plugins/akismet');
     12
    1113add_action('admin_menu', 'ksd_config_page');
    1214
    1315if ( ! function_exists('wp_nonce_field') ) {
     
    2527function ksd_config_page() {
    2628        global $wpdb;
    2729        if ( function_exists('add_submenu_page') )
    28                 add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf');
     30                add_submenu_page('plugins.php', __('Akismet Configuration', 'akismet'), __('Akismet Configuration', 'akismet'), 'manage_options', __FILE__, 'akismet_conf');
    2931}
    3032
    3133function akismet_conf() {
     
    4648?>
    4749
    4850<div class="wrap">
    49 <h2><?php _e('Akismet Configuration'); ?></h2>
     51<h2><?php _e('Akismet Configuration', 'akismet'); ?></h2>
    5052<div class="narrow">
    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>.'), 'http://akismet.com/', 'http://wordpress.com/api-keys/'); ?></p>
     53        <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>
    5254
    5355<form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; ">
    5456<?php akismet_nonce_field($akismet_nonce) ?>
    55 <h3><label for="key"><?php _e('WordPress.com API Key'); ?></label></h3>
     57<h3><label for="key"><?php _e('WordPress.com API Key', 'akismet'); ?></label></h3>
    5658<?php if ( $invalid_key ) { ?>
    57         <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.'); ?></p>
     59        <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.', 'akismet'); ?></p>
    5860<?php } ?>
    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>'); ?>)</p>
    60         <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;'); ?>" /></p>
     61<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>
     62        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;', 'akismet'); ?>" /></p>
    6163</form>
    6264</div>
    6365</div>
     
    7779if ( !get_option('wordpress_api_key') && !isset($_POST['submit']) ) {
    7880        function akismet_warning() {
    7981                echo "
    80                 <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>
     82                <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>
    8183                <style type='text/css'>
    8284                #adminmenu { margin-bottom: 5em; }
    8385                #akismet-warning { position: absolute; top: 7em; }
     
    201203
    202204function ksd_manage_page() {
    203205        global $wpdb, $submenu;
    204         $count = sprintf(__('Akismet Spam (%s)'), ksd_spam_count());
     206        $count = sprintf(__('Akismet Spam (%s)', 'akismet'), ksd_spam_count());
    205207        if ( isset( $submenu['edit-comments.php'] ) )
    206                 add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught' );
     208                add_submenu_page('edit-comments.php', __('Akismet Spam', 'akismet'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught' );
    207209        elseif ( function_exists('add_management_page') )
    208                 add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught');
     210                add_management_page(__('Akismet Spam', 'akismet'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught');
    209211}
    210212
    211213function ksd_caught() {
     
    213215        akismet_recheck_queue();
    214216        if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) {
    215217                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') )
    216                         die(__('You do not have sufficient permission to moderate comments.'));
     218                        die(__('You do not have sufficient permission to moderate comments.', 'akismet'));
    217219               
    218220                $i = 0;
    219221                foreach ($_POST['not_spam'] as $comment):
     
    225227                        ksd_submit_nonspam_comment($comment);
    226228                        ++$i;
    227229                endforeach;
    228                 echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.'), $i) . "</p></div>";
     230                echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.', 'akismet'), $i) . "</p></div>";
    229231        }
    230232        if ('delete' == $_POST['action']) {
    231233                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') )
    232                         die(__('You do not have sufficient permission to moderate comments.'));
     234                        die(__('You do not have sufficient permission to moderate comments.', 'akismet'));
    233235
    234236                $delete_time = addslashes( $_POST['display_time'] );
    235237                $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
    236238                if (isset($nuked)) {
    237239                        echo '<div class="updated"><p>';
    238240                        if ($nuked) {
    239                                 _e('All spam deleted.');
     241                                _e('All spam deleted.', 'akismet');
    240242                        }
    241243                        echo "</p></div>";
    242244                }
    243245        }
    244246?>
    245247<div class="wrap">
    246 <h2><?php _e('Caught Spam') ?></h2>
     248<h2><?php _e('Caught Spam', 'akismet') ?></h2>
    247249<?php
    248250$count = get_option('akismet_spam_count');
    249251if ( $count ) {
    250252?>
    251 <p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.'), number_format($count) ); ?></p>
     253<p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.', 'akismet'), number_format($count) ); ?></p>
    252254<?php
    253255}
    254256$spam_count = ksd_spam_count();
    255257if (0 == $spam_count) {
    256         echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)').'</p>';
     258        echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)', 'akismet').'</p>';
    257259        echo '</div>';
    258260} else {
    259         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>';
     261        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>';
    260262?>
    261263<form method="post" action="">
    262264<input type="hidden" name="action" value="delete" />
    263 <?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'); ?>" />
     265<?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'); ?>" />
    264266<input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" />
    265267</form>
    266268</div>
    267269<div class="wrap">
    268 <h2><?php _e('Latest Spam'); ?></h2>
    269 <?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>'; ?>
     270<h2><?php _e('Latest Spam', 'akismet'); ?></h2>
     271<?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>'; ?>
    270272<?php
    271273if ( isset( $_GET['apage'] ) )
    272274        $page = (int) $_GET['apage'];
     
    334336
    335337<p><label for="spam-<?php echo $comment->comment_ID; ?>">
    336338<input type="checkbox" id="spam-<?php echo $comment->comment_ID; ?>" name="not_spam[]" value="<?php echo $comment->comment_ID; ?>" />
    337 <?php _e('Not Spam') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [
     339<?php _e('Not Spam', 'akismet') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [
    338340<?php
    339341$post = get_post($comment->comment_post_ID);
    340342$post_title = wp_specialchars( $post->post_title, 'double' );
     
    349351?>
    350352</ul>
    351353<p class="submit">
    352 <input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;'); ?>" />
     354<input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;', 'akismet'); ?>" />
    353355</p>
    354 <p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.'); ?></p>
     356<p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.', 'akismet'); ?></p>
    355357</form>
    356358<form method="post" action="">
    357359<p><input type="hidden" name="action" value="delete" />
    358 <?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'); ?>" />
     360<?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'); ?>" />
    359361<input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p>
    360362</form>
    361363</div>
     
    370372        if ( !$count )
    371373                return;
    372374        $path = plugin_basename(__FILE__);
    373         echo '<h3>'.__('Spam').'</h3>';
     375        echo '<h3>' . __('Spam', 'akismet') . '</h3>';
    374376        global $submenu;
    375377        if ( isset( $submenu['edit-comments.php'] ) )
    376378                $link = 'edit-comments.php';
    377379        else
    378380                $link = 'edit.php';
    379         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/', "$link?page=akismet-admin", number_format($count) ).'</p>';
     381        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/', "$link?page=akismet-admin", number_format($count) ) . '</p>';
    380382}
    381383
    382384add_action('activity_box_end', 'akismet_stats');
     
    387389                extract($args);
    388390                $options = get_option('widget_akismet');
    389391                $count = number_format(get_option('akismet_spam_count'));
    390                 $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.');
     392                $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.', 'akismet');
    391393                ?>
    392394                        <?php echo $before_widget; ?>
    393395                                <?php echo $before_title . $options['title'] . $after_title; ?>
    394                                 <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>
     396                                <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"><?php _e('Akismet', 'akismet') ?></span></div></a></div></div>
    395397                        <?php echo $after_widget; ?>
    396398        <?php
    397399        }
     
    475477        <?php
    476478        }
    477479
    478         register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet');
    479         register_widget_control('Akismet', 'widget_akismet_control', 300, 75, 'akismet');
     480        register_sidebar_widget(array('Akismet', 'akismet'), 'widget_akismet', null, 'akismet');
     481        register_widget_control(array('Akismet', 'akismet'), 'widget_akismet_control', 300, 75, 'akismet');
    480482        if ( is_active_widget('widget_akismet') )
    481483                add_action('wp_head', 'widget_akismet_style');
    482484        endif;
     
    499501<?php
    500502$count = number_format(get_option('akismet_spam_count'));
    501503?>
    502 <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>
     504<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"><?php _e('Akismet', 'akismet') ?></span></div></a></div></div>
    503505<?php
    504506}
    505507
     
    510512                        $link = 'edit-comments.php';
    511513                else
    512514                        $link = 'edit.php';
    513                 $button = "<a href='$link?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true' style='display: block; width: 100px; position: absolute; right: 7%; padding: 5px; font-size: 14px; text-decoration: underline; background: #fff; border: 1px solid #ccc;'>Recheck Queue for Spam</a>";
     515                $button = "<a href='$link?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true' style='display: block; width: 100px; position: absolute; right: 7%; padding: 5px; font-size: 14px; text-decoration: underline; background: #fff; border: 1px solid #ccc;'>" . <?php _e('Recheck Queue for Spam', 'akismet') ?> . "</a>";
    514516                $page = str_replace( '<div class="wrap">', '<div class="wrap">' . $button, $page );
    515517                return $page;
    516518        }