function cleantalk_settings_form in Anti Spam by CleanTalk 7.4
Same name and namespace in other branches
- 8 cleantalk.admin.inc \cleantalk_settings_form()
- 7.5 src/Form/CleantalkSettingsForm.php \cleantalk_settings_form()
- 7 cleantalk.admin.inc \cleantalk_settings_form()
- 7.2 cleantalk.admin.inc \cleantalk_settings_form()
Cleantalk settings form.
1 string reference to 'cleantalk_settings_form'
- cleantalk_menu in ./
cleantalk.module - Implements hook_menu().
File
- src/
Form/ CleantalkSettingsForm.php, line 13 - CleanTalk module admin functions.
Code
function cleantalk_settings_form($form, &$form_state) {
//Renew banner
if (variable_get('cleantalk_show_renew_banner', 0)) {
$link = variable_get('cleantalk_api_trial', 0) ? 'https://cleantalk.org/my/bill/recharge?utm_source=banner&utm_medium=wp-backend&utm_campaign=Drupal%20backend%20trial&user_token=' : 'https://cleantalk.org/my/bill/recharge?utm_source=banner&utm_medium=wp-backend&utm_campaign=Drupal%20backend%20renew&user_token=';
drupal_set_message(t("Cleantalk module trial period ends, please upgrade to <a href='" . $link . variable_get('cleantalk_api_user_token', '') . "' target='_blank'><b>premium version</b></a> ."), 'warning', false);
}
$form['cleantalk_authkey'] = array(
'#type' => 'textfield',
'#title' => t('Access key'),
'#size' => 20,
'#maxlength' => 20,
'#default_value' => variable_get('cleantalk_authkey', ''),
'#description' => variable_get('cleantalk_authkey', '') ? t('Account at cleantalk.org is <b>' . variable_get('cleantalk_api_account_name_ob', '') . '</b>') : t('Click <a target="_blank" href="!ct_link">here</a> to get access key.', array(
'!ct_link' => url('http://cleantalk.org/register?platform=drupal'),
)),
);
$form['cleantalk_comments'] = array(
'#type' => 'fieldset',
'#title' => t('Comments'),
);
$form['cleantalk_comments']['cleantalk_check_comments'] = array(
'#type' => 'checkbox',
'#title' => t('Check comments'),
'#default_value' => variable_get('cleantalk_check_comments', 1),
'#description' => t('Enabling this option will allow you to check all comments on your website.'),
);
$form['cleantalk_comments']['cleantalk_check_comments_automod'] = array(
'#type' => 'checkbox',
'#title' => t('Enable automoderation'),
'#default_value' => variable_get('cleantalk_check_comments_automod', 0),
'#description' => t('Automatically put suspicious comments which may not be 100% spam to manual approvement and block obvious spam comments.') . '<br /><span class="admin-disabled">' . t('Note: If disabled, all suspicious comments will be automatically blocked!') . '</span>',
'#states' => array(
// Only show this field when the value when checking comments is enabled
'disabled' => array(
':input[name="cleantalk_check_comments"]' => array(
'checked' => FALSE,
),
),
),
);
$form['cleantalk_comments']['cleantalk_check_comments_min_approved'] = array(
'#type' => 'textfield',
'#title' => t('Minimum approved comments per registered user'),
'#size' => 5,
'#maxlength' => 5,
'#default_value' => variable_get('cleantalk_check_comments_min_approved', 3),
'#element_validate' => array(
'element_validate_integer_positive',
),
'#description' => t('Moderate messages of guests and registered users who have approved messages less than this value (must be more than 0).'),
'#states' => array(
// Only show this field when the value when checking comments is enabled
'disabled' => array(
':input[name="cleantalk_check_comments"]' => array(
'checked' => FALSE,
),
),
),
);
$form['cleantalk_search'] = array(
'#type' => 'fieldset',
'#title' => t('Search'),
);
$form['cleantalk_search']['cleantalk_check_search_form'] = array(
'#type' => 'checkbox',
'#title' => t('Check search form'),
'#default_value' => variable_get('cleantalk_check_search_form', 1),
'#description' => t('Enabling this option will allow you to check search form on your website.'),
);
$form['cleantalk_search']['cleantalk_add_search_noindex'] = array(
'#type' => 'checkbox',
'#title' => t('Add noindex for search form'),
'#default_value' => variable_get('cleantalk_add_search_noindex', 0),
'#description' => t('Add html meta-tag robots-noindex to skip index for search form.'),
);
$form['cleantalk_exclusions'] = array(
'#type' => 'fieldset',
'#title' => t('Exclusions'),
);
// Container URL_EXCLUSIONS
$form['cleantalk_exclusions']['cleantalk_url_exclusions_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('URL exclusions'),
'#description' => t('Exclude urls from spam check. List them separated by commas.'),
);
$form['cleantalk_exclusions']['cleantalk_url_exclusions_fieldset']['cleantalk_url_exclusions_container_inline'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['cleantalk_exclusions']['cleantalk_url_exclusions_fieldset']['cleantalk_url_exclusions_container_inline']['cleantalk_url_exclusions'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('cleantalk_url_exclusions', ''),
'#element_validate' => array(
'cleantalk_regexp_validation',
),
);
$form['cleantalk_exclusions']['cleantalk_url_exclusions_fieldset']['cleantalk_url_exclusions_container_inline']['cleantalk_url_exclusions_regexp'] = array(
'#type' => 'checkbox',
'#title' => t('RegExp?'),
'#default_value' => variable_get('cleantalk_url_exclusions_regexp', 0),
);
// Container FIELDS_EXCLUSIONS
$form['cleantalk_exclusions']['cleantalk_fields_exclusions_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Fields exclusions'),
'#description' => t('Exclude fields from spam check. List them separated by commas. Works on forms except for registration and comment forms.'),
);
$form['cleantalk_exclusions']['cleantalk_fields_exclusions_fieldset']['cleantalk_fields_exclusions_container_inline'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['cleantalk_exclusions']['cleantalk_fields_exclusions_fieldset']['cleantalk_fields_exclusions_container_inline']['cleantalk_fields_exclusions'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('cleantalk_fields_exclusions', ''),
);
// Container ROLES_EXCLUSIONS
$form['cleantalk_exclusions']['cleantalk_roles_exclusions_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Roles checking'),
'#description' => t('Roles which bypass spam test. You can select multiple roles.'),
);
$form['cleantalk_exclusions']['cleantalk_roles_exclusions_fieldset']['cleantalk_roles_exclusions_container_inline'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['cleantalk_exclusions']['cleantalk_roles_exclusions_fieldset']['cleantalk_roles_exclusions_container_inline']['cleantalk_roles_exclusions'] = array(
'#type' => 'select',
'#options' => CleantalkFuncs::cleantalk_get_user_roles(),
'#multiple' => true,
'#default_value' => variable_get('cleantalk_roles_exclusions', CleantalkFuncs::cleantalk_get_user_roles_default()),
);
$form['cleantalk_check_register'] = array(
'#type' => 'checkbox',
'#title' => t('Check registrations'),
'#default_value' => variable_get('cleantalk_check_register', 1),
'#description' => t('Enabling this option will allow you to check all registrations on your website.'),
);
$form['cleantalk_check_webforms'] = array(
'#type' => 'checkbox',
'#title' => t('Check webforms'),
'#default_value' => variable_get('cleantalk_check_webforms', 0),
'#description' => t('Enabling this option will allow you to check all webforms on your website.'),
);
$form['cleantalk_check_contact_forms'] = array(
'#type' => 'checkbox',
'#title' => t('Check contact forms'),
'#default_value' => variable_get('cleantalk_check_contact_forms', 1),
'#description' => t('Enabling this option will allow you to check all contact forms on your website.'),
);
$form['cleantalk_check_forum_topics'] = array(
'#type' => 'checkbox',
'#title' => t('Check forum topics'),
'#default_value' => variable_get('cleantalk_check_forum_topics', 0),
'#description' => t('Enabling this option will allow you to check all forum topics on your website.'),
);
$form['cleantalk_check_ccf'] = array(
'#type' => 'checkbox',
'#title' => t('Check custom form'),
'#default_value' => variable_get('cleantalk_check_ccf', 0),
'#description' => t('Enabling this option will allow you to check all forms on your website.') . '<br /><span class="admin-disabled">' . t('Note: May cause conflicts!') . '</span>',
);
$form['cleantalk_set_cookies'] = array(
'#type' => 'checkbox',
'#title' => t('Set cookies'),
'#default_value' => variable_get('cleantalk_set_cookies', 1),
'#description' => t('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off!') . '<br /><span class="admin-disabled">' . t('Note: We strongly recommend you to enable this otherwise it could cause false positives spam detection.') . '</span>',
);
$form['cleantalk_alternative_cookies_session'] = array(
'#type' => 'checkbox',
'#title' => t('Use alternative mechanism for cookies'),
'#default_value' => variable_get('cleantalk_alternative_cookies_session', 0),
'#description' => t('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.'),
'#states' => array(
// Only show this field when the value when checking comments is enabled
'invisible' => array(
':input[name="cleantalk_set_cookies"]' => array(
'checked' => FALSE,
),
),
),
);
$form['cleantalk_sfw'] = array(
'#type' => 'checkbox',
'#title' => t('Spam FireWall'),
'#default_value' => variable_get('cleantalk_sfw', 0),
'#description' => t('This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.'),
);
$form['cleantalk_link'] = array(
'#type' => 'checkbox',
'#title' => t('Tell others about CleanTalk'),
'#default_value' => variable_get('cleantalk_link', 0),
'#description' => t('Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.'),
);
return system_settings_form($form);
}