You are here

function cleantalk_form_mailchimp_signup_subscribe_form_alter in Anti Spam by CleanTalk 8

Same name and namespace in other branches
  1. 7 cleantalk.module \cleantalk_form_mailchimp_signup_subscribe_form_alter()
  2. 7.2 cleantalk.module \cleantalk_form_mailchimp_signup_subscribe_form_alter()

Implements hook_form_BASE_FORM_ID_alter()

File

./cleantalk.module, line 248
Main CleanTalk integration module functions.

Code

function cleantalk_form_mailchimp_signup_subscribe_form_alter(&$form, &$form_state, $form_id) {
  drupal_session_start();
  $_SESSION['ct_submit_comment_time'] = REQUEST_TIME;
  $field_name = 'ct_checkjs';
  $ct_check_def = '0';
  if (!isset($_COOKIE[$field_name])) {
    setcookie($field_name, $ct_check_def, 0, '/');
  }

  // We cannot place JS in separate file.
  // Because it is not static - we have to use generated values.

  /*  $ct_check_value = _cleantalk_get_checkjs_value();
    $js_template = 'function ctSetCookie(c_name, value, def_value) {
    document.cookie = c_name + "=" + escape(value.replace(/^def_value$/, value)) + "; path=/";
  }
  setTimeout("ctSetCookie(\"%s\", \"%s\", \"%s\");",1000);';
    $js_addon_body = sprintf($js_template, $field_name, $ct_check_value, $ct_check_def);

    drupal_add_js($js_addon_body,
      array(
        'type' => 'inline',
        'scope' => 'footer',
        'weight' => 5,
        'cache' => FALSE,
        'every_page' => FALSE,
      )
    );*/
}