function recaptcha_get_html in reCAPTCHA 8
Same name and namespace in other branches
- 5.2 recaptcha/recaptchalib.php \recaptcha_get_html()
- 6 recaptcha-php-1.11/recaptchalib.php \recaptcha_get_html()
- 7 recaptcha-php-1.11/recaptchalib.php \recaptcha_get_html()
Gets the challenge HTML (javascript and non-javascript version). This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.
Parameters
string $pubkey A public key for reCAPTCHA:
string $error The error given by reCAPTCHA (optional, default is null):
boolean $use_ssl Should the request be made over ssl? (optional, default is false):
Return value
string - The HTML to be embedded in the user's form.
1 call to recaptcha_get_html()
- recaptcha_captcha in ./
recaptcha.module - Implements hook_captcha().
File
- recaptcha-php-1.11/
recaptchalib.php, line 106
Code
function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) {
if ($pubkey == null || $pubkey == '') {
die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
}
else {
$server = RECAPTCHA_API_SERVER;
}
$errorpart = "";
if ($error) {
$errorpart = "&error=" . $error;
}
return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
<noscript>
<iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>';
}