mirror of
https://github.com/standardebooks/web.git
synced 2025-07-18 20:36:38 -04:00
Flesh out some PHPDocs, and consistently name enums
This commit is contained in:
parent
ace9cea6b7
commit
a9eab552ab
25 changed files with 205 additions and 118 deletions
|
@ -11,7 +11,7 @@ $downloadUrl = null;
|
|||
|
||||
try{
|
||||
$urlPath = HttpInput::Str(GET, 'url-path') ?? null;
|
||||
$format = EbookFormat::tryFrom(HttpInput::Str(GET, 'format') ?? '') ?? EbookFormat::Epub;
|
||||
$format = EbookFormatType::tryFrom(HttpInput::Str(GET, 'format') ?? '') ?? EbookFormatType::Epub;
|
||||
$wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath;
|
||||
|
||||
// Do we have the ebook cached?
|
||||
|
@ -24,19 +24,19 @@ try{
|
|||
}
|
||||
|
||||
switch($format){
|
||||
case EbookFormat::Kepub:
|
||||
case EbookFormatType::Kepub:
|
||||
$downloadUrl = $ebook->KepubUrl;
|
||||
break;
|
||||
|
||||
case EbookFormat::Azw3:
|
||||
case EbookFormatType::Azw3:
|
||||
$downloadUrl = $ebook->Azw3Url;
|
||||
break;
|
||||
|
||||
case EbookFormat::AdvancedEpub:
|
||||
case EbookFormatType::AdvancedEpub:
|
||||
$downloadUrl = $ebook->AdvancedEpubUrl;
|
||||
break;
|
||||
|
||||
case EbookFormat::Epub:
|
||||
case EbookFormatType::Epub:
|
||||
default:
|
||||
$downloadUrl = $ebook->EpubUrl;
|
||||
break;
|
||||
|
|
|
@ -230,7 +230,7 @@ catch(Exceptions\EbookNotFoundException){
|
|||
<meta property="schema:description" content="epub"/>
|
||||
<meta property="schema:encodingFormat" content="application/epub+zip"/>
|
||||
<p>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormat::Epub->value ?>" class="epub">Compatible epub</a></span> <span>—</span> <span>All devices and apps except Kindles and Kobos.</span>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormatType::Epub->value ?>" class="epub">Compatible epub</a></span> <span>—</span> <span>All devices and apps except Kindles and Kobos.</span>
|
||||
</p>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
@ -239,7 +239,7 @@ catch(Exceptions\EbookNotFoundException){
|
|||
<li property="schema:encoding" typeof="schema:MediaObject">
|
||||
<meta property="schema:encodingFormat" content="application/x-mobipocket-ebook"/>
|
||||
<p>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormat::Azw3->value ?>" class="amazon"><span property="schema:description">azw3</span></a></span> <span>—</span> <span>Kindle devices and apps.<? if($ebook->KindleCoverUrl !== null){ ?> Also download the <a href="<?= $ebook->KindleCoverUrl ?>">Kindle cover thumbnail</a> to see the cover in your Kindle’s library. Despite what you’ve been told, <a href="/help/how-to-use-our-ebooks#kindle-epub">Kindle does not natively support epub.</a> You may also be interested in our <a href="/help/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? }else{ ?> Also see our <a href="/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? } ?></span>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormatType::Azw3->value ?>" class="amazon"><span property="schema:description">azw3</span></a></span> <span>—</span> <span>Kindle devices and apps.<? if($ebook->KindleCoverUrl !== null){ ?> Also download the <a href="<?= $ebook->KindleCoverUrl ?>">Kindle cover thumbnail</a> to see the cover in your Kindle’s library. Despite what you’ve been told, <a href="/help/how-to-use-our-ebooks#kindle-epub">Kindle does not natively support epub.</a> You may also be interested in our <a href="/help/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? }else{ ?> Also see our <a href="/how-to-use-our-ebooks#kindle-faq">Kindle FAQ</a>.<? } ?></span>
|
||||
</p>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
@ -248,7 +248,7 @@ catch(Exceptions\EbookNotFoundException){
|
|||
<li property="schema:encoding" typeof="schema:MediaObject">
|
||||
<meta property="schema:encodingFormat" content="application/kepub+zip"/>
|
||||
<p>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormat::Kepub->value ?>" class="kobo"><span property="schema:description">kepub</span></a></span> <span>—</span> <span>Kobo devices and apps. You may also be interested in our <a href="/help/how-to-use-our-ebooks#kobo-faq">Kobo FAQ</a>.</span>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormatType::Kepub->value ?>" class="kobo"><span property="schema:description">kepub</span></a></span> <span>—</span> <span>Kobo devices and apps. You may also be interested in our <a href="/help/how-to-use-our-ebooks#kobo-faq">Kobo FAQ</a>.</span>
|
||||
</p>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
@ -257,7 +257,7 @@ catch(Exceptions\EbookNotFoundException){
|
|||
<li property="schema:encoding" typeof="schema:MediaObject">
|
||||
<meta property="schema:encodingFormat" content="application/epub+zip"/>
|
||||
<p>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormat::AdvancedEpub->value ?>" class="epub"><span property="schema:description">Advanced epub</span></a></span> <span>—</span> <span>An advanced format that uses the latest technology not yet fully supported by most ereaders.</span>
|
||||
<span><a property="schema:contentUrl" rel="nofollow" href="<?= $ebook->Url ?>/download?format=<?= EbookFormatType::AdvancedEpub->value ?>" class="epub"><span property="schema:description">Advanced epub</span></a></span> <span>—</span> <span>An advanced format that uses the latest technology not yet fully supported by most ereaders.</span>
|
||||
</p>
|
||||
</li>
|
||||
<? } ?>
|
||||
|
|
|
@ -7,7 +7,7 @@ $perPage = HttpInput::Int(GET, 'per-page') ?? EBOOKS_PER_PAGE;
|
|||
$query = HttpInput::Str(GET, 'query') ?? '';
|
||||
$tags = HttpInput::Array(GET, 'tags') ?? [];
|
||||
$view = ViewType::tryFrom(HttpInput::Str(GET, 'view') ?? '');
|
||||
$sort = EbookSort::tryFrom(HttpInput::Str(GET, 'sort') ?? '');
|
||||
$sort = EbookSortType::tryFrom(HttpInput::Str(GET, 'sort') ?? '');
|
||||
$queryString = '';
|
||||
$queryStringParams = [];
|
||||
$queryStringWithoutPage = '';
|
||||
|
@ -27,7 +27,7 @@ try{
|
|||
$view = null;
|
||||
}
|
||||
|
||||
if($sort == EbookSort::Newest){
|
||||
if($sort == EbookSortType::Newest){
|
||||
$sort = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue