Podcasts aangepast voor weergave op voorpagina
This commit is contained in:
@@ -9,8 +9,8 @@ class Model {
|
||||
// In that case $field will be an object
|
||||
if(is_object($field)) {
|
||||
$field = ($field->timezone)
|
||||
? new \DateTime($field->date, new \DateTimeZone($field->timezone))
|
||||
: (new \DateTime($field->date));
|
||||
? new \DateTimeImmutable($field->date, new \DateTimeZone($field->timezone))
|
||||
: (new \DateTimeImmutable($field->date));
|
||||
} else {
|
||||
// If $field is not an object, assume it's a plain, valid, string
|
||||
$field = new \DateTime($field);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Model;
|
||||
|
||||
require "Program.php";
|
||||
|
||||
class Podcast extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
@@ -36,6 +34,11 @@ class Podcast extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
public function titleWithoutProgram() {
|
||||
if(!$this->program) { return $this->title; }
|
||||
return trim(str_replace($this->program->name, '', $this->title), "- \t\n\r\0\x0B");
|
||||
}
|
||||
|
||||
public function isValidAuth($key) {
|
||||
return ($key == $this->key);
|
||||
}
|
||||
@@ -45,9 +48,8 @@ class Podcast extends Model {
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
$maxLength = 500;
|
||||
return '<p class="news-excerpt long">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
|
||||
Reference in New Issue
Block a user