+ // can be either URLs or enclosure objects
+
+ foreach ($this->enclosures as $enclosure) {
+ if (is_string($enclosure)) {
+ $xs->element('link', array('rel' => 'enclosure',
+ 'href' => $enclosure));
+ } else {
+ $attributes = array('rel' => 'enclosure',
+ 'href' => $enclosure->url,
+ 'type' => $enclosure->mimetype,
+ 'length' => $enclosure->size);
+ if ($enclosure->title) {
+ $attributes['title'] = $enclosure->title;
+ }
+ $xs->element('link', $attributes);
+ }
+ }
+
+ // Info on the source feed
+
+ if ($source && !empty($this->source)) {
+ $xs->elementStart('source');
+
+ $xs->element('id', null, $this->source->id);
+ $xs->element('title', null, $this->source->title);
+
+ if (array_key_exists('alternate', $this->source->links)) {
+ $xs->element('link', array('rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $this->source->links['alternate']));
+ }
+
+ if (array_key_exists('self', $this->source->links)) {
+ $xs->element('link', array('rel' => 'self',
+ 'type' => 'application/atom+xml',
+ 'href' => $this->source->links['self']));
+ }
+
+ if (array_key_exists('license', $this->source->links)) {
+ $xs->element('link', array('rel' => 'license',
+ 'href' => $this->source->links['license']));
+ }
+
+ if (!empty($this->source->icon)) {
+ $xs->element('icon', null, $this->source->icon);
+ }
+
+ if (!empty($this->source->updated)) {
+ $xs->element('updated', null, $this->source->updated);
+ }
+
+ $xs->elementEnd('source');
+ }
+
+ if (!empty($this->selfLink)) {
+ $xs->element('link', array('rel' => 'self',
+ 'type' => 'application/atom+xml',
+ 'href' => $this->selfLink));
+ }
+
+ if (!empty($this->editLink)) {
+ $xs->element('link', array('rel' => 'edit',
+ 'type' => 'application/atom+xml',
+ 'href' => $this->editLink));
+ }
+
+ // For throwing in extra elements; used for statusnet:notice_info
+
+ foreach ($this->extra as $el) {
+ list($tag, $attrs, $content) = $el;
+ $xs->element($tag, $attrs, $content);
+ }
+