function blogapi_admin_settings in Drupal 5
Same name and namespace in other branches
- 6 modules/blogapi/blogapi.module \blogapi_admin_settings()
1 string reference to 'blogapi_admin_settings'
- blogapi_menu in modules/
blogapi/ blogapi.module
File
- modules/
blogapi/ blogapi.module, line 680 - Enable users to post using applications that support XML-RPC blog APIs.
Code
function blogapi_admin_settings() {
$node_types = array_map('check_plain', node_get_types('names'));
$defaults = isset($node_types['blog']) ? array(
'blog' => 1,
) : array();
$form['blogapi_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Blog types'),
'#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults),
'#options' => $node_types,
'#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).'),
);
$blogapi_extensions_default = variable_get('blogapi_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp');
$blogapi_uploadsize_default = variable_get('blogapi_uploadsize_default', 1);
$blogapi_usersize_default = variable_get('blogapi_usersize_default', 1);
$form['settings_general'] = array(
'#type' => 'fieldset',
'#title' => t('File settings'),
'#collapsible' => TRUE,
);
$form['settings_general']['blogapi_extensions_default'] = array(
'#type' => 'textfield',
'#title' => t('Default permitted file extensions'),
'#default_value' => $blogapi_extensions_default,
'#maxlength' => 255,
'#description' => t('Default extensions that users can upload. Separate extensions with a space and do not include the leading dot.'),
);
$form['settings_general']['blogapi_uploadsize_default'] = array(
'#type' => 'textfield',
'#title' => t('Default maximum file size per upload'),
'#default_value' => $blogapi_uploadsize_default,
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The default maximum file size a user can upload.'),
'#field_suffix' => t('MB'),
);
$form['settings_general']['blogapi_usersize_default'] = array(
'#type' => 'textfield',
'#title' => t('Default total file size per user'),
'#default_value' => $blogapi_usersize_default,
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The default maximum size of all files a user can have on the site.'),
'#field_suffix' => t('MB'),
);
$form['settings_general']['upload_max_size'] = array(
'#value' => '<p>' . t('Your PHP settings limit the maximum file size per upload to %size.', array(
'%size' => format_size(file_upload_max_size()),
)) . '</p>',
);
$roles = user_roles(0, 'administer content with blog api');
$form['roles'] = array(
'#type' => 'value',
'#value' => $roles,
);
foreach ($roles as $rid => $role) {
$form['settings_role_' . $rid] = array(
'#type' => 'fieldset',
'#title' => t('Settings for @role', array(
'@role' => $role,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings_role_' . $rid]['blogapi_extensions_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Permitted file extensions'),
'#default_value' => variable_get('blogapi_extensions_' . $rid, $blogapi_extensions_default),
'#maxlength' => 255,
'#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'),
);
$form['settings_role_' . $rid]['blogapi_uploadsize_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Maximum file size per upload'),
'#default_value' => variable_get('blogapi_uploadsize_' . $rid, $blogapi_uploadsize_default),
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The maximum size of a file a user can upload (in megabytes).'),
);
$form['settings_role_' . $rid]['blogapi_usersize_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Total file size per user'),
'#default_value' => variable_get('blogapi_usersize_' . $rid, $blogapi_usersize_default),
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The maximum size of all files a user can have on the site (in megabytes).'),
);
}
return system_settings_form($form);
}