From 75bfec619e511071ab4048b3c9f3527441ae320b Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 27 Feb 2019 13:26:52 -0600 Subject: [PATCH] Improve collection title for collections with diacritics --- www/ebooks/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/ebooks/index.php b/www/ebooks/index.php index 70ace3a1..4ab26a85 100644 --- a/www/ebooks/index.php +++ b/www/ebooks/index.php @@ -40,6 +40,12 @@ try{ elseif($collection !== null){ $collection = strtolower(str_replace('-', ' ', Formatter::RemoveDiacritics($collection))); $ebooks = Library::GetEbooksByCollection($collection); + // Get the *actual* name of the collection, in case there are accent marks (like "Arsène Lupin") + foreach($ebooks[0]->Collections as $c){ + if($collection == strtolower(str_replace('-', ' ', Formatter::RemoveDiacritics($c->Name)))){ + $collection = (string)$c->Name; // Explicit typecast to string to satisfy PHPStan + } + } $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';