*/ protected static $spam_flagged = array(); /** * Whether the current request's submission for the given flag key was * silently classified as spam. * * @param string $captcha_action The per-form flag key (accuaform_{fid}). * @return bool */ public static function isSpamFlagged( $captcha_action ) { return ! empty( self::$spam_flagged[ $captcha_action ] ); } /** * The silent spam action of the validator that flagged this request. * * @param string $captcha_action The per-form flag key (accuaform_{fid}). * @return string 'spam', 'trash', 'delete', or '' when nothing was flagged. */ public static function getSpamAction( $captcha_action ) { return isset( self::$spam_flagged[ $captcha_action ] ) ? (string) self::$spam_flagged[ $captcha_action ] : ''; } /** * Handle a failed verification according to the configured spam action: * fail validation (reject) or flag the submission and let it pass (silent). * * @return bool The value isValid() must return. */ protected function failed() { if ( in_array( $this->spamAction, array( 'spam', 'trash', 'delete' ), true ) ) { self::$spam_flagged[ $this->captchaAction ] = $this->spamAction; return true; } return false; } }