Index: recaptcha.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/recaptcha/Attic/recaptcha.admin.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 recaptcha.admin.inc --- recaptcha.admin.inc 10 Aug 2009 17:50:02 -0000 1.1.2.1 +++ recaptcha.admin.inc 8 Feb 2010 04:25:12 -0000 @@ -36,6 +36,12 @@ function recaptcha_admin_settings() { '#default_value' => variable_get('recaptcha_secure_connection', FALSE), '#description' => t('Connect to the reCAPTCHA server using a secure connection.'), ); + $form['recaptcha_ajax_api'] = array( + '#type' => 'checkbox', + '#title' => t('AJAX API'), + '#default_value' => variable_get('recaptcha_ajax_api', FALSE), + '#description' => t('Use the AJAX API to display reCAPTCHA.'), + ); $form['recaptcha_theme_settings'] = array( '#type' => 'fieldset', '#title' => t('Theme Settings'), Index: recaptcha.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/recaptcha/Attic/recaptcha.module,v retrieving revision 1.13.2.4.2.11.2.12 diff -u -p -r1.13.2.4.2.11.2.12 recaptcha.module --- recaptcha.module 23 Sep 2009 17:27:35 -0000 1.13.2.4.2.11.2.12 +++ recaptcha.module 8 Feb 2010 04:25:13 -0000 @@ -86,10 +86,12 @@ function recaptcha_captcha() { $recaptcha_tabindex = variable_get('recaptcha_tabindex', NULL); $recaptcha_public_key = variable_get('recaptcha_public_key', ''); $recaptcha_form_value = NULL; + $recaptcha_ajax_api = variable_get('recaptcha_ajax_api', FALSE); + // Construct the Javascript, but only display it once. static $_recaptcha_jsadded = FALSE; - if ($_recaptcha_jsadded == FALSE) { + if ($_recaptcha_jsadded == FALSE && $recaptcha_ajax_api == FALSE) { $_recaptcha_jsadded = TRUE; $recaptcha_options = array( 'theme' => $recaptcha_theme, @@ -124,10 +126,23 @@ function recaptcha_captcha() { '#type' => 'hidden', '#value' => 'reCAPTCHA', ); - $captcha['form']['captcha_form'] = array( - '#type' => 'item', - '#value' => ($recaptcha_form_value ? '
'. $recaptcha_form_value .'
' : '') . $html, - ); + if ($recaptcha_ajax_api == FALSE) { + $captcha['form']['captcha_form'] = array( + '#type' => 'item', + '#value' => ($recaptcha_form_value ? '
'. $recaptcha_form_value .'
' : '') . $html, + ); + } + else { + $html = ($recaptcha_theme == 'custom') ? theme('recaptcha_custom_widget') : ''; + $captcha['form']['captcha_form'] = array( + '#type' => 'item', + '#value' => '
'. $html .'
', + ); + $js = "$(function() { Recaptcha.create('$recaptcha_public_key', 'recaptcha_ajax_api_container', {theme: '$recaptcha_theme'});});"; + drupal_add_js($js, 'inline', 'header'); + drupal_set_html_head(''); + } + } return $captcha; }