Add DateTimeFormat enum

This commit is contained in:
Alex Cabal 2024-11-08 16:41:15 -06:00
parent be5574eaec
commit c35c47b793
18 changed files with 38 additions and 26 deletions

View file

@ -21,7 +21,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<title><?= Formatter::EscapeXml($title) ?></title>
<? if($subtitle !== null){ ?><subtitle><?= Formatter::EscapeXml($subtitle) ?></subtitle><? } ?>
<icon><?= SITE_URL ?>/images/logo.png</icon>
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
<updated><?= $updated->format(Enums\DateTimeFormat::Iso->value) ?></updated>
<author>
<name>Standard Ebooks</name>
<uri><?= SITE_URL ?></uri>

View file

@ -15,8 +15,8 @@ use function Safe\filesize;
<uri><?= SITE_URL . Formatter::EscapeXml($entry->AuthorsUrl) ?></uri>
</author>
<? } ?>
<published><?= $entry->Created->format('Y-m-d\TH:i:s\Z') ?></published>
<updated><?= $entry->Updated->format('Y-m-d\TH:i:s\Z') ?></updated>
<published><?= $entry->Created->format(Enums\DateTimeFormat::Iso->value) ?></published>
<updated><?= $entry->Updated->format(Enums\DateTimeFormat::Iso->value) ?></updated>
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>
<summary type="text"><?= Formatter::EscapeXml($entry->Description) ?></summary>
<content type="html"><?= Formatter::EscapeXml($entry->LongDescription) ?></content>

View file

@ -24,9 +24,9 @@ use function Safe\filesize;
<? } ?>
</author>
<? } ?>
<published><?= $entry->EbookCreated->format('Y-m-d\TH:i:s\Z') ?></published>
<dc:issued><?= $entry->EbookCreated->format('Y-m-d\TH:i:s\Z') ?></dc:issued>
<updated><?= $entry->EbookUpdated->format('Y-m-d\TH:i:s\Z') ?></updated>
<published><?= $entry->EbookCreated->format(Enums\DateTimeFormat::Iso->value) ?></published>
<dc:issued><?= $entry->EbookCreated->format(Enums\DateTimeFormat::Iso->value) ?></dc:issued>
<updated><?= $entry->EbookUpdated->format(Enums\DateTimeFormat::Iso->value) ?></updated>
<dc:language><?= Formatter::EscapeXml($entry->Language) ?></dc:language>
<dc:publisher>Standard Ebooks</dc:publisher>
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>

View file

@ -36,7 +36,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<subtitle><?= Formatter::EscapeXml($subtitle) ?></subtitle>
<? } ?>
<icon><?= SITE_URL ?>/images/logo.png</icon>
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
<updated><?= $updated->format(Enums\DateTimeFormat::Iso->value) ?></updated>
<? if($isCrawlable){ ?>
<fh:complete/>
<? } ?>

View file

@ -30,7 +30,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<subtitle><?= Formatter::EscapeXml($subtitle) ?></subtitle>
<? } ?>
<icon><?= SITE_URL ?>/images/logo.png</icon>
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
<updated><?= $updated->format(Enums\DateTimeFormat::Iso->value) ?></updated>
<author>
<name>Standard Ebooks</name>
<uri><?= SITE_URL ?></uri>
@ -39,7 +39,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<entry>
<title><?= Formatter::EscapeXml($entry->Title) ?></title>
<link href="<?= SITE_URL . Formatter::EscapeXml($entry->Url) ?>" rel="<?= Formatter::EscapeXml($entry->Rel) ?>" type="application/atom+xml;profile=opds-catalog;kind=<?= $entry->Type ?>; charset=utf-8"/>
<updated><? if($entry->Updated !== null){ ?><?= $entry->Updated->format('Y-m-d\TH:i:s\Z') ?><? } ?></updated>
<updated><? if($entry->Updated !== null){ ?><?= $entry->Updated->format(Enums\DateTimeFormat::Iso->value) ?><? } ?></updated>
<id><?= Formatter::EscapeXml($entry->Id) ?></id>
<content type="text"><?= Formatter::EscapeXml($entry->Description) ?></content>
</entry>

View file

@ -10,7 +10,7 @@ use function Safe\preg_replace;
<title><?= Formatter::EscapeXml($entry->Title) ?>, by <?= Formatter::EscapeXml(strip_tags($entry->AuthorsHtml)) ?></title>
<link><?= SITE_URL . Formatter::EscapeXml($entry->Url) ?></link>
<description><?= Formatter::EscapeXml($entry->Description) ?></description>
<pubDate><?= $entry->EbookCreated->format('r') ?></pubDate>
<pubDate><?= $entry->EbookCreated->format(Enums\DateTimeFormat::Rss->value) ?></pubDate>
<guid><?= Formatter::EscapeXml(preg_replace('/^url:/ius', '', $entry->Identifier)) ?></guid>
<? foreach($entry->Tags as $tag){ ?>
<category domain="https://standardebooks.org/vocab/subjects"><?= Formatter::EscapeXml($tag->Name) ?></category>

View file

@ -18,7 +18,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<description><?= Formatter::EscapeXml($description) ?></description>
<language>en-US</language>
<copyright>https://creativecommons.org/publicdomain/zero/1.0/</copyright>
<lastBuildDate><?= $updated->format('r'); ?></lastBuildDate>
<lastBuildDate><?= $updated->format(Enums\DateTimeFormat::Rss->value); ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<atom:link href="<?= SITE_URL . Formatter::EscapeXml($url) ?>" rel="self" type="application/rss+xml"/>
<atom:link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" />