diff --git a/lib/Collection.php b/lib/Collection.php index 55e2cfcf..9d684559 100644 --- a/lib/Collection.php +++ b/lib/Collection.php @@ -5,7 +5,7 @@ class Collection{ public function __construct(string $name){ $this->Name = $name; - $this->Url = '/collections/' . strtolower(str_replace(' ', '-', Formatter::ToPlainText($this->Name))) . '/'; + $this->Url = '/collections/' . strtolower(str_replace(' ', '-', Formatter::ToPlainText(Formatter::RemoveDiacritics($this->Name)))) . '/'; } } ?> diff --git a/lib/Ebook.php b/lib/Ebook.php index 89527915..edfa6a24 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -521,7 +521,7 @@ class Ebook{ public function IsInCollection(string $collection): bool{ foreach($this->Collections as $c){ - if(strtolower($c->Name) == strtolower($collection)){ + if(strtolower(Formatter::RemoveDiacritics($c->Name)) == strtolower(Formatter::RemoveDiacritics($collection))){ return true; } } diff --git a/www/ebooks/ebook.php b/www/ebooks/ebook.php index 17e317d4..8f6d7e6f 100644 --- a/www/ebooks/ebook.php +++ b/www/ebooks/ebook.php @@ -72,9 +72,11 @@ catch(\Exception $ex){
= $ebook->ContributorsHtml ?>
} ?> if(sizeof($ebook->Collections) > 0){ ?> - foreach($ebook->Collections as $collection){ ?> -Part of the = Formatter::ToPlainText($collection->Name) ?> collection.
- } ?> +Part of the + for($i = 0; $i < sizeof($ebook->Collections); $i++){ ?> + = Formatter::ToPlainText(preg_replace('/^The /ius', '', (string)$ebook->Collections[$i]->Name) ?? '') ?> if(sizeof($ebook->Collections) > 2){ ?> if($i == sizeof($ebook->Collections) - 2){ ?>, and }elseif($i != sizeof($ebook->Collections) - 1){ ?>, } ?> }elseif($i == sizeof($ebook->Collections) - 2){ ?> and } ?> + } ?> + collection if(sizeof($ebook->Collections) > 1){ ?>s } ?>.
} ?> diff --git a/www/ebooks/index.php b/www/ebooks/index.php index 246e904a..70ace3a1 100644 --- a/www/ebooks/index.php +++ b/www/ebooks/index.php @@ -28,15 +28,22 @@ try{ $tag = strtolower(str_replace('-', ' ', $tag)); $ebooks = Library::GetEbooksByTag($tag); $pageTitle = 'Browse ebooks tagged “' . Formatter::ToPlainText($tag) . '”'; - $pageDescription = 'A list of ebooks tagged “' . Formatter::ToPlainText($tag) . '”'; + $pageDescription = 'Page ' . $page . ' of ebooks tagged “' . Formatter::ToPlainText($tag) . '”'; $pageHeader = 'Ebooks tagged “' . Formatter::ToPlainText($tag) . '”'; + + $pages = ceil(sizeof($ebooks) / EBOOKS_PER_PAGE); + + $totalEbooks = sizeof($ebooks); + + $ebooks = array_slice($ebooks, ($page - 1) * EBOOKS_PER_PAGE, EBOOKS_PER_PAGE); } elseif($collection !== null){ - $collection = strtolower(str_replace('-', ' ', $collection)); + $collection = strtolower(str_replace('-', ' ', Formatter::RemoveDiacritics($collection))); $ebooks = Library::GetEbooksByCollection($collection); - $pageTitle = 'Browse ebooks in the ' . Formatter::ToPlainText(ucwords($collection)) . ' collection'; - $pageDescription = 'A list of ebooks in the ' . Formatter::ToPlainText(ucwords($collection)) . ' collection'; - $pageHeader = 'Ebooks in the ' . Formatter::ToPlainText(ucwords($collection)) . ' collection'; + $collectionName = ucwords(preg_replace('/^The /ius', '', $collection) ?? ''); + $pageTitle = 'Browse ebooks in the ' . Formatter::ToPlainText($collectionName) . ' collection'; + $pageDescription = 'A list of ebooks in the ' . Formatter::ToPlainText($collectionName) . ' collection'; + $pageHeader = 'Ebooks in the ' . Formatter::ToPlainText($collectionName) . ' collection'; } else{ $pageTitle = 'Browse Standard Ebooks'; @@ -74,7 +81,7 @@ catch(\Exception $ex){ }else{ ?> = Template::EbookGrid(['ebooks' => $ebooks]) ?> } ?> - if($query === null){ ?> + if($query === null && $tag === null && $collection === null){ ?> + }elseif($tag !== null){ ?> + + } ?> + if($query === null && $tag === null && $collection === null){ ?>