Tiger_Validate_Recaptcha

@api · extends Zend_Validate_Abstract

Tiger_Validate_Recaptcha — server-side validation of a Google reCAPTCHA response.

A standard Zend_Validate you can attach to any element (or, via Tiger_Form_Element_Recaptcha, get automatically). It reads the widget's token from the form context (the widget always posts the fixed field g-recaptcha-response), verifies it with Google (Tiger_Recaptcha::verify), and — for v3 — enforces the score threshold and, optionally, the expected action.

When reCAPTCHA is disabled in config it passes through, so forms validate normally in dev without keys. See Tiger_Recaptcha for the fail-open-on-outage policy.

Methods

__construct()

__construct($options = null)

Build the validator, optionally binding an expected v3 action.

  • $options array|Zend_Config|null — optional config; an action key sets the expected v3 action

isValid()

isValid($value, $context = null)

Verify the reCAPTCHA token from the form context (pass-through when disabled).

  • $value mixed — the element value (usually empty — the real token is in context)
  • $context array — the full form data, carrying g-recaptcha-response

Returns bool — true when reCAPTCHA is disabled, the outage policy fails open, or verification passes