diff --git a/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php b/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php index a802c0cbca1..9dcafdfbf6d 100644 --- a/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php +++ b/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php @@ -16,8 +16,8 @@ namespace APP\plugins\generic\announcementFeed; use APP\template\TemplateManager; +use Carbon\Carbon; use PKP\announcement\Announcement; -use PKP\core\Core; use PKP\db\DAORegistry; use PKP\plugins\GatewayPlugin; use PKP\site\VersionDAO; @@ -139,14 +139,14 @@ public function fetch($args, $request) $lastDateUpdated = $this->_parentPlugin->getSetting($journal->getId(), 'dateUpdated'); if ($announcements->isEmpty()) { if (empty($lastDateUpdated)) { - $dateUpdated = Core::getCurrentDate(); + $dateUpdated = Carbon::now(); $this->_parentPlugin->updateSetting($journal->getId(), 'dateUpdated', $dateUpdated, 'string'); } else { $dateUpdated = $lastDateUpdated; } } else { - $dateUpdated = $announcements->first()->getAttribute('datePosted'); - if (empty($lastDateUpdated) || (strtotime($dateUpdated) > strtotime($lastDateUpdated))) { + $dateUpdated = $announcements->first()->datePosted; + if (empty($lastDateUpdated) || $dateUpdated->gt($lastDateUpdated)) { $this->_parentPlugin->updateSetting($journal->getId(), 'dateUpdated', $dateUpdated, 'string'); } } diff --git a/plugins/generic/announcementFeed/templates/atom.tpl b/plugins/generic/announcementFeed/templates/atom.tpl index a184b535ede..0cff2f4a3c3 100644 --- a/plugins/generic/announcementFeed/templates/atom.tpl +++ b/plugins/generic/announcementFeed/templates/atom.tpl @@ -36,21 +36,21 @@ {foreach from=$announcements item=announcement} {* required elements *} - {url page="announcement" op="view" path=$announcement->getKey()} + {url page="announcement" op="view" path=$announcement->id} {$announcement->getLocalizedData('fullTitle')|strip|escape:"html"} - {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} + {$announcement->datePosted->format("%Y-%m-%dT%T%z")|regex_replace:"/00$/":":00"} {$journal->getLocalizedName()|strip|escape:"html"} - getKey()}" /> + id}" /> {if $announcement->getLocalizedData('description')} - getKey()}">{$announcement->getLocalizedData('description')|strip|escape:"html"} + id}">{$announcement->getLocalizedData('description')|strip|escape:"html"} {/if} {* optional elements *} {* *} {* *} - {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} + {$announcement->datePosted->format("%Y-%m-%dT%T%z")|regex_replace:"/00$/":":00"} {* *} {* *} diff --git a/plugins/generic/announcementFeed/templates/rss.tpl b/plugins/generic/announcementFeed/templates/rss.tpl index 4da99e0720e..7e9e2b7a610 100644 --- a/plugins/generic/announcementFeed/templates/rss.tpl +++ b/plugins/generic/announcementFeed/templates/rss.tpl @@ -34,24 +34,24 @@ {foreach from=$announcements item=announcement} - getKey()}"/> + id}"/> {/foreach} {foreach from=$announcements item=announcement} - getKey()}"> + id}"> {* required elements *} {$announcement->getLocalizedData('fullTitle')|strip|escape:"html"} - {url page="announcement" op="view" path=$announcement->getKey()} + {url page="announcement" op="view" path=$announcement->id} {* optional elements *} {if $announcement->getLocalizedData('description')} {$announcement->getLocalizedData('description')|strip|escape:"html"} {/if} {$journal->getLocalizedName()|strip|escape:"html"} - {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%d"} + {$announcement->datePosted->format("%Y-%m-%d")} {/foreach}