mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
Add collections and authors RSS/Atom/OPDS feeds
This commit is contained in:
parent
e19847adac
commit
05e0f77b45
19 changed files with 280 additions and 142 deletions
|
@ -23,7 +23,7 @@ class AtomFeed extends Feed{
|
|||
parent::__construct($title, $url, $path, $entries);
|
||||
$this->Subtitle = $subtitle;
|
||||
$this->Id = $url;
|
||||
$this->Stylesheet = '/feeds/atom/style';
|
||||
$this->Stylesheet = SITE_URL . '/feeds/atom/style';
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,13 +41,16 @@ class AtomFeed extends Feed{
|
|||
return $this->XmlString;
|
||||
}
|
||||
|
||||
public function SaveIfChanged(): void{
|
||||
public function SaveIfChanged(): bool{
|
||||
// Did we actually update the feed? If so, write to file and update the index
|
||||
if($this->HasChanged($this->Path)){
|
||||
// Files don't match, save the file
|
||||
$this->Updated = new DateTime();
|
||||
$this->Save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function HasChanged(string $path): bool{
|
||||
|
|
|
@ -322,7 +322,10 @@ class Library{
|
|||
* @return array<string, array<int|string, array<int|string, mixed>>>
|
||||
*/
|
||||
public static function RebuildBulkDownloadsCache(): array{
|
||||
$collator = collator_create( 'en_US' ); // Used for sorting letters with diacritics like in author names
|
||||
$collator = Collator::create('en_US'); // Used for sorting letters with diacritics like in author names
|
||||
if($collator === null){
|
||||
throw new Exceptions\SeException('Couldn\'t create collator object when rebuilding bulk download cache.');
|
||||
}
|
||||
$months = [];
|
||||
$subjects = [];
|
||||
$collections = [];
|
||||
|
|
|
@ -16,7 +16,7 @@ class OpdsFeed extends AtomFeed{
|
|||
public function __construct(string $title, string $subtitle, string $url, string $path, array $entries, ?OpdsNavigationFeed $parent){
|
||||
parent::__construct($title, $subtitle, $url, $path, $entries);
|
||||
$this->Parent = $parent;
|
||||
$this->Stylesheet = '/feeds/opds/style';
|
||||
$this->Stylesheet = SITE_URL . '/feeds/opds/style';
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ class OpdsFeed extends AtomFeed{
|
|||
}
|
||||
}
|
||||
|
||||
public function SaveIfChanged(): void{
|
||||
public function SaveIfChanged(): bool{
|
||||
// Did we actually update the feed? If so, write to file and update the index
|
||||
if($this->HasChanged($this->Path)){
|
||||
// Files don't match, save the file and update the parent navigation feed with the last updated timestamp
|
||||
|
@ -58,6 +58,9 @@ class OpdsFeed extends AtomFeed{
|
|||
|
||||
// Save our own file
|
||||
$this->Save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class RssFeed extends Feed{
|
|||
public function __construct(string $title, string $description, string $url, string $path, array $entries){
|
||||
parent::__construct($title, $url, $path, $entries);
|
||||
$this->Description = $description;
|
||||
$this->Stylesheet = '/feeds/rss/style';
|
||||
$this->Stylesheet = SITE_URL . '/feeds/rss/style';
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,12 +35,15 @@ class RssFeed extends Feed{
|
|||
return $this->XmlString;
|
||||
}
|
||||
|
||||
public function SaveIfChanged(): void{
|
||||
public function SaveIfChanged(): bool{
|
||||
// Did we actually update the feed? If so, write to file and update the index
|
||||
if($this->HasChanged($this->Path)){
|
||||
// Files don't match, save the file
|
||||
$this->Save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function HasChanged(string $path): bool{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue