You are here

function spamspan_admin::filter_settings in SpamSpan filter 7

Settings callback for spamspan filter

File

./spamspan_admin.php, line 39
This module implements the spamspan technique (http://www.spamspan.com ) for hiding email addresses from spambots.

Class

spamspan_admin

Code

function filter_settings($form, $form_state, $filter, $format, $defaults, $filters) {
  $filter->settings += $defaults;

  // spamspan '@' replacement
  $settings['spamspan_at'] = array(
    '#type' => 'textfield',
    '#title' => t('Replacement for "@"'),
    '#default_value' => $filter->settings['spamspan_at'],
    '#required' => TRUE,
    '#description' => t('Replace "@" with this text when javascript is disabled.'),
  );
  $settings['spamspan_use_graphic'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use a graphical replacement for "@"'),
    '#default_value' => $filter->settings['spamspan_use_graphic'],
    '#description' => t('Replace "@" with a graphical representation when javascript is disabled' . ' (and ignore the setting "Replacement for @" above).'),
  );
  $settings['spamspan_dot_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Replace dots in email with text'),
    '#default_value' => $filter->settings['spamspan_dot_enable'],
    '#description' => t('Switch on dot replacement.'),
  );
  $settings['spamspan_dot'] = array(
    '#type' => 'textfield',
    '#title' => t('Replacement for "."'),
    '#default_value' => $filter->settings['spamspan_dot'],
    '#required' => TRUE,
    '#description' => t('Replace "." with this text.'),
  );
  $settings['use_form'] = array(
    '#type' => 'fieldset',
    '#title' => t('Use a form instead of a link'),
  );
  $settings['use_form']['spamspan_use_form'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use a form instead of a link'),
    '#default_value' => $filter->settings['spamspan_use_form'],
    '#description' => t('Link to a contact form instad of an email address. The following settings are used only if you select this option.'),
  );
  $settings['use_form']['spamspan_form_pattern'] = array(
    '#type' => 'textfield',
    '#title' => t('Replacement string for the email address'),
    '#default_value' => $filter->settings['spamspan_form_pattern'],
    '#required' => TRUE,
    '#description' => t('Replace the email link with this string and substitute the following <br />%url = the url where the form resides,<br />%email = the email address (base64 and urlencoded),<br />%displaytext = text to display instead of the email address.'),
  );
  $settings['use_form']['spamspan_form_default_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Default url'),
    '#default_value' => $filter->settings['spamspan_form_default_url'],
    '#required' => TRUE,
    '#description' => t('Default url to form to use if none specified (e.g. me@example.com[custom_url_to_form])'),
  );
  $settings['use_form']['spamspan_form_default_displaytext'] = array(
    '#type' => 'textfield',
    '#title' => t('Default displaytext'),
    '#default_value' => $filter->settings['spamspan_form_default_displaytext'],
    '#required' => TRUE,
    '#description' => t('Default displaytext to use if none specified (e.g. me@example.com[custom_url_to_form|custom_displaytext])'),
  );

  // we need this to insert our own validate/submit handlers
  // we use our own validate handler to extract use_form settings
  $settings['use_form']['#process'] = array(
    '_spamspan_admin_settings_form_process',
  );
  return $settings;
}