created); $this->url = $this->id . '/' . parent::url_slug($this->title); 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) && $data->program) { $this->program = null; if(is_object($data->program)) { $this->program = new \Model\Program($data->program); } else { // $this->program = new \Model\Program(['id' => $this->program, 'name' => $data->program_name, 'description' => $data->program_description]); } } } 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 excerpt() { $maxLength = 500; return '

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

'; } }