X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSitemap%2Fsitemapaction.php;h=ef77645c3166133aeeff59eddfd43574d0a7c2e1;hb=36b331d469b6dcd1101783f21265f7be624bc58f;hp=ab80b85eaa67734551568b0012120c7cc50aa93a;hpb=ce0e6cb50d88c593db62edd8375c4414e8a8ebf8;p=quix0rs-gnu-social.git diff --git a/plugins/Sitemap/sitemapaction.php b/plugins/Sitemap/sitemapaction.php index ab80b85eaa..ef77645c31 100644 --- a/plugins/Sitemap/sitemapaction.php +++ b/plugins/Sitemap/sitemapaction.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class SitemapAction extends Action { /** @@ -50,23 +49,45 @@ class SitemapAction extends Action * * @return void */ - function handle($args) { + parent::handle($args); + header('Content-Type: text/xml; charset=UTF-8'); $this->startXML(); - $this->elementStart('sitemap'); + $this->elementStart('urlset', array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9')); while (list($url, $lm, $cf, $p) = $this->nextUrl()) { $this->showUrl($url, $lm, $cf, $p); } - $this->elementEnd('sitemap'); + $this->elementEnd('urlset'); $this->endXML(); } + function lastModified() + { + $y = $this->trimmed('year'); + + $m = $this->trimmed('month'); + $d = $this->trimmed('day'); + + $y += 0; + $m += 0; + $d += 0; + + $begdate = strtotime("$y-$m-$d 00:00:00"); + $enddate = $begdate + (24 * 60 * 60); + + if ($enddate < time()) { + return $enddate; + } else { + return null; + } + } + function showUrl($url, $lastMod=null, $changeFreq=null, $priority=null) { $this->elementStart('url'); @@ -87,4 +108,9 @@ class SitemapAction extends Action { return null; } + + function isReadOnly() + { + return true; + } }