| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: xmlsitemap.xmlsitemap.inc,v 1.5.2.2 2010/04/29 16:22:09 davereid Exp $ 3 4 /** 5 * @file 6 * XML sitemap integration functions for xmlsitemap.module. 7 */ 8 9 /** 10 * Implements hook_xmlsitemap_link_info(). 11 */ 12 function xmlsitemap_xmlsitemap_link_info() { 13 return array( 14 'frontpage' => array( 15 'label' => t('Frontpage'), 16 'xmlsitemap' => array( 17 'settings callback' => 'xmlsitemap_link_frontpage_settings', 18 ), 19 ), 20 ); 21 } 22 23 /** 24 * XML sitemap link type settings callback for frontpage link entity. 25 */ 26 function xmlsitemap_link_frontpage_settings(&$form) { 27 module_load_include('admin.inc', 'xmlsitemap'); 28 if (user_access('administer site configuration')) { 29 $form['#description'] = t('The front page path can be changed at <a href="@url-frontpage">@url-frontpage</a>.', array('@url-frontpage' => url('admin/settings/site-information'))); 30 } 31 $form['xmlsitemap_frontpage_priority'] = array( 32 '#type' => 'select', 33 '#title' => t('Priority'), 34 '#options' => xmlsitemap_get_priority_options(), 35 '#default_value' => variable_get('xmlsitemap_frontpage_priority', 1.0), 36 ); 37 $form['xmlsitemap_frontpage_changefreq'] = array( 38 '#type' => 'select', 39 '#title' => t('Change frequency'), 40 '#options' => xmlsitemap_get_changefreq_options(), 41 '#default_value' => variable_get('xmlsitemap_frontpage_changefreq', XMLSITEMAP_FREQUENCY_DAILY), 42 ); 43 return $form; 44 } 45 46 /** 47 * Implements hook_xmlsitemap_link_alter(). 48 */ 49 function xmlsitemap_xmlsitemap_link_alter(&$link) { 50 // Alter the frontpage priority. 51 if ($link['type'] == 'frontpage' || $link['loc'] == '' || $link['loc'] == drupal_get_normal_path(variable_get('site_frontpage', 'node'))) { 52 $link['priority'] = variable_get('xmlsitemap_frontpage_priority', 1.0); 53 $link['changefreq'] = variable_get('xmlsitemap_frontpage_changefreq', XMLSITEMAP_FREQUENCY_DAILY); 54 } 55 } 56 57 /** 58 * Implements hook_xmlsitemap_links(). 59 */ 60 function xmlsitemap_xmlsitemap_links() { 61 // Frontpage link. 62 $links[] = array( 63 'type' => 'frontpage', 64 'id' => 0, 65 'loc' => '', 66 ); 67 return $links; 68 } 69 70 /** 71 * Implements hook_xmlsitemap_sitemap_operations(). 72 */ 73 function xmlsitemap_xmlsitemap_sitemap_operations() { 74 $operations['update'] = array( 75 'label' => t('Update cached files'), 76 'action past' => t('Updated'), 77 'callback' => 'xmlsitemap_sitemap_multiple_update', 78 ); 79 return $operations; 80 } 81 82 /** 83 * XML sitemap operation callback; regenerate sitemap files using the batch API. 84 * 85 * @param $smids 86 * An array of XML sitemap IDs. 87 * 88 * @see xmlsitemap_regenerate_batch() 89 */ 90 function xmlsitemap_sitemap_multiple_update(array $smids) { 91 module_load_include('generate.inc', 'xmlsitemap'); 92 $batch = xmlsitemap_regenerate_batch($smids); 93 batch_set($batch); 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |