You are here

function BotchaRecipebookAbstract::isSpam in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6.2 controller/botcha_recipebook.controller.inc \BotchaRecipebookAbstract::isSpam()

Spam check. Currently the logic is as follows: if we could find a recipe that failed spam check - then we consider this form submission as spam and decline it.

_state

Parameters

array $form:

Return value

boolean

File

controller/botcha_recipebook.controller.inc, line 339
Controller layer of the BotchaRecipebook objects.

Class

BotchaRecipebookAbstract
@file Controller layer of the BotchaRecipebook objects.

Code

function isSpam($form, $form_state) {
  $isSpam = FALSE;
  $recipes = $this
    ->getRecipes();
  foreach ($recipes as $recipe) {
    $recipe
      ->setStatus($recipe
      ->isSpam($form, $form_state) ? 'spam' : 'success');

    // Do per recipe handling right here. Global handling will be done later.
    $recipe
      ->handle($recipe
      ->getStatus(), $form, $form_state);

    // One is enough to block the form.
    $isSpam = $isSpam || $recipe
      ->getStatus() == 'spam';
  }
  return $isSpam;
}