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
|
// In that case $field will be an object
|
||||||
if(is_object($field)) {
|
if(is_object($field)) {
|
||||||
$field = ($field->timezone)
|
$field = ($field->timezone)
|
||||||
? new \DateTime($field->date, new \DateTimeZone($field->timezone))
|
? new \DateTimeImmutable($field->date, new \DateTimeZone($field->timezone))
|
||||||
: (new \DateTime($field->date));
|
: (new \DateTimeImmutable($field->date));
|
||||||
} else {
|
} else {
|
||||||
// If $field is not an object, assume it's a plain, valid, string
|
// If $field is not an object, assume it's a plain, valid, string
|
||||||
$field = new \DateTime($field);
|
$field = new \DateTime($field);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Model;
|
namespace Model;
|
||||||
|
|
||||||
require "Program.php";
|
|
||||||
|
|
||||||
class Podcast extends Model {
|
class Podcast extends Model {
|
||||||
public $id;
|
public $id;
|
||||||
public $title;
|
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) {
|
public function isValidAuth($key) {
|
||||||
return ($key == $this->key);
|
return ($key == $this->key);
|
||||||
}
|
}
|
||||||
@@ -45,9 +48,8 @@ class Podcast extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function excerpt() {
|
public function excerpt() {
|
||||||
$hasImages = count($this->images) > 0;
|
$maxLength = 500;
|
||||||
$maxLength = $hasImages ? 200 : 500;
|
return '<p class="news-excerpt long">' .
|
||||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
|
||||||
substr($this->content, 0, $maxLength) .
|
substr($this->content, 0, $maxLength) .
|
||||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||||
'</p>';
|
'</p>';
|
||||||
|
|||||||
Reference in New Issue
Block a user