const URI = 'uri';
const EMAIL = 'email';
+ const POSTEROUS = 'http://posterous.com/help/rss/1.0';
+ const AUTHOR = 'author';
+ const USERIMAGE = 'userImage';
+ const PROFILEURL = 'profileUrl';
+ const NICKNAME = 'nickName';
+ const DISPLAYNAME = 'displayName';
+
public $element;
public $type;
public $id;
public $poco;
public $displayName;
+ // @todo move this stuff to it's own PHOTO activity object
+ const MEDIA_DESCRIPTION = 'description';
+
+ public $thumbnail;
+ public $largerImage;
+ public $description;
+
/**
* Constructor
*
$this->poco = new PoCo($element);
}
+
+ if ($this->type == self::PHOTO) {
+
+ $this->thumbnail = ActivityUtils::getLink($element, 'preview');
+ $this->largerImage = ActivityUtils::getLink($element, 'enclosure');
+
+ $this->description = ActivityUtils::childContent(
+ $element,
+ ActivityObject::MEDIA_DESCRIPTION,
+ Activity::MEDIA
+ );
+
+ }
}
private function _fromAuthor($element)
{
$this->type = self::PERSON; // XXX: is this fair?
$this->title = $this->_childContent($element, self::NAME);
- $this->id = $this->_childContent($element, self::URI);
+
+ $this->id = $this->_childContent($element, self::URI);
if (empty($this->id)) {
$email = $this->_childContent($element, self::EMAIL);
$this->type = ActivityObject::NOTE;
}
- $this->id = $this->_childContent($element, self::ID);
$this->summary = ActivityUtils::childHtmlContent($element, self::SUMMARY);
$this->content = ActivityUtils::getContent($element);
$this->source = $this->_getSource($element);
$this->link = ActivityUtils::getPermalink($element);
+
+ $this->id = $this->_childContent($element, self::ID);
+
+ if (empty($this->id) && !empty($this->link)) { // fallback if there's no ID
+ $this->id = $this->link;
+ }
}
// @fixme rationalize with Activity::_fromRssItem()
$imageEl = ActivityUtils::child($el, Activity::IMAGE, Activity::RSS);
if (!empty($imageEl)) {
- $obj->avatarLinks[] = ActivityUtils::childContent($imageEl, Activity::URL, Activity::RSS);
+ $url = ActivityUtils::childContent($imageEl, Activity::URL, Activity::RSS);
+ $al = new AvatarLink();
+ $al->url = $url;
+ $obj->avatarLinks[] = $al;
}
return $obj;
}
+ public static function fromPosterousAuthor($el)
+ {
+ $obj = new ActivityObject();
+
+ $obj->type = ActivityObject::PERSON; // @fixme any others...?
+
+ $userImage = ActivityUtils::childContent($el, self::USERIMAGE, self::POSTEROUS);
+
+ if (!empty($userImage)) {
+ $al = new AvatarLink();
+ $al->url = $userImage;
+ $obj->avatarLinks[] = $al;
+ }
+
+ $obj->link = ActivityUtils::childContent($el, self::PROFILEURL, self::POSTEROUS);
+ $obj->id = $obj->link;
+
+ $obj->poco = new PoCo();
+
+ $obj->poco->preferredUsername = ActivityUtils::childContent($el, self::NICKNAME, self::POSTEROUS);
+ $obj->poco->displayName = ActivityUtils::childContent($el, self::DISPLAYNAME, self::POSTEROUS);
+
+ $obj->title = $obj->poco->displayName;
+
+ return $obj;
+ }
+
private function _childContent($element, $tag, $namespace=ActivityUtils::ATOM)
{
return ActivityUtils::childContent($element, $tag, $namespace);