From f11c8c3f5ba8f043a13525f9842526fc14080620 Mon Sep 17 00:00:00 2001 From: Peter Keijsers Date: Wed, 15 Aug 2018 10:23:13 +0000 Subject: [PATCH] [TASK] Allow multiple recaptcha' on the same page Made the javascipt function unique per form using the form's id. --- .../Studioforty9/Recaptcha/Block/Explicit.php | 6 +-- .../studioforty9/recaptcha/explicit.phtml | 45 ++++++++++--------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/app/code/community/Studioforty9/Recaptcha/Block/Explicit.php b/app/code/community/Studioforty9/Recaptcha/Block/Explicit.php index 6ea9664..06d5615 100644 --- a/app/code/community/Studioforty9/Recaptcha/Block/Explicit.php +++ b/app/code/community/Studioforty9/Recaptcha/Block/Explicit.php @@ -26,7 +26,7 @@ class Studioforty9_Recaptcha_Block_Explicit extends Mage_Core_Block_Template 'ca_ES' => 'ca', 'zh_CN' => 'zh-CN', 'zh_HK|zh_TW' => 'zh-TW', - 'hr_HR' => 'hr', + 'hr_HR' => 'hr', 'cs_CZ' => 'cs', 'da_DK' => 'da', 'nl_NL' => 'nl', @@ -132,7 +132,7 @@ public function getSize() * * @return string */ - public function getRecaptchaScript() + public function getRecaptchaScript($id) { if (! $this->_getHelper()->isEnabled()) { return ''; @@ -148,7 +148,7 @@ public function getRecaptchaScript() } $query = array( - 'onload' => 'onloadCallback', + 'onload' => 'onloadCallback'.$id, 'render' => 'explicit', 'hl' => $lang ); diff --git a/app/design/frontend/base/default/template/studioforty9/recaptcha/explicit.phtml b/app/design/frontend/base/default/template/studioforty9/recaptcha/explicit.phtml index 118cc21..f007aba 100644 --- a/app/design/frontend/base/default/template/studioforty9/recaptcha/explicit.phtml +++ b/app/design/frontend/base/default/template/studioforty9/recaptcha/explicit.phtml @@ -13,27 +13,28 @@ */ $id = $this->getRecaptchaId(); ?> -isAllowed($this->getAction()->getFullActionName())): ?> +isAllowed($this->getAction()->getFullActionName())): ?> -
- -
- - getRecaptchaScript(); ?> -
+
+ +
+ getRecaptchaScript($id); ?> +
+ +