-
- $xs->elementEnd('source');
- }
- }
- Event::handle('EndActivitySource', array(&$this, &$xs));
- }
-
- $title = common_xml_safe_str($this->content);
-
- if (Event::handle('StartActivityTitle', array(&$this, &$xs, &$title))) {
- $xs->element('title', null, $title);
- Event::handle('EndActivityTitle', array($this, &$xs, $title));
- }
-
- $atomAuthor = '';
-
- if ($author) {
- $atomAuthor = $profile->asAtomAuthor($cur);
- }
-
- if (Event::handle('StartActivityAuthor', array(&$this, &$xs, &$atomAuthor))) {
- if (!empty($atomAuthor)) {
- $xs->raw($atomAuthor);
- Event::handle('EndActivityAuthor', array(&$this, &$xs, &$atomAuthor));
- }
- }
-
- $actor = '';
-
- if ($author) {
- $actor = $profile->asActivityActor();
- }
-
- if (Event::handle('StartActivityActor', array(&$this, &$xs, &$actor))) {
- if (!empty($actor)) {
- $xs->raw($actor);
- Event::handle('EndActivityActor', array(&$this, &$xs, &$actor));
- }
- }
-
- $url = $this->bestUrl();
-
- if (Event::handle('StartActivityLink', array(&$this, &$xs, &$url))) {
- $xs->element('link', array('rel' => 'alternate',
- 'type' => 'text/html',
- 'href' => $url));
- Event::handle('EndActivityLink', array(&$this, &$xs, $url));
- }
-
- $id = $this->uri;
-
- if (Event::handle('StartActivityId', array(&$this, &$xs, &$id))) {
- $xs->element('id', null, $id);
- Event::handle('EndActivityId', array(&$this, &$xs, $id));
- }
-
- $published = self::utcDate($this->created);
-
- if (Event::handle('StartActivityPublished', array(&$this, &$xs, &$published))) {
- $xs->element('published', null, $published);
- Event::handle('EndActivityPublished', array(&$this, &$xs, $published));
- }
-
- $updated = $published; // XXX: notices are usually immutable
-
- if (Event::handle('StartActivityUpdated', array(&$this, &$xs, &$updated))) {
- $xs->element('updated', null, $updated);
- Event::handle('EndActivityUpdated', array(&$this, &$xs, $updated));
- }
-
- $content = common_xml_safe_str($this->rendered);
-
- if (Event::handle('StartActivityContent', array(&$this, &$xs, &$content))) {
- $xs->element('content', array('type' => 'html'), $content);
- Event::handle('EndActivityContent', array(&$this, &$xs, $content));
- }
-
- // Most of our notices represent POSTing a NOTE. This is the default verb
- // for activity streams, so we normally just leave it out.
-
- $verb = ActivityVerb::POST;
-
- if (Event::handle('StartActivityVerb', array(&$this, &$xs, &$verb))) {
- $xs->element('activity:verb', null, $verb);
- Event::handle('EndActivityVerb', array(&$this, &$xs, $verb));
- }
-
- // We use the default behavior for activity streams: if there's no activity:object,
- // then treat the entry itself as the object. Here, you can set the type of that object,
- // which is normally a NOTE.
-
- $type = ActivityObject::NOTE;
-
- if (Event::handle('StartActivityDefaultObjectType', array(&$this, &$xs, &$type))) {
- $xs->element('activity:object-type', null, $type);
- Event::handle('EndActivityDefaultObjectType', array(&$this, &$xs, $type));
- }
-
- // Since we usually use the entry itself as an object, we don't have an explicit
- // object. Some extensions may want to add them (for photo, event, music, etc.).
-
- $objects = array();
-
- if (Event::handle('StartActivityObjects', array(&$this, &$xs, &$objects))) {
- foreach ($objects as $object) {
- $xs->raw($object->asString());
- }
- Event::handle('EndActivityObjects', array(&$this, &$xs, $objects));
- }
-
- $noticeInfoAttr = array('local_id' => $this->id); // local notice ID (useful to clients for ordering)
-
- $ns = $this->getSource();
-
- if (!empty($ns)) {
- $noticeInfoAttr['source'] = $ns->code;
- if (!empty($ns->url)) {
- $noticeInfoAttr['source_link'] = $ns->url;
- if (!empty($ns->name)) {
- $noticeInfoAttr['source'] = '<a href="'
- . htmlspecialchars($ns->url)
- . '" rel="nofollow">'
- . htmlspecialchars($ns->name)
- . '</a>';