" . __('After the Deadline is almost ready.', 'after-the-deadline') . ' ' . sprintf( __( 'You must enter your API key for it to work.', 'after-the-deadline' ), 'plugins.php?page=atd-key-config' ) . '

'; } add_action( 'admin_notices', 'AtD_warning' ); } /* * post an admin message if fsockopen is disabled */ if ( !function_exists('fsockopen') ) { function AtD_warning_fsockopen() { echo "

" . __("After the Deadine can't connect to the proofreading service. Contact your system administrator and ask them to allow the use of fsockopen from PHP.", 'after-the-deadline') . "

"; } add_action( 'admin_notices', 'AtD_warning_fsockopen' ); } /* * connect to the AtD service and verify the key the user entered */ function AtD_verify_key( $key ) { $session = AtD_http_get( 'service.afterthedeadline.com', '/verify?blog=' . urlencode( get_option( 'home' ) ) . '&key=' . urlencode( $key )); return $session[1]; } /* * display the form for the user to enter the key, also saving of the key option is handled here as well. */ function AtD_display_key_form() { if ( isset($_POST['submit']) ) { if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) { die( __('Cheatin’ uh?', 'after-the-deadline') ); } $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); } else { $key = get_option( 'AtD_api_key' ); } if ( empty($key) ) { $key_status = 'empty'; $ms[] = isset( $_POST['submit'] ) ? 'new_key_empty' : 'key_empty'; delete_option( 'AtD_api_key' ); } else if ( strlen($key) < 32 ) { $key_status = 'key_invalid'; $ms[] = 'new_key_is_wp_key'; delete_option( 'AtD_api_key' ); } else { $key_status = trim( AtD_verify_key( $key ) ); if ( strcmp( $key_status, 'valid' ) == 0 || strcmp( $key_status, 'Got it!' ) == 0) { update_option( 'AtD_api_key', $key ); $ms[] = isset( $_POST['submit'] ) ? 'new_key_valid' : 'key_valid'; } else if ( strcmp( $key_status, 'invalid' ) == 0 ) { delete_option( 'AtD_api_key' ); $ms[] = isset( $_POST['submit'] ) ? 'new_key_invalid' : 'key_invalid'; } else { $ms[] = isset( $_POST['submit'] ) ? 'new_key_failed' : 'key_failed'; } } /* potential messages */ $messages = array( 'new_key_is_wp_key' => array('color' => 'd22', 'text' => sprintf(__('A WordPress.com API key doesn\'t work here. (Get your After the Deadline API key.)', 'after-the-deadline'), 'http://www.afterthedeadline.com/profile.slp')), 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key is cleared.', 'after-the-deadline')), 'new_key_valid' => array('color' => '2d2', 'text' => __('Your key is now verified. Enjoy!', 'after-the-deadline')), 'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please check it.', 'after-the-deadline')), 'new_key_failed' => array('color' => 'd22', 'text' => __('Unable to connect to afterthedeadline.com to verify your key. Please check your server configuration.', 'after-the-deadline')), 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (Get your key.)'), 'http://www.afterthedeadline.com/profile.slp', 'after-the-deadline')), 'key_valid' => array('color' => '2d2', 'text' => __('Your key is valid.', 'after-the-deadline')), 'key_failed' => array('color' => 'aa0', 'text' => __('Your key was valid but I was unable to connect to afterthedeadline.com and verify it.', 'after-the-deadline')) ); ?>

After the Deadline website.', 'after-the-deadline'), 'http://www.afterthedeadline.com/profile.slp'); ?>

0 ) { foreach ( $ms as $m ) { ?>

in the editor to check spelling, style, and grammar.', 'after-the-deadline'), WP_PLUGIN_URL . '/after-the-deadline/button.gif'); ?>

profile page to configure After the Deadline proofreading software options.', 'after-the-deadline'), 'profile.php'); ?>

After the Deadline to give feedback, report bugs, and offer suggestions.', 'after-the-deadline'), 'http://www.afterthedeadline.com/support'); ?>