Ticket #2509: akismet.php.3.diff
File akismet.php.3.diff, 14.8 KB (added by , 18 years ago) |
---|
-
akismet.php
8 8 Author URI: http://photomatt.net/ 9 9 */ 10 10 11 load_plugin_textdomain('akismet', 'wp-content/plugins/akismet'); 12 11 13 add_action('admin_menu', 'ksd_config_page'); 12 14 13 15 if ( ! function_exists('wp_nonce_field') ) { … … 25 27 function ksd_config_page() { 26 28 global $wpdb; 27 29 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'); 29 31 } 30 32 31 33 function akismet_conf() { … … 46 48 ?> 47 49 48 50 <div class="wrap"> 49 <h2><?php _e('Akismet Configuration' ); ?></h2>51 <h2><?php _e('Akismet Configuration', 'akismet'); ?></h2> 50 52 <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> 52 54 53 55 <form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; "> 54 56 <?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> 56 58 <?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> 58 60 <?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 »' ); ?>" /></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 »', 'akismet'); ?>" /></p> 61 63 </form> 62 64 </div> 63 65 </div> … … 77 79 if ( !get_option('wordpress_api_key') && !isset($_POST['submit']) ) { 78 80 function akismet_warning() { 79 81 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> 81 83 <style type='text/css'> 82 84 #adminmenu { margin-bottom: 5em; } 83 85 #akismet-warning { position: absolute; top: 7em; } … … 201 203 202 204 function ksd_manage_page() { 203 205 global $wpdb, $submenu; 204 $count = sprintf(__('Akismet Spam (%s)' ), ksd_spam_count());206 $count = sprintf(__('Akismet Spam (%s)', 'akismet'), ksd_spam_count()); 205 207 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' ); 207 209 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'); 209 211 } 210 212 211 213 function ksd_caught() { … … 213 215 akismet_recheck_queue(); 214 216 if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { 215 217 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')); 217 219 218 220 $i = 0; 219 221 foreach ($_POST['not_spam'] as $comment): … … 225 227 ksd_submit_nonspam_comment($comment); 226 228 ++$i; 227 229 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>"; 229 231 } 230 232 if ('delete' == $_POST['action']) { 231 233 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')); 233 235 234 236 $delete_time = addslashes( $_POST['display_time'] ); 235 237 $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 236 238 if (isset($nuked)) { 237 239 echo '<div class="updated"><p>'; 238 240 if ($nuked) { 239 _e('All spam deleted.' );241 _e('All spam deleted.', 'akismet'); 240 242 } 241 243 echo "</p></div>"; 242 244 } 243 245 } 244 246 ?> 245 247 <div class="wrap"> 246 <h2><?php _e('Caught Spam' ) ?></h2>248 <h2><?php _e('Caught Spam', 'akismet') ?></h2> 247 249 <?php 248 250 $count = get_option('akismet_spam_count'); 249 251 if ( $count ) { 250 252 ?> 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> 252 254 <?php 253 255 } 254 256 $spam_count = ksd_spam_count(); 255 257 if (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>'; 257 259 echo '</div>'; 258 260 } 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’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’t sweat it.', 'akismet').'</p>'; 260 262 ?> 261 263 <form method="post" action=""> 262 264 <input type="hidden" name="action" value="delete" /> 263 <?php printf(__('There are currently %1$s comments identified as spam.' ), $spam_count); ?> <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); ?> <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 264 266 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /> 265 267 </form> 266 268 </div> 267 269 <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>'; ?> 270 272 <?php 271 273 if ( isset( $_GET['apage'] ) ) 272 274 $page = (int) $_GET['apage']; … … 334 336 335 337 <p><label for="spam-<?php echo $comment->comment_ID; ?>"> 336 338 <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> — <?php comment_date('M j, g:i A'); ?> — [339 <?php _e('Not Spam', 'akismet') ?></label> — <?php comment_date('M j, g:i A'); ?> — [ 338 340 <?php 339 341 $post = get_post($comment->comment_post_ID); 340 342 $post_title = wp_specialchars( $post->post_title, 'double' ); … … 349 351 ?> 350 352 </ul> 351 353 <p class="submit"> 352 <input type="submit" name="submit" value="<?php _e('De-spam marked comments »' ); ?>" />354 <input type="submit" name="submit" value="<?php _e('De-spam marked comments »', 'akismet'); ?>" /> 353 355 </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> 355 357 </form> 356 358 <form method="post" action=""> 357 359 <p><input type="hidden" name="action" value="delete" /> 358 <?php printf(__('There are currently %1$s comments identified as spam.' ), $spam_count); ?> <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); ?> <input type="submit" name="Submit" value="<?php _e('Delete all', 'akismet'); ?>" /> 359 361 <input type="hidden" name="display_time" value="<?php echo current_time('mysql', 1); ?>" /></p> 360 362 </form> 361 363 </div> … … 370 372 if ( !$count ) 371 373 return; 372 374 $path = plugin_basename(__FILE__); 373 echo '<h3>' .__('Spam').'</h3>';375 echo '<h3>' . __('Spam', 'akismet') . '</h3>'; 374 376 global $submenu; 375 377 if ( isset( $submenu['edit-comments.php'] ) ) 376 378 $link = 'edit-comments.php'; 377 379 else 378 380 $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>'; 380 382 } 381 383 382 384 add_action('activity_box_end', 'akismet_stats'); … … 387 389 extract($args); 388 390 $options = get_option('widget_akismet'); 389 391 $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'); 391 393 ?> 392 394 <?php echo $before_widget; ?> 393 395 <?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> 395 397 <?php echo $after_widget; ?> 396 398 <?php 397 399 } … … 475 477 <?php 476 478 } 477 479 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'); 480 482 if ( is_active_widget('widget_akismet') ) 481 483 add_action('wp_head', 'widget_akismet_style'); 482 484 endif; … … 499 501 <?php 500 502 $count = number_format(get_option('akismet_spam_count')); 501 503 ?> 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> 503 505 <?php 504 506 } 505 507 … … 510 512 $link = 'edit-comments.php'; 511 513 else 512 514 $link = 'edit.php'; 513 $button = "<a href='$link?page=akismet-admin&recheckqueue=true&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&recheckqueue=true&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>"; 514 516 $page = str_replace( '<div class="wrap">', '<div class="wrap">' . $button, $page ); 515 517 return $page; 516 518 }