diff --git a/lib/Collection.php b/lib/Collection.php index 857b3d05..7247cc8f 100644 --- a/lib/Collection.php +++ b/lib/Collection.php @@ -3,6 +3,7 @@ class Collection{ public $Name; public $Url; public $SequenceNumber = null; + public $Type = null; public function __construct(string $name){ $this->Name = $name; diff --git a/lib/Ebook.php b/lib/Ebook.php index 4d1559e5..03a4ba0f 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -170,6 +170,9 @@ class Ebook{ foreach($xml->xpath('/package/metadata/meta[@refines="#' . $collection->attributes()->id . '"][@property="group-position"]') ?: [] as $s){ $c->SequenceNumber = (int)$s; } + foreach($xml->xpath('/package/metadata/meta[@refines="#' . $collection->attributes()->id . '"][@property="collection-type"]') ?: [] as $s){ + $c->Type = (string)$s; + } $this->Collections[] = $c; } diff --git a/www/ebooks/ebook.php b/www/ebooks/ebook.php index 76332635..3575ea1a 100644 --- a/www/ebooks/ebook.php +++ b/www/ebooks/ebook.php @@ -79,11 +79,11 @@ catch(\Exception $ex){
= $ebook->ContributorsHtml ?>
} ?> if(sizeof($ebook->Collections) > 0){ ?> -Part of the +
if(sizeof($ebook->Collections) == 1 && $ebook->Collections[0]->SequenceNumber !== null){ ?>№ = number_format($ebook->Collections[0]->SequenceNumber) ?> in the }else{ ?>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 } ?>.
+ if(sizeof($ebook->Collections) == 1 && $ebook->Collections[0]->Type !== null){ ?> if(substr_compare(mb_strtolower($ebook->Collections[0]->Name), mb_strtolower($ebook->Collections[0]->Type), -strlen(mb_strtolower($ebook->Collections[0]->Type))) !== 0){ ?>= $ebook->Collections[0]->Type ?> } ?> }else{ ?>collection if(sizeof($ebook->Collections) > 1){ ?>s } ?> } ?>. } ?>