Cleanup of recaptcha plugin remove xhtml hack

This commit is contained in:
Eric Helgeson 2009-12-07 14:53:17 -05:00
parent 048f07a1e6
commit 684e65e3de

View File

@ -45,10 +45,10 @@ class RecaptchaPlugin extends Plugin
function onInitializePlugin(){ function onInitializePlugin(){
if(!isset($this->private_key)) { if(!isset($this->private_key)) {
common_log(LOG_ERR, "Recaptcha: Must specify private_key in config.php"); common_log(LOG_ERR, 'Recaptcha: Must specify private_key in config.php');
} }
if(!isset($this->public_key)) { if(!isset($this->public_key)) {
common_log(LOG_ERR, "Recaptcha: Must specify public_key in config.php"); common_log(LOG_ERR, 'Recaptcha: Must specify public_key in config.php');
} }
} }
@ -59,22 +59,10 @@ class RecaptchaPlugin extends Plugin
return false; return false;
} }
function onStartShowHTML($action)
{
//XXX: Horrible hack to make Safari, FF2, and Chrome work with
//reChapcha. reChapcha beaks xhtml strict
header('Content-Type: text/html');
$action->extraHeaders();
$action->startXML('html');
$action->style('#recaptcha_area{float:left;}');
return false;
}
function onEndRegistrationFormData($action) function onEndRegistrationFormData($action)
{ {
$action->style('#recaptcha_area{float:left;}');
$action->elementStart('li'); $action->elementStart('li');
$action->raw('<label for="recaptcha_area">Captcha</label>'); $action->raw('<label for="recaptcha_area">Captcha</label>');
if($this->checkssl() === true) { if($this->checkssl() === true) {
@ -93,11 +81,9 @@ class RecaptchaPlugin extends Plugin
$action->trimmed('recaptcha_challenge_field'), $action->trimmed('recaptcha_challenge_field'),
$action->trimmed('recaptcha_response_field')); $action->trimmed('recaptcha_response_field'));
if (!$resp->is_valid) if (!$resp->is_valid) {
{ if($this->display_errors) {
if($this->display_errors) $action->showForm ("(reCAPTCHA error: " . $resp->error . ")");
{
$action->showForm ("(reCAPTCHA said: " . $resp->error . ")");
} }
$action->showForm("Captcha does not match!"); $action->showForm("Captcha does not match!");
return false; return false;