/podcast/{overzicht,stream,download} toegevoegd

This commit is contained in:
2017-06-11 22:58:53 +02:00
parent f2ae355e72
commit 7ede0532ac
8 changed files with 1660 additions and 211 deletions

View File

@@ -46,7 +46,7 @@ class Model {
$text = str_replace($search, $replace, $text);
// Verwijder alle woorden van 3 letters, behalve BEL (BEL-combinatie etc)
$text = preg_replace('/\b(?!bel)([a-z]{1,3})\b/u', '', $text);
$text = preg_replace('/\b(?!bel|fm)([a-z]{1,3})\b/u', '', $text);
// Vervang alles dat niet een woord-karakter is (letter, cijfer), een streepje of spatie
$text = preg_replace('/[^\w_\-\s]/', '', $text);

View File

@@ -0,0 +1,46 @@
<?php
namespace Model;
require "Program.php";
class Podcast extends Model {
public $id;
public $title;
public $content;
protected $soundfilename;
public $created;
public $program;
public $url;
public $download;
private $key;
public function __construct($data) {
parent::__construct($data);
parent::ConvertToDateTime($this->created);
$this->key = sha1($this->id . ':' . session_id() . ':' . $this->soundfilename);
$this->url = $this->id . '/' . parent::url_slug($this->title) . '?auth=' . $this->key;
if($this->program != 0) {
$this->program = new \Model\Program(['id' => $this->program, 'name' => $data->program_name, 'description' => $data->program_description]);
}
}
public function isValidAuth($key) {
return ($key == $this->key);
}
public function getSoundfile() {
return '/tmp/podcast.mp3';
}
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>';
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Model;
class Program extends Model {
public $id;
public $name;
public $description;
// TODO: Implementeren
public $hosts;
public $schedule;
public $podcasts;
public function __construct($data) {
parent::__construct($data);
}
}