summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gallery.module34
-rw-r--r--gallery_settings.inc21
2 files changed, 24 insertions, 31 deletions
diff --git a/gallery.module b/gallery.module
index 43bb817..44661a2 100644
--- a/gallery.module
+++ b/gallery.module
@@ -433,41 +433,35 @@ function gallery_page() {
}
/**
- * Function gallery_gsitemap().
+ * Implementation of hook_xmlsitemap_links().
* (define additional links to add to the site map)
- *
- * This hook allows modules to add additional links to the site map. Links
- * may be associated with nodes, terms, or users, as shown in the example.
- *
- * @param $type
- * If given, the type of link to associate additional links with.
- * @param $excludes
- * If given, an array of criteria for excluding links.
- * @return
- * An array of links or an empty array.
*/
-function gallery_gsitemap($type = NULL, $excludes = array()) {
+function gallery_xmlsitemap_links($type = NULL, $excludes = array()) {
if (($type != 'xml') || !variable_get('gallery_enable_sitemap', 1) || !_gallery_init(TRUE)) {
return;
}
-
- $view_name = 'sitemap.Sitemap';
- list($ret, $view) = GalleryView::loadView($view_name);
+
+ list($ret, $view) = GalleryView::loadView('sitemap.Sitemap');
if ($ret) {
- gallery_error(t('Error loading the Gallery2 Google Sitemap. Make sure the \'Google Sitemap\' plugin is enabled in Gallery2.'), $ret);
+ gallery_error(t('Error loading the Gallery2 Sitemap. Make sure the \'Sitemap\' plugin is enabled in Gallery2.'), $ret);
return;
}
- list($ret, $root_id) = GalleryCoreApi::getDefaultAlbumId();
+ list($ret, $root) = GalleryCoreApi::getDefaultAlbumId();
if ($ret) {
- gallery_error(t('Error loading the Gallery2 Default Album Id.'), $ret);
+ gallery_error(t('Error calling getDefaultAlbumId()'), $ret);
return;
}
// Get the sitemap from Gallery2
ob_start();
- $ret = $view->renderSitemap($root_id);
+ $ret = $view->renderSitemap($root);
$g2_sitemap = ob_get_contents();
ob_end_clean();
-
+
+ if ($ret) {
+ gallery_error(t('Error getting sitemap from Gallery2.'), $ret);
+ return;
+ }
+
return $g2_sitemap;
}
diff --git a/gallery_settings.inc b/gallery_settings.inc
index 454801a..b7c432f 100644
--- a/gallery_settings.inc
+++ b/gallery_settings.inc
@@ -109,28 +109,26 @@ function _gallery_settings_general() {
(but cannot be changed in the current Gallery2 versions).'),
'#disabled' => !variable_get('gallery_move_sidebar_to_block', 1),
);
-
+
// Gallery2 Google Sitemap Settings
$gallery2_sitemap_status = gallery_single_plugin_status('sitemap');
$gallery2_sitemap_status_str = theme('gallery_plugin_status_message', $gallery2_sitemap_status);
- $gsitemap_status = module_exists('gsitemap');
+ $gsitemap_status = module_exists('xmlsitemap');
$gsitemap_status_str = theme('gallery_module_status_message', $gsitemap_status);
$gsitemap_available = $gsitemap_status && ($gallery2_sitemap_status == GALLERY_PLUGIN_ENABLED);
- $desc = t('Allows the Gallery2 Google (XML) sitemap to be merged
- with the Drupal one so that only one URL
- needs to be supplied to Google (or other search site). Requires the
- Drupal gsitemap module (!gsitemap_status) and the Gallery2 sitemap module
- (!gallery2_sitemap_status) to be installed/activated.',
+ $desc = t('Allows the Gallery2 sitemap to be merged with the Drupal one so that only one URL needs to
+ be supplied to search engines. Requires the Drupal XML Sitemap module (!gsitemap_status) and
+ the Gallery2 sitemap module (!gallery2_sitemap_status) to be installed/activated.',
array(
'!gsitemap_status' => $gsitemap_status_str,
'!gallery2_sitemap_status' => $gallery2_sitemap_status_str,
)
);
-
+
$form['sitemap'] = array(
'#type' => 'fieldset',
- '#title' => t('Google (XML) sitemap settings'),
+ '#title' => t('XML Sitemap settings'),
'#description' => '',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
@@ -142,7 +140,7 @@ function _gallery_settings_general() {
'#default_value' => $gsitemap_available ? variable_get('gallery_enable_sitemap', 1) : FALSE,
'#disabled' => !$gsitemap_available,
);
-
+
// Error logging / Debug Settings
$form['error'] = array(
'#type' => 'fieldset',
@@ -249,7 +247,8 @@ function _gallery_settings_general_validate($form_id, $form_values) {
*/
function _gallery_settings_general_submit($form_id, $form_values) {
if ($form_values['gallery_enable_sitemap'] != variable_get('gallery_enable_sitemap', 0)) {
- drupal_set_message('The Google (XML) sitemap setting has been updated, but the new sitemap may not be generated immediately (controlled by gsitemap).');
+ drupal_set_message('The XML sitemap setting has been updated, but the new sitemap may not be generated
+ immediately (controlled by XML Sitemap).');
}
}