function protected_submissions_config in Protected Submissions 7
Administrative settings form.
1 string reference to 'protected_submissions_config'
- protected_submissions_menu in ./
protected_submissions.module - Implements hook_menu().
File
- ./
protected_submissions.module, line 83 - Blocks submissions from anonymous users that contain pre-defined strings.
Code
function protected_submissions_config() {
$form = array();
$form['#attached']['css'] = array(
drupal_get_path('module', 'protected_submissions') . '/css/protected_submissions.css',
);
// Allowed language scripts.
$language_scripts = protected_submissions_variable_get('protected_submissions_language_scripts');
$language_scripts_keys = array_keys($language_scripts);
$form['protected_submissions_allowed_scripts'] = array(
'#type' => 'checkboxes',
'#options' => drupal_map_assoc($language_scripts_keys),
'#default_value' => protected_submissions_variable_get('protected_submissions_allowed_scripts'),
'#title' => t('Allowed language scripts'),
'#required' => TRUE,
'#description' => t('Select language scripts allowed for submission.'),
);
$form['protected_submissions_check_quantity'] = array(
'#type' => 'textfield',
'#default_value' => protected_submissions_variable_get('protected_submissions_check_quantity'),
'#title' => t('Number of characters to validate'),
'#size' => 5,
'#required' => TRUE,
'#description' => t('Spam texts can be constructed using mixed characters from multiple languages.
Checking each character would cause performance overhead, so we validate only randomly selected characters.
Indicate how many characters from submitted text should be validated for allowed language scripts.'),
);
// Message displayed to users when submission is rejected.
$form['protected_submissions_reject_message'] = array(
'#type' => 'textfield',
'#default_value' => protected_submissions_variable_get('protected_submissions_reject_message'),
'#title' => t('Reject message'),
'#size' => 60,
'#maxlength' => 256,
'#required' => TRUE,
'#description' => t('Enter a message to display when submission of undesired pattern is attempted.'),
);
// Reject patterns.
$reject_patterns = protected_submissions_variable_get('protected_submissions_reject_patterns');
$form['protected_submissions_reject_patterns'] = array(
'#type' => 'textarea',
'#rows' => 10,
'#columns' => 60,
'#default_value' => strtolower($reject_patterns),
'#title' => t('Reject patterns'),
'#required' => TRUE,
'#description' => t('Enter words or patterns to reject, separating them with commas or new lines.'),
);
// Give users option to enable/disable logging if Database Logging is on.
if (module_exists('dblog')) {
$form['protected_submissions_log_rejected'] = array(
'#type' => 'checkbox',
'#title' => t('Log rejected messages?'),
'#default_value' => protected_submissions_variable_get('protected_submissions_log_rejected'),
'#description' => t('Registering every rejected message could quickly flood your website\'s log. If you don\'t need to analyze rejected messages, then you might want to disable logging.'),
);
}
return system_settings_form($form);
}