]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Sitemap/sitemapaction.php
Merge branch '1.0.x' into testing
[quix0rs-gnu-social.git] / plugins / Sitemap / sitemapaction.php
index ab80b85eaa67734551568b0012120c7cc50aa93a..ef77645c3166133aeeff59eddfd43574d0a7c2e1 100644 (file)
@@ -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;
+    }
 }