here; however, any issues with this module are not the fault of the original authors. Version: 2.6 Author: Originally by Ben Maurer & Mike Crawford Email: support@recaptcha.net Author URI: http://bmaurer.blogspot.com */ require_once (dirname(__FILE__) . '/recaptchalib.php'); global $recaptcha_opt; $recaptcha_opt = get_option('plugin_recaptcha'); define ("RECAPTCHA_WP_HASH_SALT", "b7e063dvdv8d85f5d7f3694f68e944136d62"); if(strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false){ add_action('awp_admin_commentform',array('AWP_recaptcha','admin')); add_filter('awp_get_options',array('AWP_recaptcha','awp_get_options')); }elseif(AWP::enabled('recaptcha')){ add_filter('preprocess_comment', array('AWP_recaptcha','check_comment'),0); add_filter('awp_ajax_submit_commentform_actions', array('AWP_recaptcha','comment_form_actions')); add_filter('awp_ajax_commentform_actions', array('AWP_recaptcha','comment_form_inline')); add_action( 'comment_form', array('AWP_recaptcha','comment_form')); } class AWP_recaptcha{ function get_html($recaptcha_error){ global $recaptcha_opt; return recaptcha_get_html($recaptcha_opt['pubkey'], $recaptcha_error); } function comment_form_actions($actions){ $actions[] = "Recaptcha.reload();"; return $actions; } function hash_comment ($id) { global $recaptcha_opt; if (function_exists('wp_hash') ) { return wp_hash (RECAPTCHA_WP_HASH_COMMENT . $id); } else { return md5 (RECAPTCHA_WP_HASH_COMMENT . $recaptcha_opt['privkey'] . $id); } } /** * Embeds the reCAPTCHA widget into the comment form. * */ function comment_form() { global $id,$awpall; if(defined('AWP_AJAXED')){ echo "

"; }else{ //modify the comment form for the reCAPTCHA widget $recaptcha_js_opts = << var RecaptchaOptions = { theme : '$awpall[recap_color]', lang : '$awpall[recap_lang]'}; OPTS; echo $recaptcha_js_opts . AWP_recaptcha::get_html($_GET['rerror']) . $comment_string; } } function comment_form_inline($actions){ global $id,$recaptcha_opt, $awpall; $actions[] = "setTimeout(\"var s = document.createElement('script'); s.src = '".RECAPTCHA_API_SERVER. "/js/recaptcha_ajax.js';document.getElementById('recaptcha_$id').parentNode.appendChild(s);\",1000);"; $actions[] = "setTimeout(\"Recaptcha.create('$recaptcha_opt[pubkey]', 'recaptcha_$id', {theme : '$awpall[recap_color]', lang : '$awpall[recap_lang]'});\",1500);"; return $actions; } function show_captcha_for_comment () { global $user_ID; return true; } /** * Checks if the reCAPTCHA guess was correct and sets an error session variable if not * @param array $comment_data * @return array $comment_data */ function check_comment($comment_data) { global $user_ID, $recaptcha_opt; global $recaptcha_saved_error; if ( $comment_data['comment_type'] == '' ) { // Do not check trackbacks/pingbacks $challenge = $_POST['recaptcha_challenge_field']; $response = $_POST['recaptcha_response_field']; $recaptcha_response = recaptcha_check_answer ($recaptcha_opt ['privkey'], $_SERVER['REMOTE_ADDR'], $challenge, $response); if ($recaptcha_response->is_valid) { return $comment_data; } else { $die = ''; if(!defined('AWP_AJAXED')){ $die = '

'.__('Please hit back on your browser and try again.','awp').'

'. __('You may want to copy your comment to ensure it is saved.','awp').'

'.$_POST[comment].''; } wp_die(printf(__('ReCaptcha was incorrect. Please try again. %s','awp'), $die)); } } return $comment_data; } function blog_domain () { $uri = parse_url(get_settings('siteurl')); return $uri['host']; } function admin(){ global $aWP, $awpall; ob_start(); ?> <?php _e('reCAPTCHA Module.','awp');?> reCAPTCHA website.','awp');?>]]> reCAPTCHA.';?>
]]>
'', 'privkey' => '', ); add_option('plugin_recaptcha', $optionarray_def, 'reCAPTCHA Options'); /* Check form submission and update options if no error occurred */ if (isset($_POST['submit']) ) { $optionarray_update = array ( 'pubkey' => $_POST['recaptcha_opt_pubkey'], 'privkey' => $_POST['recaptcha_opt_privkey'], ); update_option('plugin_recaptcha', $optionarray_update); } /* Get options */ $optionarray_def = get_option('plugin_recaptcha'); ?>

reCAPTCHA website.','awp');?>

reCAPTCHA.';?>



© Copyright 2007  reCAPTCHA

reCAPTCHA is not active You must enter your reCAPTCHA API key for it to work

"; } add_action('admin_footer', 'recaptcha_warning'); return; } ?>