//the keys without double quote
&recaptchaJs=`{lang:"[[++cultureKey]]", theme:"custom", custom_theme_widget:"recaptcha_widget"}`
//the keys and values use single quote
&recaptchaJs=`{’lang’:’[[++cultureKey]]’, ’theme’:’custom’, ’custom_theme_widget’:’recaptcha_widget’}`
[[!FormIt?
&hooks=`recaptcha`
&recaptchaJs=`{"lang":"[[++cultureKey]]", "theme":"custom", "custom_theme_widget":"recaptcha_widget"}`
]]
<form>
<!-- DIV ID="recaptcha_widget" as custom_theme_widget -->
<div id="recaptcha_widget" style="display:none">
<!-- DIV ID="recaptcha_image" to show captcha image -->
<div id="recaptcha_image"></div>
<!-- ADD TEXTFIELD: "recaptcha_response_field" -->
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
<!-- FormIt RESPONSE ERROR -->
<span class="error">[[!+fi.error.recaptcha]]</span>
<!-- Add a:link to reload captcha -->
<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
</div>
<form>
<!-- FormIt recaptcha_html placeHolder -->
[[!+formit.recaptcha_html]]
[[!FormIt?
&hooks=`recaptcha`
&recaptchaJs=`{"lang":"[[++cultureKey]]", "theme":"custom", "custom_theme_widget":"recaptcha_widget"}`
]]
<form>
<!-- DIV ID="recaptcha_widget" as custom_theme_widget -->
<div id="recaptcha_widget" style="display:none">
<!-- DIV ID="recaptcha_image" to show captcha image -->
<div id="recaptcha_image"></div>
<!-- ADD TEXTFIELD: "recaptcha_response_field" -->
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />
<!-- FormIt RESPONSE ERROR -->
<span class="error">[[!+fi.error.recaptcha]]</span>
<!-- FormIt recaptcha_html placeHolder -->
[[!+formit.recaptcha_html]]
<!-- Add a:link to reload captcha -->
<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
</div>
<form><script type="text/javascript">var RecaptchaOptions = {"theme":"custom", "lang":"en", "custom_theme_widget":"recaptcha_widget"};</script>
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=my_public_key"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=my_public_key" height="" width="" frameborder="0" style="width: px; height: px;"></iframe>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
<?php
/**
* FormItCustom snippet: Based on FormIt
*
* register javascript hook and add "formit.noscript" placeHolder.
*
**/
$modx->runSnippet('FormIt', $scriptProperties);
$recaptcha_html = $modx->getPlaceholder('formit.recaptcha_html');
if (!empty($recaptcha_html)) {
if (preg_match("@([\s\S]*)?<noscript[^>]*?>([\s\S]*)?<\/noscript>@im", $recaptcha_html, $matches)) {
$modx->regClientScript($matches[1]);
$modx->setPlaceholder('formit.recaptcha_html','<noscript>'.$matches[2].'</noscript>');
$modx->setPlaceholder('formit.noscript', '<noscript>Javascript required! Either javascript is disabled or you use inappropriate browser.</noscript>');
}
}
return '';[[!FormItCustom?
&hooks=`recaptcha`
&recaptchaJs=`{"lang":"[[++cultureKey]]", "theme":"custom", "custom_theme_widget":"recaptcha_widget"}`
]]