first import
This commit is contained in:
64
sites/all/modules/variable/includes/forum.variable.inc
Normal file
64
sites/all/modules/variable/includes/forum.variable.inc
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function forum_variable_info($options) {
|
||||
$variables['forum_hot_topic'] = array(
|
||||
'title' => t('Hot topic threshold'),
|
||||
'type' => 'select_number',
|
||||
'default' => 15,
|
||||
'options' => array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500),
|
||||
'description' => t('The number of replies a topic must have to be considered "hot".'),
|
||||
'group' => 'forum_settings',
|
||||
);
|
||||
$variables['forum_per_page'] = array(
|
||||
'title' => t('Topics per page'),
|
||||
'type' => 'select_number',
|
||||
'default' => 25,
|
||||
'options' => array(10, 25, 50, 75, 100),
|
||||
'description' => t('Default number of forum topics displayed per page.'),
|
||||
'group' => 'forum_settings',
|
||||
);
|
||||
$forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4 => t('Posts - least active first'));
|
||||
$variables['forum_order'] = array(
|
||||
'title' => t('Default order'),
|
||||
'type' => 'select',
|
||||
'default' => 1,
|
||||
'options' => $forder,
|
||||
'description' => t('Default display order for topics.'),
|
||||
'group' => 'forum_settings',
|
||||
);
|
||||
// Some hidden variables that we may want exposed, localized, etc..
|
||||
$variables['forum_nav_vocabulary'] = array(
|
||||
'type' => 'select',
|
||||
'options' => 'vocabulary_vid',
|
||||
'title' => t('Forum navigation vocabulary'),
|
||||
'default' => 0,
|
||||
'group' => 'forum_settings',
|
||||
'localize' => TRUE,
|
||||
);
|
||||
$variables['forum_containers'] = array(
|
||||
'type' => 'array',
|
||||
'title' => t('Forum containers'),
|
||||
'group' => 'forum_settings',
|
||||
);
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
function forum_variable_group_info() {
|
||||
$groups['forum_settings'] = array(
|
||||
'title' => t('Forum settings'),
|
||||
'access' => 'administer forums',
|
||||
'path' => 'admin/structure/menu/settings',
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
92
sites/all/modules/variable/includes/locale.variable.inc
Normal file
92
sites/all/modules/variable/includes/locale.variable.inc
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function locale_variable_info($options) {
|
||||
// This variable will be altered by translation module. See translation.variable.inc
|
||||
$variables['language_content_type_[node_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Multilingual support'),
|
||||
'repeat' => array(
|
||||
'type' => 'enable',
|
||||
// Set options here so translation module can add some more
|
||||
'options' => array(t('Disabled'), t('Enabled')),
|
||||
),
|
||||
'description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language', $options)), $options),
|
||||
'group' => 'node_type_settings',
|
||||
);
|
||||
$variables['language_default'] = array(
|
||||
'title' => t('Site default language'),
|
||||
'type' => 'select',
|
||||
'group' => 'regional_settings',
|
||||
'options callback' => 'locale_variable_options_language',
|
||||
'format callback' => 'locale_variable_language_default_format',
|
||||
'element callback' => 'locale_variable_language_default_element',
|
||||
'default callback' => 'locale_variable_language_default',
|
||||
);
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info().
|
||||
*/
|
||||
function locale_variable_type_info() {
|
||||
// Language code
|
||||
$type['language'] = array(
|
||||
'title' => t('Language'),
|
||||
'options callback' => 'locale_variable_options_language',
|
||||
'type' => 'select',
|
||||
);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for all languages
|
||||
*/
|
||||
function locale_variable_options_language($variable, $options) {
|
||||
return locale_language_list('name', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form element for site default language
|
||||
*/
|
||||
function locale_variable_language_default_element($variable, $options) {
|
||||
$element = variable_form_element_options($variable, $options);
|
||||
// Default needs to be language code for the radios to work.
|
||||
$element['#default_value'] = $element['#default_value']->language;
|
||||
// Since 'value callback' is useless as it is run before validation, we use validate
|
||||
// callback to transform language code into an object.
|
||||
$element['#element_validate'][] = 'locale_variable_language_element_validate';
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get language default.
|
||||
*/
|
||||
function locale_variable_language_default($variable, $options) {
|
||||
return language_default();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format language object variable
|
||||
*/
|
||||
function locale_variable_language_default_format($variable, $options = array()) {
|
||||
return !empty($variable['value']) ? check_plain($variable['value']->name) : t('None');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace language code by language object on submission.
|
||||
*
|
||||
* This runs alter default element validation so we know it is a valid checkbox option.
|
||||
*/
|
||||
function locale_variable_language_element_validate($element, &$form_state, $form) {
|
||||
$languages = language_list();
|
||||
$language = $languages[$element['#value']];
|
||||
form_set_value($element, $language, $form_state);
|
||||
}
|
61
sites/all/modules/variable/includes/menu.variable.inc
Normal file
61
sites/all/modules/variable/includes/menu.variable.inc
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function menu_variable_info($options) {
|
||||
$variables['menu_main_links_source'] = array(
|
||||
'type' => 'select',
|
||||
'title' => t('Source for the Main links'),
|
||||
'options' => 'menu',
|
||||
'default' => 'main-menu',
|
||||
'element' => array('#empty_option' => t('No Main links')),
|
||||
'description' => t('Select what should be displayed as the Main links (typically at the top of the page).', array(), $options),
|
||||
'group' => 'menu_settings'
|
||||
);
|
||||
$variables['menu_secondary_links_source'] = array(
|
||||
'type' => 'select',
|
||||
'title' => t('Source for the Secondary links'),
|
||||
'options' => 'menu',
|
||||
'default' => 'user-menu',
|
||||
'element' => array('#empty_option' => t('No Secondary links')),
|
||||
'description' => t('Select the source for the Secondary links.', array() , $options),
|
||||
'group' => 'menu_settings'
|
||||
);
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
function menu_variable_group_info() {
|
||||
$groups['menu_settings'] = array(
|
||||
'title' => t('Menu settings'),
|
||||
'access' => 'administer menu',
|
||||
'path' => 'admin/structure/menu/settings',
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info()
|
||||
*/
|
||||
function menu_variable_type_info() {
|
||||
$type['menu'] = array(
|
||||
'title' => t('Menu'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'menu_variable_menu_list',
|
||||
);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu option list
|
||||
*/
|
||||
function menu_variable_menu_list($variable, $options) {
|
||||
return menu_get_menus();
|
||||
}
|
144
sites/all/modules/variable/includes/node.variable.inc
Normal file
144
sites/all/modules/variable/includes/node.variable.inc
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function node_variable_info($options) {
|
||||
// Per content type options. Group 'node_type_settings'.
|
||||
$variables['teaser_length_[node_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Length of trimmed posts'),
|
||||
'repeat' => array(
|
||||
'type' => 'select',
|
||||
'default' => 600,
|
||||
'options' => 'text_length',
|
||||
),
|
||||
'description' => t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.", array(), $options),
|
||||
'group' => 'node_type_settings',
|
||||
);
|
||||
$variables['node_preview_[node_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Preview before submitting'),
|
||||
'repeat' => array(
|
||||
'type' => 'select',
|
||||
'default' => DRUPAL_OPTIONAL,
|
||||
'options callback' => 'node_variable_option_list',
|
||||
),
|
||||
'description' => t('Must users preview posts before submitting?', array(), $options),
|
||||
'group' => 'node_type_settings',
|
||||
);
|
||||
$variables['node_options_[node_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Default options', array(), $options),
|
||||
'repeat' => array(
|
||||
'type' => 'options',
|
||||
'default' => array('status', 'promote'),
|
||||
'options callback' => 'node_variable_option_list',
|
||||
),
|
||||
'description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.', array(), $options),
|
||||
'group' => 'node_type_settings',
|
||||
);
|
||||
$variables['node_submitted_[node_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Display author and date information.', array(), $options),
|
||||
'repeat' => array(
|
||||
'default' => TRUE,
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'description' => t('Author username and publish date will be displayed.', array(), $options),
|
||||
'group' => 'node_type_settings',
|
||||
);
|
||||
return $variables;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
function node_variable_group_info() {
|
||||
$groups['node_type_settings'] = array(
|
||||
'title' => t('Node type settings'),
|
||||
'description' => t('Settings for each node type.'),
|
||||
'access' => 'administer nodes',
|
||||
'path' => 'admin/structure/types',
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info()
|
||||
*/
|
||||
function node_variable_type_info() {
|
||||
$type['node_type'] = array(
|
||||
'title' => t('Node type'),
|
||||
'options callback' => 'node_type_get_names',
|
||||
'type' => 'select',
|
||||
);
|
||||
$type['text_length'] = array(
|
||||
'title' => t('Text length'),
|
||||
'options callback' => 'node_variable_option_text_length',
|
||||
'type' => 'select',
|
||||
);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for node variable options
|
||||
*/
|
||||
function node_variable_option_text_length($variable, $options = array()) {
|
||||
return array(
|
||||
0 => t('Unlimited', array(), $options),
|
||||
200 => t('@count characters', array('@count' => 200), $options),
|
||||
400 => t('@count characters', array('@count' => 400), $options),
|
||||
600 => t('@count characters', array('@count' => 600), $options),
|
||||
800 => t('@count characters', array('@count' => 800), $options),
|
||||
1000 => t('@count characters', array('@count' => 1000), $options),
|
||||
1200 => t('@count characters', array('@count' => 1200), $options),
|
||||
1400 => t('@count characters', array('@count' => 1400), $options),
|
||||
1600 => t('@count characters', array('@count' => 1600), $options),
|
||||
1800 => t('@count characters', array('@count' => 1800), $options),
|
||||
2000 => t('@count characters', array('@count' => 2000), $options),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for variable options
|
||||
*/
|
||||
function node_variable_option_list($variable, $options = array()) {
|
||||
switch ($variable['parent']) {
|
||||
case 'node_preview_[node_type]':
|
||||
return array(
|
||||
DRUPAL_DISABLED => t('Disabled', array(), $options),
|
||||
DRUPAL_OPTIONAL => t('Optional', array(), $options),
|
||||
DRUPAL_REQUIRED => t('Required', array(), $options),
|
||||
);
|
||||
case 'node_options_[node_type]':
|
||||
return array(
|
||||
'status' => t('Published', array(), $options),
|
||||
'promote' => t('Promoted to front page', array(), $options),
|
||||
'sticky' => t('Sticky at top of lists', array(), $options),
|
||||
'revision' => t('Create new revision', array(), $options),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build subform for variables for node type
|
||||
*
|
||||
* @param $type
|
||||
* Node type name
|
||||
* @param $list
|
||||
* List of variables to include
|
||||
*/
|
||||
function node_variable_type_subform($type, $list) {
|
||||
module_load_include('form.inc', 'variable');
|
||||
foreach ($list as $name) {
|
||||
$variable = variable_get_child($name . '_[node_type]', $type);
|
||||
$form[$name] = variable_form_element($variable);
|
||||
}
|
||||
return $form;
|
||||
}
|
447
sites/all/modules/variable/includes/system.variable.inc
Normal file
447
sites/all/modules/variable/includes/system.variable.inc
Normal file
@@ -0,0 +1,447 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function system_variable_info($options) {
|
||||
// Site configuration, site information
|
||||
$variables['site_name'] = array(
|
||||
'type' => 'string',
|
||||
'title' => t('Site name', array(), $options),
|
||||
'default' => 'Drupal',
|
||||
'description' => t('The name of this website.', array(), $options),
|
||||
'required' => TRUE,
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['site_mail'] = array(
|
||||
'type' => 'mail_address',
|
||||
'title' => t('Site email address', array(), $options),
|
||||
'default' => ini_get('sendmail_from'),
|
||||
'description' => t("The <em>From</em> address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)", array(), $options),
|
||||
'required' => TRUE,
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['site_slogan'] = array(
|
||||
'type' => 'text',
|
||||
'title' => t('Site slogan', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).", array(), $options),
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['anonymous'] = array(
|
||||
'type' => 'string',
|
||||
'title' => t('Anonymous user', array(), $options),
|
||||
'default' => t('Anonymous', array(), $options),
|
||||
'description' => t('The name used to indicate anonymous users.', array(), $options),
|
||||
'required' => TRUE,
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['site_frontpage'] = array(
|
||||
'type' => 'drupal_path',
|
||||
'title' => t('Default front page', array(), $options),
|
||||
'default' => 'node',
|
||||
'description' => t('The home page displays content from this relative URL. If unsure, specify "node".', array(), $options),
|
||||
'required' => TRUE,
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['default_nodes_main'] = array(
|
||||
'type' => 'select_number',
|
||||
'title' => t('Number of posts on main page', array(), $options),
|
||||
'default' => 10,
|
||||
'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30),
|
||||
'description' => t('The maximum number of posts displayed on overview pages such as the front page.', array(), $options),
|
||||
'group' => 'site_information',
|
||||
);
|
||||
|
||||
$variables['site_403'] = array(
|
||||
'type' => 'drupal_path',
|
||||
'title' => t('Default 403 (access denied) page', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.', array(), $options),
|
||||
'group' => 'site_information',
|
||||
);
|
||||
$variables['site_404'] = array(
|
||||
'type' => 'drupal_path',
|
||||
'title' => t('Default 404 (not found) page', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.', array(), $options),
|
||||
'group' => 'site_information',
|
||||
);
|
||||
|
||||
// Feed settings. Group 'feed_settings'.
|
||||
$variables['feed_description'] = array(
|
||||
'type' => 'text',
|
||||
'title' => t('Feed description'),
|
||||
'default' => '',
|
||||
'description' => t('Description of your site, included in each feed.', array(), $options),
|
||||
'group' => 'feed_settings',
|
||||
);
|
||||
$variables['feed_default_items'] = array(
|
||||
'type' => 'select_number',
|
||||
'title' => t('Number of items in each feed'),
|
||||
'default' => 10,
|
||||
'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30),
|
||||
'description' => t('Default number of items to include in each feed.', array(), $options),
|
||||
'group' => 'feed_settings',
|
||||
);
|
||||
$variables['feed_item_length'] = array(
|
||||
'type' => 'select',
|
||||
'title' => t('Feed content'),
|
||||
'default' => 'fulltext',
|
||||
'options' => array(
|
||||
'title' => t('Titles only', array(), $options),
|
||||
'teaser' => t('Titles plus teaser', array(), $options),
|
||||
'fulltext' => t('Full text', array(), $options)
|
||||
),
|
||||
'description' => t('Global setting for the default display of content items in each feed.', array(), $options),
|
||||
'group' => 'feed_settings',
|
||||
);
|
||||
|
||||
// Regional settings. Group 'regional_settings'.
|
||||
$variables['site_default_country'] = array(
|
||||
'type' => 'select',
|
||||
'options' => 'country',
|
||||
'title' => t('Default country', array(), $options),
|
||||
'element' => array('#type' => 'select', '#attributes' => array('class' => array('country-detect'))),
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['date_first_day'] = array(
|
||||
'type' => 'select',
|
||||
'options' => 'weekday',
|
||||
'title' => t('First day of week', array(), $options),
|
||||
'default' => 0,
|
||||
'localize' => TRUE,
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['date_default_timezone'] = array(
|
||||
'type' => 'select',
|
||||
'options' => 'timezone',
|
||||
'title' => t('Default time zone', array(), $options),
|
||||
'default callback' => 'date_default_timezone_get',
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['configurable_timezones'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Users may set their own time zone.', array(), $options),
|
||||
'default' => 1,
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['empty_timezone_message'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Remind users at login if their time zone is not set.', array(), $options),
|
||||
'default' => 0,
|
||||
'description' => t('Only applied if users may set their own time zone.', array(), $options),
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['user_default_timezone'] = array(
|
||||
'type' => 'select',
|
||||
'title' => t('Time zone for new users'),
|
||||
'default' => DRUPAL_USER_TIMEZONE_DEFAULT,
|
||||
'options' => array(
|
||||
DRUPAL_USER_TIMEZONE_DEFAULT => t('Default time zone.', array(), $options),
|
||||
DRUPAL_USER_TIMEZONE_EMPTY => t('Empty time zone.', array(), $options),
|
||||
DRUPAL_USER_TIMEZONE_SELECT => t('Users may set their own time zone at registration.', array(), $options),
|
||||
),
|
||||
'description' => t('Only applied if users may set their own time zone.', array(), $options),
|
||||
'localize' => TRUE,
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
$variables['date_format_[date_type]'] = array(
|
||||
'type' => 'multiple',
|
||||
'title' => t('Date format'),
|
||||
'repeat' => array(
|
||||
'type' => 'select',
|
||||
'options' => 'date_format',
|
||||
),
|
||||
'group' => 'regional_settings',
|
||||
);
|
||||
// Maintenance mode. Group 'site_information'
|
||||
$variables['maintenance_mode'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Put site into maintenance mode', array(), $options),
|
||||
'default' => 0,
|
||||
'description' => t('When enabled, only users with the "Use the site in maintenance mode" <a href="@permissions-url">permission</a> are able to access your site to perform maintenance; all other visitors see the maintenance mode message configured below. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => url('admin/people/permissions'), '@user-login' => url('user')), $options),
|
||||
'group' => 'site_information'
|
||||
);
|
||||
$variables['maintenance_mode_message'] = array(
|
||||
'type' => 'text',
|
||||
'title' => t('Maintenance mode message', array(), $options),
|
||||
'default' => t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')), $options),
|
||||
'description' => t('Message to show visitors when the site is in maintenance mode.', array(), $options),
|
||||
'group' => 'site_information'
|
||||
);
|
||||
// Theme settings, we may want to localize the logo. Group 'theme_settings'
|
||||
$variables['theme_settings'] = array(
|
||||
'type' => 'properties',
|
||||
'title' => t('Global theme settings.', array(), $options),
|
||||
'group' => 'theme_settings',
|
||||
'default callback' => 'system_variable_theme_defaults',
|
||||
'localize' => TRUE,
|
||||
'group' => 'theme_settings',
|
||||
);
|
||||
$variables['theme_[theme]_settings'] = array(
|
||||
'type' => 'multiple',
|
||||
'multiple' => 'theme',
|
||||
'title' => t('Theme settings', array(), $options),
|
||||
'description' => t('Logo, icons and other specific theme settings.', array(), $options),
|
||||
'repeat' => array(
|
||||
'type' => 'properties',
|
||||
'default callback' => 'system_variable_theme_defaults',
|
||||
),
|
||||
'group' => 'theme_settings',
|
||||
'localize' => TRUE,
|
||||
);
|
||||
// Performance options, changing them may need some extra cache refresh.
|
||||
$variables['cache'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Cache pages for anonymous users', array(), $options),
|
||||
'default' => 0,
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
// This one belongs to a different module, block, but it won't do any harm having it here.
|
||||
$variables['block_cache'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Cache blocks'),
|
||||
'default' => FALSE,
|
||||
'description' => t('Block caching is inactive if you have enabled modules defining content access restrictions.', array(), $options),
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
$interval = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400);
|
||||
$variables['cache_lifetime'] = array(
|
||||
'type' => 'time_interval',
|
||||
'title' => t('Minimum cache lifetime', array(), $options),
|
||||
'default' => 0,
|
||||
'interval values' => $interval,
|
||||
'description' => t('Cached pages will not be re-created until at least this much time has elapsed.', array(), $options),
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
$variables['page_cache_maximum_age'] = array(
|
||||
'type' => 'time_interval',
|
||||
'title' => t('Expiration of cached pages', array(), $options),
|
||||
'default' => 0,
|
||||
'interval values' => $interval,
|
||||
'description' => t('The maximum time an external cache can use an old version of a page.', array(), $options),
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
|
||||
$description = t('External resources can be optimized automatically, which can reduce both the size and number of requests made to your website.', array(), $options);
|
||||
$variables['page_compression'] = array(
|
||||
'type' => 'enable',
|
||||
'title' => t('Compress cached pages.', array(), $options),
|
||||
'description' => $description,
|
||||
'default' => TRUE,
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
$variables['preprocess_css'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Aggregate and compress CSS files.'),
|
||||
'description' => $description,
|
||||
'default' => 0,
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
$variables['preprocess_js'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Aggregate JavaScript files.'),
|
||||
'description' => $description,
|
||||
'default' => 0,
|
||||
'group' => 'system_performance',
|
||||
);
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
function system_variable_group_info() {
|
||||
$groups['site_information'] = array(
|
||||
'title' => t('Site information'),
|
||||
'description' => t('Site information and maintenance mode'),
|
||||
'access' => 'administer site configuration',
|
||||
'path' => array('admin/config/system/site-information', 'admin/config/development/maintenance'),
|
||||
);
|
||||
$groups['feed_settings'] = array(
|
||||
'title' => t('Feed settings'),
|
||||
'description' => t('Feed settings'),
|
||||
'access' => 'administer site configuration',
|
||||
);
|
||||
$groups['regional_settings'] = array(
|
||||
'title' => t('Regional settings'),
|
||||
'description' => t('Regional settings'),
|
||||
'access' => 'administer site configuration',
|
||||
);
|
||||
$groups['theme_settings'] = array(
|
||||
'title' => t('Theme settings'),
|
||||
'description' => t('Theme settings'),
|
||||
'access' => 'administer site configuration',
|
||||
);
|
||||
$groups['system_performance'] = array(
|
||||
'title' => t('System performance'),
|
||||
'description' => t('Options related with cache, file compression and bandwidth optimization.'),
|
||||
'access' => 'administer site configuration',
|
||||
'path' => 'admin/config/development/performance',
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info().
|
||||
*/
|
||||
function system_variable_type_info() {
|
||||
// Internal Drupal path as used by menu items.
|
||||
$type['drupal_path'] = array(
|
||||
'title' => t('Drupal path'),
|
||||
'element callback' => 'system_variable_path_element',
|
||||
'localize' => TRUE,
|
||||
);
|
||||
// File system path, relative to Drupal installation.
|
||||
$type['file_path'] = array(
|
||||
'title' => t('File path'),
|
||||
'default' => conf_path() . '/files',
|
||||
'element' => array('#type' => 'textfield', '#maxlength' => 255, '#after_build' => array('system_check_directory')),
|
||||
);
|
||||
// These are just for option lists though they can be used as variable type to have a selectable value.
|
||||
$type['weekday'] = array(
|
||||
'title' => t('Day of week'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_weekday',
|
||||
);
|
||||
$type['theme'] = array(
|
||||
'title' => t('Theme'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_theme',
|
||||
'cache' => TRUE,
|
||||
);
|
||||
$type['country'] = array(
|
||||
'title' => t('Country'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_country',
|
||||
'cache' => TRUE,
|
||||
);
|
||||
$type['timezone'] = array(
|
||||
'title' => t('Time zone'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_time_zones',
|
||||
'cache' => TRUE,
|
||||
);
|
||||
$type['date_type'] = array(
|
||||
'title' => t('Date type'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_date_type',
|
||||
);
|
||||
$type['date_format'] = array(
|
||||
'title' => t('Date format'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_date_format',
|
||||
);
|
||||
$type['time_interval'] = array(
|
||||
'title' => t('Time interval'),
|
||||
'type' => 'select',
|
||||
'options callback' => 'system_variable_option_time_interval',
|
||||
);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for theme options
|
||||
*/
|
||||
function system_variable_option_theme($variable, $options) {
|
||||
$list = array();
|
||||
foreach (list_themes() as $theme) {
|
||||
$list[$theme->name] = $theme->info['name'];
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for weekday options
|
||||
*/
|
||||
function system_variable_option_weekday($variable, $options) {
|
||||
return array(
|
||||
0 => t('Sunday', array(), $options),
|
||||
1 => t('Monday', array(), $options),
|
||||
2 => t('Tuesday', array(), $options),
|
||||
3 => t('Wednesday', array(), $options),
|
||||
4 => t('Thursday', array(), $options),
|
||||
5 => t('Friday', array(), $options),
|
||||
6 => t('Saturday', array(), $options)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for date types
|
||||
*/
|
||||
function system_variable_option_date_type($variable, $options) {
|
||||
$list = array();
|
||||
foreach (system_get_date_types() as $type => $info) {
|
||||
$list[$type] = check_plain($info['title']);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for date types
|
||||
*
|
||||
* @todo These should be different for some variables
|
||||
*/
|
||||
function system_variable_option_date_format($variable, $options) {
|
||||
// Get list of all available date formats.
|
||||
$all_formats = array();
|
||||
foreach (system_get_date_formats() as $type => $format_info) {
|
||||
$all_formats = array_merge($all_formats, $format_info);
|
||||
}
|
||||
if ($custom_formats = system_get_date_formats('custom')) {
|
||||
$all_formats = array_merge($all_formats, $custom_formats);
|
||||
}
|
||||
foreach ($all_formats as $f => $format) {
|
||||
$list[$f] = format_date(REQUEST_TIME, 'custom', $f);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for country options
|
||||
*/
|
||||
function system_variable_option_country($variable, $options) {
|
||||
include_once DRUPAL_ROOT . '/includes/locale.inc';
|
||||
return country_get_list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for time interval options
|
||||
*/
|
||||
function system_variable_option_time_interval($variable, $options) {
|
||||
$period = drupal_map_assoc($variable['interval values'], 'format_interval');
|
||||
if (isset($period[0])) {
|
||||
$period[0] = '<' . t('none') . '>';
|
||||
}
|
||||
return $period;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for default theme settings
|
||||
*/
|
||||
function system_variable_theme_defaults($variable, $options) {
|
||||
return array(
|
||||
'default_logo' => 1,
|
||||
'logo_path' => '',
|
||||
'default_favicon' => 1,
|
||||
'favicon_path' => '',
|
||||
'favicon_mimetype' => 'image/vnd.microsoft.icon',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for path variable element
|
||||
*/
|
||||
function system_variable_path_element($variable, $options) {
|
||||
$element = variable_form_element_default($variable, $options) +array(
|
||||
'#type' => 'textfield',
|
||||
'#size' => 40,
|
||||
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
|
||||
);
|
||||
return $element;
|
||||
}
|
46
sites/all/modules/variable/includes/taxonomy.variable.inc
Normal file
46
sites/all/modules/variable/includes/taxonomy.variable.inc
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info()
|
||||
*/
|
||||
function taxonomy_variable_type_info() {
|
||||
$type['vocabulary_vid'] = array(
|
||||
'title' => t('Vocabulary'),
|
||||
'options callback' => 'taxonomy_variable_vocabulary_vid_list',
|
||||
);
|
||||
$type['vocabulary_name'] = array(
|
||||
'title' => t('Vocabulary'),
|
||||
'options callback' => 'taxonomy_variable_vocabulary_name_list',
|
||||
);
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options callback for vocabulary
|
||||
*/
|
||||
function taxonomy_variable_vocabulary_vid_list($variable, $options) {
|
||||
static $list;
|
||||
if (!isset($list)) {
|
||||
foreach (taxonomy_get_vocabularies() as $vocab) {
|
||||
$list[$vocab->vid] = $vocab->name;
|
||||
};
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options callback for vocabulary
|
||||
*/
|
||||
function taxonomy_variable_vocabulary_name_list($variable, $options) {
|
||||
static $list;
|
||||
if (!isset($list)) {
|
||||
foreach (taxonomy_get_vocabularies() as $vocab) {
|
||||
$list[$vocab->machine_name] = $vocab->name;
|
||||
};
|
||||
}
|
||||
return $list;
|
||||
}
|
13
sites/all/modules/variable/includes/translation.variable.inc
Normal file
13
sites/all/modules/variable/includes/translation.variable.inc
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info_alter().
|
||||
*/
|
||||
function translation_variable_info_alter(&$variables, $options) {
|
||||
$variables['language_content_type_[node_type]']['repeat']['options'][TRANSLATION_ENABLED] = t('Enabled, with translation', array(), $options);
|
||||
$variables['language_content_type_[node_type]']['description'] = t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have content translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language', $options)), $options);
|
||||
}
|
218
sites/all/modules/variable/includes/user.variable.inc
Normal file
218
sites/all/modules/variable/includes/user.variable.inc
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Variable API module. Definition for Drupal core variables
|
||||
*/
|
||||
|
||||
/**
|
||||
* User module variables
|
||||
*/
|
||||
function user_variable_info($options) {
|
||||
// $variables = array('#type' => 'fieldset', 'title' => t('User registration settings'));
|
||||
$variables['user_register'] = array(
|
||||
'type' => 'select',
|
||||
'title' => t('Public registrations'),
|
||||
'default' => 1,
|
||||
'options' => TRUE,
|
||||
'options callback' => 'user_variable_option_list',
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_email_verification'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Require e-mail verification when a visitor creates an account', array(), $options),
|
||||
'default' => TRUE,
|
||||
'description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.', array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_registration_help'] = array(
|
||||
'type' => 'text',
|
||||
'title' => t('User registration guidelines', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t('This text is displayed at the top of the user registration form and is useful for helping or instructing your users.', array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
|
||||
// User e-mail settings.
|
||||
|
||||
// These email tokens are shared for all settings, so just define
|
||||
// the list once to help ensure they stay in sync.
|
||||
$email_token_help = ' ' . t('Available variables are: [site:name], [site:url], [user:name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url].', array(), $options);
|
||||
|
||||
$variables['user_mail_register_admin_created_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Welcome, new user created by administrator', array(), $options),
|
||||
'description' => t('Customize welcome e-mail messages sent to new member accounts created by an administrator.', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_register_no_approval_required_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Welcome, no approval required', array(), $options),
|
||||
'description' => t('Customize welcome e-mail messages sent to new members upon registering, when no administrator approval is required.', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_register_pending_approval_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Welcome, awaiting administrator approval', array(), $options),
|
||||
'description' => t('Customize welcome e-mail messages sent to new members upon registering, when administrative approval is required.', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_password_reset_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Password recovery email'),
|
||||
'description' => t('Customize e-mail messages sent to users who request a new password.') . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_status_activated_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Account activation email', array(), $options),
|
||||
'description' => t('Enable and customize e-mail messages sent to users upon account activation (when an administrator activates an account of a user who has already registered, on a site where administrative approval is required).', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_status_activated_notify'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Notify user when account is activated.', array(), $options),
|
||||
'default' => TRUE,
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_mail_status_blocked_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Account blocked email', array(), $options),
|
||||
'description' => t('Enable and customize e-mail messages sent to users when their accounts are blocked.') . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_status_blocked_notify'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Notify user when account is blocked.', array(), $options),
|
||||
'default' => FALSE,
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_mail_cancel_confirm_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Account cancellation confirmation'),
|
||||
'description' => t('Edit the e-mail messages sent to users when they attempt to cancel their accounts.', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_status_canceled_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Account deleted email'),
|
||||
'description' => t('Enable and customize e-mail messages sent to users when their accounts are deleted.', array(), $options) . $email_token_help,
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
$variables['user_mail_status_deleted_notify'] = array(
|
||||
'type' => 'boolean',
|
||||
'title' => t('Notify user when account is deleted.', array(), $options),
|
||||
'default' => FALSE,
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
// User signatures.
|
||||
$variables['user_signatures'] = array(
|
||||
'type' => 'enable',
|
||||
'title' => t('Signature support'),
|
||||
'default' => 0,
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
|
||||
// Picture support
|
||||
$picture_support = variable_get('user_pictures', 0);
|
||||
$form['user_pictures'] = array(
|
||||
'type' => 'enable',
|
||||
'title' => t('Picture support', array(), $options),
|
||||
'default' => 0,
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_picture_path'] = array(
|
||||
'type' => 'file_path',
|
||||
'title' => t('Picture directory', array(), $options),
|
||||
'default' => 'pictures',
|
||||
'element' => array('#size' => 30, '#maxlength' => 255),
|
||||
'description' => t('Subdirectory in the file upload directory where pictures will be stored.', array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_picture_default'] = array(
|
||||
'type' => 'url',
|
||||
'title' => t('Default picture', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.', array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_picture_dimensions'] = array(
|
||||
'type' => 'string',
|
||||
'title' => t('Picture maximum dimensions', array(), $options),
|
||||
'default' => '85x85',
|
||||
'description' => t('Maximum dimensions for pictures, in pixels.', array(), $options),
|
||||
'element' => array('#size' => 15, '#maxlength' => 10),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_picture_file_size'] = array(
|
||||
'type' => 'number',
|
||||
'title' => t('Picture maximum file size', array(), $options),
|
||||
'default' => 30,
|
||||
'description' => t('Maximum file size for pictures, in kB.', array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
$variables['user_picture_guidelines'] = array(
|
||||
'type' => 'text',
|
||||
'title' => t('Picture guidelines', array(), $options),
|
||||
'default' => '',
|
||||
'description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users.", array(), $options),
|
||||
'group' => 'user_settings',
|
||||
);
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Node module variable groups
|
||||
*/
|
||||
function user_variable_group_info() {
|
||||
$groups['user_settings'] = array(
|
||||
'title' => t('User settings'),
|
||||
'description' => t('User settings'),
|
||||
'access' => 'administer users',
|
||||
'path' => 'admin/user/settings',
|
||||
);
|
||||
$groups['user_mails'] = array(
|
||||
'title' => t('User emails'),
|
||||
'description' => t('User emails'),
|
||||
'access' => 'administer users',
|
||||
'path' => 'admin/user/settings',
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_type_info().
|
||||
*/
|
||||
function user_variable_type_info() {
|
||||
$types['user_mail'] = array(
|
||||
'title' => t('User mail text'),
|
||||
'type' => 'mail_text',
|
||||
'repeat' => array(
|
||||
'default callback' => 'user_variable_mail_default',
|
||||
),
|
||||
);
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default callback for user mail variables
|
||||
*/
|
||||
function user_variable_mail_default($variable, $options) {
|
||||
// Remove 'user_mail_' prefix
|
||||
$name = substr($variable['name'], 10);
|
||||
return _user_mail_text($name, $options['language']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_option_list().
|
||||
*/
|
||||
function user_variable_option_list($variable, $options = array()) {
|
||||
switch ($variable['name']) {
|
||||
case 'user_register':
|
||||
return array(
|
||||
t('Only site administrators can create new user accounts.', array(), $options),
|
||||
t('Visitors can create accounts and no administrator approval is required.', array(), $options),
|
||||
t('Visitors can create accounts but administrator approval is required.', array(), $options)
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user