Ticket #2509: akismet.php.2.diff
File akismet.php.2.diff, 13.8 KB (added by , 18 years ago) |
---|
-
akismet.php
7 7 Author URI: http://photomatt.net/ 8 8 */ 9 9 10 load_plugin_textdomain('akismet', 'wp-content/plugins/akismet'); 11 10 12 add_action('admin_menu', 'ksd_config_page'); 11 13 12 14 if ( ! function_exists('wp_nonce_field') ) { … … 24 26 function ksd_config_page() { 25 27 global $wpdb; 26 28 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'); 28 30 } 29 31 30 32 function akismet_conf() { … … 45 47 ?> 46 48 47 49 <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> 50 52 51 53 <form action="" method="post" id="akismet-conf" style="margin: auto; width: 25em; "> 52 54 <?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> 54 56 <?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> 56 58 <?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 »' ); ?>" /></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 »', 'akismet'); ?>" /></p> 59 61 </form> 60 62 </div> 61 63 <?php … … 74 76 if ( !get_option('wordpress_api_key') && !isset($_POST['submit']) ) { 75 77 function akismet_warning() { 76 78 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> 78 80 <style type='text/css'> 79 81 #adminmenu { margin-bottom: 5em; } 80 82 #akismet-warning { position: absolute; top: 7em; } … … 198 200 199 201 function ksd_manage_page() { 200 202 global $wpdb; 201 $count = sprintf(__('Akismet Spam (%s)' ), ksd_spam_count());203 $count = sprintf(__('Akismet Spam (%s)', 'akismet'), ksd_spam_count()); 202 204 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'); 204 206 } 205 207 206 208 function ksd_caught() { … … 208 210 209 211 if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { 210 212 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')); 212 214 213 215 $i = 0; 214 216 foreach ($_POST['not_spam'] as $comment): … … 220 222 ksd_submit_nonspam_comment($comment); 221 223 ++$i; 222 224 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>"; 224 226 } 225 227 if ('delete' == $_POST['action']) { 226 228 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')); 228 230 229 231 $delete_time = addslashes( $_POST['display_time'] ); 230 232 $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 231 233 if (isset($nuked)) { 232 234 echo '<div class="updated"><p>'; 233 235 if ($nuked) { 234 _e('All spam deleted.' );236 _e('All spam deleted.', 'akismet'); 235 237 } 236 238 echo "</p></div>"; 237 239 } 238 240 } 239 241 ?> 240 242 <div class="wrap"> 241 <h2><?php _e('Caught Spam' ) ?></h2>243 <h2><?php _e('Caught Spam', 'akismet') ?></h2> 242 244 <?php 243 245 $count = get_option('akismet_spam_count'); 244 246 if ( $count ) { 245 247 ?> 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> 247 249 <?php 248 250 } 249 251 $spam_count = ksd_spam_count(); 250 252 if (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>'; 252 254 echo '</div>'; 253 255 } 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’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’t sweat it.', 'akismet').'</p>'; 255 257 ?> 256 258 <form method="post" action=""> 257 259 <input type="hidden" name="action" value="delete" /> 258 <?php printf(__('There are currently %1$s comments identified as spam.' ), $spam_count); ?> <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); ?> <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 259 261 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /> 260 262 </form> 261 263 </div> 262 264 <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>'; ?> 265 267 <?php 266 268 if ( isset( $_GET['apage'] ) ) 267 269 $page = (int) $_GET['apage']; … … 280 282 $r = ''; 281 283 if ( 1 < $page ) { 282 284 $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; 283 $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page' ) .'</a>' . "\n";285 $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page', 'akismet') .'</a>' . "\n"; 284 286 } 285 287 if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { 286 288 for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : … … 301 303 } 302 304 if ( ( $page ) * 50 < $total || -1 == $total ) { 303 305 $args['apage'] = $page + 1; 304 $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page' ) .' »</a>' . "\n";306 $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page', 'akismet') .' »</a>' . "\n"; 305 307 } 306 308 echo "<p>$r</p>"; 307 309 ?> … … 329 331 330 332 <p><label for="spam-<?php echo $comment->comment_ID; ?>"> 331 333 <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> — <?php comment_date('M j, g:i A'); ?> — [334 <?php _e('Not Spam', 'akismet') ?></label> — <?php comment_date('M j, g:i A'); ?> — [ 333 335 <?php 334 336 $post = get_post($comment->comment_post_ID); 335 337 $post_title = wp_specialchars( $post->post_title, 'double' ); … … 344 346 ?> 345 347 </ul> 346 348 <p class="submit"> 347 <input type="submit" name="submit" value="<?php _e('De-spam marked comments »' ); ?>" />349 <input type="submit" name="submit" value="<?php _e('De-spam marked comments »', 'akismet'); ?>" /> 348 350 </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> 350 352 </form> 351 353 <form method="post" action=""> 352 354 <p><input type="hidden" name="action" value="delete" /> 353 <?php printf(__('There are currently %1$s comments identified as spam.' ), $spam_count); ?> <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); ?> <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 354 356 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p> 355 357 </form> 356 358 </div> … … 365 367 if ( !$count ) 366 368 return; 367 369 $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>'; 370 372 } 371 373 372 374 add_action('activity_box_end', 'akismet_stats'); … … 377 379 extract($args); 378 380 $options = get_option('widget_akismet'); 379 381 $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'); 381 383 ?> 382 384 <?php echo $before_widget; ?> 383 385 <?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> 385 387 <?php echo $after_widget; ?> 386 388 <?php 387 389 } … … 489 491 <?php 490 492 $count = number_format(get_option('akismet_spam_count')); 491 493 ?> 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> 493 495 <?php 494 496 } 495 497