Further refinment to OPDS/RSS generation and also add Atom feeds

This commit is contained in:
Alex Cabal 2022-06-23 15:03:52 -05:00
parent d75d847004
commit f9fd6c8a02
23 changed files with 733 additions and 859 deletions

View file

@ -12,7 +12,7 @@ class Feed{
public $Stylesheet = null;
protected $XmlString = null;
public function __construct(string $url, string $title, string $path, array $entries){
public function __construct(string $title, string $url, string $path, array $entries){
$this->Url = $url;
$this->Title = $title;
$this->Path = $path;
@ -38,7 +38,16 @@ class Feed{
return '';
}
function Save(): void{
public function SaveIfChanged(): void{
// 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();
}
}
public function Save(): void{
$feed = $this->GetXmlString();
file_put_contents($this->Path, $feed);