phpDocumentor Google-XML-Sitemap-Feed
[ class tree: Google-XML-Sitemap-Feed ] [ index: Google-XML-Sitemap-Feed ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3. * Google XML Sitemap Feed Cron Script
  4. *
  5. * The Google sitemap service was announced on 2 June 2005 and represents
  6. * a huge development in terms of crawler technology. This contribution is
  7. * designed to create the sitemap XML feed per the specification delineated
  8. * by Google. This cron script will call the code to create the scripts and
  9. * eliminate the session auto start issues.
  10. * @package Google-XML-Sitemap-Feed
  11. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12. * @version 1.0
  13. * @link http://www.oscommerce-freelancers.com/ osCommerce-Freelancers
  14. * @link http://www.google.com/webmasters/sitemaps/docs/en/about.html About Google Sitemap
  15. * @copyright Copyright 2005, Bobby Easland
  16. * @author Bobby Easland
  17. * @filesource
  18. */
  19.  
  20. chdir('../');
  21. /**
  22. * Option to compress the files
  23. */
  24. define('GOOGLE_SITEMAP_COMPRESS', 'false');
  25. /**
  26. * Option for change frequency of products
  27. */
  28. define('GOOGLE_SITEMAP_PROD_CHANGE_FREQ', 'weekly');
  29. /**
  30. * Option for change frequency of categories
  31. */
  32. define('GOOGLE_SITEMAP_CAT_CHANGE_FREQ', 'weekly');
  33. /**
  34. * Carried over from application_top.php for compatibility
  35. */
  36. define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
  37.  
  38. require_once('includes/configure.php');
  39. require_once(DIR_WS_INCLUDES . 'filenames.php');
  40. require_once(DIR_WS_INCLUDES . 'database_tables.php');
  41. require_once(DIR_WS_FUNCTIONS . 'database.php');
  42. tep_db_connect() or die('Unable to connect to database server!');
  43. $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
  44. while ($configuration = tep_db_fetch_array($configuration_query)) {
  45. define($configuration['cfgKey'], $configuration['cfgValue']);
  46. }
  47. require_once(DIR_WS_FUNCTIONS . 'general.php');
  48. require_once(DIR_WS_FUNCTIONS . 'html_output.php');
  49. include_once(DIR_WS_CLASSES . 'language.php');
  50. $lng = new language();
  51. $lng->get_browser_language();
  52. $languages_id = $lng->language['id'];
  53.  
  54. if ( file_exists(DIR_WS_CLASSES . 'seo.class.php') ){
  55. require_once(DIR_WS_CLASSES . 'seo.class.php');
  56. $seo_urls = new SEO_URL($languages_id);
  57. }
  58.  
  59. if ( file_exists(DIR_WS_CLASSES . 'cache.class.php') ){
  60. include(DIR_WS_CLASSES . 'cache.class.php');
  61. $cache = new cache($languages_id);
  62. }
  63.  
  64. if ( file_exists('includes/seo_cache.php') ){
  65. include('includes/seo_cache.php');
  66. $cache->get_cache('GLOBAL');
  67. }
  68.  
  69. require_once('googlesitemap/sitemap.class.php');
  70.  
  71. $google = new GoogleSitemap(DB_SERVER, DB_SERVER_USERNAME, DB_DATABASE, DB_SERVER_PASSWORD);
  72.  
  73. $submit = true;
  74. if ($google->GenerateProductSitemap()){
  75. echo 'Generated Google Product Sitemap Successfully' . "\n\n";
  76. } else {
  77. $submit = false;
  78. echo 'ERROR: Google Product Sitemap Generation FAILED!' . "\n\n";
  79. }
  80.  
  81. if ($google->GenerateCategorySitemap()){
  82. echo 'Generated Google Category Sitemap Successfully' . "\n\n";
  83. } else {
  84. $submit = false;
  85. echo 'ERROR: Google Category Sitemap Generation FAILED!' . "\n\n";
  86. }
  87.  
  88. if ($google->GenerateSitemapIndex()){
  89. echo 'Generated Google Sitemap Index Successfully' . "\n\n";
  90. } else {
  91. $submit = false;
  92. echo 'ERROR: Google Sitemap Index Generation FAILED!' . "\n\n";
  93. }
  94.  
  95. if ($submit){
  96. echo 'All files generated successfully. If you have not already submitted the sitemap index to Google click the link below.' . "\n\n";
  97. echo $google->GenerateSubmitURL();
  98. }
  99. ?>

Documentation generated on Sat, 4 Jun 2005 23:45:56 -0400 by phpDocumentor 1.3.0RC3