From f0395984109bb279b6dac157bff885b45e489a52 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 1 Jun 2009 23:58:49 -0700 Subject: Move recaptcha widget into a view for clarity. Also, wrap it in a setTimeout() call so that on subsequent reloads (which happen when you fail to validate the form) it has time to rebuild the DOM before calling the JS which tries to inject the Recaptcha HTML. Fixes ticket #327 --- modules/recaptcha/libraries/Form_Recaptcha.php | 17 +++-------------- modules/recaptcha/views/form_recaptcha.html.php | 11 +++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 modules/recaptcha/views/form_recaptcha.html.php (limited to 'modules') diff --git a/modules/recaptcha/libraries/Form_Recaptcha.php b/modules/recaptcha/libraries/Form_Recaptcha.php index d804fd78..4c0c4997 100644 --- a/modules/recaptcha/libraries/Form_Recaptcha.php +++ b/modules/recaptcha/libraries/Form_Recaptcha.php @@ -39,20 +39,9 @@ class Form_Recaptcha_Core extends Form_Input { "http://recaptcha.net/api/getkey"); } - $server = "http://api.recaptcha.net"; - - $options[] = "callback: Recaptcha.focus_response_field"; - $options[] = "lang: \"" . Kohana::config("locale.root_locale") . "\""; - $options[] = "theme: \"white\""; - $options = implode(", ", $options); - - $html = "
"; - $html .= ""; - $html .= ""; - return $html; + $view = new View("form_recaptcha.html"); + $view->public_key = $public_key; + return $view; } /** diff --git a/modules/recaptcha/views/form_recaptcha.html.php b/modules/recaptcha/views/form_recaptcha.html.php new file mode 100644 index 00000000..f5b36335 --- /dev/null +++ b/modules/recaptcha/views/form_recaptcha.html.php @@ -0,0 +1,11 @@ +
+ + + -- cgit v1.2.3