/[drupal]/contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module
ViewVC logotype

Diff of /contributions/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5.2.12.2.17, Fri Jul 3 21:24:25 2009 UTC revision 1.5.2.12.2.18, Fri Nov 13 18:30:19 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: xmlsitemap_engines.module,v 1.5.2.12.2.16 2009/06/09 19:27:34 davereid Exp $  // $Id: xmlsitemap_engines.module,v 1.5.2.12.2.17 2009/07/03 21:24:25 davereid Exp $
3    
4  /**  /**
5   * Implementation of hook_help().   * Implementation of hook_help().
# Line 8  function xmlsitemap_engines_help($path, Line 8  function xmlsitemap_engines_help($path,
8    $output = '';    $output = '';
9    switch ($path) {    switch ($path) {
10      case 'admin/settings/xmlsitemap/engines':      case 'admin/settings/xmlsitemap/engines':
11        $output .= t('In order to verify site ownership with the search engines listed below, it is highly recommended to download and install the <a href="@site-verify">Site verification module</a>.', array('@site-verify' => 'http://drupal.org/project/site_verify'));        if (!module_exists('site_verify')) {
12            $output .= t('In order to verify site ownership with the search engines listed below, it is highly recommended to download and install the <a href="@site-verify">Site verification module</a>.', array('@site-verify' => 'http://drupal.org/project/site_verify'));
13          }
14        break;        break;
15    }    }
16    
# Line 27  function xmlsitemap_engines_menu() { Line 29  function xmlsitemap_engines_menu() {
29      'type' => MENU_LOCAL_TASK,      'type' => MENU_LOCAL_TASK,
30      'file' => 'xmlsitemap_engines.admin.inc',      'file' => 'xmlsitemap_engines.admin.inc',
31    );    );
32      //$items['admin/settings/xmlsitemap/engines/submit'] = array(
33      //  'page callback' => 'xmlsitemap_engines_submit',
34      //  'access callback' => 'xmlsitemap_engines_submit_access',
35      //  'type' => MENU_CALLBACK,
36      //);
37    
38    return $items;    return $items;
39  }  }
40    
41  /**  function xmlsitemap_engines_submit_access() {
42   * Implementation of hook_cron().    // Cannot submit when site is offline since search engines cannot access the
43   */    // site's content.
44  function xmlsitemap_engines_cron() {    if (variable_get('site_offline', 0)) {
45    if (variable_get('site_offline', 0)      return FALSE;
46        || (xmlsitemap_engines_var('submit_updated') && xmlsitemap_var('generated_last') < xmlsitemap_engines_var('submit_last'))    }
47        || (REQUEST_TIME - xmlsitemap_engines_var('submit_last')) < xmlsitemap_engines_var('minimum_lifetime')) {  
48      return;    // Allow manual submissions to run.
49      //if ($_GET['q'] == 'admin/settings/xmlsitemap/engines/submit' && user_access('administer xmlsitemap')) {
50      //  return TRUE;
51      //}
52    
53      // If sitemap data has not been updated since last submission, skip.
54      if (xmlsitemap_engines_var('submit_updated') && xmlsitemap_var('generated_last') < xmlsitemap_engines_var('submit_last')) {
55        return FALSE;
56    }    }
57    
58      // Check that the minimum submission lifetime has been met.
59      if ((REQUEST_TIME - xmlsitemap_engines_var('submit_last')) < xmlsitemap_engines_var('minimum_lifetime')) {
60        return FALSE;
61      }
62    
63      return TRUE;
64    }
65    
66    /**
67     * Submit the sitemaps to all the specified search engines.
68     */
69    function xmlsitemap_engines_submit_sitemaps() {
70    $sitemaps = xmlsitemap_get_sitemaps();    $sitemaps = xmlsitemap_get_sitemaps();
71    $engines = xmlsitemap_engines_var('engines');    $engines = xmlsitemap_engines_var('engines');
72    foreach ($engines as $engine) {    foreach ($engines as $engine) {
# Line 65  function xmlsitemap_engines_cron() { Line 91  function xmlsitemap_engines_cron() {
91  }  }
92    
93  /**  /**
94     * Implementation of hook_cron().
95     */
96    function xmlsitemap_engines_cron() {
97      if (xmlsitemap_engines_submit_access()) {
98        xmlsitemap_engines_submit_sitemaps();
99      }
100    }
101    
102    /**
103   * Replace valid tokens in the URL with their appropriate values.   * Replace valid tokens in the URL with their appropriate values.
104   *   *
105   * @param $url   * @param $url

Legend:
Removed from v.1.5.2.12.2.17  
changed lines
  Added in v.1.5.2.12.2.18

  ViewVC Help
Powered by ViewVC 1.1.2