From 9e5654555f5dff6e9b82a8f94316f9494e9e315e Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sat, 23 May 2020 20:46:32 -0500 Subject: [PATCH] Don't print collection type if the type is in the name (i.e. 'Martian Series series') --- www/ebooks/index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/www/ebooks/index.php b/www/ebooks/index.php index a20eba9b..6f5776cd 100644 --- a/www/ebooks/index.php +++ b/www/ebooks/index.php @@ -53,7 +53,16 @@ try{ if($collectionObject !== null){ $collectionName = preg_replace('/^The /ius', '', $collectionObject->Name) ?? ''; $collectionType = $collectionObject->Type ?? 'collection'; - $pageTitle = 'Browse ebooks in the ' . Formatter::ToPlainText($collectionName) . ' ' . $collectionType; + + # This is a kind of .endswith() test + if(substr_compare(mb_strtolower($collectionObject->Name), mb_strtolower($collectionObject->Type), -strlen(mb_strtolower($collectionObject->Type))) !== 0){ + $collectionType = ' ' . $collectionType; + } + else{ + $collectionType = ''; + } + + $pageTitle = 'Browse ebooks in the ' . Formatter::ToPlainText($collectionName) . $collectionType; $pageDescription = 'A list of ebooks in the ' . Formatter::ToPlainText($collectionName) . ' ' . $collectionType; $pageHeader = 'Ebooks in the ' . Formatter::ToPlainText($collectionName) . ' ' . $collectionType; }