function invisimail_filter in Invisimail 5
Same name and namespace in other branches
- 6 invisimail.module \invisimail_filter()
Implementation of hook_filter().
File
- ./
invisimail.module, line 43 - This module provides a filter that will search content for email addresses and replace them with their ascii equivalents before display. This is not a complete protection from spam harvesters, but it is some help.
Code
function invisimail_filter($op, $delta = 0, $format = -1, $text = '') {
if ($op == 'list') {
return array(
0 => t('Encode email addresses'),
);
}
switch ($delta) {
case 0:
switch ($op) {
case 'description':
return t('Hide email addresses from spam-bots.');
case 'prepare':
return $text;
case 'process':
return invisimail($text, $format);
case 'settings':
$form['invisimail_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Invisimail email address encoding filter'),
'#collapsible' => true,
'#collapsed' => true,
);
$form['invisimail_settings']['invisimail_js_' . $format] = array(
'#type' => 'radios',
'#title' => t('JavaScript'),
'#default_value' => variable_get('invisimail_js_' . $format, FALSE),
'#options' => array(
FALSE => t('No JavaScript - greater compatibility'),
TRUE => t('Use JavaScript - greater security'),
),
'#description' => t('Selecting "Use JavaScript" will nearly guarantee protection from spam harvesters. However email addresses will not appear for browsers without JavaScript capability.'),
);
$form['invisimail_settings']['invisimail_link_' . $format] = array(
'#type' => 'radios',
'#title' => t('Auto-link Emails'),
'#default_value' => variable_get('invisimail_link_' . $format, FALSE),
'#options' => array(
FALSE => t('Do not create links.'),
TRUE => t('Automatically create links from email addresses.'),
),
'#description' => t('Selecting "Automatically create links" will convert email addresses into a clickable "mailto:" link.'),
);
return $form;
}
break;
}
}