Model classes van API repo naar deze repo verplaatst
This commit is contained in:
23
app/Models/Blog.php
Normal file
23
app/Models/Blog.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Blog extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $description;
|
||||
public $news_category;
|
||||
public $start_date;
|
||||
public $end_date;
|
||||
public $is_active;
|
||||
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start_date);
|
||||
parent::ConvertToDateTime($this->end_date);
|
||||
|
||||
$this->url = "/blog/{$this->id}/" . parent::url_slug($this->title);
|
||||
}
|
||||
}
|
||||
67
app/Models/CalendarEvent.php
Normal file
67
app/Models/CalendarEvent.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class CalendarEvent extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $region;
|
||||
public $content;
|
||||
public $starts;
|
||||
public $ends;
|
||||
public $images;
|
||||
public $podcast;
|
||||
public $video;
|
||||
public $keywords;
|
||||
public $url;
|
||||
public $metadata;
|
||||
public $tags;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->starts);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast)
|
||||
{
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/agenda/{$this->id}/" . parent::url_slug($this->title);
|
||||
$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', isset($this->podcast) ? $this->podcast->url : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = isset($this->images) && count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
61
app/Models/JobOpening.php
Normal file
61
app/Models/JobOpening.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class JobOpening extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $content;
|
||||
public $starts;
|
||||
public $ends;
|
||||
public $images;
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->starts);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast)
|
||||
{
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/vacatures/{$this->id}/" . parent::url_slug($this->title);
|
||||
$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', isset($this->podcast) ? $this->podcast->url : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
26
app/Models/Kerkdienst.php
Normal file
26
app/Models/Kerkdienst.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class KerkdienstInstance extends Model {
|
||||
public $name;
|
||||
public $start;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start);
|
||||
}
|
||||
}
|
||||
|
||||
class Kerkdienst extends Model {
|
||||
public $isRunning;
|
||||
public $previous;
|
||||
public $next;
|
||||
|
||||
public function __construct($data) {
|
||||
// parent::__construct($data);
|
||||
$this->isRunning = $data->isRunning;
|
||||
$this->previous = new KerkdienstInstance($data->previous);
|
||||
$this->next = new KerkdienstInstance($data->next);
|
||||
}
|
||||
}
|
||||
35
app/Models/MetaData.php
Normal file
35
app/Models/MetaData.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace Model;
|
||||
|
||||
class MetaData {
|
||||
private $data = ['type' => 'article', 'locale' => 'nl-nl'];
|
||||
|
||||
public function set($prop, $val) {
|
||||
if($val) {
|
||||
$this->data[$prop] = $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function append($prop, $val) {
|
||||
if(array_key_exists($prop, $this->data)) {
|
||||
$this->data[$prop] .= $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function prepend($prop, $val) {
|
||||
if(array_key_exists($prop, $this->data)) {
|
||||
$this->data[$prop] = $val . $this->data[$prop];
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function metaTags() {
|
||||
foreach($this->data as $prop => $val) {
|
||||
if($val) {
|
||||
echo "<meta property=\"og:$prop\" content=\"" . htmlentities($val) . "\" />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
app/Models/Model.php
Normal file
64
app/Models/Model.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Model {
|
||||
protected function ConvertToDateTime(&$field) {
|
||||
if($field) {
|
||||
// PHP7 JSON-encodes to {date: "", "timezone_type": ..., "timezone": "UTC" }
|
||||
// In that case $field will be an object
|
||||
if(is_object($field)) {
|
||||
$field = ($field->timezone)
|
||||
? 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);
|
||||
}
|
||||
|
||||
if($field === false || $field->getTimestamp() <= 0) {
|
||||
// If field had data but is invalid DateTime or is 0000-00-00 00:00, set it to null.
|
||||
$field = null;
|
||||
} else {
|
||||
// If valid, return local timezone
|
||||
$field->setTimezone(new \DateTimeZone("Europe/Amsterdam"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct($data) {
|
||||
$class = get_class($this);
|
||||
foreach($data as $key => $val) {
|
||||
if(property_exists($class, $key)) {
|
||||
$this->$key = is_string($val) ? stripslashes($val) : $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function url_slug($text) {
|
||||
// Alles naar kleine letter
|
||||
$text = strtolower($text);
|
||||
|
||||
// Vervang accent-tekens door niet-geaccentueerde versies
|
||||
// $text = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text);
|
||||
$search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u");
|
||||
$replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u");
|
||||
$text = str_replace($search, $replace, $text);
|
||||
|
||||
// Verwijder alle woorden van 3 letters, behalve BEL (BEL-combinatie etc)
|
||||
if(strlen($text) > 3) {
|
||||
$text = preg_replace('/\b(?!bel|fm|nh)([a-z]{1,3})\b/u', '', $text);
|
||||
}
|
||||
|
||||
// Vervang alles dat niet een woord-karakter is (letter, cijfer), een streepje of spatie
|
||||
if(strlen($text) > 3) {
|
||||
$text = preg_replace('/[^\w_\-\s]/', '', $text);
|
||||
}
|
||||
|
||||
// Reeksen van één of meer spaties / streepjes vervangen door een enkel streepje
|
||||
$text = preg_replace('/[\-\s]+/', '-', $text);
|
||||
|
||||
// Verwijder alle witruimte / streepjes aan begin en eind
|
||||
return trim(strtolower($text), '-');
|
||||
}
|
||||
}
|
||||
20
app/Models/NewsImage.php
Normal file
20
app/Models/NewsImage.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class NewsImage extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $author;
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $urlPrefix = '/') {
|
||||
parent::__construct($data);
|
||||
|
||||
// Deserialisatie van JSON heeft url in data,
|
||||
// lezen uit database heeft file en (als het goed is) urlPrefix
|
||||
if(isset($data->file)) {
|
||||
$this->url = $urlPrefix . $data->file;
|
||||
}
|
||||
}
|
||||
}
|
||||
118
app/Models/NewsItem.php
Normal file
118
app/Models/NewsItem.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
require_once "NewsImage.php";
|
||||
require_once "NewsSource.php";
|
||||
require_once "MetaData.php";
|
||||
|
||||
class NewsItem extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $author;
|
||||
public $content;
|
||||
public $published;
|
||||
public $edited;
|
||||
public $keywords;
|
||||
|
||||
public $source;
|
||||
public $category;
|
||||
public $theme;
|
||||
public $region;
|
||||
public $tags;
|
||||
|
||||
public $podcast;
|
||||
public $images;
|
||||
public $video;
|
||||
|
||||
public $url;
|
||||
public $metadata;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->published);
|
||||
parent::ConvertToDateTime($this->edited);
|
||||
|
||||
if($this->edited && ($this->edited->getTimestamp() - $this->published->getTimestamp() < 1800 /* == 30 minutes */)) {
|
||||
// If last edit was within grace period, consider it unedited (note: currently RES always saves edited == published on creation)
|
||||
$this->edited = null;
|
||||
}
|
||||
|
||||
$this->source = null;
|
||||
if(isset($data->source))
|
||||
{
|
||||
if(is_object($data->source))
|
||||
{
|
||||
$this->source = new \Model\NewsSource($data->source->title, $data->source->url, $data->source->show);
|
||||
} else if($data->source) {
|
||||
$this->source = new \Model\NewsSource($data->source, $data->source_url, $data->showsource);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast) {
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords) || is_object($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->region)) {
|
||||
if(is_object($data->region)) {
|
||||
$this->region = new \Model\NewsRegion($data->region->title, $data->region->slug);
|
||||
} else {
|
||||
$this->region = new \Model\NewsRegion($data->region, $data->region_slug);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->theme)) {
|
||||
if(is_object($data->theme)) {
|
||||
$this->theme = new \Model\NewsRegion($data->theme->title, $data->theme->slug);
|
||||
} else {
|
||||
$this->theme = new \Model\NewsRegion($data->theme, $data->theme_slug);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->tags)) {
|
||||
foreach($data->tags as $tag) {
|
||||
$this->theme = new \Model\NewsRegion($tag->titel, $tag->slug);
|
||||
}
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/nieuws/{$this->id}/" . parent::url_slug($this->title);
|
||||
$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('video', isset($this->video) ? $this->video : null)
|
||||
->set('audio', isset($this->podcast) ? $this->podcast->url : null)
|
||||
->set('article:published_time', $this->published->format('r'))
|
||||
->set('article:modified_time', $this->edited ? $this->edited->format('r') : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = isset($this->images) && count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
25
app/Models/NewsSource.php
Normal file
25
app/Models/NewsSource.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class NewsRegion {
|
||||
public $title;
|
||||
public $slug;
|
||||
|
||||
public function __construct($title, $slug = null) {
|
||||
$this->title = $title;
|
||||
$this->slug = $slug ? $slug : strtolower(str_replace(' ', '', $title));
|
||||
}
|
||||
}
|
||||
|
||||
class NewsSource {
|
||||
public $title;
|
||||
public $url;
|
||||
public $show;
|
||||
|
||||
public function __construct($title, $url, $show) {
|
||||
$this->title = $title;
|
||||
$this->url = $url;
|
||||
$this->show = $show;
|
||||
}
|
||||
}
|
||||
94
app/Models/Podcast.php
Normal file
94
app/Models/Podcast.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
require_once "NewsImage.php";
|
||||
|
||||
class Podcast extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $content;
|
||||
protected $soundfilename;
|
||||
public $created;
|
||||
public $program;
|
||||
public $url;
|
||||
public $auth;
|
||||
public $download;
|
||||
public $duration;
|
||||
public $image;
|
||||
public $metadata;
|
||||
public $waveform;
|
||||
private $key;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->created);
|
||||
|
||||
$this->url = '/' . $this->id . '/' . parent::url_slug($this->title) . '.mp3';
|
||||
if($this->soundfilename) {
|
||||
// Only generate when not constructing from a JSON object
|
||||
$this->key = sha1($this->id . ':' . date('Y-m-d') . ':' . $this->soundfilename);
|
||||
$this->auth = $this->key;
|
||||
}
|
||||
|
||||
if(isset($data->program)) {
|
||||
$this->program = null;
|
||||
if(is_object($data->program)) {
|
||||
$this->program = new \Model\Program($data->program);
|
||||
} elseif($data->program) {
|
||||
$this->program = new \Model\Program(['id' => $data->program, 'name' => $data->program_name, 'description' => $data->program_description]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->imagefile)) {
|
||||
$imagedata = new \stdClass();
|
||||
$imagedata->id = $this->id;
|
||||
$imagedata->file = $data->imagefile;
|
||||
$imagedata->title = $data->imagecaption;
|
||||
$this->image = new NewsImage($imagedata, '/img/podcast/');
|
||||
}
|
||||
|
||||
if(isset($data->metadata, $data->metadata->waveform)){
|
||||
$this->waveform = $data->metadata->waveform;
|
||||
}
|
||||
|
||||
$this->metadata = (new MetaData())
|
||||
->set('title', $this->title)
|
||||
->set('description', strip_tags($this->excerpt()))
|
||||
->set('image', isset($this->image) ? $this->image->url : null )
|
||||
->set('audio', $this->url)
|
||||
;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public function getSoundfile() {
|
||||
return '/var/audio/podcast/' . $this->soundfilename;
|
||||
}
|
||||
|
||||
public function formatDuration() {
|
||||
$seconds = $this->duration / 1000;
|
||||
$milliseconds = $this->duration % 1000;
|
||||
|
||||
$hours = ($seconds > 3600) ? floor($seconds / 3600) : 0;
|
||||
$seconds %= 3600;
|
||||
return str_pad($hours, 2, '0', STR_PAD_LEFT)
|
||||
. gmdate(':i:s', $seconds)
|
||||
;//. ($milliseconds ? ".$milliseconds" : '') ;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$maxLength = 500;
|
||||
return '<p class="news-excerpt long">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
55
app/Models/Program.php
Normal file
55
app/Models/Program.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Program extends Model {
|
||||
public $id;
|
||||
public $name;
|
||||
public $tagline;
|
||||
public $description;
|
||||
public $email;
|
||||
public $nonstop;
|
||||
public $rerun;
|
||||
public $priority;
|
||||
public $image;
|
||||
|
||||
public $hosts;
|
||||
public $recent;
|
||||
public $next;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
|
||||
if(isset($data->suffix) && $data->suffix) {
|
||||
$this->name .= ' ' . $data->suffix;
|
||||
}
|
||||
|
||||
if($this->recent && $this->recent) {
|
||||
foreach($this->recent as &$recent) {
|
||||
parent::ConvertToDateTime($recent->starts);
|
||||
parent::ConvertToDateTime($recent->ends);
|
||||
}
|
||||
}
|
||||
if($this->next && $this->next) {
|
||||
foreach($this->next as &$next) {
|
||||
parent::ConvertToDateTime($next->starts);
|
||||
parent::ConvertToDateTime($next->ends);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->email) && ($mailComma = strpos($data->email, ',')) !== false) {
|
||||
$this->email = substr($data->email, 0, $mailComma);
|
||||
}
|
||||
|
||||
if(isset($data->state)) {
|
||||
$this->nonstop = $data->state == 0;
|
||||
$this->rerun = $data->state == 3;
|
||||
}
|
||||
|
||||
$this->url = "/{$this->id}/" . parent::url_slug($this->name);
|
||||
}
|
||||
|
||||
public function isSpecial() {
|
||||
return ($this->priority < 2);
|
||||
}
|
||||
}
|
||||
10
app/Models/ProgramHost.php
Normal file
10
app/Models/ProgramHost.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class ProgramHost extends Model {
|
||||
public $id;
|
||||
public $name;
|
||||
public $email;
|
||||
}
|
||||
|
||||
47
app/Models/Track.php
Normal file
47
app/Models/Track.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Track extends Model {
|
||||
public $start;
|
||||
public $itemCode;
|
||||
public $title;
|
||||
public $artist;
|
||||
public $duration;
|
||||
public $ends;
|
||||
public $isLayout;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
$isLayout = $this->isLayout();
|
||||
}
|
||||
|
||||
private static $IDENTS = ['UURSLUITER' => 'Nieuws', 'NIEUWSOPEN ' => 'Nieuws', 'ANWB' => 'Verkeersinformatie', 'REGIO' => 'Regionieuws', 'CB' => 'Reclame'];
|
||||
|
||||
public function isLayout() {
|
||||
foreach(self::$IDENTS as $ident => $display) {
|
||||
if(substr($this->itemCode, 0, strlen($ident)) == $ident || substr($this->title, 0, strlen($ident)) == $ident) {
|
||||
$this->title = $display;
|
||||
$this->artist = "";
|
||||
$this->itemCode = '_' . $this->itemCode;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($this->itemCode) > 0 && ($this->itemCode[0] == 'V')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function ends($ends = null) {
|
||||
$this->ends = $ends;
|
||||
}
|
||||
|
||||
public function secondsRemaining() {
|
||||
return ($this->ends) ? ($this->ends->getTimestamp() - time()) : -1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user