0){ foreach($ebooks[0]->Collections as $c){ if($collection == Formatter::MakeUrlSafe($c->Name)){ $collectionObject = $c; } } } if($collectionObject !== null){ $collectionName = preg_replace('/^The /ius', '', $collectionObject->Name) ?? ''; $collectionType = $collectionObject->Type ?? 'collection'; # 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; } else{ throw new InvalidCollectionException(); } } else{ $pageTitle = 'Browse Standard Ebooks'; $pageHeader = 'Browse Ebooks'; $ebooks = Library::GetEbooks($sort); $pages = ceil(sizeof($ebooks) / EBOOKS_PER_PAGE); $totalEbooks = sizeof($ebooks); $ebooks = array_slice($ebooks, ($page - 1) * EBOOKS_PER_PAGE, EBOOKS_PER_PAGE); $pageDescription = 'Page ' . $page . ' of the Standard Ebooks ebook library, sorted '; switch($sort){ case SORT_NEWEST: $pageDescription .= 'by newest ebooks first.'; break; case SORT_AUTHOR_ALPHA: $pageDescription .= 'alphabetically by author name.'; break; case SORT_READING_EASE: $pageDescription .= 'by easiest ebooks first.'; break; case SORT_LENGTH: $pageDescription .= 'by shortest ebooks first.'; break; } } } catch(\Exception $ex){ http_response_code(404); include(WEB_ROOT . '/404.php'); exit(); } ?> $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription]) ?>

$query]) ?>

No ebooks matched your search. You can try different search terms, or browse all of our ebooks.

$ebooks]) ?> 0 && $query === null && $tag === null && $collection === null){ ?> 0 && $tag !== null){ ?> 0 && $query === null && $tag === null && $collection === null){ ?>