/** * Adds a entry to the feed list */ function addItem($i) { switch (get_class($i)) { case 'cd\\NewsItem': $item = $i; break; case 'cd\\VideoResource': d($i); die; // d($i); //convert into a NewsItem $item = new NewsItem(); $item->title = $i->title; $item->desc = $i->desc; $item->image_url = $i->thumbnail; $item->image_mime = file_get_mime_by_suffix($i->thumbnail); $item->Url->set($i->Url->get()); $item->Duration->set($i->Duration->get()); $item->Timestamp->set($i->Timestamp->get()); break; default: throw new \Exception('cant handle ' . get_class($i)); } parent::addItem($item); }
public function setFavicon($uri) { if (substr($uri, 0, 1) != '/') { $uri = relurl($uri); } $this->addRel('icon', $uri, file_get_mime_by_suffix($uri)); }
function embedFile($filename, $cid = '') { if (!file_exists($filename)) { throw new \Exception('File ' . $filename . ' not found'); } $a = new MailAttachment(); $a->data = file_get_contents($filename); $a->filename = basename($filename); $a->mimetype = file_get_mime_by_suffix($filename); $a->content_id = $cid; //<img src="cid:pic_name"> self::$attachments[] = $a; }