diff sitemap.php @ 44:79f708a48a7c

Added a constants include. Refactored out functions from sitemap.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Mon, 08 Oct 2012 02:01:04 +0200
parents f37be50a70cf
children 2cfea6e84694 3898353ed1d8
line wrap: on
line diff
--- a/sitemap.php	Fri Oct 05 03:16:23 2012 +0200
+++ b/sitemap.php	Mon Oct 08 02:01:04 2012 +0200
@@ -9,48 +9,10 @@
       xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
             http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
 <?
-include_once('php/Options.inc');
-
-function startswith($haystack, $needle) {
-    return strpos($haystack, $needle) === 0;
-}
-
-function endsWith($haystack, $needle) {
-  $l = strlen($haystack) - strlen($needle);
-  return strrpos($haystack, $needle) === $l;
-}
+include_once 'CacheTimeCheck.inc';
 
-function getHeaders($url)
-{
-  $response = http_head($url, array("timeout"=>1), $info);
-  $headers = array();
-  $str = explode("\n", $response);
-  foreach($str as $kv) {
-    $p = strpos($kv, ":");
-    if ($p) {
-      $key = substr($kv, 0, $p);
-      $value = trim(substr($kv, $p + 1));
-      $headers[$key] = $value;
-    }
-  }
-  return $headers;
-}
-
-function opttostring($opts)
-{
-  $str = '';
-  foreach (array_keys($opts) as $key) {
-    $value = $opts[$key];
-    if ($str) {
-      $str .= "&${key}=${value}";
-    }
-    else {
-      $str = "?${key}=${value}";
-    }
-  }
-  return $str;
-}
-
+$cache = CacheTimeCheck::instance(__FILE__);
+$cache->includeOnce('Options.inc', dirname(__FILE__));
 
 $master = new DOMDocument();
 $master->load("master.xml");