diff options
Diffstat (limited to 'modules/recaptcha')
-rw-r--r-- | modules/recaptcha/css/recaptcha.css | 7 | ||||
-rw-r--r-- | modules/recaptcha/helpers/recaptcha.php | 2 | ||||
-rw-r--r-- | modules/recaptcha/helpers/recaptcha_event.php | 8 | ||||
-rw-r--r-- | modules/recaptcha/helpers/recaptcha_theme.php | 28 | ||||
-rw-r--r-- | modules/recaptcha/views/admin_recaptcha.html.php | 46 | ||||
-rw-r--r-- | modules/recaptcha/views/form_recaptcha.html.php | 6 |
6 files changed, 70 insertions, 27 deletions
diff --git a/modules/recaptcha/css/recaptcha.css b/modules/recaptcha/css/recaptcha.css new file mode 100644 index 00000000..27117a55 --- /dev/null +++ b/modules/recaptcha/css/recaptcha.css @@ -0,0 +1,7 @@ +#g-content #g-comments ul li #g-recaptcha { + padding: 0; +} + +#g-content #g-comments ul li #g-recaptcha div { + padding: 0; +} diff --git a/modules/recaptcha/helpers/recaptcha.php b/modules/recaptcha/helpers/recaptcha.php index bead6156..789bae85 100644 --- a/modules/recaptcha/helpers/recaptcha.php +++ b/modules/recaptcha/helpers/recaptcha.php @@ -19,7 +19,7 @@ */ class recaptcha_Core { static function get_configure_form() { - $form = new Forge("admin/recaptcha", "", "post", array("id" => "gConfigureRecaptchaForm")); + $form = new Forge("admin/recaptcha", "", "post", array("id" => "g-configure-recaptcha-form")); $group = $form->group("configure_recaptcha") ->label(t("Configure reCAPTCHA")); $group->input("public_key") diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php index d23a0c74..e7ded3ab 100644 --- a/modules/recaptcha/helpers/recaptcha_event.php +++ b/modules/recaptcha/helpers/recaptcha_event.php @@ -20,7 +20,13 @@ class recaptcha_event_Core { static function comment_add_form($form) { if (module::get_var("recaptcha", "public_key")) { - $form->add_comment->recaptcha("recaptcha")->label("")->id("gRecaptcha"); + $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha"); + } + } + + static function register_add_form($form) { + if (module::get_var("recaptcha", "public_key")) { + $form->register_user->recaptcha("recaptcha")->label("")->id("g-recaptcha"); } } diff --git a/modules/recaptcha/helpers/recaptcha_theme.php b/modules/recaptcha/helpers/recaptcha_theme.php new file mode 100644 index 00000000..fd1f563c --- /dev/null +++ b/modules/recaptcha/helpers/recaptcha_theme.php @@ -0,0 +1,28 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class recaptcha_theme_Core { + static function head($theme) { + $theme->css("recaptcha.css"); + } + + static function admin_head($theme) { + $theme->css("recaptcha.css"); + } +}
\ No newline at end of file diff --git a/modules/recaptcha/views/admin_recaptcha.html.php b/modules/recaptcha/views/admin_recaptcha.html.php index 0a4b1f8f..4f07fef0 100644 --- a/modules/recaptcha/views/admin_recaptcha.html.php +++ b/modules/recaptcha/views/admin_recaptcha.html.php @@ -1,33 +1,35 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="gAdminRecaptcha"> - <h1> <?= t("reCAPTCHA Challenge Filtering") ?> </h1> +<div class="g-block"> + <h1> <?= t("reCAPTCHA challenge filtering") ?> </h1> <p> <?= t("reCAPTCHA is a free CAPTCHA service that helps to digitize books, newspapers and old time radio shows. In order to use it, you need to sign up for a <a href=\"%domain_url\">reCAPTCHA Public/Private Key pair</a>, which is also free. Once registered, the challenge and response strings are evaluated at <a href=\"%recaptcha_url\">recaptcha.net</a> to determine if the form content has been entered by a bot.", array("domain_url" => $form->get_key_url, "recaptcha_url" => html::mark_clean("http://recaptcha.net"))) ?> </p> - <?= $form ?> -</div> + <div class="g-block-content"> + <?= $form ?> -<? if ($public_key && $private_key): ?> -<div id="gAdminRecaptchaTest" class="gBlock"> - <h2> <?= t("reCAPTCHA Test") ?> </h2> - <p> - <?= t("If you see a CAPTCHA form below, then reCAPTCHA is functioning properly.") ?> - </p> + <? if ($public_key && $private_key): ?> + <div id="g-admin-recaptcha-test"> + <h2> <?= t("reCAPTCHA test") ?> </h2> + <p> + <?= t("If you see a CAPTCHA form below, then reCAPTCHA is functioning properly.") ?> + </p> + + <div id="g-recaptcha"> + <script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> + <script type="text/javascript"> + Recaptcha.create("<?= $public_key ?>", "g-recaptcha", { + callback: Recaptcha.focus_response_field, + lang: "en", + custom_translations : { instructions_visual : <?= t("Type words to check:")->for_js() ?>}, + theme: "white" + }); + </script> + </div> + </div> + <? endif ?> - <div id="gRecaptcha"/> - <script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> - <script type="text/javascript"> - Recaptcha.create("<?= $public_key ?>", "gRecaptcha", { - callback: Recaptcha.focus_response_field, - lang: "en", - custom_translations : { instructions_visual : <?= t("Type words to check:")->for_js() ?>}, - theme: "white" - }); - </script> </div> </div> -<? endif ?> - diff --git a/modules/recaptcha/views/form_recaptcha.html.php b/modules/recaptcha/views/form_recaptcha.html.php index 4ec04c49..20e7359e 100644 --- a/modules/recaptcha/views/form_recaptcha.html.php +++ b/modules/recaptcha/views/form_recaptcha.html.php @@ -1,17 +1,17 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="gRecaptcha"></div> +<div id="g-recaptcha"></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", + "g-recaptcha", { theme: "white", custom_translations : { instructions_visual : <?= t("Type words to check:")->for_js() ?>}, callback: Recaptcha.focus_response_field } ); - }, 0); + }, 500); </script> |