Commit ed734b19 authored by Deciphered's avatar Deciphered Committed by pifagor

Issue #1989862 by Deciphered, Chris Matthews, pifagor: Add Variable module integration

parent 12d0d1d3
<?php
/**
* @file
* Variable module integration.
*/
/**
* Implements hook_variable_info().
*/
function xmlsitemap_variable_info() {
$variable = array();
$variable['xmlsitemap_base_url'] = array(
'title' => t('Default base URL'),
'description' => t('This is the default base URL used for sitemaps and sitemap links.'),
'default' => $GLOBALS['base_url'],
'required' => TRUE,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_batch_limit'] = array(
'type' => 'select',
'title' => t('Maximum number of sitemap links to process at once'),
'description' => t('If you have problems running cron or rebuilding the sitemap, you may want to lower this value.'),
'options' => drupal_map_assoc(array(5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000)),
'default' => 100,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_developer_mode'] = array(
'type' => 'boolean',
'title' => t('Enable developer mode to expose additional settings.'),
'default' => 0,
'group' => 'xmlsitemap',
);
module_load_include('admin.inc', 'xmlsitemap');
$variable['xmlsitemap_frontpage_changefreq'] = array(
'type' => 'select',
'title' => t('Frontpage change frequency'),
'options' => xmlsitemap_get_changefreq_options(),
'default' => XMLSITEMAP_FREQUENCY_DAILY,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_frontpage_priority'] = array(
'type' => 'select',
'title' => t('Frontpage priority'),
'options' => xmlsitemap_get_priority_options(),
'default' => 1.0,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_lastmod_format'] = array(
'type' => 'select',
'title' => t('Last modification date format'),
'options' => array(
XMLSITEMAP_LASTMOD_SHORT => t('Short'),
XMLSITEMAP_LASTMOD_MEDIUM => t('Medium'),
XMLSITEMAP_LASTMOD_LONG => t('Long'),
),
'default' => XMLSITEMAP_LASTMOD_MEDIUM,
'group' => 'xmlsitemap',
);
foreach ($variable['xmlsitemap_lastmod_format']['options'] as $key => &$label) {
$label .= ' (' . gmdate($key, REQUEST_TIME) . ')';
}
$variable['xmlsitemap_minimum_lifetime'] = array(
'type' => 'select',
'title' => t('Minimum sitemap lifetime'),
'options' => array(0 => t('No minimum')) + drupal_map_assoc(array(300, 900, 1800, 3600, 10800, 21600, 43200, 86400, 172800, 259200, 604800), 'format_interval'),
'description' => t('The minimum amount of time that will elapse before the sitemaps are regenerated. The sitemaps will also only be regenerated on cron if any links have been added, updated, or deleted.') . '<br />' . t('Recommended value: %value.', array('%value' => t('1 day'))),
'default' => 0,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_path'] = array(
'title' => t('Sitemap cache directory'),
'description' => t('Subdirectory where the sitemap data will be stored. This folder <strong>must not be shared</strong> with any other Drupal site or install using XML sitemap.'),
'default' => 'xmlsitemap',
'required' => TRUE,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_prefetch_aliases'] = array(
'type' => 'boolean',
'title' => t('Prefetch URL aliases during sitemap generation.'),
'description' => t('When enabled, this will fetch all URL aliases at once instead of one at a time during sitemap generation. For medium or large sites, it is recommended to disable this feature as it uses a lot of memory.'),
'default' => 1,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_xsl'] = array(
'type' => 'boolean',
'title' => t('Include a stylesheet in the sitemaps for humans.'),
'description' => t('When enabled, this will add formatting and tables with sorting to make it easier to view the XML sitemap data instead of viewing raw XML output. Search engines will ignore this.'),
'default' => 1,
'group' => 'xmlsitemap',
);
return $variable;
}
/**
* Implements hook_variable_group_info().
*/
function xmlsitemap_variable_group_info() {
$groups['xmlsitemap'] = array(
'title' => t('XML sitemap'),
'description' => t('XML sitemap configuration settings'),
'access' => 'administer xmlsitemap',
'path' => array('admin/config/search/xmlsitemap'),
);
return $groups;
}
<?php
/**
* @file
* Variable module integration.
*/
/**
* Implements hook_variable_info().
*/
function xmlsitemap_engines_variable_info() {
$variable = array();
$variable['xmlsitemap_engines_custom_urls'] = array(
'type' => 'text',
'title' => t('Custom submission URLs'),
'description' => t('Enter one URL per line. The token [sitemap] will be replaced with the URL to your sitemap. For example: %example-before would become %example-after.', array('%example-before' => 'http://example.com/ping?[sitemap]', '%example-after' => xmlsitemap_engines_prepare_url('http://example.com/ping?[sitemap]', url('sitemap.xml', array('absolute' => TRUE))))),
'default' => '',
'group' => 'xmlsitemap',
);
// Build the list of support engines for the checkboxes options.
$engines = xmlsitemap_engines_get_engine_info();
$engine_options = array();
foreach ($engines as $engine => $engine_info) {
$engine_options[$engine] = $engine_info['name'];
}
asort($engine_options);
$variable['xmlsitemap_engines_engines'] = array(
'type' => 'options',
'title' => t('Submit the sitemap to the following engines'),
'options' => $engine_options,
'default' => array(),
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_engines_minimum_lifetime'] = array(
'type' => 'select',
'title' => t('Do not submit more often than every'),
'options' => drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 604800 * 2, 604800 * 4), 'format_interval'),
'default' => 86400,
'group' => 'xmlsitemap',
);
$variable['xmlsitemap_engines_submit_updated'] = array(
'type' => 'boolean',
'title' => t('Only submit if the sitemap has been updated since the last submission.'),
'default' => TRUE,
'group' => 'xmlsitemap',
);
return $variable;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment