diff options
-rw-r--r-- | modules/recaptcha/libraries/Form_Recaptcha.php | 17 | ||||
-rw-r--r-- | modules/recaptcha/views/form_recaptcha.html.php | 11 |
2 files changed, 14 insertions, 14 deletions
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</a>"); } - $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 = "<div id=\"gRecaptcha\" />"; - $html .= "<script type=\"text/javascript\" "; - $html .= "src=\"http://api.recaptcha.net/js/recaptcha_ajax.js\"></script>"; - $html .= "<script type=\"text/javascript\">"; - $html .= "Recaptcha.create(\"$public_key\", \"gRecaptcha\", {" . $options . "});"; - $html .= "</script>"; - 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 @@ +<div id="gRecaptcha"></div> +<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> +<script type="text/javascript"> + setTimeout(function() { + Recaptcha.create( + "<?= $public_key ?>", + "gRecaptcha", + { theme: "white", callback: Recaptcha.focus_response_field }); + }, 0); +</script> + |