Meta data (OpenGraph) toegevoegd.

This commit is contained in:
2020-02-05 00:40:55 +01:00
parent dc10050e40
commit 1b7527cccf
4 changed files with 62 additions and 1 deletions

View File

@@ -16,13 +16,14 @@ class Podcast extends Model {
public $download;
public $duration;
public $image;
public $metadata;
private $key;
public function __construct($data) {
parent::__construct($data);
parent::ConvertToDateTime($this->created);
$this->url = $this->id . '/' . parent::url_slug($this->title);
$this->url = '/' . $this->id . '/' . parent::url_slug($this->title);
if($this->soundfilename) {
// Only generate when not constructing from a JSON object
$this->key = sha1($this->id . ':' . date('Y-m-d') . ':' . $this->soundfilename);
@@ -45,6 +46,13 @@ class Podcast extends Model {
$imagedata->title = $data->imagecaption;
$this->image = new NewsImage($imagedata, '/img/podcast/');
}
$this->metadata = (new MetaData())
->set('title', $this->title)
->set('description', strip_tags($this->excerpt()))
->set('image', isset($this->images) && count($this->images) ? $this->images[0]->url : null )
->set('audio', $this->url)
;
}
public function titleWithoutProgram() {