BUGFIX: fixed notice level error. MINOR: updated readme to markdown format.

This commit is contained in:
wrossiter 2010-06-22 21:49:25 +00:00
parent 20842ce5fe
commit 8886348de0
3 changed files with 27 additions and 10 deletions

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# Google Sitemaps Module
## Maintainer Contact
* Will Rossiter (Nickname: <wrossiter, willr>)
<will@silverstripe.com>
## Requirements
* SilverStripe 2.4
## Documentation
* http://doc.silverstripe.com/doku.php?id=modules:googlesitemaps
## Installation Instructions
* See http://doc.silverstripe.org/modules#installation

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Initial implementation of Sitemap support. * Initial implementation of Sitemap support.
* GoogleSitemap should handle requests to 'sitemap.xml' * GoogleSitemap should handle requests to 'sitemap.xml'
@ -18,6 +19,7 @@
* *
* @package googlesitemaps * @package googlesitemaps
*/ */
class GoogleSitemap extends Controller { class GoogleSitemap extends Controller {
/** /**
@ -60,14 +62,12 @@ class GoogleSitemap extends Controller {
// If the page has been set to 0 priority, we set a flag so it won't be included // If the page has been set to 0 priority, we set a flag so it won't be included
if($page->canView() && (!isset($page->Priority) || $page->Priority > 0)) { if($page->canView() && (!isset($page->Priority) || $page->Priority > 0)) {
// The one field that isn't easy to deal with in the template is
// Change frequency, so we set that here. $created = $page->dbObject('Created');
$properties = $page->toMap();
$created = new SS_Datetime();
$created->value = $properties['Created'];
$now = new SS_Datetime(); $now = new SS_Datetime();
$now->value = date('Y-m-d H:i:s'); $now->value = date('Y-m-d H:i:s');
$versions = $properties['Version']; $versions = $page->Version;
$timediff = $now->format('U') - $created->format('U'); $timediff = $now->format('U') - $created->format('U');
// Check how many revisions have been made over the lifetime of the // Check how many revisions have been made over the lifetime of the
@ -156,4 +156,4 @@ class GoogleSitemap extends Controller {
public static function disable() { public static function disable() {
self::$enabled = false; self::$enabled = false;
} }
} }

View File

@ -83,6 +83,4 @@ class GoogleSitemapDecorator extends SiteTreeDecorator {
return $this->owner->getField('Priority'); return $this->owner->getField('Priority');
} }
} }
} }
?>