- foreach($ebook->Authors as $author){ ?>
-
if($author->Name != 'Anonymous'){ ?>= Formatter::EscapeHtml($author->Name) ?> } ?>
+ if($collection !== null){ ?>
+
+ } ?>
+ foreach($ebooks as $ebook){ ?>
+
resource="= $ebook->Url ?>" property="schema:hasPart" if($ebook->GetCollectionPosition($collection) !== null){ ?> value="= $ebook->GetCollectionPosition($collection) ?>" } ?> }else{ ?> about="= $ebook->Url ?>" } ?>>
+ if($collection !== null && $ebook->GetCollectionPosition($collection) !== null){ ?>
+
} ?>
+
-
- } ?>
-
- } ?>
+ }else{ ?>
+
+
+ if($ebook->ContributorsHtml !== null){ ?>
+
+
= rtrim($ebook->ContributorsHtml, '.') ?>
+
+ } ?>
+
= number_format($ebook->WordCount) ?> words • = $ebook->ReadingEase ?> reading ease
+
+
+ } ?>
+
+ } ?>
diff --git a/templates/EmailAdminNewPatron.php b/templates/EmailAdminNewPatron.php
index b760e61d..78fa66fe 100644
--- a/templates/EmailAdminNewPatron.php
+++ b/templates/EmailAdminNewPatron.php
@@ -1,4 +1,9 @@
-
+
+/**
+ * @var Patron $patron
+ * @var Payment $payment
+ */
+?>
New Patrons Circle member
diff --git a/templates/EmailAdminNewPatronText.php b/templates/EmailAdminNewPatronText.php
index a1dfbb9f..24a01c8c 100644
--- a/templates/EmailAdminNewPatronText.php
+++ b/templates/EmailAdminNewPatronText.php
@@ -1,4 +1,9 @@
-Name: if($patron->User->Name === null){ ?>Anonymous }else{ ?>= Formatter::EscapeHtml($patron->User->Name) ?> if($patron->IsAnonymous){ ?> (Anonymous) } ?> } ?>
+
+/**
+ * @var Patron $patron
+ * @var Payment $payment
+ */
+?>Name: if($patron->User->Name === null){ ?>Anonymous }else{ ?>= Formatter::EscapeHtml($patron->User->Name) ?> if($patron->IsAnonymous){ ?> (Anonymous) } ?> } ?>
Donation type: if($payment->IsRecurring){ ?>Recurring }else{ ?>One-time } ?>
diff --git a/templates/EmailDonationIngestion.php b/templates/EmailDonationIngestion.php
deleted file mode 100644
index aee4d077..00000000
--- a/templates/EmailDonationIngestion.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
Donation ingestion failed
-
-
-
Donation ingestion failed
-
The donation ingestion script failed with this exception:
-
-= $exception ?>
-
-
-
diff --git a/templates/EmailDonationIngestionText.php b/templates/EmailDonationIngestionText.php
deleted file mode 100644
index e44b7665..00000000
--- a/templates/EmailDonationIngestionText.php
+++ /dev/null
@@ -1,7 +0,0 @@
-# Donation ingestion failed
-
-The donation ingestion script failed with this exception:
-
-````
-= $exception ?>
-````
diff --git a/templates/EmailDonationProcessingFailed.php b/templates/EmailDonationProcessingFailed.php
index d9f80171..a2f12af8 100644
--- a/templates/EmailDonationProcessingFailed.php
+++ b/templates/EmailDonationProcessingFailed.php
@@ -1,4 +1,8 @@
-
+
+/**
+ * @var string $exception
+ */
+?>
Donation processing failed
diff --git a/templates/EmailDonationProcessingFailedText.php b/templates/EmailDonationProcessingFailedText.php
index 0c7f07d9..1f9ad067 100644
--- a/templates/EmailDonationProcessingFailedText.php
+++ b/templates/EmailDonationProcessingFailedText.php
@@ -1,3 +1,8 @@
+
+/**
+ * @var string $exception
+ */
+?>
# Donation processing failed
The donation processing script failed with this exception:
diff --git a/templates/EmailFooter.php b/templates/EmailFooter.php
index e81a245e..22d1d2d8 100644
--- a/templates/EmailFooter.php
+++ b/templates/EmailFooter.php
@@ -1,18 +1,18 @@
-
-
diff --git a/templates/EmailHeader.php b/templates/EmailHeader.php
index 9c1936b3..8c132577 100644
--- a/templates/EmailHeader.php
+++ b/templates/EmailHeader.php
@@ -191,4 +191,6 @@ $letterhead = $letterhead ?? false;
- if($preheader){ ?> } ?>
+ if($preheader){ ?>
+
+ } ?>
diff --git a/templates/EmailNewsletterConfirmation.php b/templates/EmailNewsletterConfirmation.php
index 40538dfe..9fdee8bc 100644
--- a/templates/EmailNewsletterConfirmation.php
+++ b/templates/EmailNewsletterConfirmation.php
@@ -1,10 +1,24 @@
-= Template::EmailHeader() ?>
+
+/**
+ * @var bool $isSubscribedToNewsletter
+ * @var bool $isSubscribedToSummary
+ * @var NewsletterSubscription $subscription
+ */
+?>= Template::EmailHeader() ?>
Confirm your newsletter subscription
Thank you for subscribing to the Standard Ebooks newsletter!
You subscribed to:
- if($isSubscribedToNewsletter){ ?>The occasional Standard Ebooks newsletter
} ?>
- if($isSubscribedToSummary){ ?>A monthly summary of new ebook releases
} ?>
+ if($isSubscribedToNewsletter){ ?>
+ -
+
The occasional Standard Ebooks newsletter
+
+ } ?>
+ if($isSubscribedToSummary){ ?>
+ -
+
A monthly summary of new ebook releases
+
+ } ?>
Please use the button below to confirm your subscription—you won’t receive email from us until you do.
diff --git a/templates/EmailNewsletterConfirmationText.php b/templates/EmailNewsletterConfirmationText.php
index 2a1440b1..7c623c22 100644
--- a/templates/EmailNewsletterConfirmationText.php
+++ b/templates/EmailNewsletterConfirmationText.php
@@ -1,3 +1,10 @@
+
+/**
+ * @var bool $isSubscribedToNewsletter
+ * @var bool $isSubscribedToSummary
+ * @var NewsletterSubscription $subscription
+ */
+?>
# Confirm your newsletter subscription
Thank you for subscribing to the Standard Ebooks newsletter!
diff --git a/templates/EmailPatronsCircleCompleted.php b/templates/EmailPatronsCircleCompleted.php
index 22789d72..9d0bb848 100644
--- a/templates/EmailPatronsCircleCompleted.php
+++ b/templates/EmailPatronsCircleCompleted.php
@@ -1,4 +1,8 @@
-= Template::EmailHeader(['letterhead' => true]) ?>
+
+/**
+ * @var int $ebooksThisYear
+ */
+?>= Template::EmailHeader(['letterhead' => true]) ?>
Hello,
Last year, your generous donation to Standard Ebooks made it possible for us to continue producing beautiful ebook editions for free distribution.
It also allowed me to add you to our Patrons Circle, a group of donors who are honored on our masthead, and who have a direct voice in the future of our ebook catalog, for one year.
diff --git a/templates/EmailPatronsCircleCompletedText.php b/templates/EmailPatronsCircleCompletedText.php
index a9cb2531..b600c31d 100644
--- a/templates/EmailPatronsCircleCompletedText.php
+++ b/templates/EmailPatronsCircleCompletedText.php
@@ -1,3 +1,8 @@
+
+/**
+ * @var int $ebooksThisYear
+ */
+?>
Hello,
Last year, your generous donation to Standard Ebooks made it possible for us to continue producing beautiful ebook editions for free distribution.
diff --git a/templates/EmailPatronsCircleWelcome.php b/templates/EmailPatronsCircleWelcome.php
index 307f94b0..6f26fde4 100644
--- a/templates/EmailPatronsCircleWelcome.php
+++ b/templates/EmailPatronsCircleWelcome.php
@@ -1,4 +1,9 @@
-
+
+/**
+ * @var bool $isAnonymous
+ * @var bool $isReturning
+ */
+?>
Thank you for supporting Standard Ebooks!
@@ -7,9 +12,9 @@
Hello,
I wanted to thank you personally for your recent donation to Standard Ebooks. Your donation will go towards continuing our mission of producing and distributing high-quality ebooks that are free of cost and free of copyright restrictions. Donations like yours help ensure that the world’s literature is available in beautiful editions made for the digital age.
if($isAnonymous){ ?>
-
I’m pleased to be able to if($isReturning){ ?>welcome you back to }else{ ?>include you in } ?> our Patrons Circle. Since you indicated you want your donation to remain anonymous, I haven’t listed your name on our masthead. If you do prefer to have your name listed, just let me know.
+
I’m pleased to be able to if($isReturning){ ?>welcome you back to }else{ ?>include you in } ?> our Patrons Circle. Since you indicated you want your donation to remain anonymous, I haven’t listed your name on our masthead. If you do prefer to have your name listed, just let me know.
}else{ ?>
-
I’m pleased to be able to if($isReturning){ ?>welcome you back to }else{ ?>include you in } ?> our Patrons Circle, with your name listed on our masthead for the duration of your donation. If you’d like to use a different name than the one you entered on our donation form, just let me know.
+
I’m pleased to be able to if($isReturning){ ?>welcome you back to }else{ ?>include you in } ?> our Patrons Circle, with your name listed on our masthead for the duration of your donation. If you’d like to use a different name than the one you entered on our donation form, just let me know.
} ?>
As a Patron, once per quarter you may suggest a book for inclusion in our Wanted Ebooks list. Before submitting a suggestion, please review our collections policy; then you can contact me directly at = EDITOR_IN_CHIEF_EMAIL_ADDRESS ?> with your selection.
You also get access to our ebook feeds for use in your ereading app or RSS reader, and bulk downloads to download collections of ebooks easily. To use the feeds, enter your email address when prompted, and leave the password field empty.
diff --git a/templates/EmailPatronsCircleWelcomeText.php b/templates/EmailPatronsCircleWelcomeText.php
index bc6378d1..3d34ea92 100644
--- a/templates/EmailPatronsCircleWelcomeText.php
+++ b/templates/EmailPatronsCircleWelcomeText.php
@@ -1,3 +1,9 @@
+
+/**
+ * @var bool $isAnonymous
+ * @var bool $isReturning
+ */
+?>
Hello,
I wanted to thank you personally for your recent donation to Standard Ebooks. Your donation will go towards continuing our mission of producing and distributing high-quality ebooks that are free of cost and free of copyright restrictions. Donations like yours help ensure that the world’s literature is available in beautiful editions made for the digital age.
diff --git a/templates/Error.php b/templates/Error.php
index d42376bf..6901153c 100644
--- a/templates/Error.php
+++ b/templates/Error.php
@@ -1,6 +1,9 @@
+/**
+ * @var ?Exception $exception
+ */
-if(!$exception){
+if($exception === null){
return;
}
@@ -15,8 +18,8 @@ else{
?>
foreach($exceptions as $ex){ ?>
- -
-
$message = $ex->getMessage(); if($message == ''){ $message = 'An error occurred.'; } ?>= str_replace('CAPTCHA', 'CAPTCHA', Formatter::EscapeHtml($message)) ?>
-
+ -
+
$message = $ex->getMessage(); if($message == ''){ $message = 'An error occurred.'; } ?>= str_replace('CAPTCHA', 'CAPTCHA', Formatter::EscapeHtml($message)) ?>
+
} ?>
diff --git a/templates/FeedHowTo.php b/templates/FeedHowTo.php
index 1fe9589e..89b3bffc 100644
--- a/templates/FeedHowTo.php
+++ b/templates/FeedHowTo.php
@@ -1,17 +1,29 @@
Accessing the feeds
if($GLOBALS['User'] === null){ ?>
- Our New Releases feeds are open to everyone. Our other feeds are a benefit of Patrons Circle membership.
-
- Join the Patrons Circle by making a small donation in support of our mission. Patrons have full access to our ebook feeds for the duration of their gift.
- Produce an ebook for Standard Ebooks to get lifetime access to our ebook feeds. (If you’ve already done that, contact us to enable your access.)
- Corporate sponsors get access to all of our ebook feeds for the duration of their sponsorship. Contact us to chat about having your organization sponsor our mission.
- Open source projects can get free access to all of our ebook feeds if they meet certain criteria. Contact us to discuss free access for your open source project.
-
- If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.
+ Our New Releases feeds are open to everyone. Our other feeds are a benefit of Patrons Circle membership.
+
+ -
+
Join the Patrons Circle by making a small donation in support of our mission. Patrons have full access to our ebook feeds for the duration of their gift.
+
+ -
+
Produce an ebook for Standard Ebooks to get lifetime access to our ebook feeds. (If you’ve already done that, contact us to enable your access.)
+
+ -
+
Corporate sponsors get access to all of our ebook feeds for the duration of their sponsorship. Contact us to chat about having your organization sponsor our mission.
+
+ -
+
Open source projects can get free access to all of our ebook feeds if they meet certain criteria. Contact us to discuss free access for your open source project.
+
+
+
+ If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.
+
}elseif($GLOBALS['User']->Benefits->CanAccessFeeds){ ?>
When prompted enter your email address and leave the password field blank to access a feed.
}else{ ?>
- If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.
+
+ If you’re a Patrons Circle member, when prompted enter your email address and leave the password field blank to access a feed.
+
} ?>
diff --git a/templates/Header.php b/templates/Header.php
index 6c6abec5..bad3e962 100644
--- a/templates/Header.php
+++ b/templates/Header.php
@@ -1,4 +1,5 @@
+use function Safe\filemtime;
$title = $title ?? '';
$highlight = $highlight ?? '';
diff --git a/templates/OpdsAcquisitionEntry.php b/templates/OpdsAcquisitionEntry.php
index e808ae6a..5e36f508 100644
--- a/templates/OpdsAcquisitionEntry.php
+++ b/templates/OpdsAcquisitionEntry.php
@@ -1,3 +1,10 @@
+
+use function Safe\filesize;
+
+/**
+ * @var Ebook $entry
+ */
+?>
= SITE_URL . $entry->Url ?>
= Formatter::EscapeXml($entry->Identifier) ?>
@@ -6,9 +13,15 @@
= Formatter::EscapeXml($author->Name) ?>
= SITE_URL . Formatter::EscapeXml($entry->AuthorsUrl) ?>
- if($author->FullName !== null){ ?>= Formatter::EscapeXml($author->FullName) ?> } ?>
- if($author->WikipediaUrl !== null){ ?>= Formatter::EscapeXml($author->WikipediaUrl) ?> } ?>
- if($author->NacoafUrl !== null){ ?>= Formatter::EscapeXml($author->NacoafUrl) ?> } ?>
+ if($author->FullName !== null){ ?>
+ = Formatter::EscapeXml($author->FullName) ?>
+ } ?>
+ if($author->WikipediaUrl !== null){ ?>
+ = Formatter::EscapeXml($author->WikipediaUrl) ?>
+ } ?>
+ if($author->NacoafUrl !== null){ ?>
+ = Formatter::EscapeXml($author->NacoafUrl) ?>
+ } ?>
} ?>
= $entry->EbookCreated->format('Y-m-d\TH:i:s\Z') ?>
@@ -20,17 +33,27 @@
= Formatter::EscapeXml($entry->Description) ?>
= Formatter::EscapeXml($entry->LongDescription) ?>
foreach($entry->LocSubjects as $subject){ ?>
-
+
} ?>
foreach($entry->Tags as $subject){ ?>
-
+
} ?>
- if(file_exists(WEB_ROOT . $entry->EpubUrl)){ ?> } ?>
- if(file_exists(WEB_ROOT . $entry->AdvancedEpubUrl)){ ?> } ?>
- if(file_exists(WEB_ROOT . $entry->KepubUrl)){ ?> } ?>
- if(file_exists(WEB_ROOT . $entry->Azw3Url)){ ?> } ?>
- if(file_exists(WEB_ROOT . $entry->TextSinglePageUrl)){ ?> } ?>
+ if(file_exists(WEB_ROOT . $entry->EpubUrl)){ ?>
+
+ } ?>
+ if(file_exists(WEB_ROOT . $entry->AdvancedEpubUrl)){ ?>
+
+ } ?>
+ if(file_exists(WEB_ROOT . $entry->KepubUrl)){ ?>
+
+ } ?>
+ if(file_exists(WEB_ROOT . $entry->Azw3Url)){ ?>
+
+ } ?>
+ if(file_exists(WEB_ROOT . $entry->TextSinglePageUrl)){ ?>
+
+ } ?>
diff --git a/templates/OpdsAcquisitionFeed.php b/templates/OpdsAcquisitionFeed.php
index c2225c6a..1bcb0bd2 100644
--- a/templates/OpdsAcquisitionFeed.php
+++ b/templates/OpdsAcquisitionFeed.php
@@ -1,12 +1,20 @@
+/**
+ * Notes:
+ *
+ * - *All* OPDS feeds must contain a `rel="http://opds-spec.org/crawlable"` link pointing to the `/feeds/opds/all` feed.
+ * - The `
` element is required to note this as a "Complete Acquisition Feeds"; see
.
+ */
-/* Notes:
-
-- *All* OPDS feeds must contain a rel="http://opds-spec.org/crawlable" link pointing to the /feeds/opds/all feed
-
-- The element is required to note this as a "Complete Acquisition Feeds"; see https://specs.opds.io/opds-1.2#25-complete-acquisition-feeds
-
-*/
+/**
+ * @var string $id
+ * @var string $url
+ * @var string $parentUrl
+ * @var string $title
+ * @var ?string $subtitle
+ * @var DateTimeImmutable $updated
+ * @var array $entries
+ */
$isCrawlable = $isCrawlable ?? false;
$subtitle = $subtitle ?? null;
@@ -24,10 +32,14 @@ print("\n");
= Formatter::EscapeXml($title) ?>
- if($subtitle !== null){ ?>= Formatter::EscapeXml($subtitle) ?> } ?>
+ if($subtitle !== null){ ?>
+ = Formatter::EscapeXml($subtitle) ?>
+ } ?>
= SITE_URL ?>/images/logo.png
= $updated->format('Y-m-d\TH:i:s\Z') ?>
- if($isCrawlable){ ?> } ?>
+ if($isCrawlable){ ?>
+
+ } ?>
Standard Ebooks
= SITE_URL ?>
diff --git a/templates/OpdsNavigationFeed.php b/templates/OpdsNavigationFeed.php
index 0a4f4aa0..fc35a27a 100644
--- a/templates/OpdsNavigationFeed.php
+++ b/templates/OpdsNavigationFeed.php
@@ -1,4 +1,13 @@
+/**
+ * @var string $id
+ * @var string $url
+ * @var string $parentUrl
+ * @var string $title
+ * @var ?string $subtitle
+ * @var DateTimeImmutable $updated
+ * @var array $entries
+ */
$subtitle = $subtitle ?? null;
@@ -13,9 +22,13 @@ print("\n");
- if($parentUrl !== null){ ?> } ?>
+ if($parentUrl !== null){ ?>
+
+ } ?>
= Formatter::EscapeXml($title) ?>
- if($subtitle !== null){ ?>= Formatter::EscapeXml($subtitle) ?> } ?>
+ if($subtitle !== null){ ?>
+ = Formatter::EscapeXml($subtitle) ?>
+ } ?>
= SITE_URL ?>/images/logo.png
= $updated->format('Y-m-d\TH:i:s\Z') ?>
diff --git a/templates/RssEntry.php b/templates/RssEntry.php
index ce680483..258ff54d 100644
--- a/templates/RssEntry.php
+++ b/templates/RssEntry.php
@@ -1,3 +1,11 @@
+
+use function Safe\filesize;
+use function Safe\preg_replace;
+
+/**
+ * @var Ebook $entry
+ */
+?>
-
= Formatter::EscapeXml($entry->Title) ?>, by = Formatter::EscapeXml(strip_tags($entry->AuthorsHtml)) ?>
= SITE_URL . Formatter::EscapeXml($entry->Url) ?>
@@ -5,10 +13,10 @@
= $entry->EbookCreated->format('r') ?>
= Formatter::EscapeXml(preg_replace('/^url:/ius', '', $entry->Identifier)) ?>
foreach($entry->Tags as $tag){ ?>
- = Formatter::EscapeXml($tag->Name) ?>
+ = Formatter::EscapeXml($tag->Name) ?>
} ?>
if($entry->EpubUrl !== null){ ?>
- /* Only one is allowed */ ?>
+ /* Only one is allowed */ ?>
} ?>
diff --git a/templates/RssFeed.php b/templates/RssFeed.php
index 4eec714f..f365e73c 100644
--- a/templates/RssFeed.php
+++ b/templates/RssFeed.php
@@ -1,4 +1,12 @@
+/**
+ * @var string $title
+ * @var string $description
+ * @var DateTimeImmutable $updated
+ * @var string $url
+ * @var array $entries
+ */
+
// Note that the XSL stylesheet gets stripped during `se clean` when we generate the feed.
// `se clean` will also start adding empty namespaces everywhere if we include the stylesheet declaration first.
// We have to add it programmatically when saving the feed file.
@@ -10,7 +18,7 @@ print("\n");
= Formatter::EscapeXml($description) ?>
en-US
https://creativecommons.org/publicdomain/zero/1.0/
- = $updated ?>
+ = $updated->format('r'); ?>
http://blogs.law.harvard.edu/tech/rss
diff --git a/templates/SearchForm.php b/templates/SearchForm.php
index 9a29ce18..4d33c1e4 100644
--- a/templates/SearchForm.php
+++ b/templates/SearchForm.php
@@ -1,12 +1,19 @@
-$allSelected = sizeof($tags) == 0 || in_array('all', $tags);
+/**
+ * @var array $tags
+ * @var EbookSortType $sort
+ * @var ViewType $view
+ * @var int $perPage
+ */
+
+$isAllSelected = sizeof($tags) == 0 || in_array('all', $tags);
?>