published); parent::ConvertToDateTime($this->edited); $this->source = $data->source ? new \Model\NewsSource($data->source, $data->source_url, $data->showsource) : null; $this->keywords = trim($data->keywords) ? explode(' ', $data->keywords) : null; $this->podcast = $data->podcast ? $data->podcast : null; $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); } public function detailsUrl() { return "/{$this->id}/" . urlencode($this->title); } public function excerpt() { $hasImages = count($this->images) > 0; $maxLength = $hasImages ? 200 : 500; return '

' . substr($this->content, 0, $maxLength) . (strlen($this->content) > $maxLength ? '...' : '') . '

'; } }