- $this->out->elementEnd('li');
- }
-}
-
-class Attachment extends AttachmentListItem
-{
- function showLink() {
- $this->out->elementStart('div', array('id' => 'attachment_view',
- 'class' => 'hentry'));
- $this->out->elementStart('div', 'entry-title');
- $this->out->elementStart('a', $this->linkAttr());
- $this->out->element('span', null, $this->linkTitle());
- $this->out->elementEnd('a');
- $this->out->elementEnd('div');
-
- $this->out->elementStart('div', 'entry-content');
- $this->showRepresentation();
- $this->out->elementEnd('div');
-
- if (!empty($this->oembed->author_name) || !empty($this->oembed->provider)) {
- $this->out->elementStart('div', array('id' => 'oembed_info',
- 'class' => 'entry-content'));
- if (!empty($this->oembed->author_name)) {
- $this->out->elementStart('dl', 'vcard author');
- $this->out->element('dt', null, _('Author'));
- $this->out->elementStart('dd', 'fn');
- if (empty($this->oembed->author_url)) {
- $this->out->text($this->oembed->author_name);
- } else {
- $this->out->element('a', array('href' => $this->oembed->author_url,
- 'class' => 'url'), $this->oembed->author_name);
- }
- $this->out->elementEnd('dd');
- $this->out->elementEnd('dl');
- }
- if (!empty($this->oembed->provider)) {
- $this->out->elementStart('dl', 'vcard');
- $this->out->element('dt', null, _('Provider'));
- $this->out->elementStart('dd', 'fn');
- if (empty($this->oembed->provider_url)) {
- $this->out->text($this->oembed->provider);
- } else {
- $this->out->element('a', array('href' => $this->oembed->provider_url,
- 'class' => 'url'), $this->oembed->provider);
- }
- $this->out->elementEnd('dd');
- $this->out->elementEnd('dl');
- }
- $this->out->elementEnd('div');
- }
- $this->out->elementEnd('div');
- }
-
- function show() {
- $this->showNoticeAttachment();
- }
-
- function linkAttr() {
- return array('class' => 'external', 'href' => $this->attachment->url);
- }
-
- function linkTitle() {
- return $this->attachment->url;
- }
-
- function showRepresentation() {
- if (empty($this->oembed->type)) {
- if (empty($this->attachment->mimetype)) {
- $this->out->element('pre', null, 'oh well... not sure how to handle the following: ' . print_r($this->attachment, true));
- } else {
- switch ($this->attachment->mimetype) {
- case 'image/gif':
- case 'image/png':
- case 'image/jpg':
- case 'image/jpeg':
- $this->out->element('img', array('src' => $this->attachment->url, 'alt' => 'alt'));
- break;
-
- case 'application/ogg':
- case 'audio/x-speex':
- case 'video/mpeg':
- case 'audio/mpeg':
- case 'video/mp4':
- case 'video/quicktime':
- $arr = array('type' => $this->attachment->mimetype,
- 'data' => $this->attachment->url,
- 'width' => 320,
- 'height' => 240
- );
- $this->out->elementStart('object', $arr);
- $this->out->element('param', array('name' => 'src', 'value' => $this->attachment->url));
- $this->out->element('param', array('name' => 'autoStart', 'value' => 1));
- $this->out->elementEnd('object');
- break;
- }
- }
- } else {
- switch ($this->oembed->type) {
- case 'rich':
- case 'video':
- case 'link':
- if (!empty($this->oembed->html)) {
- $this->out->raw($this->oembed->html);
- }
- break;
-
- case 'photo':
- $this->out->element('img', array('src' => $this->oembed->url, 'width' => $this->oembed->width, 'height' => $this->oembed->height, 'alt' => 'alt'));
- break;
-
- default:
- $this->out->element('pre', null, 'oh well... not sure how to handle the following oembed: ' . print_r($this->oembed, true));
- }
- }