comparison Sitemap.inc @ 96:c7de7a4641d7

Generate humanreadable urls for sitemap.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 18 Oct 2012 21:48:58 +0200
parents 8a9bfbe220ca
children f2d52fed708c
comparison
equal deleted inserted replaced
95:8a9bfbe220ca 96:c7de7a4641d7
49 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 49 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
50 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> 50 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
51 '; 51 ';
52 52
53 $base = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; 53 $base = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
54 $base = substr($base, 0, strrpos($base, '/')); 54 $l = strrpos($base, '/');
55 if ($l)
56 $base = substr($base, 0, $l);
55 57
56 $acceptedLanguages = $this->options->getAcceptedLanguages(); 58 $acceptedLanguages = $this->options->getAcceptedLanguages();
57 59
58 foreach($this->options->getAcceptedLanguages() as $lang) { 60 foreach($this->options->getAcceptedLanguages() as $lang) {
59 if ($handle = opendir(basePath() . "/${lang}")) { 61 if ($handle = opendir(basePath() . "/${lang}")) {
77 79
78 if ($name != $this->options->getInputDefault('name')) { 80 if ($name != $this->options->getInputDefault('name')) {
79 $opts['name'] = $name; 81 $opts['name'] = $name;
80 } 82 }
81 83
82 $optstring = opttostring($opts); 84 $optstring = genUrl($opts, array(), array('lang', 'name'));
83 85
84 $location = "${base}/${optstring}"; 86 $location = "${base}${optstring}/";
87
85 $headers = Http::getHeaders($location, 5); 88 $headers = Http::getHeaders($location, 5);
86 89
87 $location = htmlentities($location); 90 $location = htmlentities($location);
88 91
89 $lastmod = $headers["Last-Modified"]; 92 $lastmod = $headers["Last-Modified"];