mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
by pass the exception (error) where there's an error on spamprotecter field
This commit is contained in:
parent
cbe2fa3171
commit
98e0c85937
@ -27,14 +27,23 @@ class SpamProtecterManager {
|
|||||||
* and a string of field names (seperated by comma) as a value.
|
* and a string of field names (seperated by comma) as a value.
|
||||||
* The naming of the fields is based on the implementation of the subclass of SpamProtecterField.
|
* The naming of the fields is based on the implementation of the subclass of SpamProtecterField.
|
||||||
* *** Most of the web service doesn't require this.
|
* *** Most of the web service doesn't require this.
|
||||||
* @return SpamProtector object or return null if the spamprotecter class is not found
|
* @return SpamProtector object on success or null if the spamprotecter class is not found
|
||||||
* or spamprotecterfield creation fails.
|
* also null if spamprotecterfield creation fails.
|
||||||
*/
|
*/
|
||||||
static function update_form($form, $before=null, $callbackObject=null, $fieldsToSpamServiceMapping=null) {
|
static function update_form($form, $before=null, $callbackObject=null, $fieldsToSpamServiceMapping=null) {
|
||||||
if (!class_exists(self::$spam_protecter)) return null;
|
if (!class_exists(self::$spam_protecter)) return null;
|
||||||
|
|
||||||
$protecter = new self::$spam_protecter();
|
$protecter = new self::$spam_protecter();
|
||||||
|
try {
|
||||||
$check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping);
|
$check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
$form->setMessage(
|
||||||
|
_t("SpamProtection.SPAMSPECTIONFAILED", self::$spam_protecter . " failed."),
|
||||||
|
"warning"
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$check) return null;
|
if (!$check) return null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user