- <?php
- * @file
- * Configuration system that lets administrators modify the workings of the site.
- */
-
- * Maximum age of temporary files in seconds.
- */
- define('BACKDROP_MAXIMUM_TEMP_FILE_AGE', 21600);
-
- * New users will be set to the default time zone at registration.
- */
- define('BACKDROP_USER_TIMEZONE_DEFAULT', 0);
-
- * New users will get an empty time zone at registration.
- */
- define('BACKDROP_USER_TIMEZONE_EMPTY', 1);
-
- * New users will select their own timezone at registration.
- */
- define('BACKDROP_USER_TIMEZONE_SELECT', 2);
-
-
- * Disabled option on forms and settings
- */
- define('BACKDROP_DISABLED', 0);
-
- * Optional option on forms and settings
- */
- define('BACKDROP_OPTIONAL', 1);
-
- * Required option on forms and settings
- */
- define('BACKDROP_REQUIRED', 2);
-
- * Maximum number of values in a weight select element.
- *
- * If the number of values is over the maximum, a text field is used instead.
- */
- define('BACKDROP_WEIGHT_SELECT_MAX', 100);
-
- * Maximum length of e-mail fields.
- */
- define('EMAIL_MAX_LENGTH', 254);
-
- * The maximum depth for token tree recursion.
- */
- define('TOKEN_MAX_DEPTH', 9);
-
- * Implements hook_theme().
- */
- function system_theme() {
- $base = array(
- 'file' => 'system.theme.inc',
- );
-
- return array_merge(backdrop_common_theme(), array(
- 'system_themes_page' => array(
- 'variables' => array('theme_groups' => NULL),
- ) + $base,
- 'system_settings_form' => array(
- 'render element' => 'form',
- ) + $base,
- 'confirm_form' => array(
- 'render element' => 'form',
- ) + $base,
- 'system_modules_fieldset' => array(
- 'render element' => 'form',
- ) + $base,
- 'system_modules_incompatible' => array(
- 'variables' => array('message' => NULL),
- ) + $base,
- 'system_modules_uninstall' => array(
- 'render element' => 'form',
- ) + $base,
- 'status_report' => array(
- 'render element' => 'requirements',
- ) + $base,
- 'admin_page' => array(
- 'variables' => array('blocks' => NULL),
- ) + $base,
- 'admin_block' => array(
- 'variables' => array('block' => NULL),
- ) + $base,
- 'admin_block_content' => array(
- 'variables' => array('content' => NULL),
- ) + $base,
- 'page_components' => array(
- 'variables' => array('settings' => NULL, 'child_delta' => NULL),
- 'template' => 'templates/page-components',
- ) + $base,
- 'system_admin_index' => array(
- 'variables' => array('menu_items' => NULL),
- ) + $base,
- 'system_powered_by' => array(
- 'variables' => array(),
- ) + $base,
- 'block__system__main' => array(
- 'template' => 'templates/block--system--main',
-
- 'base hook' => 'block',
- ) + $base,
- 'tree_table' => array(
- 'variables' => array(
- 'header' => array(),
- 'rows' => array(),
- 'attributes' => array(),
- 'empty' => '',
- 'caption' => '',
- ),
- ) + $base,
- 'token_tree' => array(
- 'variables' => array(
- 'token_types' => array(),
- 'global_types' => TRUE,
- 'click_insert' => TRUE,
- 'show_restricted' => FALSE,
- 'recursion_limit' => 3,
- 'dialog' => FALSE,
- ),
- ) + $base,
- 'token_tree_link' => array(
- 'variables' => array(
- 'text' => NULL,
- 'options' => array(),
- 'token_types' => array(),
- 'global_types' => TRUE,
- 'click_insert' => TRUE,
- 'show_restricted' => FALSE,
- 'recursion_limit' => 3,
- 'dialog' => TRUE,
- ),
- ) + $base,
- 'label_machine_name' => array(
- 'variables' => array(
- 'label' => NULL,
- 'machine_name' => NULL,
- ),
- ) + $base,
- ));
- }
-
- * Implements hook_permission().
- */
- function system_permission() {
- return array(
- 'administer modules' => array(
- 'title' => t('Administer modules'),
- ),
- 'administer site configuration' => array(
- 'title' => t('Administer site configuration'),
- 'restrict access' => TRUE,
- ),
- 'administer themes' => array(
- 'title' => t('Administer themes'),
- ),
- 'administer software updates' => array(
- 'title' => t('Administer software updates'),
- 'restrict access' => TRUE,
- ),
- 'access administration pages' => array(
- 'title' => t('Use the administration pages'),
- ),
- 'access site in maintenance mode' => array(
- 'title' => t('Use the site in maintenance mode'),
- ),
- 'view the administration theme' => array(
- 'title' => t('View the administration theme'),
- 'description' => config_get('system.core', 'admin_theme') ? '' : t('This is only used when the site is configured to use a separate administration theme on the <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))),
- ),
- 'access site reports' => array(
- 'title' => t('View site reports'),
- ),
- 'flush caches' => array(
- 'title' => t('Flush caches'),
- 'description' => t('Provides access to manually flush caches.'),
- ),
- );
- }
-
- * Implements hook_views_api().
- */
- function system_views_api() {
- return array(
- 'api' => '3.0',
- 'path' => backdrop_get_path('module', 'system') . '/views',
- );
- }
-
- * Implements hook_hook_info().
- */
- function system_hook_info() {
- $hooks['token_info'] = array(
- 'group' => 'tokens',
- );
- $hooks['token_info_alter'] = array(
- 'group' => 'tokens',
- );
- $hooks['tokens'] = array(
- 'group' => 'tokens',
- );
- $hooks['tokens_alter'] = array(
- 'group' => 'tokens',
- );
-
- return $hooks;
- }
-
- * Implements hook_element_info().
- */
- function system_element_info() {
-
- $types['form'] = array(
- '#method' => 'post',
- '#action' => request_uri(),
- '#theme_wrappers' => array('form'),
- );
-
-
-
-
- $types['ajax'] = array(
- '#header' => TRUE,
- '#commands' => array(),
- '#error' => NULL,
- );
- $types['head_tag'] = array(
- '#theme' => 'head_tag',
- '#pre_render' => array('backdrop_pre_render_conditional_comments'),
- '#attributes' => array(),
- '#value' => NULL,
- );
- $types['styles'] = array(
- '#items' => array(),
- '#pre_render' => array('backdrop_pre_render_styles'),
- '#group_callback' => 'backdrop_group_css',
- '#aggregate_callback' => 'backdrop_aggregate_css',
- );
- $types['scripts'] = array(
- '#items' => array(),
- '#pre_render' => array('backdrop_pre_render_scripts'),
- '#group_callback' => 'backdrop_group_js',
- '#aggregate_callback' => 'backdrop_aggregate_js',
- );
-
-
- $types['submit'] = array(
- '#input' => TRUE,
- '#name' => 'op',
- '#button_type' => 'submit',
- '#executes_submit_callback' => TRUE,
- '#limit_validation_errors' => FALSE,
- '#process' => array('ajax_process_form', 'form_process_button'),
- '#theme_wrappers' => array('button'),
- );
- $types['button'] = array(
- '#input' => TRUE,
- '#name' => 'op',
- '#button_type' => 'submit',
- '#executes_submit_callback' => FALSE,
- '#limit_validation_errors' => FALSE,
- '#process' => array('ajax_process_form', 'form_process_button'),
- '#theme_wrappers' => array('button'),
- );
- $types['image_button'] = array(
- '#input' => TRUE,
- '#button_type' => 'submit',
- '#executes_submit_callback' => TRUE,
- '#limit_validation_errors' => FALSE,
- '#process' => array('ajax_process_form', 'form_process_button'),
- '#return_value' => TRUE,
- '#has_garbage_value' => TRUE,
- '#src' => NULL,
- '#theme_wrappers' => array('image_button'),
- );
- $types['textfield'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#maxlength' => 128,
- '#autocomplete_path' => FALSE,
- '#process' => array('form_process_autocomplete', 'ajax_process_form'),
- '#theme' => 'textfield',
- '#theme_wrappers' => array('form_element'),
- );
- $types['tel'] = array(
- '#input' => TRUE,
- '#size' => 30,
- '#maxlength' => 128,
- '#autocomplete_path' => FALSE,
- '#process' => array('ajax_process_form'),
- '#theme' => 'tel',
- '#theme_wrappers' => array('form_element'),
- );
- $types['email'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#maxlength' => EMAIL_MAX_LENGTH,
- '#autocomplete_path' => FALSE,
- '#process' => array('ajax_process_form'),
- '#element_validate' => array('form_validate_email'),
- '#theme' => 'email',
- '#theme_wrappers' => array('form_element'),
- );
- $types['url'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#maxlength' => 255,
- '#autocomplete_path' => FALSE,
- '#process' => array('ajax_process_form'),
- '#element_validate' => array('form_validate_url'),
- '#theme' => 'url',
- '#theme_wrappers' => array('form_element'),
- );
- $types['color'] = array(
- '#input' => TRUE,
- '#process' => array('ajax_process_form'),
- '#element_validate' => array('form_validate_color'),
- '#theme' => 'color',
- '#theme_wrappers' => array('form_element'),
- );
- $types['number'] = array(
- '#input' => TRUE,
- '#step' => 1,
- '#process' => array('ajax_process_form'),
- '#element_validate' => array('form_validate_number'),
- '#theme' => 'number',
- '#theme_wrappers' => array('form_element'),
- );
- $types['range'] = array(
- '#input' => TRUE,
- '#size' => 30,
- '#step' => 1,
- '#min' => 0,
- '#max' => 100,
- '#maxlength' => 128,
- '#process' => array('ajax_process_form'),
- '#element_validate' => array('form_validate_number'),
- '#theme' => 'range',
- '#theme_wrappers' => array('form_element'),
- );
- $types['search'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#maxlength' => 128,
- '#autocomplete_path' => FALSE,
- '#process' => array('ajax_process_form'),
- '#theme' => 'search',
- '#theme_wrappers' => array('form_element'),
- );
- $types['machine_name'] = array(
- '#input' => TRUE,
- '#default_value' => NULL,
- '#required' => TRUE,
- '#maxlength' => 64,
- '#size' => 60,
- '#autocomplete_path' => FALSE,
- '#process' => array('form_process_machine_name', 'ajax_process_form'),
- '#element_validate' => array('form_validate_machine_name'),
- '#theme' => 'textfield',
- '#theme_wrappers' => array('form_element'),
- );
- $types['password'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#maxlength' => 128,
- '#process' => array('ajax_process_form'),
- '#theme' => 'password',
- '#theme_wrappers' => array('form_element'),
- '#password_strength' => FALSE,
- '#password_toggle' => FALSE,
- '#password_shown' => FALSE,
- '#process' => array('user_form_process_password'),
- );
- $types['password_confirm'] = array(
- '#input' => TRUE,
- '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
- '#theme_wrappers' => array('form_element'),
- );
- $types['textarea'] = array(
- '#input' => TRUE,
- '#cols' => 60,
- '#rows' => 5,
- '#resizable' => TRUE,
- '#process' => array('ajax_process_form'),
- '#theme' => 'textarea',
- '#theme_wrappers' => array('form_element'),
- );
- $types['radios'] = array(
- '#input' => TRUE,
- '#process' => array('form_process_radios'),
- '#theme_wrappers' => array('container__radios'),
- '#pre_render' => array('form_pre_render_conditional_form_element'),
- );
- $types['radio'] = array(
- '#input' => TRUE,
- '#default_value' => NULL,
- '#process' => array('ajax_process_form'),
- '#theme' => 'radio',
- '#theme_wrappers' => array('form_element'),
- '#title_display' => 'after',
- );
- $types['checkboxes'] = array(
- '#input' => TRUE,
- '#process' => array('form_process_checkboxes'),
- '#theme_wrappers' => array('container__checkboxes'),
- '#pre_render' => array('form_pre_render_conditional_form_element'),
- );
- $types['checkbox'] = array(
- '#input' => TRUE,
- '#return_value' => 1,
- '#theme' => 'checkbox',
- '#process' => array('form_process_checkbox', 'ajax_process_form'),
- '#theme_wrappers' => array('form_element'),
- '#title_display' => 'after',
- );
- $types['select'] = array(
- '#input' => TRUE,
- '#multiple' => FALSE,
- '#process' => array('form_process_select', 'ajax_process_form'),
- '#theme' => 'select',
- '#theme_wrappers' => array('form_element'),
- );
- $types['weight'] = array(
- '#input' => TRUE,
- '#delta' => 10,
- '#default_value' => 0,
- '#process' => array('form_process_weight', 'ajax_process_form'),
- );
- $types['date'] = array(
- '#input' => TRUE,
- '#element_validate' => array('date_validate'),
- '#process' => array('form_process_date'),
- '#theme' => 'date',
- '#theme_wrappers' => array('form_element'),
- );
- $types['html_date'] = array(
- '#input' => TRUE,
- '#element_validate' => array('html_date_validate'),
- '#theme' => 'html_date',
- '#theme_wrappers' => array('form_element'),
- );
- $types['html_time'] = array(
- '#input' => TRUE,
- '#element_validate' => array('html_time_validate'),
- '#theme' => 'html_time',
- '#theme_wrappers' => array('form_element'),
- );
- $types['html_datetime'] = array(
- '#input' => TRUE,
- '#element_validate' => array('html_datetime_validate'),
- '#process' => array('form_process_html_datetime'),
- '#theme' => 'html_datetime',
- '#theme_wrappers' => array('form_element'),
- );
- $types['file'] = array(
- '#input' => TRUE,
- '#size' => 60,
- '#theme' => 'file',
- '#theme_wrappers' => array('form_element'),
- );
- $types['tableselect'] = array(
- '#input' => TRUE,
- '#js_select' => TRUE,
- '#multiple' => TRUE,
- '#process' => array('form_process_tableselect'),
- '#options' => array(),
- '#empty' => '',
- '#theme' => 'tableselect',
- );
-
-
- $types['item'] = array(
- '#markup' => '',
- '#pre_render' => array('backdrop_pre_render_markup'),
- '#theme_wrappers' => array('form_element'),
- );
- $types['hidden'] = array(
- '#input' => TRUE,
- '#process' => array('ajax_process_form'),
- '#theme' => 'hidden',
- );
- $types['value'] = array(
- '#input' => TRUE,
- );
- $types['markup'] = array(
- '#markup' => '',
- '#pre_render' => array('backdrop_pre_render_markup'),
- );
- $types['help'] = array(
- '#markup' => '',
- '#pre_render' => array('backdrop_pre_render_markup'),
- '#theme' => 'help',
- );
- $types['link'] = array(
- '#pre_render' => array('backdrop_pre_render_link', 'backdrop_pre_render_markup'),
- );
- $types['fieldset'] = array(
- '#collapsible' => FALSE,
- '#collapsed' => FALSE,
- '#value' => NULL,
- '#process' => array('form_process_fieldset', 'ajax_process_form'),
- '#pre_render' => array('form_pre_render_fieldset'),
- '#theme_wrappers' => array('fieldset'),
- );
- $types['vertical_tabs'] = array(
- '#theme_wrappers' => array('vertical_tabs'),
- '#default_tab' => '',
- '#process' => array('form_process_vertical_tabs'),
- );
- $types['dropbutton'] = array(
- '#pre_render' => array('backdrop_pre_render_dropbutton'),
- '#theme' => 'links__dropbutton',
- );
- $types['operations'] = array(
- '#pre_render' => array('backdrop_pre_render_dropbutton'),
- '#theme' => 'links__dropbutton__operations',
- );
- $types['details'] = array(
- '#summary' => NULL,
- '#details' => NULL,
- '#open' => FALSE,
- '#theme_wrappers' => array('details'),
- );
- $types['container'] = array(
- '#theme_wrappers' => array('container'),
- '#process' => array('form_process_container'),
- );
- $types['actions'] = array(
- '#theme_wrappers' => array('container'),
- '#process' => array('form_process_actions', 'form_process_container'),
- '#weight' => 100,
- );
-
- $types['token'] = array(
- '#input' => TRUE,
- '#theme' => 'hidden',
- );
-
- return $types;
- }
-
- * Implements hook_menu().
- */
- function system_menu() {
- $items['system/files'] = array(
- 'title' => 'File download',
- 'page callback' => 'file_download',
- 'page arguments' => array('private'),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- $items['system/temporary'] = array(
- 'title' => 'Temporary files',
- 'page callback' => 'file_download',
- 'page arguments' => array('temporary'),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- $items['system/ajax'] = array(
- 'title' => 'AJAX callback',
- 'page callback' => 'ajax_form_callback',
- 'delivery callback' => 'ajax_deliver',
- 'access callback' => TRUE,
- 'theme callback' => 'ajax_base_page_theme',
- 'type' => MENU_CALLBACK,
- 'file path' => 'core/includes',
- 'file' => 'form.inc',
- );
- $items['system/timezone'] = array(
- 'title' => 'Time zone',
- 'page callback' => 'system_timezone',
- 'delivery callback' => 'backdrop_json_deliver',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
- $items['system/404'] = array(
- 'title' => 'Page not found',
- 'page callback' => 'system_404',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- $items['system/403'] = array(
- 'title' => 'Access denied',
- 'page callback' => 'system_403',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- $items['path-autocomplete'] = array(
- 'title' => 'Path autocomplete',
- 'page callback' => 'path_autocomplete',
- 'access callback' => 'user_access',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin'] = array(
- 'title' => 'Administration',
- 'access arguments' => array('access administration pages'),
- 'page callback' => 'system_admin_menu_block_page',
- 'weight' => 9,
- 'menu_name' => 'management',
- 'file' => 'system.admin.inc',
- );
- $items['admin/tasks'] = array(
- 'title' => 'Tasks',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -20,
- );
- $items['admin/index'] = array(
- 'title' => 'Index',
- 'page callback' => 'system_admin_index',
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => -18,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/structure'] = array(
- 'title' => 'Structure',
- 'description' => 'Administer blocks, content types, menus, etc.',
- 'position' => 'right',
- 'weight' => -2,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
-
- $items['admin/appearance'] = array(
- 'title' => 'Appearance',
- 'description' => 'Select and configure themes.',
- 'page callback' => 'system_themes_page',
- 'access arguments' => array('administer themes'),
- 'position' => 'left',
- 'weight' => -4,
- 'file' => 'system.admin.inc',
- );
- $items['admin/appearance/list'] = array(
- 'title' => 'List themes',
- 'description' => 'Select and configure themes.',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -1,
- 'file' => 'system.admin.inc',
- );
- $items['admin/appearance/enable'] = array(
- 'title' => 'Enable theme',
- 'page callback' => 'system_theme_enable',
- 'access arguments' => array('administer themes'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
- $items['admin/appearance/disable'] = array(
- 'title' => 'Disable theme',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_theme_disable_confirm'),
- 'access arguments' => array('administer themes'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
- $items['admin/appearance/default'] = array(
- 'title' => 'Set default theme',
- 'page callback' => 'system_theme_default',
- 'access arguments' => array('administer themes'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
- foreach (list_themes() as $key => $theme) {
-
- if (theme_has_settings($key)) {
- $items['admin/appearance/settings/' . $theme->name] = array(
- 'title' => $theme->info['name'] . ' settings',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_theme_settings', $theme->name),
- 'access callback' => '_system_themes_access',
- 'access arguments' => array($key),
- 'file' => 'system.admin.inc',
- 'weight' => 20,
- );
- }
- }
-
-
- $items['admin/modules'] = array(
- 'title' => 'Functionality',
- 'description' => 'Install or uninstall modules.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_modules'),
- 'access arguments' => array('administer modules'),
- 'file' => 'system.admin.inc',
- 'weight' => -3,
- );
- $items['admin/modules/list'] = array(
- 'title' => 'List modules',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- );
- $items['admin/modules/list/confirm'] = array(
- 'title' => 'List modules',
- 'access arguments' => array('administer modules'),
- 'type' => MENU_VISIBLE_IN_BREADCRUMB,
- );
- $items['admin/modules/uninstall'] = array(
- 'title' => 'Uninstall modules',
- 'page arguments' => array('system_modules_uninstall'),
- 'access arguments' => array('administer modules'),
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'system.admin.inc',
- 'weight' => 20,
- );
- $items['admin/modules/uninstall/confirm'] = array(
- 'title' => 'Uninstall modules',
- 'access arguments' => array('administer modules'),
- 'type' => MENU_VISIBLE_IN_BREADCRUMB,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config'] = array(
- 'title' => 'Configuration',
- 'description' => 'Administer settings.',
- 'page callback' => 'system_admin_config_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/administration'] = array(
- 'title' => 'Administration',
- 'description' => 'Administration tools.',
- 'position' => 'left',
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
-
- $items['admin/config/media'] = array(
- 'title' => 'Media',
- 'description' => 'Media tools.',
- 'position' => 'left',
- 'weight' => -10,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/media/file-system'] = array(
- 'title' => 'File system',
- 'description' => 'Tell Backdrop where to store uploaded files and how they are accessed.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_file_system_settings'),
- 'access arguments' => array('administer site configuration'),
- 'weight' => -10,
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/media/file-system/transliteration'] = array(
- 'title' => 'Transliteration',
- 'description' => 'Convert existing file names to US-ASCII.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_transliteration_retroactive'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'type' => MENU_VISIBLE_IN_BREADCRUMB,
- );
- $items['admin/config/media/image-toolkit'] = array(
- 'title' => 'Image toolkit',
- 'description' => 'Choose which image toolkit to use if you have installed optional toolkits.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_image_toolkit_settings'),
- 'access arguments' => array('administer site configuration'),
- 'weight' => 20,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config/services'] = array(
- 'title' => 'Web services',
- 'description' => 'Tools related to web services.',
- 'position' => 'right',
- 'weight' => 0,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/services/rss-publishing'] = array(
- 'title' => 'RSS publishing',
- 'description' => 'Configure the site description, the number of items per feed and whether feeds should be titles/teasers/full-text.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_rss_feeds_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config/development'] = array(
- 'title' => 'Development',
- 'description' => 'Development tools.',
- 'position' => 'right',
- 'weight' => -10,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/development/maintenance'] = array(
- 'title' => 'Maintenance mode',
- 'description' => 'Take the site offline for maintenance or bring it back online.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_site_maintenance_mode'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'weight' => -10,
- );
- $items['admin/config/development/performance'] = array(
- 'title' => 'Performance',
- 'description' => 'Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_performance_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'weight' => -20,
- );
- $items['admin/config/development/logging'] = array(
- 'title' => 'Logging and errors',
- 'description' => "Settings for logging and alerts modules. Various modules can route Backdrop's system events to different destinations, such as syslog, database, email, etc.",
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_logging_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'weight' => -15,
- );
- $items['admin/config/development/utf8mb4-upgrade'] = array(
- 'title' => 'Database 4 byte UTF-8 upgrade',
- 'description' => 'Upgrades the database to support 4 byte UTF-8 characters such as emoji and mathmatical symbols.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_utf8mb4_convert_form'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'type' => MENU_VISIBLE_IN_BREADCRUMB,
- );
-
- $items['admin/config/drivers'] = array(
- 'title' => 'Drivers',
- 'description' => 'Manage drivers',
- 'page callback' => 'system_admin_drivers_page',
- 'page arguments' => array(),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.drivers.inc',
- 'type' => MENU_NORMAL_ITEM,
- );
- $items['admin/config/drivers/settings'] = array(
- 'title' => 'Overview',
- 'description' => 'Driver settings',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- );
-
-
- $items['admin/config/regional'] = array(
- 'title' => 'Regional and language',
- 'description' => 'Regional settings, localization and translation.',
- 'position' => 'left',
- 'weight' => -5,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/settings'] = array(
- 'title' => 'Regional settings',
- 'description' => "Settings for the site's default time zone and country.",
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_regional_settings'),
- 'access arguments' => array('administer site configuration'),
- 'weight' => -20,
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/date-time'] = array(
- 'title' => 'Date and time formats',
- 'description' => 'Configure the display of date and time strings.',
- 'page callback' => 'system_date_time_formats',
- 'access arguments' => array('administer site configuration'),
- 'weight' => -9,
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/date-time/formats/add'] = array(
- 'title' => 'Add date format',
- 'description' => 'Allow users to add additional date formats.',
- 'type' => MENU_LOCAL_ACTION,
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_configure_date_formats_form'),
- 'access arguments' => array('administer site configuration'),
- 'weight' => -10,
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/date-time/formats/%system_date_format'] = array(
- 'title' => 'Edit date format',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_configure_date_formats_form', 5),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/date-time/formats/%system_date_format/edit'] = array(
- 'title' => 'Edit',
- 'description' => 'Allow users to edit a configured date format.',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -10,
- );
- $items['admin/config/regional/date-time/formats/%system_date_format/delete'] = array(
- 'title' => 'Delete date format',
- 'description' => 'Allow users to delete a configured date format.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_date_delete_format_form', 5),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/regional/date-time/formats/lookup'] = array(
- 'title' => 'Date and time lookup',
- 'page callback' => 'system_date_time_lookup',
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config/search'] = array(
- 'title' => 'Search',
- 'description' => 'Local site search settings.',
- 'position' => 'left',
- 'weight' => -10,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config/system'] = array(
- 'title' => 'System',
- 'description' => 'General system related configuration.',
- 'position' => 'right',
- 'weight' => -20,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/system/site-information'] = array(
- 'title' => 'Site information',
- 'description' => 'Change site name, logo, favicon, slogan, e-mail address, default home page, and number of posts per page, error pages.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_site_information_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'weight' => -20,
- );
- $items['admin/config/system/cron'] = array(
- 'title' => 'Cron',
- 'description' => 'Manage automatic site maintenance tasks.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_cron_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- 'weight' => 20,
- );
-
-
- $items['admin/config/urls'] = array(
- 'title' => 'URL handling',
- 'description' => 'Settings related to URLs including path aliases and URL recirects.',
- 'position' => 'right',
- 'weight' => -20,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/urls/settings'] = array(
- 'title' => 'URL settings',
- 'description' => 'General URL-related configuration for your site.',
- 'page callback' => 'backdrop_get_form',
- 'page arguments' => array('system_urls_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/urls/settings/check'] = array(
- 'title' => 'Clean URL check',
- 'page callback' => 'backdrop_json_output',
- 'page arguments' => array(array('status' => TRUE)),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/config/search/urls'] = array(
- 'page callback' => 'system_redirect_deprecated_page',
- 'page arguments' => array('admin/config/urls/settings'),
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/config/search/clean-urls'] = array(
- 'page callback' => 'system_redirect_deprecated_page',
- 'page arguments' => array('admin/config/urls/settings'),
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_CALLBACK,
- );
-
- $items['admin/config/search/urls/check'] = array(
- 'page callback' => 'system_redirect_deprecated_page',
- 'page arguments' => array('admin/config/urls/settings/check'),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
-
-
- $items['admin/config/content'] = array(
- 'title' => 'Content authoring',
- 'description' => 'Settings related to formatting and authoring content.',
- 'position' => 'left',
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/metadata'] = array(
- 'title' => 'Metadata',
- 'description' => 'Settings related to meta tags, and other data commonly used by search engines.',
- 'position' => 'left',
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/user-interface'] = array(
- 'title' => 'User interface',
- 'description' => 'Tools that enhance the user interface.',
- 'position' => 'right',
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/config/workflow'] = array(
- 'title' => 'Workflow',
- 'description' => 'Settings related to editorial workflow.',
- 'position' => 'right',
- 'weight' => 5,
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access administration pages'),
- 'file' => 'system.admin.inc',
- );
-
-
- $items['admin/reports'] = array(
- 'title' => 'Reports',
- 'description' => 'View reports, updates, and errors.',
- 'page callback' => 'system_admin_menu_block_page',
- 'access arguments' => array('access site reports'),
- 'weight' => 5,
- 'position' => 'left',
- 'file' => 'system.admin.inc',
- );
- $items['admin/reports/status'] = array(
- 'title' => 'Status report',
- 'description' => "Get a status report about your site's operation and any detected problems.",
- 'page callback' => 'system_status',
- 'weight' => -60,
- 'access arguments' => array('access site reports'),
- 'file' => 'system.admin.inc',
- );
- $items['admin/reports/status/run-cron'] = array(
- 'title' => 'Run cron',
- 'page callback' => 'system_run_cron',
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
- $items['admin/reports/status/php'] = array(
- 'title' => 'PHP',
- 'page callback' => 'system_php',
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['batch'] = array(
- 'page callback' => 'system_batch_page',
- 'access callback' => TRUE,
- 'theme callback' => '_system_batch_theme',
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
-
- $items['token/tree'] = array(
- 'page callback' => 'system_token_output',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'system.pages.inc',
- 'theme callback' => 'ajax_base_page_theme',
- );
-
-
- $items['system/transliterate/%'] = array(
- 'page callback' => 'system_transliterate_ajax',
- 'page arguments' => array(2),
- 'access callback' => 'system_transliterate_ajax_access',
- 'type' => MENU_CALLBACK,
- 'file' => 'system.admin.inc',
- );
-
- return $items;
- }
-
- * Theme callback for the default batch page.
- */
- function _system_batch_theme() {
-
- $batch = &batch_get();
- if (!$batch && isset($_REQUEST['id'])) {
- require_once BACKDROP_ROOT . '/core/includes/batch.inc';
- $batch = batch_load($_REQUEST['id']);
- }
-
- if (!empty($batch['theme'])) {
- return $batch['theme'];
- }
- }
-
- * Implements hook_page_delivery_callback_alter().
- *
- * Enables the ability to display arbitrary pages as dialogs based on the
- * HTTP request header.
- */
- function system_page_delivery_callback_alter(&$delivery_callback, $page_output) {
-
- if (backdrop_is_ajax()) {
- $delivery_callback = 'ajax_deliver';
- }
-
- elseif (backdrop_is_dialog()) {
- $delivery_callback = 'ajax_deliver_dialog';
- }
-
- elseif (isset($page_output['#type']) && $page_output['#type'] === 'ajax') {
- $delivery_callback = 'ajax_deliver';
- }
- }
-
- * Implements hook_library_info().
- */
- function system_library_info() {
- $system_module_path = backdrop_get_path('module', 'system');
-
-
- $libraries['backdrop.ajax'] = array(
- 'title' => 'Backdrop AJAX',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/ajax.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'backdrop.progress'),
- ),
- );
-
-
- $libraries['backdrop.batch'] = array(
- 'title' => 'Backdrop batch API',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/batch.js' => array('group' => JS_DEFAULT, 'cache' => FALSE),
- ),
- 'dependencies' => array(
- array('system', 'backdrop.progress'),
- ),
- );
-
-
- $libraries['backdrop.progress'] = array(
- 'title' => 'Backdrop progress indicator',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/progress.js' => array('group' => JS_DEFAULT),
- ),
- );
-
-
- $libraries['backdrop.form'] = array(
- 'title' => 'Backdrop form library',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/form.js' => array('group' => JS_LIBRARY, 'weight' => 1),
- ),
- );
-
-
- $libraries['backdrop.dialog'] = array(
- 'title' => 'Backdrop dialog',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/dialog.js' => array('group' => JS_LIBRARY),
- ),
- 'css' => array(
- 'core/misc/dialog.theme.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'jquery'),
- array('system', 'ui.dialog'),
- ),
- );
-
-
- $libraries['backdrop.dialog.ajax'] = array(
- 'title' => 'Backdrop dialog AJAX integration',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/dialog.ajax.js' => array('group' => JS_LIBRARY, 'weight' => 3),
- ),
- 'dependencies' => array(
- array('system', 'jquery'),
- array('system', 'backdrop.ajax'),
- array('system', 'backdrop.dialog'),
- ),
- );
-
-
- $libraries['backdrop.states'] = array(
- 'title' => 'Backdrop states',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/states.js' => array('group' => JS_LIBRARY, 'weight' => 1),
- ),
- );
-
-
- $libraries['backdrop.tableresponsive'] = array(
- 'title' => 'Backdrop responsive table API',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/tableresponsive.js' => array('group' => JS_LIBRARY),
- ),
- 'dependencies' => array(
- array('system', 'jquery.once'),
- ),
- );
-
-
- $libraries['backdrop.collapse'] = array(
- 'title' => 'Backdrop collapsible fieldset',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/collapse.js' => array('group' => JS_DEFAULT),
- ),
- 'dependencies' => array(
-
- array('system', 'backdrop.form'),
- ),
- );
-
-
- $libraries['backdrop.textarea'] = array(
- 'title' => 'Backdrop resizable textarea',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/textarea.js' => array('group' => JS_LIBRARY),
- ),
- );
-
-
- $libraries['backdrop.autocomplete'] = array(
- 'title' => 'Backdrop autocomplete',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/autocomplete.js' => array('group' => JS_DEFAULT),
- ),
- );
-
-
- $libraries['backdrop.autosubmit'] = array(
- 'title' => 'Backdrop autosubmit',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/autosubmit.js' => array('group' => JS_DEFAULT),
- ),
- );
-
- $libraries['backdrop.modules'] = array(
- 'title' => 'Modules Filter',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- $system_module_path . '/js/modules.js' => array('group' => JS_DEFAULT),
- ),
- );
-
- $libraries['backdrop.menus'] = array(
- 'title' => 'Backdrop menu styles',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- $system_module_path . '/js/menus.js' => array('group' => JS_DEFAULT),
- ),
-
- );
-
-
- $libraries['backdrop.announce'] = array(
- 'title' => 'Announce',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/announce.js' => array('group' => JS_DEFAULT),
- ),
- );
-
- $libraries['backdrop.menu-toggle'] = array(
- 'title' => 'Backdrop menu toggle',
- 'version' => BACKDROP_VERSION,
-
- );
-
-
- $menu_config = config('menu.settings');
- if ($menu_config->get('menu_breakpoint') == 'custom') {
- $libraries['backdrop.menus']['css'] = array(
- $system_module_path . '/css/menu-dropdown.theme.breakpoint.css' => array('group' => CSS_DEFAULT),
- $system_module_path . '/css/menu-dropdown.theme.breakpoint-queries.css' => array(
- 'group' => CSS_DEFAULT,
- 'media' => 'all and (min-width: ' . $menu_config->get('menu_breakpoint_custom') . ')',
- ),
- );
- $libraries['backdrop.menu-toggle']['css'] = array(
- $system_module_path . '/css/menu-toggle.theme.breakpoint.css' => array('group' => CSS_DEFAULT),
- $system_module_path . '/css/menu-toggle.theme.breakpoint-queries.css' => array(
- 'group' => CSS_DEFAULT,
- 'media' => 'all and (min-width: ' . $menu_config->get('menu_breakpoint_custom') . ')',
- ),
- );
- }
- else {
- $libraries['backdrop.menus']['css'][$system_module_path . '/css/menu-dropdown.theme.css'] = array('group' => CSS_DEFAULT);
- $libraries['backdrop.menu-toggle']['css'][$system_module_path . '/css/menu-toggle.theme.css'] = array('group' => CSS_DEFAULT);
- }
-
-
- $libraries['backdrop.dismiss'] = array(
- 'title' => 'Dismiss buttons',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/dismiss.js' => array('group' => JS_DEFAULT),
- ),
- );
-
-
- $libraries['jquery'] = array(
- 'title' => 'jQuery',
- 'website' => 'http://jquery.com',
- 'version' => '1.12.4',
- 'js' => array(
- 'core/misc/jquery.js' => array('group' => JS_LIBRARY, 'weight' => -20),
-
-
- 'core/misc/jquery-extend-3.4.0.js' => array('group' => JS_LIBRARY, 'weight' => -19),
- 'core/misc/jquery-html-prefilter-3.5.0.js' => array('group' => JS_LIBRARY, 'weight' => -19),
- ),
- );
-
-
- $libraries['jquery.once'] = array(
- 'title' => 'jQuery Once',
- 'website' => 'http://plugins.jquery.com/project/once',
- 'version' => '1.2',
- 'js' => array(
- 'core/misc/jquery.once.js' => array('group' => JS_LIBRARY, 'weight' => -19),
- ),
- );
-
-
- $libraries['jquery.form'] = array(
- 'title' => 'jQuery Form Plugin',
- 'website' => 'https://github.com/jquery-form/form',
- 'version' => '4.2.1',
- 'js' => array(
- 'core/misc/jquery.form.js' => array(),
- ),
- );
-
-
- $libraries['jquery.timeentry'] = array(
- 'title' => 'jQuery Time Entry Plugin',
- 'website' => 'http://keith-wood.name/timeEntry.html',
- 'version' => '1.5.2',
- 'js' => array(
- 'core/misc/jquery.timeentry.js' => array(),
- ),
- );
-
-
- $libraries['backdrop.dropbutton'] = array(
- 'title' => 'Dropbutton',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/dropbutton.js' => array(),
- ),
- 'css' => array(
- 'core/misc/dropbutton.css' => array(),
- 'core/misc/dropbutton.theme.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'jquery.once'),
- ),
- );
-
-
- $libraries['backdrop.vertical-tabs'] = array(
- 'title' => 'Vertical Tabs',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- 'core/misc/vertical-tabs.js' => array(),
- ),
- 'css' => array(
- 'core/misc/vertical-tabs.css' => array(),
- ),
- 'dependencies' => array(
-
- array('system', 'backdrop.form'),
- ),
- );
-
-
- $libraries['jump-menu'] = array(
- 'title' => 'Jump Menu',
- 'version' => BACKDROP_VERSION,
- 'js' => array(
- $system_module_path . '/js/system.jump-menu.js' => array('group' => JS_DEFAULT),
- ),
- );
-
-
- $libraries['farbtastic'] = array(
- 'title' => 'Farbtastic',
- 'website' => 'http://code.google.com/p/farbtastic/',
- 'version' => '1.2',
- 'js' => array(
- 'core/misc/farbtastic/farbtastic.js' => array(),
- ),
- 'css' => array(
- 'core/misc/farbtastic/farbtastic.css' => array(),
- ),
- );
-
-
- $libraries['html5shiv'] = array(
- 'title' => 'html5shiv',
- 'website' => 'http://code.google.com/p/html5shiv/',
- 'version' => '3.7.2',
- 'js' => array(
- 'core/misc/html5.js' => array(
- 'group' => JS_LIBRARY,
- 'weight' => -21,
- 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE),
- ),
- ),
- );
-
-
- $libraries['smartmenus'] = array(
- 'title' => 'SmartMenus',
- 'website' => 'http://www.smartmenus.org',
- 'version' => '1.0.0',
- 'css' => array(
- 'core/misc/smartmenus/css/sm-core-css.css' => array(
- 'group' => CSS_THEME,
- 'media' => 'screen',
- ),
- ),
- 'js' => array(
- 'core/misc/smartmenus/jquery.smartmenus.js' => array(
- 'group' => JS_LIBRARY,
- ),
- 'core/misc/smartmenus/addons/keyboard/jquery.smartmenus.keyboard.js' => array(
- 'group' => JS_LIBRARY,
- ),
- ),
- );
-
-
- $libraries['opensans'] = array(
- 'title' => 'OpenSans',
- 'website' => 'https://fonts.google.com/specimen/Open+Sans',
- 'version' => '1.0',
- 'css' => array(
- 'core/misc/opensans/opensans.css' => array(
- 'group' => CSS_THEME,
- 'media' => 'screen',
- ),
- ),
- );
-
-
- $libraries['jquery.cookie'] = array(
- 'title' => 'Cookie',
- 'website' => 'http://plugins.jquery.com/project/cookie',
- 'version' => '1.0',
- 'js' => array(
- 'core/misc/jquery.cookie.js' => array(),
- ),
- );
-
-
- $libraries['ui'] = array(
- 'title' => 'jQuery UI: Core',
- 'website' => 'http://jqueryui.com',
- 'version' => '1.12.1',
- 'js' => array(
- 'core/misc/ui/jquery.ui.data.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.disable-selection.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.form.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.labels.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.scroll-parent.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.tabbable.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.unique-id.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.version.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.escape-selector.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.focusable.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.form-reset-mixin.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.ie.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.keycode.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.scroll-parent.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.plugin.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.safe-active-element.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- 'core/misc/ui/jquery.ui.safe-blur.min.js' => array('group' => JS_LIBRARY, 'weight' => -11),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.core.css' => array(),
- 'core/misc/ui/jquery.ui.theme.css' => array(),
- ),
- );
- $libraries['ui.accordion'] = array(
- 'title' => 'jQuery UI: Accordion',
- 'website' => 'http://jqueryui.com/accordion/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.accordion.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.accordion.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.autocomplete'] = array(
- 'title' => 'jQuery UI: Autocomplete',
- 'website' => 'http://jqueryui.com/autocomplete/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.autocomplete.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.autocomplete.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.position'),
- array('system', 'ui.menu'),
- ),
- );
- $libraries['ui.button'] = array(
- 'title' => 'jQuery UI: Button',
- 'website' => 'http://jqueryui.com/button/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.button.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.button.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.checkboxradio'] = array(
- 'title' => 'jQuery UI: Checkbox Radio',
- 'website' => 'http://jqueryui.com/checkboxradio/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.checkboxradio.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.checkboxradio.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.controlgroup'] = array(
- 'title' => 'jQuery UI: Control Group',
- 'website' => 'http://jqueryui.com/controlgroup/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.controlgroup.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.controlgroup.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.datepicker'] = array(
- 'title' => 'jQuery UI: Date Picker',
- 'website' => 'http://jqueryui.com/datepicker/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.datepicker.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.datepicker.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui'),
- ),
- );
- $libraries['ui.dialog'] = array(
- 'title' => 'jQuery UI: Dialog',
- 'website' => 'http://jqueryui.com/dialog/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.dialog.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.dialog.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.button'),
- array('system', 'ui.draggable'),
- array('system', 'ui.mouse'),
- array('system', 'ui.position'),
- array('system', 'ui.resizable'),
- ),
- );
- $libraries['ui.draggable'] = array(
- 'title' => 'jQuery UI: Draggable',
- 'website' => 'http://jqueryui.com/draggable/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.draggable.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.draggable.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- array('system', 'ui.touch-punch'),
- ),
- );
- $libraries['ui.droppable'] = array(
- 'title' => 'jQuery UI: Droppable',
- 'website' => 'http://jqueryui.com/droppable/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.droppable.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- array('system', 'ui.draggable'),
- ),
- );
- $libraries['ui.menu'] = array(
- 'title' => 'jQuery UI: Mouse',
- 'website' => 'http://jqueryui.com/menu/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.menu.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.menu.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.position'),
- ),
- );
- $libraries['ui.mouse'] = array(
- 'title' => 'jQuery UI: Mouse',
- 'website' => 'http://jqueryui.com/mouse/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.mouse.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.position'] = array(
- 'title' => 'jQuery UI: Position',
- 'website' => 'http://jqueryui.com/position/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.position.min.js' => array(),
- ),
- );
- $libraries['ui.progressbar'] = array(
- 'title' => 'jQuery UI: Progress Bar',
- 'website' => 'http://jqueryui.com/progressbar/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.progressbar.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.progressbar.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.resizable'] = array(
- 'title' => 'jQuery UI: Resizable',
- 'website' => 'http://jqueryui.com/resizable/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.resizable.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.resizable.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- ),
- );
- $libraries['ui.selectable'] = array(
- 'title' => 'jQuery UI: Selectable',
- 'website' => 'http://jqueryui.com/selectable/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.selectable.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.selectable.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- ),
- );
-
- $libraries['ui.selectmenu'] = array(
- 'title' => 'jQuery UI: Select Menu',
- 'website' => 'http://jqueryui.com/selectmenu/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.selectmenu.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.selectmenu.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.position'),
- array('system', 'ui.menu'),
- ),
- );
- $libraries['ui.slider'] = array(
- 'title' => 'jQuery UI: Slider',
- 'website' => 'http://jqueryui.com/slider/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.slider.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.slider.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- ),
- );
- $libraries['ui.sortable'] = array(
- 'title' => 'jQuery UI: Sortable',
- 'website' => 'http://jqueryui.com/sortable/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.sortable.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.sortable.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.draggable'),
- array('system', 'ui.droppable'),
- ),
- );
- $libraries['ui.spinner'] = array(
- 'title' => 'jQuery UI: Spinner',
- 'website' => 'http://jqueryui.com/spinner/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.spinner.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.spinner.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.button'),
- ),
- );
- $libraries['ui.tabs'] = array(
- 'title' => 'jQuery UI: Tabs',
- 'website' => 'http://jqueryui.com/tabs/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.tabs.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.tabs.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- ),
- );
- $libraries['ui.tooltip'] = array(
- 'title' => 'jQuery UI: Tooltip',
- 'website' => 'http://jqueryui.com/tooltip/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.tooltip.min.js' => array(),
- ),
- 'css' => array(
- 'core/misc/ui/jquery.ui.tooltip.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.position'),
- ),
- );
- $libraries['ui.widget'] = array(
- 'title' => 'jQuery UI: Widget',
- 'website' => 'http://jqueryui.com/widget/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.widget.min.js' => array('group' => JS_LIBRARY, 'weight' => -10),
- ),
- 'dependencies' => array(
- array('system', 'ui'),
- ),
- );
- $libraries['effects'] = array(
- 'title' => 'jQuery UI: Effects',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect.min.js' => array('group' => JS_LIBRARY, 'weight' => -9),
- ),
- );
- $libraries['effects.blind'] = array(
- 'title' => 'jQuery UI: Effects Blind',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-blind.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.bounce'] = array(
- 'title' => 'jQuery UI: Effects Bounce',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-bounce.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.clip'] = array(
- 'title' => 'jQuery UI: Effects Clip',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-clip.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.drop'] = array(
- 'title' => 'jQuery UI: Effects Drop',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-drop.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.explode'] = array(
- 'title' => 'jQuery UI: Effects Explode',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-explode.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.fade'] = array(
- 'title' => 'jQuery UI: Effects Fade',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-fade.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.fold'] = array(
- 'title' => 'jQuery UI: Effects Fold',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-fold.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.highlight'] = array(
- 'title' => 'jQuery UI: Effects Highlight',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-highlight.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.puff'] = array(
- 'title' => 'jQuery UI: Effects Puff',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-puff.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.pulsate'] = array(
- 'title' => 'jQuery UI: Effects Pulsate',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-pulsate.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.scale'] = array(
- 'title' => 'jQuery UI: Effects Scale',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-scale.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.shake'] = array(
- 'title' => 'jQuery UI: Effects Shake',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-shake.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.scale'] = array(
- 'title' => 'jQuery UI: Effects Scale',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-scale.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.slide'] = array(
- 'title' => 'jQuery UI: Effects Slide',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-slide.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
- $libraries['effects.transfer'] = array(
- 'title' => 'jQuery UI: Effects Transfer',
- 'website' => 'http://jqueryui.com/effect/',
- 'version' => $libraries['ui']['version'],
- 'js' => array(
- 'core/misc/ui/jquery.ui.effect-transfer.min.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'effects'),
- ),
- );
-
-
- $libraries['ui.touch-punch'] = array(
- 'title' => 'jQuery UI Touch Punch',
- 'website' => 'http://touchpunch.furf.com/',
- 'version' => '0.2.3',
- 'js' => array(
- 'core/misc/jquery.ui.touch-punch.js' => array(),
- ),
- 'dependencies' => array(
- array('system', 'ui.widget'),
- array('system', 'ui.mouse'),
- ),
- );
-
-
- $libraries['token'] = array(
- 'title' => 'Token behaviors',
- 'version' => '1.0',
- 'js' => array(
- $system_module_path . '/js/token.js' => array(),
- ),
- 'css' => array(
- $system_module_path . '/css/token.css' => array(),
- ),
- 'dependencies' => array(
- array('system', 'jquery.treetable'),
- array('system', 'backdrop.ajax'),
- ),
- );
-
-
- $libraries['jquery.treetable'] = array(
- 'title' => 'jQuery treetable',
- 'website' => 'http://plugins.jquery.com/project/treetable',
- 'version' => '3.2.0',
- 'js' => array(
- $system_module_path . '/js/jquery.treetable.js' => array(),
- ),
- 'css' => array(
- $system_module_path . '/css/jquery.treetable.css' => array(),
- $system_module_path . '/css/jquery.treetable.theme.default.css' => array(),
- ),
- );
-
- return $libraries;
- }
-
- * Implements hook_stream_wrappers().
- */
- function system_stream_wrappers() {
- $wrappers = array(
- 'public' => array(
- 'name' => t('Public files'),
- 'class' => 'BackdropPublicStreamWrapper',
- 'description' => t('Public local files served by the webserver'),
- 'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
- ),
- 'temporary' => array(
- 'name' => t('Temporary files'),
- 'class' => 'BackdropTemporaryStreamWrapper',
- 'description' => t('Temporary local files for upload and previews'),
- 'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
- ),
- );
-
-
- if (config_get('system.core', 'file_private_path')) {
- $wrappers['private'] = array(
- 'name' => t('Private files'),
- 'class' => 'BackdropPrivateStreamWrapper',
- 'description' => t('Private local files served by Backdrop'),
- 'type' => STREAM_WRAPPERS_LOCAL_NORMAL,
- );
- }
-
- return $wrappers;
- }
-
- * Menu item access callback - only admin or enabled themes can be accessed.
- */
- function _system_themes_access($theme) {
- return user_access('administer themes') && backdrop_theme_access($theme);
- }
-
- * @defgroup authorize Authorized operations
- * @{
- * Functions to run operations with elevated privileges via authorize.php.
- *
- * Because of the Update manager functionality included in Backdrop core, there
- * is a mechanism for running operations with elevated file system privileges,
- * the top-level authorize.php script. This script runs at a reduced Backdrop
- * bootstrap level so that it is not reliant on the entire site being
- * functional. The operations use a FileTransfer class to manipulate code
- * installed on the system as the user that owns the files, not the user that
- * the httpd is running as.
- *
- * The first setup is to define a callback function that should be authorized
- * to run with the elevated privileges. This callback should take a
- * FileTransfer as its first argument, although you can define an array of
- * other arguments it should be invoked with. The callback should be placed in
- * a separate .inc file that will be included by authorize.php.
- *
- * To run the operation, certain data must be saved into the SESSION, and then
- * the flow of control should be redirected to the authorize.php script. There
- * are two ways to do this, either to call system_authorized_run() directly,
- * or to call system_authorized_init() and then redirect to authorize.php,
- * using the URL from system_authorized_get_url(). Redirecting yourself is
- * necessary when your authorized operation is being triggered by a form
- * submit handler, since calling backdrop_goto() in a submit handler is a bad
- * idea, and you should instead set $form_state['redirect'].
- *
- * Once the SESSION is setup for the operation and the user is redirected to
- * authorize.php, they will be prompted for their connection credentials (core
- * provides FTP and SSH by default, although other connection classes can be
- * added via contributed modules). With valid credentials, authorize.php will
- * instantiate the appropriate FileTransfer object, and then invoke the
- * desired operation passing in that object. The authorize.php script can act
- * as a Batch API processing page, if the operation requires a batch.
- *
- * @see authorize.php
- * @see FileTransfer
- * @see hook_filetransfer_info()
- */
-
- * Setup a given callback to run via authorize.php with elevated privileges.
- *
- * To use authorize.php, certain variables must be stashed into $_SESSION. This
- * function sets up all the necessary $_SESSION variables. The calling function
- * should then redirect to authorize.php, using the full path returned by
- * system_authorized_get_url(). That initiates the workflow that will eventually
- * lead to the callback being invoked. The callback will be invoked at a low
- * bootstrap level, without all modules being invoked, so it needs to be careful
- * not to assume any code exists. Example (system_authorized_run()):
- * @code
- * system_authorized_init($callback, $file, $arguments, $page_title);
- * backdrop_goto(system_authorized_get_url());
- * @endcode
- * Example (update_manager_install_form_submit()):
- * @code
- * system_authorized_init('installer_authorize_run_install',
- * backdrop_get_path('module', 'installer') . '/installer.authorize.inc',
- * $arguments, t('Installer'));
- * $form_state['redirect'] = system_authorized_get_url();
- * @endcode
- *
- * @param $callback
- * The name of the function to invoke once the user authorizes the operation.
- * @param $file
- * The full path to the file where the callback function is implemented.
- * @param $arguments
- * Optional array of arguments to pass into the callback when it is invoked.
- * Note that the first argument to the callback is always the FileTransfer
- * object created by authorize.php when the user authorizes the operation.
- * @param $page_title
- * Optional string to use as the page title once redirected to authorize.php.
- * @return
- * Nothing, this function just initializes variables in the user's session.
- */
- function system_authorized_init($callback, $file, $arguments = array(), $page_title = NULL) {
-
-
-
- $_SESSION['authorize_filetransfer_info'] = backdrop_get_filetransfer_info();
-
-
- $_SESSION['authorize_operation'] = array(
- 'callback' => $callback,
- 'file' => $file,
- 'arguments' => $arguments,
- );
-
- if (isset($page_title)) {
- $_SESSION['authorize_operation']['page_title'] = $page_title;
- }
- }
-
- * Return the URL for the authorize.php script.
- *
- * @param array $options
- * Optional array of options to pass to url().
- * @return
- * The full URL to authorize.php, using HTTPS if available.
- *
- * @see system_authorized_init()
- */
- function system_authorized_get_url(array $options = array()) {
- global $base_url;
-
- $options['https'] = TRUE;
-
-
- return url($base_url . '/core/authorize.php', $options);
- }
-
- * Returns the URL for the authorize.php script when it is processing a batch.
- */
- function system_authorized_batch_processing_url() {
- return system_authorized_get_url(array('query' => array('batch' => '1')));
- }
-
- * Setup and invoke an operation using authorize.php.
- *
- * @see system_authorized_init()
- */
- function system_authorized_run($callback, $file, $arguments = array(), $page_title = NULL) {
- system_authorized_init($callback, $file, $arguments, $page_title);
- backdrop_goto(system_authorized_get_url());
- }
-
- * Use authorize.php to run batch_process().
- *
- * @see batch_process()
- */
- function system_authorized_batch_process($redirect_callback = 'backdrop_goto') {
- $finish_url = system_authorized_get_url();
- $process_url = system_authorized_batch_processing_url();
- batch_process($finish_url, $process_url, $redirect_callback);
- }
-
- * @} End of "defgroup authorize".
- */
-
- * Implements hook_updater_info().
- */
- function system_updater_info() {
- return array(
- 'core' => array(
- 'class' => 'CoreUpdater',
- 'name' => t('Update Backdrop core'),
- 'weight' => 0,
- ),
- 'module' => array(
- 'class' => 'ModuleUpdater',
- 'name' => t('Update modules'),
- 'weight' => 0,
- ),
- 'theme' => array(
- 'class' => 'ThemeUpdater',
- 'name' => t('Update themes'),
- 'weight' => 0,
- ),
- 'layout' => array(
- 'class' => 'LayoutUpdater',
- 'name' => t('Update layouts'),
- 'weight' => 0,
- ),
- );
- }
-
- * Implements hook_filetransfer_info().
- */
- function system_filetransfer_info() {
- $backends = array();
-
-
- if (function_exists('ftp_connect')) {
- $backends['ftp'] = array(
- 'title' => t('FTP'),
- 'class' => 'FileTransferFTP',
- 'file' => 'ftp.inc',
- 'file path' => 'core/includes/filetransfer',
- 'weight' => 0,
- );
- }
-
-
-
- if (function_exists('ssh2_connect')) {
- $backends['ssh'] = array(
- 'title' => t('SSH'),
- 'class' => 'FileTransferSSH',
- 'file' => 'ssh.inc',
- 'file path' => 'core/includes/filetransfer',
- 'weight' => 20,
- );
- }
- return $backends;
- }
-
- * Implements hook_file_presave().
- */
- function system_file_presave(File $file) {
-
-
-
-
-
- $config = config('system.core');
- if (!empty($_FILES['files']['name']) && $config->get('file_transliterate_uploads') && !$config->get('file_transliterate_uploads_display_name')) {
- $key = array_search($file->filename, $_FILES['files']['name']);
- if ($key !== FALSE && isset($_FILES['files']['orig_name'][$key])) {
- $file->filename = $_FILES['files']['orig_name'][$key];
- }
- }
- }
-
- * Implements hook_init().
- */
- function system_init() {
- $path = backdrop_get_path('module', 'system');
-
-
- backdrop_add_css('core/misc/normalize.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -1000));
- backdrop_add_css($path . '/css/system.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));
- if (path_is_admin(current_path())) {
- backdrop_add_css($path . '/css/system.admin.css', array('group' => CSS_SYSTEM));
- }
- backdrop_add_css($path . '/css/system.theme.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));
- backdrop_add_css($path . '/css/messages.theme.css', array('group' => CSS_SYSTEM, 'every_page' => TRUE));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (isset($_SESSION['ignore_slave_server'])) {
- if ($_SESSION['ignore_slave_server'] >= REQUEST_TIME) {
- Database::ignoreTarget('default', 'slave');
- }
- else {
- unset($_SESSION['ignore_slave_server']);
- }
- }
-
-
- system_add_module_assets();
-
-
- if (!empty($_FILES['files']) && config_get('system.core', 'file_transliterate_uploads')) {
-
-
- $langcode = NULL;
- if (!empty($_POST['langcode'])) {
- $languages = language_list();
- if (isset($languages[$_POST['langcode']])) {
- $langcode = $_POST['langcode'];
- }
- }
- foreach ($_FILES['files']['name'] as $field => $filename) {
- include_once BACKDROP_ROOT . '/core/includes/transliteration.inc';
-
- $_FILES['files']['orig_name'][$field] = $filename;
- $_FILES['files']['name'][$field] = transliteration_clean_filename($filename, $langcode);
- }
- }
-
- }
-
- * Adds CSS and JavaScript files declared in module .info files.
- */
- function system_add_module_assets() {
- foreach (system_get_info('module') as $module => $info) {
- if (!empty($info['stylesheets'])) {
- foreach ($info['stylesheets'] as $media => $stylesheets) {
- foreach ($stylesheets as $stylesheet) {
- backdrop_add_css($stylesheet, array('every_page' => TRUE, 'media' => $media));
- }
- }
- }
- if (!empty($info['scripts'])) {
- foreach ($info['scripts'] as $script) {
- backdrop_add_js($script, array('every_page' => TRUE));
- }
- }
- }
- }
-
- * Implements hook_custom_theme().
- */
- function system_custom_theme() {
- if (user_access('view the administration theme') && path_is_admin(current_path())) {
- return config_get('system.core', 'admin_theme');
- }
- }
-
- * Implements hook_form_FORM_ID_alter().
- */
- function system_form_user_profile_form_alter(&$form, &$form_state) {
- if (config_get('system.date', 'user_configurable_timezones')) {
- system_user_timezone($form, $form_state);
- }
- return $form;
- }
-
- * Implements hook_form_FORM_ID_alter().
- */
- function system_form_user_register_form_alter(&$form, &$form_state) {
- $config = config('system.date');
- if ($config->get('user_configurable_timezones') && $config->get('user_default_timezone') == BACKDROP_USER_TIMEZONE_SELECT) {
- system_user_timezone($form, $form_state);
- return $form;
- }
- }
-
- * Implements hook_user_presave().
- */
- function system_user_presave($account) {
- $config = config('system.date');
- if ($config->get('user_configurable_timezones') && empty($account->timezone) && !$config->get('user_default_timezone')) {
- $account->timezone = $config->get('default_timezone');
- }
- }
-
- * Implements hook_user_login().
- */
- function system_user_login(&$edit, $account) {
- $config = config('system.date');
-
- if (!$account->timezone && $config->get('user_configurable_timezones') && $config->get('user_empty_timezone_message')) {
- backdrop_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => backdrop_get_destination(), 'fragment' => 'edit-timezone')))));
- }
- }
-
- * Add the time zone field to the user edit and register forms.
- */
- function system_user_timezone(&$form, &$form_state) {
- global $user;
-
- $account = $form['#user'];
- $form['timezone'] = array(
- '#type' => 'fieldset',
- '#title' => t('Locale settings'),
- '#weight' => 6,
- '#collapsible' => TRUE,
- );
- $form['timezone']['timezone'] = array(
- '#type' => 'select',
- '#title' => t('Time zone'),
- '#default_value' => isset($account->timezone) ? $account->timezone : ($account->uid == $user->uid ? config_get('system.date', 'default_timezone') : ''),
- '#options' => system_time_zones($account->uid != $user->uid),
- '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
- );
- if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) {
- $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
- backdrop_add_js('core/misc/timezone.js');
- }
- }
-
- * Implements hook_block_info().
- */
- function system_block_info() {
- $blocks['main'] = array(
- 'info' => t('Main page content'),
- 'description' => t('The default content for this page. <strong>This block may be required for this page to work properly.</strong>'),
- 'required contexts' => array(
- 'overrides_path' => 'overrides_path',
- ),
- 'render first' => TRUE,
- );
- $blocks['header'] = array(
- 'info' => t('Header block'),
- 'description' => t('Contains elements typical of a site header including the site logo, name, slogan, and optionally a navigational menu.'),
- );
- $blocks['breadcrumb'] = array(
- 'info' => t('Breadcrumb'),
- 'description' => t('A trail of links from the homepage to the current page.'),
- 'render last' => TRUE,
- );
- $blocks['powered-by'] = array(
- 'info' => t('Powered by Silkscreen'),
- 'description' => t('Displays a link to <a href="https://silkscreencms.org">the Silkscreen CMS website</a>.'),
- 'weight' => '10',
- );
- $blocks['page_components'] = array(
- 'info' => t('Page components'),
- 'description' => t('Displays the page title, local task tabs, local actions links, and messages.'),
- 'class' => 'PageComponents',
- 'render last' => TRUE,
- );
-
- $all_menus = function_exists('menu_get_menus') ? menu_get_menus() : array();
- foreach (menu_list_system_menus() as $menu_name => $title) {
- $custom_title = isset($all_menus[$menu_name]) ? $all_menus[$menu_name] : $title;
- $blocks[$menu_name] = array(
-
- 'info' => check_plain(t($custom_title)),
- 'description' => t('A list of links for the menu: %title.', array('%title' => t($custom_title))),
- );
- }
- return $blocks;
- }
-
- * Implements hook_block_view().
- *
- * Generate a block with a promotional link to BackdropCMS.org and
- * all system menu blocks.
- */
- function system_block_view($delta = '', $settings = array()) {
- $block = array();
- switch ($delta) {
- case 'main':
- $router_item = menu_get_item();
- if ($router_item['include_file']) {
- require_once BACKDROP_ROOT . '/' . $router_item['include_file'];
- }
- $block['subject'] = NULL;
- $block['content'] = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
- return $block;
- case 'header':
- $block['subject'] = NULL;
- $block['content'] = system_header_block($settings);
- return $block;
- case 'breadcrumb':
- $block['subject'] = NULL;
- $block['content'] = system_breadcrumb_block($settings);
- return $block;
- case 'powered-by':
- $block['subject'] = NULL;
- $block['content'] = theme('system_powered_by');
- return $block;
- default:
-
- $system_menus = menu_list_system_menus();
- if (isset($system_menus[$delta])) {
- module_load_include('inc', 'system', 'system.menu');
- $settings += system_menu_block_defaults($delta);
- $data = system_menu_block_build($settings);
- $block['subject'] = $data['subject'];
- $block['content'] = $data['content'];
- return $block;
- }
- break;
- }
- }
-
- * Implements hook_block_configure().
- */
- function system_block_configure($delta, $settings) {
- if ($delta === 'header') {
- return system_header_block_form($settings);
- }
- elseif ($delta === 'breadcrumb') {
- $form['current'] = array(
- '#type' => 'checkbox',
- '#title' => t('Display the current page title as the last breadcrumb'),
- '#default_value' => !empty($settings['current']),
- );
- return $form;
- }
-
- foreach (menu_list_system_menus() as $menu_name => $title) {
- if ($delta === $menu_name) {
- module_load_include('inc', 'system', 'system.menu');
- return _system_block_configure($delta, $settings);
- }
- }
- }
-
- * Implements hook_block_save().
- */
- function system_block_save($delta, &$edit = array()) {
- if ($delta === 'header') {
-
- if (is_array($edit['components']) && !empty($edit['components'])) {
- foreach ($edit['components'] as $key => $value) {
- $edit[$key] = $value;
- }
- unset($edit['components']);
- }
- }
- }
-
- * Implements hook_preprocess_block().
- */
- function system_preprocess_block(&$variables) {
- if ($variables['block']->module == 'system') {
-
- switch ($variables['block']->delta) {
- case 'powered-by':
- $variables['attributes']['role'] = 'complementary';
- break;
-
- case 'main':
- $variables['classes'] = array_values(array_diff($variables['classes'], array('block', 'block-system-main')));
- break;
-
-
- default:
- if (in_array($variables['block']->delta, array_keys(menu_list_system_menus()))) {
- $variables['attributes']['role'] = 'navigation';
- $variables['classes'][] = 'block-menu';
- }
- }
- }
- }
-
- * Provide a single block on the administration overview page.
- *
- * @param $item
- * The menu item to be displayed.
- */
- function system_admin_menu_block($item) {
- $cache = &backdrop_static(__FUNCTION__, array());
-
-
-
-
- if ($item['tab_root'] != $item['path']) {
- $item = menu_get_item($item['tab_root_href']);
- }
-
- if (!isset($item['mlid'])) {
- $item += db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = :path AND module = 'system'", array(':path' => $item['path']))->fetchAssoc();
- }
-
- if (isset($cache[$item['mlid']])) {
- return $cache[$item['mlid']];
- }
-
- $content = array();
- $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC));
- $query->join('menu_router', 'm', 'm.path = ml.router_path');
- $query
- ->fields('ml')
-
- ->fields('m', array_diff(backdrop_schema_fields_sql('menu_router'), array('weight')))
- ->condition('ml.plid', $item['mlid'])
- ->condition('ml.menu_name', $item['menu_name'])
- ->condition('ml.hidden', 0);
-
- foreach ($query->execute() as $link) {
- _menu_link_translate($link);
- if ($link['access']) {
-
-
- if (!empty($link['localized_options']['attributes']['title'])) {
- $link['description'] = $link['localized_options']['attributes']['title'];
- unset($link['localized_options']['attributes']['title']);
- }
-
-
- $key = (50000 + $link['weight']) . ' ' . backdrop_strtolower($link['title']) . ' ' . $link['mlid'];
- $content[$key] = $link;
- }
- }
- ksort($content);
- $cache[$item['mlid']] = $content;
- return $content;
- }
-
- * Checks the existence of the directory specified in $form_element.
- *
- * This function is called from the system_settings form to check all core
- * file directories (file_public_path, file_private_path, file_temporary_path).
- *
- * @param $form_element
- * The form element containing the name of the directory to check.
- */
- function system_check_directory($form_element) {
- $directory = $form_element['#value'];
- if (strlen($directory) == 0) {
- return $form_element;
- }
-
- if (!is_dir($directory) && !backdrop_mkdir($directory, NULL, TRUE)) {
-
- form_set_error($form_element['#parents'][0], t('The directory %directory does not exist and could not be created.', array('%directory' => $directory)));
- watchdog('file system', 'The directory %directory does not exist and could not be created.', array('%directory' => $directory), WATCHDOG_ERROR);
- }
-
- if (is_dir($directory) && !is_writable($directory) && !backdrop_chmod($directory)) {
-
- form_set_error($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory)));
- watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory), WATCHDOG_ERROR);
- }
- elseif (is_dir($directory) && backdrop_is_apache()) {
- if ($form_element['#name'] == 'file_public_path') {
-
- file_save_htaccess($directory, FALSE);
- }
- else {
-
- file_save_htaccess($directory);
- }
- }
-
- return $form_element;
- }
-
- * Retrieves the current status of an array of files in the system table.
- *
- * @param $files
- * An array of files to check.
- * @param $type
- * The type of the files ('module', 'theme', 'layout').
- */
- function system_get_files_database(&$files, $type) {
-
- $result = db_query("SELECT filename, name, type, status, schema_version, weight FROM {system} WHERE type = :type", array(':type' => $type));
- foreach ($result as $file) {
- if (isset($files[$file->name]) && is_object($files[$file->name])) {
- $file->uri = $file->filename;
- foreach ($file as $key => $value) {
- if (!isset($files[$file->name]->$key)) {
- $files[$file->name]->$key = $value;
- }
- }
- }
- }
- }
-
- * Updates the records in the system table based on the files array.
- *
- * @param $files
- * An array of files.
- * @param $type
- * The type of the files.
- */
- function system_update_files_database(&$files, $type) {
- $result = db_query("SELECT * FROM {system} WHERE type = :type", array(':type' => $type));
-
-
- $delete = db_or();
- foreach ($result as $file) {
- if (isset($files[$file->name]) && is_object($files[$file->name])) {
-
- $old_filename = $file->filename;
-
- $updated_fields = array();
-
-
- $serialized_info = serialize($files[$file->name]->info);
- if ($serialized_info != $file->info) {
- $updated_fields['info'] = $serialized_info;
- }
- unset($file->info);
-
-
- foreach ($file as $key => $value) {
- if (isset($files[$file->name]->$key) && $files[$file->name]->$key != $value) {
- $updated_fields[$key] = $files[$file->name]->$key;
- }
- }
-
-
- if (count($updated_fields)) {
- db_update('system')
- ->fields($updated_fields)
- ->condition('filename', $old_filename)
- ->execute();
- }
-
-
- $files[$file->name]->exists = TRUE;
- }
- else {
-
- $delete->condition('filename', $file->filename);
- }
- }
-
- if (count($delete) > 0) {
-
-
- db_delete('system')
- ->condition($delete)
- ->condition('schema_version', -1)
- ->execute();
- }
-
-
- $query = db_insert('system')->fields(array('filename', 'name', 'type', 'owner', 'info'));
- foreach ($files as &$file) {
- if (isset($file->exists)) {
- unset($file->exists);
- }
- else {
- $query->values(array(
- 'filename' => $file->uri,
- 'name' => $file->name,
- 'type' => $type,
- 'owner' => isset($file->owner) ? $file->owner : '',
- 'info' => serialize($file->info),
- ));
- $file->type = $type;
- $file->status = 0;
- $file->schema_version = -1;
- }
- }
- $query->execute();
-
-
-
-
- system_list_reset();
- }
-
- * Returns an array of information about enabled modules or themes.
- *
- * This function returns the information from the {system} table corresponding
- * to the cached contents of the .info file for each active module or theme.
- *
- * @param $type
- * Either 'module' or 'theme'.
- * @param $name
- * (optional) The name of a module or theme whose information shall be
- * returned. If omitted, all records for the provided $type will be returned.
- * If $name does not exist in the provided $type or is not enabled, an empty
- * array will be returned.
- *
- * @return
- * An associative array of module or theme information keyed by name, or only
- * information for $name, if given. If no records are available, an empty
- * array is returned.
- *
- * @see system_rebuild_module_data()
- * @see system_rebuild_theme_data()
- */
- function system_get_info($type, $name = NULL) {
- $info = array();
- if ($type == 'module') {
- $type = 'module_enabled';
- }
- $list = system_list($type);
- foreach ($list as $shortname => $item) {
- if (!empty($item->status)) {
- $info[$shortname] = $item->info;
- }
- }
- if (isset($name)) {
- return isset($info[$name]) ? $info[$name] : array();
- }
- return $info;
- }
-
- * Helper function to scan and collect module .info data.
- *
- * @return
- * An associative array of module information.
- */
- function _system_rebuild_module_data() {
-
- $modules = backdrop_system_listing('/^' . BACKDROP_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0);
-
-
- $profile = backdrop_get_profile();
- $profile_uri = 'profiles/' . $profile . '/' . $profile . '.profile';
- if (file_exists(BACKDROP_ROOT . '/core/profiles/' . $profile . '/' . $profile . '.profile')) {
- $profile_uri = 'core/' . $profile_uri;
- }
- $modules[$profile] = new stdClass();
- $modules[$profile]->name = $profile;
- $modules[$profile]->uri = $profile_uri;
- $modules[$profile]->filename = $profile . '.profile';
-
-
- $modules[$profile]->weight = 1000;
-
-
- $defaults = array(
- 'dependencies' => array(),
- 'description' => '',
- 'package' => 'Other',
- 'version' => NULL,
- 'php' => BACKDROP_MINIMUM_PHP,
- 'files' => array(),
- 'bootstrap' => 0,
- );
-
-
- foreach ($modules as $key => $module) {
-
-
- $modules[$key]->filename = $module->uri;
-
-
- $module->info = backdrop_parse_info_file(dirname($module->uri) . '/' . $module->name . '.info');
-
-
- if (empty($module->info)) {
- unset($modules[$key]);
- continue;
- }
-
-
-
- $module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.info');
-
-
- $modules[$key]->info = $module->info + $defaults;
-
-
-
- $modules[$key]->info += array('name' => $key);
-
-
- $path = dirname($module->uri);
- if (isset($module->info['stylesheets'])) {
- $module->info['stylesheets'] = _system_info_add_path($module->info['stylesheets'], $path);
- }
- if (isset($module->info['scripts'])) {
- $module->info['scripts'] = _system_info_add_path($module->info['scripts'], $path);
- }
-
-
-
- if ($key == $profile && !isset($modules[$key]->info['hidden'])) {
- $modules[$key]->info['hidden'] = TRUE;
- }
-
-
- if (empty($modules[$key]->info['version'])) {
- $module_base_path = BACKDROP_ROOT . '/' . preg_replace('!(.*modules/[^/]+).*!', '$1', $module->uri);
- $git_version = FALSE;
- if (file_exists($module_base_path . '/.git/HEAD')) {
-
- $git_head_contents = trim(file_get_contents($module_base_path . '/.git/HEAD'));
- if (strpos($git_head_contents, 'ref') === 0) {
- $git_version = trim(preg_replace('!^.*refs/heads/(.*)$!', '$1', $git_head_contents));
- }
-
- elseif (is_dir($module_base_path . '/.git/refs/tags')) {
- $tag_files = file_scan_directory($module_base_path . '/.git/refs/tags', '/.*/', array('key' => 'filename', 'recurse' => FALSE));
- $tag_files = array_reverse($tag_files, TRUE);
- foreach ($tag_files as $tag_name => $tag_file) {
- if (trim(file_get_contents($tag_file->uri)) == $git_head_contents) {
- $git_version = $tag_name;
- break;
- }
- }
- }
- if ($git_version) {
- $git_version = preg_replace('/^' . preg_quote(BACKDROP_CORE_COMPATIBILITY, '/') . '-/', '', $git_version);
- $modules[$key]->info['version'] = $git_version . '-dev';
- }
- }
- }
-
-
-
- $type = 'module';
- backdrop_alter('system_info', $modules[$key]->info, $modules[$key], $type);
- }
-
- if (isset($modules[$profile])) {
-
- $modules[$profile]->info['required'] = TRUE;
-
-
- if (!isset($modules[$profile]->info['distribution_name'])) {
- $modules[$profile]->info['distribution_name'] = 'Silkscreen CMS';
- }
- }
-
- return $modules;
- }
-
- * Rebuild, save, and return data about all currently available modules.
- *
- * @return
- * Array of all available modules and their data.
- */
- function system_rebuild_module_data() {
- $modules_cache = &backdrop_static(__FUNCTION__);
-
-
-
- if (!isset($modules_cache)) {
- $modules = _system_rebuild_module_data();
- ksort($modules);
- system_get_files_database($modules, 'module');
- system_update_files_database($modules, 'module');
- $modules = _module_build_dependencies($modules);
- $modules_cache = $modules;
- }
- return $modules_cache;
- }
-
- * Refresh bootstrap column in the system table.
- *
- * This is called internally by module_enable/disable() to flag modules that
- * implement hooks used during bootstrap, such as hook_boot(). These modules
- * are loaded earlier to invoke the hooks.
- */
- function _system_update_bootstrap_status() {
- $bootstrap_modules = array();
- foreach (bootstrap_hooks() as $hook) {
- foreach (module_implements($hook) as $module) {
- $bootstrap_modules[] = $module;
- }
- }
- $query = db_update('system')->fields(array('bootstrap' => 0));
- if ($bootstrap_modules) {
- db_update('system')
- ->fields(array('bootstrap' => 1))
- ->condition('name', $bootstrap_modules, 'IN')
- ->execute();
- $query->condition('name', $bootstrap_modules, 'NOT IN');
- }
- $query->execute();
-
- system_list_reset();
- }
-
- * Helper function to scan and collect theme .info data and their engines.
- *
- * @return
- * An associative array of themes information.
- */
- function _system_rebuild_theme_data() {
-
- $themes = backdrop_system_listing('/^' . BACKDROP_PHP_FUNCTION_PATTERN . '\.info$/', 'themes');
-
- if ($module_themes = module_invoke_all('system_theme_info')) {
- foreach ($module_themes as $name => $uri) {
-
- $themes[$name] = (object) array(
- 'uri' => $uri,
- 'filename' => pathinfo($uri, PATHINFO_FILENAME),
- 'name' => $name,
- );
- }
- }
-
-
- $engines = backdrop_system_listing('/^' . BACKDROP_PHP_FUNCTION_PATTERN . '\.engine$/', 'themes/engines');
-
-
- $defaults = array(
- 'engine' => 'phptemplate',
- 'description' => '',
- 'screenshot' => 'screenshot.png',
- 'php' => BACKDROP_MINIMUM_PHP,
- 'stylesheets' => array(),
- 'scripts' => array(),
- );
-
- $sub_themes = array();
-
- foreach ($themes as $key => $theme) {
- $themes[$key]->filename = $theme->uri;
- $themes[$key]->info = backdrop_parse_info_file($theme->uri) + $defaults;
-
-
-
- $themes[$key]->info += array('name' => $key);
-
-
-
- $themes[$key]->info['mtime'] = filemtime($theme->uri);
-
-
-
- $type = 'theme';
- backdrop_alter('system_info', $themes[$key]->info, $themes[$key], $type);
-
- if (!empty($themes[$key]->info['base theme'])) {
- $sub_themes[] = $key;
- }
- if ($themes[$key]->info['engine'] == 'theme') {
- $filename = dirname($themes[$key]->uri) . '/' . $themes[$key]->name . '.theme';
- if (file_exists($filename)) {
- $themes[$key]->owner = $filename;
- $themes[$key]->prefix = $key;
- }
- }
- else {
- $engine = $themes[$key]->info['engine'];
- if (isset($engines[$engine])) {
- $themes[$key]->owner = $engines[$engine]->uri;
- $themes[$key]->prefix = $engines[$engine]->name;
- $themes[$key]->template = TRUE;
- }
- }
-
-
- $path = dirname($theme->uri);
- $theme->info['stylesheets'] = _system_info_add_path($theme->info['stylesheets'], $path);
- $theme->info['scripts'] = _system_info_add_path($theme->info['scripts'], $path);
-
-
- if (!empty($themes[$key]->info['screenshot'])) {
- $themes[$key]->info['screenshot'] = $path . '/' . $themes[$key]->info['screenshot'];
- }
- }
-
-
-
- foreach ($sub_themes as $key) {
- $themes[$key]->base_themes = backdrop_find_base_themes($themes, $key);
-
- if (!current($themes[$key]->base_themes)) {
- continue;
- }
- $base_key = key($themes[$key]->base_themes);
- foreach (array_keys($themes[$key]->base_themes) as $base_theme) {
- $themes[$base_theme]->sub_themes[$key] = $themes[$key]->info['name'];
- }
-
-
- if (isset($themes[$base_key]->owner)) {
- if (isset($themes[$base_key]->info['engine'])) {
- $themes[$key]->info['engine'] = $themes[$base_key]->info['engine'];
- $themes[$key]->owner = $themes[$base_key]->owner;
- $themes[$key]->prefix = $themes[$base_key]->prefix;
- }
- else {
- $themes[$key]->prefix = $key;
- }
- }
- }
-
- return $themes;
- }
-
- * Rebuild, save, and return data about all currently available themes.
- *
- * @return
- * Array of all available themes and their data.
- */
- function system_rebuild_theme_data() {
- $themes = _system_rebuild_theme_data();
- ksort($themes);
- system_get_files_database($themes, 'theme');
- system_update_files_database($themes, 'theme');
- return $themes;
- }
-
- * Implements hook_themes_disabled().
- *
- * Remove the theme settings from config when the theme is disabled.
- */
- function system_themes_disabled($theme_list) {
- foreach ($theme_list as $theme_name) {
- if (theme_has_settings($theme_name)) {
- $config = config($theme_name . '.settings');
- if (!$config->isNew()) {
- $config->delete();
- }
- }
- }
- }
-
- * Prefixes all values in an .info file array with a given path.
- *
- * This helper function is mainly used to prefix all array values of an .info
- * file property with a single given path (to the module or theme); e.g., to
- * prefix all values of the 'stylesheets' or 'scripts' properties with the file
- * path to the defining module/theme.
- *
- * @param $info
- * A nested array of data of an .info file to be processed.
- * @param $path
- * A file path to prepend to each value in $info.
- *
- * @return
- * The $info array with prefixed values.
- *
- * @see _system_rebuild_module_data()
- * @see _system_rebuild_theme_data()
- */
- function _system_info_add_path($info, $path) {
- foreach ($info as $key => $value) {
-
- if (is_array($value)) {
- $info[$key] = _system_info_add_path($info[$key], $path);
- }
-
-
- else {
- unset($info[$key]);
- $info[$value] = $path . '/' . $value;
- }
- }
- return $info;
- }
-
- * Settings form for the header block.
- */
- function system_header_block_form($settings) {
- $settings += array(
- 'menu' => 'user-menu',
- 'logo' => TRUE,
- 'site_name' => TRUE,
- 'site_slogan' => TRUE,
- );
-
- $form['menu'] = array(
- '#title' => t('Menu'),
- '#type' => 'select',
- '#options' => menu_get_menus(),
- '#empty_option' => '- ' . t('None') . ' -',
- '#default_value' => $settings['menu'],
- );
- $form['components'] = array(
- '#type' => 'fieldset',
- '#title' => t('Site information'),
- '#description' => t('Show or hide various components of your site header. To change the values of these components, visit the !site_info page.',
- array('!site_info' => l(t('Site information'), 'admin/config/system/site-information'))),
- );
- $form['components']['logo'] = array(
- '#type' => 'checkbox',
- '#title' => t('Logo'),
- '#default_value' => $settings['logo'],
- );
- $form['components']['site_name'] = array(
- '#type' => 'checkbox',
- '#title' => t('Site name'),
- '#default_value' => $settings['site_name'],
- );
- $form['components']['site_slogan'] = array(
- '#type' => 'checkbox',
- '#title' => t('Site slogan'),
- '#default_value' => $settings['site_slogan'],
- );
-
- return $form;
- }
-
- * Output the content for the header block.
- *
- * @see system_block_view()
- */
- function system_header_block($settings) {
- $settings += array(
- 'menu' => 'user-menu',
- 'logo' => TRUE,
- 'site_name' => TRUE,
- 'site_slogan' => TRUE,
- );
-
- $menu = $settings['menu'] ? menu_navigation_links($settings['menu']) : NULL;
- $site_config = config('system.core');
- $variables['logo'] = $settings['logo'] ? backdrop_get_logo() : NULL;
- $variables['logo_attributes'] = $settings['logo'] ? array_diff_key(backdrop_get_logo_info(), array('path' => '')) : array();
- $variables['site_name'] = $settings['site_name'] ? check_plain($site_config->getTranslated('site_name')) : '';
- $variables['site_slogan'] = $settings['site_slogan'] ? filter_xss_admin($site_config->getTranslated('site_slogan')) : '';
- $variables['menu'] = $menu ? theme('links__header_menu', array('links' => $menu)) : NULL;
-
- return theme('header', $variables);
- }
-
- * Output the content for the breadcrumb block.
- *
- * @see system_block_view()
- */
- function system_breadcrumb_block($settings = array()) {
- $crumbs = backdrop_get_breadcrumb();
- if (isset($settings['current']) && $settings['current'] == TRUE) {
- $crumbs[] = '<span>' . backdrop_get_title() . '</span>';
- }
-
- return theme('breadcrumb', array('breadcrumb' => $crumbs));
- }
-
- * Helper function to sort requirements.
- */
- function _system_sort_requirements($a, $b) {
- if (!isset($a['weight'])) {
- if (!isset($b['weight'])) {
- return strcasecmp($a['title'], $b['title']);
- }
- return -$b['weight'];
- }
- return isset($b['weight']) ? $a['weight'] - $b['weight'] : $a['weight'];
- }
-
- * Generates a form array for a confirmation form.
- *
- * This function returns a complete form array for confirming an action. The
- * form contains a confirm button as well as a cancellation link that allows a
- * user to abort the action.
- *
- * If the submit handler for a form that implements confirm_form() is invoked,
- * the user successfully confirmed the action. You should never directly
- * inspect $_POST to see if an action was confirmed.
- *
- * Note - if the parameters $question, $description, $yes, or $no could contain
- * any user input (such as node titles or taxonomy terms), it is the
- * responsibility of the code calling confirm_form() to sanitize them first with
- * a function like check_plain() or filter_xss().
- *
- * @param $form
- * Additional elements to add to the form. These can be regular form elements,
- * #value elements, etc., and their values will be available to the submit
- * handler.
- * @param $question
- * The question to ask the user (e.g. "Are you sure you want to delete the
- * block <em>foo</em>?"). The page title will be set to this value.
- * @param $path
- * The page to go to if the user cancels the action. This can be either:
- * - A string containing a Backdrop path.
- * - An associative array with a 'path' key. Additional array values are
- * passed as the $options parameter to l().
- * If the 'destination' query parameter is set in the URL when viewing a
- * confirmation form, that value will be used instead of $path.
- * @param $description
- * Additional text to display. Defaults to t('This action cannot be undone.').
- * @param $yes
- * A caption for the button that confirms the action (e.g. "Delete",
- * "Replace", ...). Defaults to t('Confirm').
- * @param $no
- * A caption for the link which cancels the action (e.g. "Cancel"). Defaults
- * to t('Cancel').
- * @param $name
- * The internal name used to refer to the confirmation item.
- *
- * @return
- * The form array.
- */
- function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $no = NULL, $name = 'confirm') {
- $description = isset($description) ? $description : t('This action cannot be undone.');
-
-
- if (isset($_GET['destination'])) {
- $options = backdrop_parse_url($_GET['destination']);
- }
- elseif (is_array($path)) {
- $options = $path;
- }
- else {
- $options = array('path' => $path);
- }
-
- backdrop_set_title($question, PASS_THROUGH);
-
- $form['#attributes']['class'][] = 'confirmation';
- $form['description'] = array('#markup' => $description);
- $form[$name] = array('#type' => 'hidden', '#value' => 1);
-
- $form['actions'] = array('#type' => 'actions');
- $form['actions']['submit'] = array(
- '#type' => 'submit',
- '#value' => $yes ? $yes : t('Confirm'),
- '#attributes' => array('class' => array('button-danger')),
- );
- $form['actions']['cancel'] = array(
- '#type' => 'link',
- '#title' => $no ? $no : t('Cancel'),
- '#href' => $options['path'],
- '#options' => $options,
- );
-
- if (!isset($form['#theme'])) {
- $form['#theme'] = 'confirm_form';
- }
- return $form;
- }
-
- * Generate a jump menu form.
- *
- * A jump menu is a select box and an optional 'go' button which can be removed
- * if JavaScript is in use. Each item is keyed to the href that the button
- * should go to. With JavaScript, the page is immediately redirected. Without
- * javascript, the form is submitted and a backdrop_goto() is given.
- *
- * This can either be used with backdrop_get_form() or directly added to a
- * form. The button provides its own submit handler so by default, other
- * submit handlers will not be called.
- *
- * Do not use #tree = TRUE in jump menu forms or it will be unable to find the
- * proper value.
- *
- * @code
- * $output = backdrop_get_form('system_jump_menu', $targets, $options);
- * @endcode
- *
- * @param $select
- * An array suitable for use as the #options. The keys will be the direct
- * URLs that will be jumped to, so you absolutely must encode these using
- * url() in order for them to work reliably.
- *
- * @param $options
- * $options may be an array with the following options:
- * - 'title': The text to display for the #title attribute.
- * - 'description': The text to display for the #description attribute.
- * - 'default_value': The text to display for the #default_value attribute.
- * - 'hide': If TRUE the go button will be set to hide via javascript and
- * will submit on change.
- * - 'button': The text to display on the button.
- * - 'image': If set, an image button will be used instead, and the image
- * set to this.
- * - 'inline': If set to TRUE (default) the display will be forced inline.
- */
- function system_jump_menu($form, &$form_state, $select, $options = array()) {
- $options += array(
- 'button' => t('Go'),
- 'choose' => t('- Choose -'),
- 'inline' => TRUE,
- 'hide' => TRUE,
- );
-
- $form['#attached']['library'][] = array('system', 'jump-menu');
-
- if (!empty($options['choose'])) {
- $select = array('' => $options['choose']) + $select;
- }
-
- $form['jump'] = array(
- '#type' => 'select',
- '#options' => $select,
- '#attributes' => array(
- 'class' => array('jump-menu-select'),
- ),
- );
-
- if (!empty($options['title'])) {
- $form['jump']['#title'] = $options['title'];
- }
-
- if (!empty($options['description'])) {
- $form['jump']['#description'] = $options['description'];
- }
-
- if (!empty($options['default_value'])) {
- $form['jump']['#default_value'] = $options['default_value'];
- }
-
- if (isset($options['image'])) {
- $form['go'] = array(
- '#type' => 'image_button',
- '#src' => $options['image'],
- '#submit' => array('system_jump_menu_submit'),
- '#attributes' => array(
- 'class' => array('jump-menu-button'),
- ),
- );
- }
- else {
- $form['go'] = array(
- '#type' => 'submit',
- '#value' => $options['button'],
- '#submit' => array('system_jump_menu_submit'),
- '#attributes' => array(
- 'class' => array('jump-menu-button'),
- ),
- );
- }
-
- if ($options['inline']) {
- $form['jump']['#prefix'] = '<div class="container-inline">';
- $form['go']['#suffix'] = '</div>';
- }
-
- if ($options['hide']) {
- $form['jump']['#attributes']['class'][] = 'jump-menu-change';
- $form['go']['#attributes']['class'][] = 'jump-menu-hide';
- }
-
- return $form;
- }
-
- * Submit handler for the jump menu.
- *
- * This is normally only invoked upon submit without javascript enabled.
- */
- function system_jump_menu_submit($form, &$form_state) {
- if ($form_state['values']['jump'] === '') {
-
- return;
- }
-
-
-
-
- $redirect_array = explode("::", $form_state['values']['jump']);
-
- if(isset($redirect_array[1]) && !empty($redirect_array[1])){
- $redirect = $redirect_array[1];
- }
- else {
- $redirect = $form_state['values']['jump'];
- }
-
-
-
-
- $base_path = base_path();
- if (strpos($redirect, $base_path) === 0) {
- $redirect = substr($redirect, strlen($base_path));
- }
-
-
-
- $redirect = backdrop_parse_url($redirect);
- $redirect['path'] = urldecode($redirect['path']);
- $form_state['redirect'] = array($redirect['path'], $redirect);
- }
-
- * Generate a list of tasks offered by a specified module.
- *
- * @param $module
- * Module name.
- * @param $info
- * The module's information, as provided by system_get_info().
- *
- * @return
- * An array of task links.
- */
- function system_get_module_admin_tasks($module, $info) {
- $links = &backdrop_static(__FUNCTION__);
-
- if (!isset($links)) {
- $links = array();
- $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC));
- $query->join('menu_router', 'm', 'm.path = ml.router_path');
- $query
- ->fields('ml')
-
- ->fields('m', array_diff(backdrop_schema_fields_sql('menu_router'), array('weight')))
- ->condition('ml.link_path', 'admin/%', 'LIKE')
- ->condition('ml.hidden', 0, '>=')
- ->condition('ml.module', 'system')
- ->condition('m.number_parts', 1, '>')
- ->condition('m.page_callback', 'system_admin_menu_block_page', '<>');
- foreach ($query->execute() as $link) {
- _menu_link_translate($link);
- if ($link['access']) {
- $links[$link['router_path']] = $link;
- }
- }
- }
-
- $admin_tasks = array();
- $titles = array();
- if ($menu = module_invoke($module, 'menu')) {
- foreach ($menu as $path => $item) {
- if (isset($links[$path])) {
- $task = $links[$path];
-
-
- if (!empty($task['localized_options']['attributes']['title'])) {
- $task['description'] = $task['localized_options']['attributes']['title'];
- unset($task['localized_options']['attributes']['title']);
- }
-
-
-
- $duplicate_path = array_search($task['title'], $titles);
- if ($duplicate_path !== FALSE) {
- if ($parent = menu_link_load($task['plid'])) {
-
- $task['title'] = t('@original_title (@parent_title)', array('@original_title' => $task['title'], '@parent_title' => $parent['title']));
- }
- if ($parent = menu_link_load($admin_tasks[$duplicate_path]['plid'])) {
-
-
- $admin_tasks[$duplicate_path]['title'] = t('@original_title (@parent_title)', array('@original_title' => $links[$duplicate_path]['title'], '@parent_title' => $parent['title']));
- }
- }
- else {
- $titles[$path] = $task['title'];
- }
-
- $admin_tasks[$path] = $task;
- }
- }
- }
-
-
- if (module_hook($module, 'permission')) {
- $item = menu_get_item('admin/config/people/permissions');
- if (!empty($item['access'])) {
- $item['link_path'] = $item['href'];
- $item['title'] = t('Configure @module permissions', array('@module' => $info['name']));
- unset($item['description']);
- $item['localized_options']['fragment'] = 'module-' . $module;
- $admin_tasks["admin/config/people/permissions#module-$module"] = $item;
- }
- }
-
- return $admin_tasks;
- }
-
- * Implements hook_cron().
- *
- * Remove older rows from flood and batch table. Remove old temporary files.
- */
- function system_cron() {
-
- db_delete('flood')
- ->condition('expiration', REQUEST_TIME, '<')
- ->execute();
-
-
- db_delete('tempstore')
- ->condition('expire', REQUEST_TIME, '<')
- ->execute();
-
-
-
-
- $result = db_query('SELECT fid FROM {file_managed} WHERE status <> :permanent AND timestamp < :timestamp', array(
- ':permanent' => FILE_STATUS_PERMANENT,
- ':timestamp' => REQUEST_TIME - BACKDROP_MAXIMUM_TEMP_FILE_AGE
- ));
- foreach ($result as $row) {
- if ($file = file_load($row->fid)) {
- $references = file_usage_list($file);
- if (empty($references)) {
- $file->delete();
- }
- else {
- watchdog('file system', 'Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);
- }
- }
- }
-
-
-
-
-
-
- $cache_object = cache_get('system_cache_tables');
- if (empty($cache_object)) {
- $core = array('cache', 'path', 'filter', 'page', 'menu');
- $cache_bins = array_merge(module_invoke_all('flush_caches'), $core);
- cache_set('system_cache_tables', $cache_bins);
- }
- else {
- $cache_bins = $cache_object->data;
- }
- foreach ($cache_bins as $bin) {
- cache($bin)->garbageCollection();
- }
-
-
- db_delete('batch')
- ->condition('timestamp', REQUEST_TIME - 864000, '<')
- ->execute();
- db_delete('queue')
- ->condition('created', REQUEST_TIME - 864000, '<')
- ->condition('name', 'backdrop_batch:%', 'LIKE')
- ->execute();
-
-
-
- db_update('queue')
- ->fields(array(
- 'expire' => 0,
- ))
- ->condition('expire', 0, '<>')
- ->condition('expire', REQUEST_TIME, '<')
- ->execute();
- }
-
- * Implements hook_flush_caches().
- */
- function system_flush_caches() {
-
- menu_reset_static_cache();
- }
-
- * Implements hook_mail().
- */
- function system_mail($key, &$message, $params) {
- $context = $params['context'];
-
- $subject = token_replace($context['subject'], $context);
- $body = token_replace($context['message'], $context);
-
- $message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
- $message['body'][] = $body;
- }
-
- * Generate an array of time zones and their local time&date.
- *
- * @param $blank
- * If evaluates true, prepend an empty time zone option to the array.
- */
- function system_time_zones($blank = NULL) {
- $zonelist = timezone_identifiers_list();
- $zones = $blank ? array('' => t('- None selected -')) : array();
- foreach ($zonelist as $zone) {
-
-
-
- if (preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone)) {
- $zones[$zone] = t('@zone: @date', array('@zone' => t(str_replace('_', ' ', $zone)), '@date' => format_date(REQUEST_TIME, 'custom', config_get('system.date', 'formats.long.pattern.php') . ' O', $zone)));
- }
- }
-
- asort($zones);
- return $zones;
- }
-
- * Checks whether the server is capable of issuing HTTP requests.
- *
- * The function sets the backdrop_http_request_fail system variable to TRUE if
- * backdrop_http_request() does not work and then the system status report page
- * will contain an error.
- *
- * Note that this check was never 100% reliable. On some web servers, it would
- * return FALSE even if external requests were allowed. Use of this function
- * has been deprecated and it will be removed in Backdrop 2.0.
- *
- * @return
- * TRUE if this installation can issue HTTP requests.
- *
- * @deprecated since 1.3.1
- */
- function system_check_http_request() {
- watchdog_deprecated_function('system', __FUNCTION__);
-
- $result = backdrop_http_request(url('', array('absolute' => TRUE)), array('max_redirects' => 0, 'timeout' => 10));
-
-
- $works = isset($result->code) && ($result->code >= 100) && ($result->code < 600);
- return $works;
- }
-
- * Menu callback; Retrieve a JSON object containing a suggested time zone name.
- */
- function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_time = NULL) {
-
-
- $abbreviation = $abbreviation ? $abbreviation : '';
- $timezone = timezone_name_from_abbr($abbreviation, intval($offset), $is_daylight_saving_time);
- return array('timezone' => $timezone);
- }
-
- * Implements hook_image_toolkits().
- */
- function system_image_toolkits() {
- include_once BACKDROP_ROOT . '/' . backdrop_get_path('module', 'system') . '/image.gd.inc';
- return array(
- 'gd' => array(
- 'title' => t('GD2 image manipulation toolkit'),
- 'available' => function_exists('image_gd_check_settings') && image_gd_check_settings(),
- ),
- );
- }
-
- * Implements hook_image_supported_extensions_alter().
- *
- * Add webp to supported file extensions if GD is the active image toolkit and
- * the GD version supports WebP.
- */
- function system_image_supported_extensions_alter(&$supported_extensions) {
- if (config_get('system.core', 'image_toolkit') == 'gd' && defined('IMAGETYPE_WEBP')) {
- $gd_info = gd_info();
- if (isset($gd_info['WebP Support']) && $gd_info['WebP Support'] == TRUE) {
- $supported_extensions[] = 'webp';
- }
- }
- }
-
- * Attempts to get a file using backdrop_http_request and to store it locally.
- *
- * @param string $url
- * The URL of the file to grab.
- * @param string $destination
- * Stream wrapper URI specifying where the file should be placed. If a
- * directory path is provided, the file is saved into that directory under
- * its original name. If the path contains a filename as well, that one will
- * be used instead.
- * If this value is omitted, the site's default files scheme will be used,
- * usually "public://".
- * @param bool $managed
- * If this is set to TRUE, the file API hooks will be invoked and the file is
- * registered in the database.
- * @param int $replace
- * Replace behavior when the destination file already exists:
- * - FILE_EXISTS_REPLACE: Replace the existing file.
- * - FILE_EXISTS_RENAME: Append _{incrementing number} until the filename is
- * unique.
- * - FILE_EXISTS_ERROR: Do nothing and return FALSE.
- *
- * @return mixed
- * One of these possibilities:
- * - If it succeeds and $managed is FALSE, the location where the file was
- * saved.
- * - If it succeeds and $managed is TRUE, a FileInterface object which
- * describes the file.
- * - If it fails, FALSE.
- */
- function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $replace = FILE_EXISTS_RENAME) {
- $parsed_url = parse_url($url);
- if (!isset($destination)) {
- $path = file_build_uri(backdrop_basename($parsed_url['path']));
- }
- else {
- if (is_dir(backdrop_realpath($destination))) {
-
- $path = str_replace('///', '//', "$destination/") . backdrop_basename($parsed_url['path']);
- }
- else {
- $path = $destination;
- }
- }
- $result = backdrop_http_request($url);
- if ($result->code != 200) {
- backdrop_set_message(t('HTTP error @errorcode occurred when trying to fetch @remote.', array('@errorcode' => $result->code, '@remote' => $url)), 'error');
- return FALSE;
- }
- $local = $managed ? file_save_data($result->data, $path, $replace) : file_unmanaged_save_data($result->data, $path, $replace);
- if (!$local) {
- backdrop_set_message(t('@remote could not be saved to @path.', array('@remote' => $url, '@path' => $path)), 'error');
- }
-
- return $local;
- }
-
- * Run the automated cron if enabled.
- */
- function system_run_automated_cron() {
-
-
-
- if (($threshold = config('system.core')->get('cron_safe_threshold')) > 0 && state_get('install_task') == 'done') {
- $cron_last = state_get('cron_last', NULL);
- if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) {
- backdrop_cron_run();
- }
- }
- }
-
- * Gets the list of defined date formats and attributes.
- *
- * @param $date_format_name
- * (optional) The date type name.
- *
- * @return
- * An associative array of date formats. The top-level keys are the
- * machine-readable names of the date formats. The values are associative
- * arrays with the following keys:
- * - name: The string human readable name of the date format.
- * - pattern: The pattern string as usable by the PHP date() function.
- *
- * If $date_format_name was defined, only the date formats associated with the
- * given machine name are returned, in an associative array keyed by format
- * string.
- */
- function system_get_date_formats($date_format_name = NULL) {
- $date_formats = &backdrop_static(__FUNCTION__, array());
- if (empty($date_formats)) {
- $date_formats = config_get('system.date', 'formats');
- foreach ($date_formats as $name => $format) {
- $date_formats[$name]['name'] = $name;
- }
- }
-
-
- if (empty($date_format_name)) {
- return $date_formats;
- }
- else {
- return isset($date_formats[$date_format_name]) ? $date_formats[$date_format_name] : FALSE;
- }
- }
-
- * Menu loader function for a date format.
- *
- * @param string $date_format_name
- * The date type name.
- * @param bool $include_hidden
- * Include hidden, non-configurable date formats, such as those used by HTML5
- * date/time elements.
- *
- * @return mixed
- * The date format array if it exists and is not hidden, FALSE otherwise.
- */
- function system_date_format_load($date_format_name, $include_hidden = TRUE) {
- if (($format = system_get_date_formats($date_format_name)) && ($include_hidden || empty($format['hidden']))) {
- return $format;
- }
- return FALSE;
- }
-
- * Saves a date format to the database.
- *
- * @param array $date_format
- * A date format array containing the following keys:
- * - name: The machine name of this date format.
- * - label: The human-readable label for this date format.
- * - pattern: The pattern string as usable by the PHP date() function.
- * - langcode: Optional. If multiple languages are available, this specifies
- * which language the default format is in.
- * - module: If provided by a module, the name of the providing module. This
- * will prevent the format from being deleted in the UI.
- * - hidden: Optional. A boolean indicating whether or not this format should
- * be configurable from the user interface.
- *
- * @see http://php.net/date
- */
- function system_date_format_save($date_format) {
- $format = array(
- 'label' => $date_format['label'],
- 'pattern' => $date_format['pattern'],
- );
-
- if (isset($date_format['locales'])) {
- $date_format['locales'] = array_filter(array_filter($date_format['locales'], 'trim'));
- }
-
- foreach (array('module', 'hidden', 'locales') as $key) {
- if (!empty($date_format[$key])) {
- $format[$key] = $date_format[$key];
- }
- }
- config_set('system.date', 'formats.' . $date_format['name'], $format);
- backdrop_static_reset('system_get_date_formats');
- }
-
- * Deletes a date format from the database.
- *
- * @param $date_format_name
- * The date format ID.
- */
- function system_date_format_delete($date_format_name) {
-
- $format = system_get_date_formats($date_format_name);
- if (isset($format['module'])) {
- return FALSE;
- }
-
- $format_id = 'formats.' . $date_format_name;
- config('system.date')->clear($format_id)->save();
- backdrop_static_reset('system_get_date_formats');
- }
-
- * Implements hook_archiver_info().
- */
- function system_archiver_info() {
- $archivers['tar'] = array(
- 'class' => 'ArchiverTar',
- 'extensions' => array('tar', 'tgz', 'tar.gz', 'tar.bz2'),
- );
- if (class_exists('ZipArchive')) {
- $archivers['zip'] = array(
- 'class' => 'ArchiverZip',
- 'extensions' => array('zip'),
- );
- }
- return $archivers;
- }
-
- * Implements hook_autoload_info().
- */
- function system_autoload_info() {
- return array(
- 'ArchiverTar' => 'system.archiver.inc',
- 'ArchiverZip' => 'system.archiver.inc',
- 'DefaultMailSystem' => 'system.mail.inc',
- 'TestingMailSystem' => 'system.mail.inc',
- 'BackdropQueue' => 'system.queue.inc',
- 'BackdropQueueInterface' => 'system.queue.inc',
- 'BackdropReliableQueueInterface' => 'system.queue.inc',
- 'SystemQueue' => 'system.queue.inc',
- 'MemoryQueue' => 'system.queue.inc',
- 'Archive_Tar' => 'system.tar.inc',
- 'CoreUpdater' => 'system.updater.inc',
- 'ModuleUpdater' => 'system.updater.inc',
- 'ThemeUpdater' => 'system.updater.inc',
- 'LayoutUpdater' => 'system.updater.inc',
-
-
- 'PageComponents' => 'block.page_components.inc',
-
-
- 'views_handler_filter_system_type' => 'views/views_handler_filter_system_type.inc',
- );
- }
-
- * Implements hook_config_info().
- */
- function system_config_info() {
- $prefixes['system.core'] = array(
- 'label' => t('System core settings'),
- 'group' => t('Configuration'),
- );
- $prefixes['system.authorize'] = array(
- 'label' => t('System authorize'),
- 'group' => t('Configuration'),
- );
- $prefixes['system.date'] = array(
- 'label' => t('System date'),
- 'group' => t('Configuration'),
- );
- $prefixes['system.mail'] = array(
- 'label' => t('Mail systems'),
- 'group' => t('Configuration'),
- );
-
-
- $themes = list_themes();
- foreach ($themes as $theme_name => $theme) {
-
- if (theme_has_settings($theme_name) && $theme->status == 1) {
- $prefixes[$theme_name . '.settings'] = array(
- 'label' => t('!theme settings', array('!theme' => $theme->info['name'])),
- 'group' => t('Configuration'),
- );
- }
- }
-
- return $prefixes;
- }
-
- * Implements hook_system_info_alter().
- *
- * @deprecated since 1.1
- * This function should not be necessary in Backdrop 2.0, where modules
- * built-into core no longer need to be prevented from enabling.
- */
- function system_system_info_alter(&$info, $file, $type) {
- if (in_array($file->name, backdrop_merged_modules())) {
-
- $info['merged_into_core'] = TRUE;
-
- $info['backdrop'] = NULL;
- }
- }
-
- * Menu callback; Returns the standard "Page not found" error page.
- */
- function system_404() {
- return t('The requested page "@path" could not be found.', array('@path' => request_uri()));
- }
-
- * Menu callback; Returns the standard "Page not found" error page.
- */
- function system_403() {
- return t('You are not authorized to access this page.');
- }
-
- * Menu callback; Autocomplete callback for paths.
- *
- * @param string $string
- * The string to find matches for.
- */
- function path_autocomplete($string = '') {
- $matches = array();
- $match_count = 0;
- $range = 10;
-
- if ($string) {
-
- $results = db_select('node')
- ->fields('node', array('nid', 'type', 'title', 'status'))
- ->condition('title', '%' . db_like($string) . '%', 'LIKE')
- ->condition('status', 1)
- ->addTag('node_access')
- ->orderBy('nid', 'DESC')
- ->range(0, $range)
- ->execute();
- foreach ($results as $result) {
- $path = backdrop_get_path_alias('node/' . $result->nid);
- $match = '<span class="autocomplete-suggestion">' . $result->title . '</span>';
- $match_description = t('Content: %type', array('%type' => node_type_get_name($result->type)));
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
-
-
- if (user_access('manage files') && $match_count < $range) {
- $results = db_select('file_managed')
- ->fields('file_managed', array('fid', 'filename', 'uri', 'filemime', 'status', 'type'))
- ->condition('filename', '%' . db_like($string) . '%', 'LIKE')
- ->condition('status', 1)
- ->condition('filemime', 'image%', 'NOT LIKE')
- ->orderBy('fid', 'DESC')
- ->range(0, $range - $match_count)
- ->execute();
- foreach ($results as $result) {
-
- $absolute_path = parse_url($GLOBALS['base_url'], PHP_URL_PATH) . '/';
- $url = file_create_url($result->uri);
- $path = str_replace($GLOBALS['base_url'] . '/', $absolute_path, $url);
- $match = '<span class="autocomplete-suggestion">' . $result->filename . '</span>';
- $match_description = t('File: %type', array('%type' => file_type_get_name($result->type)));
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
-
-
- if (user_access('access user profiles') && $match_count < $range) {
- $results = db_select('users')
- ->fields('users', array('uid', 'name'))
- ->condition('name', '%' . db_like($string) . '%', 'LIKE')
- ->range(0, $range - $match_count)
- ->orderBy('uid', 'DESC')
- ->execute();
-
- $uids = array();
- foreach ($results as $result) {
- $uids[] = $result->uid;
- }
- if (!empty($uids)) {
- $users = user_load_multiple($uids);
- foreach ($users as $user) {
- $path = backdrop_get_path_alias('user/' . $user->uid);
- $match = '<span class="autocomplete-suggestion">' . user_format_name($user) . '</span>';
- $match_description = t('User account');
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
- }
-
-
- if (module_exists('taxonomy') && $match_count < $range) {
- $results = db_select('taxonomy_term_data')
- ->fields('taxonomy_term_data', array('tid', 'vocabulary', 'name'))
- ->condition('name', '%' . db_like($string) . '%', 'LIKE')
- ->addTag('taxonomy_term_access')
- ->range(0, $range - $match_count)
- ->orderBy('tid', 'DESC')
- ->execute();
- foreach ($results as $result) {
- $path = backdrop_get_path_alias('taxonomy/term/' . $result->tid);
- $match = '<span class="autocomplete-suggestion">' . $result->name . '</span>';
- $match_description = t('Taxonomy term: %vocabulary', array('%vocabulary' => taxonomy_vocabulary_load($result->vocabulary)->name));
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
-
-
- if ($match_count < $range) {
- $views = views_get_enabled_views();
- foreach ($views as $view) {
- foreach ($view->display as $display_id => $display) {
- if ($view->access($display_id) && $display->display_plugin == 'page' && !empty($display->display_options['path'])) {
- $path = backdrop_get_path_alias($display->display_options['path']);
- if (!path_is_admin($path)) {
- $found_match = FALSE;
-
- if (!empty($display->display_options['title']) && stripos($display->display_options['title'], $string) !== FALSE) {
- $found_match = TRUE;
- $view_title = $display->display_options['title'];
- }
-
- elseif (!empty($view->display['default']->display_options['title']) && stripos($view->display['default']->display_options['title'], $string) !== FALSE) {
- $found_match = TRUE;
- $view_title = $view->display['default']->display_options['title'];
- }
-
- elseif (stripos($view->human_name, $string) !== FALSE) {
- $found_match = TRUE;
- $view_title = $view->human_name;
- }
- if ($found_match) {
- $match = '<span class="autocomplete-suggestion">' . $view_title . '</span>';
- $match_description = t('View: %human - %display', array('%human' => $view->human_name, '%display' => $display->display_title));
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
- }
- if ($match_count == $range) {
- break 2;
- }
- }
- }
- }
-
-
- if ($match_count < $range) {
- $menu_items = layout_get_all_configs('menu_item');
- foreach ($menu_items as $menu_item) {
- if ($match_count < $range) {
- $found_match = FALSE;
- if (!empty($menu_item['menu']['title']) && stripos($menu_item['menu']['title'], $string) !== FALSE) {
- $found_match = TRUE;
- $layout_title = $menu_item['menu']['title'];
- }
- elseif (stripos($menu_item['name'], $string) !== FALSE) {
- $found_match = TRUE;
- $layout_title = $menu_item['name'];
- }
- if ($found_match) {
- $match = '<span class="autocomplete-suggestion">' . $layout_title . '</span>';
- $match_description = t('Layout: %display', array('%display' => $menu_item['name']));
- $matches[$menu_item['path']] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
- }
- }
-
-
- if ($match_count < $range) {
- $results = db_select('menu_links')
- ->fields('menu_links', array('link_title', 'link_path'))
- ->condition('link_title', '%' . db_like($string) . '%', 'LIKE')
- ->condition('link_path', '%' . db_like('%') . '%', 'NOT LIKE')
- ->range(0, $range)
- ->execute();
- foreach ($results as $result) {
- $path = backdrop_get_path_alias($result->link_path);
- if (!isset($matches[$path]) && !path_is_admin($path)) {
- $match = '<span class="autocomplete-suggestion">' . $result->link_title . '</span>';
- $match_description = t('Menu item: %path', array('%path' => $path));
- $matches[$path] = $match . ' <span class="autocomplete-description">(' . $match_description . ')</span>';
- $match_count++;
- }
- }
- }
- }
-
-
- backdrop_alter('path_autocomplete', $matches, $string);
- backdrop_json_output($matches);
- }
-
- * Menu callback; Redirects a deprecated menu location to a new path.
- *
- * This wrapper around backdrop_goto_deprecated() should be used as the menu
- * callback in hook_menu() when redirecting from an old path to a new one.
- *
- * @param string $path
- * The path to which the user should be redirected. Because this is intended
- * to be used as a page callback, the old path is pulled from the current
- * menu location (the $_GET['q'] variable).
- * @param array $argument_map
- * If the old path and new path have differing argument orders, this can be
- * used to map an argument from one position to another. An old path of
- * "my-module/%key-one/edit/%" could be redirected to
- * "my-module/configure/%key-one/%" by setting a map such as:
- * @code
- * array(
- * 1 => 2
- * 3 => 3
- * );
- * @endcode
- *
- * Note that this map is zero-indexed.
- *
- * @see arg()
- *
- * @since 1.19.0 Function added.
- */
- function system_redirect_deprecated_page($path, $argument_map = array()) {
-
-
- $argument_map = array_flip($argument_map);
-
-
- $parts = explode('/', $path);
- foreach ($parts as $index => $path_part) {
- if (backdrop_substr($path_part, 0, 1) === '%') {
- if (!empty($argument_map)) {
- $parts[$index] = arg($argument_map[$index]);
- }
- else {
- $parts[$index] = arg($index);
- }
- }
- }
- $path = implode('/', $parts);
-
- backdrop_goto_deprecated($path);
- }
-
- * Implements hook_admin_paths().
- */
- function system_admin_paths() {
- $paths = array(
- 'admin' => TRUE,
- 'admin/*' => TRUE,
- 'batch' => TRUE,
-
-
- 'admin/reports/status/php' => FALSE,
- );
- return $paths;
- }
-
- * Sets up a form to save information automatically.
- *
- * This function adds a submit handler and a submit button to a form array. The
- * submit function saves all the data in the form.
- *
- * If $form['#config'] is present in the form, the values will be saved to the
- * named settings file (e.g., mymodule.settings). If sub-elements or groups of
- * sub-elements have their own '#config' keys, then values of those elements and
- * their children will be saved to that settings file.
- *
- * For example, consider the form:
- *
- * @code
- * $primary_config = config('mymodule.settings');
- * $secondary_config = config('mymodule.second');
- * $tertiary_config = config('mymodule.third');
- * $form = array(
- * '#config' => 'mymodule.settings',
- * 'first_setting' => array(
- * '#type' => 'textfield',
- * '#title' => t('First Setting'),
- * '#default_setting' => $settings_config->get('first_setting'),
- * ),
- * 'second_setting' => array( ... ),
- *
- * 'bonus_fieldset' => array(
- * '#type' => 'fieldset',
- * '#title' => t('Secondary Settings'),
- * '#config' => 'mymodule.second',
- *
- * 'bonus_one' => array( ... ),
- * 'bonus_two' => array( ... ),
- *
- * 'bonus_three' => array(
- * '#type' => 'textfield',
- * '#default_setting' => $tertiary_config->get('bonus_three'),
- * '#config' => 'mymodule.third',
- * ),
- * ),
- * );
- * @endcode
- *
- * The top-level '#config' is "mymodule.settings". The values of 'first_setting'
- * and 'second_setting' will both be saved to "mymodule.settings".
- *
- * The 'bonus_fieldset' has its own '#config' setting, "mymodule.second", which
- * overrides the top-level '#config' setting, so 'bonus_one' and 'bonus_two'
- * will be saved to "mymodule.second".
- *
- * The 'bonus_three' has its own '#config' setting, "mymodule.third", which
- * overrides the one from the fieldset. The value of 'bonus_three' will be
- * saved to the "mymodule.third".
- *
- * Modules that implement hook_form_alter() can use the '#config' settings to
- * save their data to their own settings file by setting the '#config' parameter
- * in thier elements or fieldsets.
- *
- * If no top-level $form['#config'] value is present, then the values will be
- * saved to variables using variable_set() from the Drupal compatibility layer.
- * This behavior is deprecated and will be remove in Backdrop 2.0.
- *
- * If you need to manipulate the data in a custom manner, you can either put
- * your own submission handler in the form array before calling this function,
- * or just use your own submission handler instead of calling this function.
- *
- * @param $form
- * An associative array containing the structure of the form.
- *
- * @return
- * The form structure.
- *
- * @see system_settings_form_submit()
- * @see _system_sort_form_values_by_config()
- *
- * @since 1.6.0 Restored and made compatible with configuration management.
- */
- function system_settings_form($form) {
- $form['actions']['#type'] = 'actions';
- $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
-
- if (empty($form['#config']) && !settings_get('backdrop_drupal_compatibility')) {
- backdrop_set_message(t('Drupal compatibility layer is disabled and this form has not been updated to use Backdrop configuration management. Changes will not be saved.'), 'warning');
- }
-
- if (!empty($_POST) && form_get_errors()) {
- backdrop_set_message(t('The settings have not been saved because of the errors.'), 'error');
- }
- $form['#submit'][] = 'system_settings_form_submit';
- if (!isset($form['#theme'])) {
- $form['#theme'] = 'system_settings_form';
- }
- return $form;
- }
-
- * Form submission handler for system_settings_form().
- *
- * If you want node type configure style handling of your checkboxes,
- * add an array_filter value to your form.
- *
- * @since 1.6.0 Restored and made compatible with configuration management.
- */
- function system_settings_form_submit($form, &$form_state) {
- form_state_values_clean($form_state);
-
- if (!empty($form['#config'])) {
- $configs = _system_sort_form_values_by_config($form, $form_state, $form['#config']);
- foreach ($configs as $bucket => $data) {
- config_set_multiple($bucket, $data);
- }
- }
- else {
- watchdog('form', 'Backdrop 2.0 and later will require forms using system_settings_form() to set $form[\'#config\'].', array(), WATCHDOG_DEPRECATED);
- if (!settings_get('backdrop_drupal_compatibility')) {
- backdrop_set_message(t('Settings not saved: Drupal compatibility layer is disabled and this form has not been updated to use Backdrop configuration management.', 'error'));
- return;
- }
-
- foreach ($form_state['values'] as $key => $value) {
- if (is_array($value) && isset($form_state['values']['array_filter'])) {
- $value = array_keys(array_filter($value));
- }
- variable_set($key, $value);
- }
- }
-
- backdrop_set_message(t('The configuration options have been saved.'));
- }
-
- * Sorts the $form_state['values'] array into CMI buckets by $form['#config'].
- *
- * This function recursively searches the form to assign values from
- * $form_state['values'] into specific CMI buckets. The top of $form must
- * contain a $form['#config'] entry with the name of the default CMI bucket
- * to use. If an element contains its own $form['#config'] entry, that CMI
- * bucket name will be used for that element and any child elements in the
- * form.
- *
- * @param $form
- * An associative array containing the structure of a portion of the form.
- * @param &$form_state
- * A keyed array containing the current state of the form.
- * @param $inherited_bucket
- * The name of the bucket to use if $form['#config'] is not set.
- * @param $configs
- * A keyed array that will contain the form values sorted by CMI bucket when
- * the function returns. Defaults to an empty array.
- * @return
- * Returns an array where the keys are the names of the CMI buckets (e.g.,
- * system.settings) and the values are key => value arrays of the settings
- * for each bucket.
- */
- function _system_sort_form_values_by_config($form, &$form_state, $inherited_bucket, $configs = array()) {
- foreach (element_children($form) as $key) {
- $form_fragment = $form[$key];
-
-
- $bucket = empty($form_fragment['#config']) ? $inherited_bucket : $form_fragment['#config'];
-
- if (array_key_exists($key, $form_state['values'])) {
- $configs[$bucket][$key] = $form_state['values'][$key];
- }
-
- if (is_array($form_fragment) && count(element_children($form_fragment))) {
- $configs = _system_sort_form_values_by_config($form_fragment, $form_state, $bucket, $configs);
- }
- }
- return $configs;
- }
-
- * Implements hook_admin_bar_cache_info().
- */
- function system_admin_bar_cache_info() {
- $caches = array(
- 'assets' => t('CSS and JavaScript'),
- 'cache' => t('Page and else'),
- 'layout' => t('Layout'),
- 'menu' => t('Menu'),
- 'theme' => t('Theme registry'),
- 'token' => t('Token registry'),
- );
- foreach ($caches as $name => $cache) {
- $caches[$name] = array(
- 'title' => $cache,
- 'callback' => '_admin_bar_flush_cache',
- );
- }
- return $caches;
- }
-
- * Check if theme_debug is enabled, and throw a warning if so.
- */
- function system_theme_debug_enabled_warning() {
- $theme_debug_enabled = config_get('system.core', 'theme_debug');
- if ($theme_debug_enabled) {
- backdrop_set_message(t('Theme debugging is enabled. See the <a href="!url">Status report</a> page for more info.', array('!url' => url('admin/reports/status'))), 'warning', FALSE);
- }
- }