function simplenews_admin_settings in Simplenews 5
Same name and namespace in other branches
- 6.2 includes/simplenews.admin.inc \simplenews_admin_settings()
- 6 simplenews.admin.inc \simplenews_admin_settings()
Generate settings form.
1 string reference to 'simplenews_admin_settings'
- simplenews_menu in ./
simplenews.module - Implementation of hook_menu().
File
- ./
simplenews.module, line 2253
Code
function simplenews_admin_settings($tid = NULL) {
$address_default = variable_get('site_mail', ini_get('sendmail_from'));
$name_default = variable_get('site_name', 'drupal');
$form = array();
$form['#validate']['simplenews_admin_settings_validate'] = array();
if (isset($tid) && ($term = taxonomy_get_term($tid))) {
// Add the term ID as an argument to the settings validation function.
$form['#validate']['simplenews_admin_settings_validate'][] = $term->tid;
$form['simplenews_sender_information'] = array(
'#type' => 'fieldset',
'#title' => t('Sender information'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['simplenews_sender_information']['simplenews_from_name_' . $term->tid] = array(
'#type' => 'textfield',
'#title' => t('From name'),
'#size' => 60,
'#maxlength' => 128,
'#default_value' => variable_get('simplenews_from_name_' . $term->tid, variable_get('simplenews_from_name', $name_default)),
);
$form['simplenews_sender_information']['simplenews_from_address_' . $term->tid] = array(
'#type' => 'textfield',
'#title' => t('From e-mail address'),
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#default_value' => variable_get('simplenews_from_address_' . $term->tid, variable_get('simplenews_from_address', $address_default)),
);
$form['simplenews_hyperlinks'] = array(
'#type' => 'fieldset',
'#title' => t('HTML to text conversion'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('When your newsletter is sent as plain text, these options will determine how the conversion to text is performed.'),
);
$form['simplenews_hyperlinks']['simplenews_hyperlinks_' . $term->tid] = array(
'#type' => 'radios',
'#title' => t('Hyperlink conversion'),
'#options' => array(
t('Append hyperlinks and links to images as a numbered reference list'),
t('Display hyperlinks and links to image inline with the text'),
),
'#default_value' => variable_get('simplenews_hyperlinks_' . $term->tid, 1),
);
}
else {
$form['simplenews_default_options'] = array(
'#type' => 'fieldset',
'#title' => t('Default newsletter options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => t('These options will be the defaults for new newsletters, but can be overridden in the newsletter editing form.'),
);
$form['simplenews_default_options']['simplenews_format'] = array(
'#type' => 'select',
'#title' => t('Format'),
'#options' => _simplenews_format_options(),
'#description' => t('Select the default newsletter sending format.'),
'#default_value' => variable_get('simplenews_format', 'plain'),
);
$form['simplenews_default_options']['simplenews_priority'] = array(
'#type' => 'select',
'#title' => t('Priority'),
'#options' => array(
0 => t('none'),
1 => t('highest'),
2 => t('high'),
3 => t('normal'),
4 => t('low'),
5 => t('lowest'),
),
'#description' => t('Note that e-mail priority is ignored by a lot of e-mail programs.'),
'#default_value' => variable_get('simplenews_priority', 0),
);
$form['simplenews_default_options']['simplenews_receipt'] = array(
'#type' => 'checkbox',
'#title' => t('Request receipt'),
'#return_value' => 1,
'#default_value' => variable_get('simplenews_receipt', 0),
'#description' => t('Request a Read Receipt from your newsletters. A lot of e-mail programs ignore these so it is not a definitive indication of how many people have read your newsletter.'),
);
$form['simplenews_default_options']['simplenews_send'] = array(
'#type' => 'radios',
'#title' => t('Default selection for sending newsletters'),
'#options' => array(
0 => t("Don't send now"),
2 => t('Send one test newsletter to the test address'),
1 => t('Send newsletter'),
),
'#default_value' => variable_get('simplenews_send', 0),
);
$form['simplenews_test_address'] = array(
'#type' => 'fieldset',
'#title' => t('Test addresses options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Supply a comma-separated list of e-mail addresses to be used as test addresses. The override function allows to override these addresses upon newsletter creation.'),
);
$form['simplenews_test_address']['simplenews_test_address'] = array(
'#type' => 'textfield',
'#title' => t('Test e-mail address'),
'#size' => 60,
'#maxlength' => 128,
'#default_value' => variable_get('simplenews_test_address', $address_default),
);
$form['simplenews_test_address']['simplenews_test_address_override'] = array(
'#type' => 'checkbox',
'#title' => t('Allow test address override'),
'#return_value' => 1,
'#default_value' => variable_get('simplenews_test_address_override', 0),
);
$form['simplenews_sender_info'] = array(
'#type' => 'fieldset',
'#title' => t('Sender information'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Default sender address that will only be used for confirmation e-mails. You can specify sender information for each newsletter separately on the newsletter\'s settings page.'),
);
$form['simplenews_sender_info']['simplenews_from_name'] = array(
'#type' => 'textfield',
'#title' => t('From name'),
'#size' => 60,
'#maxlength' => 128,
'#default_value' => variable_get('simplenews_from_name', $name_default),
);
$form['simplenews_sender_info']['simplenews_from_address'] = array(
'#type' => 'textfield',
'#title' => t('From e-mail address'),
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#default_value' => variable_get('simplenews_from_address', $address_default),
);
$form['simplenews_subscription'] = array(
'#type' => 'fieldset',
'#title' => t('Subscription options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['simplenews_subscription']['simplenews_sync_account'] = array(
'#type' => 'checkbox',
'#title' => t('Synchronize with account'),
'#default_value' => variable_get('simplenews_sync_account', FALSE),
'#description' => t('When checked subscriptions will be synchronized with site accounts. When accounts are deteted, subscriptions with the same email address will be removed. When site accounts are blocked/unblocked, subscriptions will be deactivated/activated. When not checked subscriptions will be unchanged when associated accounts are deleted or blocked.'),
);
$form['simplenews_mail_backend'] = array(
'#type' => 'fieldset',
'#title' => t('Mail backend'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$max_time = array(
0,
1,
2,
3,
4,
);
for ($i = 5; $i < ini_get('max_execution_time'); $i = $i + 5) {
$max_time[] = $i;
}
$form['simplenews_mail_backend']['simplenews_time'] = array(
'#type' => 'select',
'#title' => t('Initial send time'),
'#options' => drupal_map_assoc($max_time),
'#default_value' => variable_get('simplenews_time', 2),
'#description' => t('Sets the maximum time in seconds during which newsletters are sent. If not all recipients have been mailed within this time, sending is further handled as a cronjob.') . ' <br /> ' . t('The highest value in the dropdown list is based on max_execution_time in your php.ini file. Note that if not all previous newsletters have been sent to all recipients yet, these are sent first.'),
);
$throttle = drupal_map_assoc(array(
1,
10,
20,
30,
40,
50,
100,
200,
300,
400,
500,
1000,
2000,
3000,
4000,
5000,
));
$throttle[999999] = t('Unlimited');
$form['simplenews_mail_backend']['simplenews_throttle'] = array(
'#type' => 'select',
'#title' => t('Cron throttle'),
'#options' => $throttle,
'#default_value' => variable_get('simplenews_throttle', 20),
'#description' => t('Sets the numbers of newsletters sent per cron run. Failure to send will also be counted.'),
);
$form['simplenews_mail_backend']['simplenews_debug'] = array(
'#type' => 'checkbox',
'#title' => t('Log emails'),
'#default_value' => variable_get('simplenews_debug', FALSE),
'#description' => t('When checked all outgoing simplenews emails are logged in the system log. A logged email does not guarantee that it is send or will be delivered. It only indicates that a message is send to the PHP mail() function. No status information is available of delivery by the PHP mail() function.'),
);
}
return system_settings_form($form);
}