Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/code/community/Studioforty9/Recaptcha/Block/Explicit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -132,7 +132,7 @@ public function getSize()
*
* @return string
*/
public function getRecaptchaScript()
public function getRecaptchaScript($id)
{
if (! $this->_getHelper()->isEnabled()) {
return '';
Expand All @@ -148,7 +148,7 @@ public function getRecaptchaScript()
}

$query = array(
'onload' => 'onloadCallback',
'onload' => 'onloadCallback'.$id,
'render' => 'explicit',
'hl' => $lang
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,28 @@
*/
$id = $this->getRecaptchaId();
?>
<?php if ($this->isAllowed($this->getAction()->getFullActionName())): ?>
<?php if ($this->isAllowed($this->getAction()->getFullActionName())): ?>

<div class="recaptcha" style="overflow:hidden;position:relative;margin-bottom:10px;">
<input type="checkbox" id="cb-<?php echo $id ?>" name="cb-<?php echo $id ?>" value="" class="required-entry" style="visibility:hidden; position:absolute; left:-1000000px" />
<div id="el-<?php echo $id ?>"></div>
<script type="text/javascript">
var onloadCallback = function() {
grecaptcha.render('el-<?php echo $id ?>', {
'sitekey': "<?php echo $this->getSiteKey(); ?>",
'theme': "<?php echo $this->getTheme(); ?>",
'type': "<?php echo $this->getType(); ?>",
'size': "<?php echo $this->getSize(); ?>",
'callback': function(response) {
if (response.length > 0) {
$('cb-<?php echo $id ?>').writeAttribute('value', 'checked');
$('cb-<?php echo $id ?>').checked = true;
}
}
});
};
</script>
<?php echo $this->getRecaptchaScript(); ?>
</div>
<div class="recaptcha" style="overflow:hidden;position:relative;margin-bottom:10px;">
<input type="checkbox" id="cb-<?php echo $id ?>" name="cb-<?php echo $id ?>" value="" class="required-entry" style="visibility:hidden; position:absolute; left:-1000000px" />
<div id="el-<?php echo $id ?>"></div>
<?php echo $this->getRecaptchaScript($id); ?>
</div>
<?php endif; ?>

<script type="text/javascript">
function onloadCallback<?php echo $id ?>(){
ReCaptchaRender = grecaptcha.render('el-<?php echo $id ?>', {
'sitekey': "<?php echo $this->getSiteKey(); ?>",
'theme': "<?php echo $this->getTheme(); ?>",
'type': "<?php echo $this->getType(); ?>",
'size': "<?php echo $this->getSize(); ?>",
'callback': function (response) {
if (response.length > 0) {
$('cb-<?php echo $id ?>').writeAttribute('value', 'checked');
$('cb-<?php echo $id ?>').checked = true;
}
}
});
};
</script>