Ticket #2509: akismet.php.3.diff

File akismet.php.3.diff, 14.8 KB (added by Sewar, 6 years ago)
Line 
1Index: akismet.php
2===================================================================
3--- akismet.php (revision 6972)
4+++ akismet.php (working copy)
5@@ -8,6 +8,8 @@
6 Author URI: http://photomatt.net/
7 */
8 
9+load_plugin_textdomain('akismet', 'wp-content/plugins/akismet');
10+
11 add_action('admin_menu', 'ksd_config_page');
12 
13 if ( ! function_exists('wp_nonce_field') ) {
14@@ -25,7 +27,7 @@
15 function ksd_config_page() {
16        global $wpdb;
17        if ( function_exists('add_submenu_page') )
18-               add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf');
19+               add_submenu_page('plugins.php', __('Akismet Configuration', 'akismet'), __('Akismet Configuration', 'akismet'), 'manage_options', __FILE__, 'akismet_conf');
20 }
21 
22 function akismet_conf() {
23@@ -46,18 +48,18 @@
24 ?>
25 
26 <div class="wrap">
27-<h2><?php _e('Akismet Configuration'); ?></h2>
28+<h2><?php _e('Akismet Configuration', 'akismet'); ?></h2>
29 <div class="narrow">
30-       <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>
31+       <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>
32 
33 <form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; ">
34 <?php akismet_nonce_field($akismet_nonce) ?>
35-<h3><label for="key"><?php _e('WordPress.com API Key'); ?></label></h3>
36+<h3><label for="key"><?php _e('WordPress.com API Key', 'akismet'); ?></label></h3>
37 <?php if ( $invalid_key ) { ?>
38-       <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.'); ?></p>
39+       <p style="padding: .5em; background-color: #f33; color: #fff; font-weight: bold;"><?php _e('Your key appears invalid. Double-check it.', 'akismet'); ?></p>
40 <?php } ?>
41-<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>
42-       <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;'); ?>" /></p>
43+<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>
44+       <p class="submit"><input type="submit" name="submit" value="<?php _e('Update API Key &raquo;', 'akismet'); ?>" /></p>
45 </form>
46 </div>
47 </div>
48@@ -77,7 +79,7 @@
49 if ( !get_option('wordpress_api_key') && !isset($_POST['submit']) ) {
50        function akismet_warning() {
51                echo "
52-               <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>
53+               <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>
54                <style type='text/css'>
55                #adminmenu { margin-bottom: 5em; }
56                #akismet-warning { position: absolute; top: 7em; }
57@@ -201,11 +203,11 @@
58 
59 function ksd_manage_page() {
60        global $wpdb, $submenu;
61-       $count = sprintf(__('Akismet Spam (%s)'), ksd_spam_count());
62+       $count = sprintf(__('Akismet Spam (%s)', 'akismet'), ksd_spam_count());
63        if ( isset( $submenu['edit-comments.php'] ) )
64-               add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught' );
65+               add_submenu_page('edit-comments.php', __('Akismet Spam', 'akismet'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught' );
66        elseif ( function_exists('add_management_page') )
67-               add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught');
68+               add_management_page(__('Akismet Spam', 'akismet'), $count, 'moderate_comments', 'akismet-admin', 'ksd_caught');
69 }
70 
71 function ksd_caught() {
72@@ -213,7 +215,7 @@
73        akismet_recheck_queue();
74        if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) {
75                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') )
76-                       die(__('You do not have sufficient permission to moderate comments.'));
77+                       die(__('You do not have sufficient permission to moderate comments.', 'akismet'));
78               
79                $i = 0;
80                foreach ($_POST['not_spam'] as $comment):
81@@ -225,48 +227,48 @@
82                        ksd_submit_nonspam_comment($comment);
83                        ++$i;
84                endforeach;
85-               echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.'), $i) . "</p></div>";
86+               echo '<div class="updated"><p>' . sprintf(__('%1$s comments recovered.', 'akismet'), $i) . "</p></div>";
87        }
88        if ('delete' == $_POST['action']) {
89                if ( function_exists('current_user_can') && !current_user_can('moderate_comments') )
90-                       die(__('You do not have sufficient permission to moderate comments.'));
91+                       die(__('You do not have sufficient permission to moderate comments.', 'akismet'));
92 
93                $delete_time = addslashes( $_POST['display_time'] );
94                $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
95                if (isset($nuked)) {
96                        echo '<div class="updated"><p>';
97                        if ($nuked) {
98-                               _e('All spam deleted.');
99+                               _e('All spam deleted.', 'akismet');
100                        }
101                        echo "</p></div>";
102                }
103        }
104 ?>
105 <div class="wrap">
106-<h2><?php _e('Caught Spam') ?></h2>
107+<h2><?php _e('Caught Spam', 'akismet') ?></h2>
108 <?php
109 $count = get_option('akismet_spam_count');
110 if ( $count ) {
111 ?>
112-<p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.'), number_format($count) ); ?></p>
113+<p><?php printf(__('Akismet has caught <strong>%1$s spam</strong> for you since you first installed it.', 'akismet'), number_format($count) ); ?></p>
114 <?php
115 }
116 $spam_count = ksd_spam_count();
117 if (0 == $spam_count) {
118-       echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)').'</p>';
119+       echo '<p>'.__('You have no spam currently in the queue. Must be your lucky day. :)', 'akismet').'</p>';
120        echo '</div>';
121 } else {
122-       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>';
123+       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>';
124 ?>
125 <form method="post" action="">
126 <input type="hidden" name="action" value="delete" />
127-<?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'); ?>" />
128+<?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'); ?>" />
129 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" />
130 </form>
131 </div>
132 <div class="wrap">
133-<h2><?php _e('Latest Spam'); ?></h2>
134-<?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>'; ?>
135+<h2><?php _e('Latest Spam', 'akismet'); ?></h2>
136+<?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>'; ?>
137 <?php
138 if ( isset( $_GET['apage'] ) )
139        $page = (int) $_GET['apage'];
140@@ -334,7 +336,7 @@
141 
142 <p><label for="spam-<?php echo $comment->comment_ID; ?>">
143 <input type="checkbox" id="spam-<?php echo $comment->comment_ID; ?>" name="not_spam[]" value="<?php echo $comment->comment_ID; ?>" />
144-<?php _e('Not Spam') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [
145+<?php _e('Not Spam', 'akismet') ?></label> &#8212; <?php comment_date('M j, g:i A');  ?> &#8212; [
146 <?php
147 $post = get_post($comment->comment_post_ID);
148 $post_title = wp_specialchars( $post->post_title, 'double' );
149@@ -349,13 +351,13 @@
150 ?>
151 </ul>
152 <p class="submit">
153-<input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;'); ?>" />
154+<input type="submit" name="submit" value="<?php _e('De-spam marked comments &raquo;', 'akismet'); ?>" />
155 </p>
156-<p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.'); ?></p>
157+<p><?php _e('Comments you de-spam will be submitted to Akismet as mistakes so it can learn and get better.', 'akismet'); ?></p>
158 </form>
159 <form method="post" action="">
160 <p><input type="hidden" name="action" value="delete" />
161-<?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'); ?>" />
162+<?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'); ?>" />
163 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p>
164 </form>
165 </div>
166@@ -370,13 +372,13 @@
167        if ( !$count )
168                return;
169        $path = plugin_basename(__FILE__);
170-       echo '<h3>'.__('Spam').'</h3>';
171+       echo '<h3>' . __('Spam', 'akismet') . '</h3>';
172        global $submenu;
173        if ( isset( $submenu['edit-comments.php'] ) )
174                $link = 'edit-comments.php';
175        else
176                $link = 'edit.php';
177-       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>';
178+       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>';
179 }
180 
181 add_action('activity_box_end', 'akismet_stats');
182@@ -387,11 +389,11 @@
183                extract($args);
184                $options = get_option('widget_akismet');
185                $count = number_format(get_option('akismet_spam_count'));
186-               $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.');
187+               $text = __('%d spam comments have been blocked by <a href="http://akismet.com">Akismet</a>.', 'akismet');
188                ?>
189                        <?php echo $before_widget; ?>
190                                <?php echo $before_title . $options['title'] . $after_title; ?>
191-                               <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>
192+                               <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>
193                        <?php echo $after_widget; ?>
194        <?php
195        }
196@@ -475,8 +477,8 @@
197        <?php
198        }
199 
200-       register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet');
201-       register_widget_control('Akismet', 'widget_akismet_control', 300, 75, 'akismet');
202+       register_sidebar_widget(array('Akismet', 'akismet'), 'widget_akismet', null, 'akismet');
203+       register_widget_control(array('Akismet', 'akismet'), 'widget_akismet_control', 300, 75, 'akismet');
204        if ( is_active_widget('widget_akismet') )
205                add_action('wp_head', 'widget_akismet_style');
206        endif;
207@@ -499,7 +501,7 @@
208 <?php
209 $count = number_format(get_option('akismet_spam_count'));
210 ?>
211-<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>
212+<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>
213 <?php
214 }
215 
216@@ -510,7 +512,7 @@
217                        $link = 'edit-comments.php';
218                else
219                        $link = 'edit.php';
220-               $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>";
221+               $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>";
222                $page = str_replace( '<div class="wrap">', '<div class="wrap">' . $button, $page );
223                return $page;
224        }