-<h2><?php _e('Akismet Configuration'); ?></h2>
-<?php if (isset($_GET['message']) && $_GET['message'] == 'success') { ?>
- <div class="updated below-h2" id="message"><p><?php _e( '<strong>Sign up success!</strong> Please check your email for your Akismet API Key and enter it below.' ); ?></p></div>
-<?php } ?>
-<div class="narrow">
-<form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; ">
-<?php if ( !$wpcom_api_key ) { ?>
- <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 an API key yet, you can get one at <a href="%2$s">Akismet.com</a>.'), 'http://akismet.com/?return=true', 'http://akismet.com/get/?return=true'); ?></p>
-
-<h3><label for="key"><?php _e('Akismet API Key'); ?></label></h3>
-<?php foreach ( $ms as $m ) : ?>
- <p style="padding: .5em; background-color: #<?php echo $messages[$m]['color']; ?>; color: #fff; font-weight: bold;"><?php echo $messages[$m]['text']; ?></p>
-<?php endforeach; ?>
-<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://akismet.com/get/?return=true">What is this?</a>'); ?>)</p>
-<?php if ( isset( $invalid_key) && $invalid_key ) { ?>
-<h3><?php _e('Why might my key be invalid?'); ?></h3>
-<p><?php _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the Akismet servers, which is most often caused by an issue with your web host around firewalls or similar.'); ?></p>
-<?php } ?>
-<?php } ?>
-<?php akismet_nonce_field($akismet_nonce) ?>
-<p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Auto-delete spam submitted on posts more than a month old.'); ?></label></p>
-<p><label><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php if ( get_option('akismet_show_user_comments_approved') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Show the number of comments you\'ve approved beside each comment author.'); ?></label></p>
- <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options »'); ?>" /></p>
-</form>
-
-<form action="" method="post" id="akismet-connectivity" style="margin: auto; width: 400px; ">
-
-<h3><?php _e('Server Connectivity'); ?></h3>
-<?php
- if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) {
- ?>
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p>
- <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
- <?php
- } else {
- $servers = akismet_get_server_connectivity();
- $fail_count = count($servers) - count( array_filter($servers) );
- if ( is_array($servers) && count($servers) > 0 ) {
- // some connections work, some fail
- if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
- <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p>
- <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com. Akismet is working but this may cause problems during times of network congestion. Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
- <?php
- // all connections fail
- } elseif ( $fail_count > 0 ) { ?>
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p>
- <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
- <?php
- // all connections work
- } else { ?>
- <p style="padding: .5em; background-color: #4AB915; color: #fff; font-weight:bold;"><?php _e('All Akismet servers are available.'); ?></p>
- <p><?php _e('Akismet is working correctly. All servers are accessible.'); ?></p>
- <?php
- }
- } else {
- ?>
- <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p>
- <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
- <?php
- }
- }
-
- if ( !empty($servers) ) {
-?>
-<table style="width: 100%;">
-<thead><th><?php _e('Akismet server'); ?></th><th><?php _e('Network Status'); ?></th></thead>
-<tbody>
-<?php
- asort($servers);
- foreach ( $servers as $ip => $status ) {
- $color = ( $status ? '#4AB915' : '#888');
- ?>
- <tr>
- <td><?php echo htmlspecialchars($ip); ?></td>
- <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('Accessible') : __('Re-trying') ); ?></td>
+ <?php if ( !$api_key ) : ?>
+ <h2 class="ak-header"><?php _e('Akismet'); ?></h2>
+ <?php else: ?>
+ <h2 class="ak-header"><?php printf( __( 'Akismet <a href="%s" class="add-new-h2">Stats</a>' ), $stats_link ); ?></h2>
+ <?php endif; ?>
+ <div class="no-key <?php echo $show_key_form ? 'hidden' : '';?>">
+ <p><?php _e('Akismet eliminates the comment and trackback spam you get on your site. To use Akismet you may need to sign up for an API key. Click the button below to get started.'); ?></p>
+ <form name="akismet_activate" action="https://akismet.com/get/" method="POST">
+ <input type="hidden" name="return" value="1"/>
+ <input type="hidden" name="jetpack" value="<?php echo (string) class_exists( 'Jetpack' );?>"/>
+ <input type="hidden" name="user" value="<?php echo esc_attr( $current_user->user_login );?>"/>
+ <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Create a new Akismet Key' ); ?>"/>
+ </form>
+ <br/>
+ <a href="<?php echo $config_link;?>"><?php _e('I already have a key'); ?></a>
+ </div>
+ <div class="have-key <?php echo $show_key_form ? '' : 'hidden';?>">
+ <?php if ( !empty($_POST['submit'] ) && $saved_ok ) : ?>
+ <div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>
+ <?php endif; ?>
+ <?php if ( isset($_GET['message']) && $_GET['message'] == 'success' ) : ?>
+ <div id="message" class="updated fade"><p><?php _e('<strong>Sign up success!</strong> Please check your email for your Akismet API Key and enter it below.') ?></p></div>
+ <?php endif; ?>
+ <?php foreach( $ms as $m ) : ?>
+ <div class="<?php echo $messages[$m]['class']; ?>"><p><strong><?php echo $messages[$m]['text']; ?></strong></p></div>
+ <?php endforeach; ?>
+ <form action="" method="post" id="akismet-conf">
+ <table class="form-table">
+ <tbody>
+ <tr>
+ <th><label for="key"><?php _e('Akismet API Key');?></label></th>
+ <td>
+ <input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $key_status;?>"><div class="under-input key-status <?php echo $key_status;?>"><?php echo isset( $key_status_strings[ $key_status ] ) ? $key_status_strings[ $key_status ] : '';?></div>
+ <p class="need-key description"><?php printf( __('You must enter a valid Akismet API key here. If you need an API key, you can <a href="%s">create one here</a>'), '#' );?></p>
+ </td>
+ </tr>
+ <?php if ( $api_key ):?>
+ <tr valign="top">
+ <th scope="row"><?php _e('Settings');?></th>
+ <td>
+ <fieldset><legend class="screen-reader-text"><span><?php _e('Settings');?></span></legend>
+ <label for="akismet_discard_month" title="<?php esc_attr_e( 'Auto-detete old spam' ); ?>"><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php echo get_option('akismet_discard_month') == 'true' ? 'checked="checked"':''; ?>> <span><?php _e('Auto-delete spam submitted on posts more than a month old.'); ?></span></label><br>
+ <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' ); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php echo get_option('akismet_show_user_comments_approved') == 'true' ? 'checked="checked"':''; ?>> <span><?php _e('Show the number of comments you\'ve approved beside each comment author.'); ?></span></label>
+ </fieldset>
+ </td>
+ </tr>
+ <?php endif; ?>
+ </tbody>
+ </table>
+ <?php akismet_nonce_field($akismet_nonce) ?>
+ <p class="submit">
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes');?>">
+ </p>
+ </form>