+ $published = common_date_w3dtf($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());