X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivityobject.php;h=e89c8db4e9afee4e611a0e54d41ac150b9d14fc5;hb=dc4fafbbd16adecc94fb1e3ee889689cfb786c3a;hp=34d1b91700432bd1d55dabd041176f0ac2a62e15;hpb=800b33590696e85480aa73c25261d80f1926e56d;p=quix0rs-gnu-social.git diff --git a/lib/activityobject.php b/lib/activityobject.php index 34d1b91700..e89c8db4e9 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -49,7 +49,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ - class ActivityObject { const ARTICLE = 'http://activitystrea.ms/schema/1.0/article'; @@ -116,7 +115,6 @@ class ActivityObject * * @param DOMElement $element DOM thing to turn into an Activity thing */ - function __construct($element = null) { if (empty($element)) { @@ -168,7 +166,6 @@ class ActivityObject ActivityObject::MEDIA_DESCRIPTION, Activity::MEDIA ); - } } @@ -177,10 +174,7 @@ class ActivityObject $this->type = self::PERSON; // XXX: is this fair? $this->title = $this->_childContent($element, self::NAME); - $id = $this->_childContent($element, self::URI); - if (ActivityUtils::validateUri($id)) { - $this->id = $id; - } + $this->id = $this->_childContent($element, self::URI); if (empty($this->id)) { $email = $this->_childContent($element, self::EMAIL); @@ -193,15 +187,6 @@ class ActivityObject private function _fromAtomEntry($element) { - if ($element->localName == 'actor') { - // Old-fashioned ... - // First pull anything from , then we'll add on top. - $author = ActivityUtils::child($element->parentNode, 'author'); - if ($author) { - $this->_fromAuthor($author); - } - } - $this->type = $this->_childContent($element, Activity::OBJECTTYPE, Activity::SPEC); @@ -209,11 +194,6 @@ class ActivityObject $this->type = ActivityObject::NOTE; } - $id = $this->_childContent($element, self::ID); - if (ActivityUtils::validateUri($id)) { - $this->id = $id; - } - $this->summary = ActivityUtils::childHtmlContent($element, self::SUMMARY); $this->content = ActivityUtils::getContent($element); @@ -221,15 +201,20 @@ class ActivityObject $title = ActivityUtils::childHtmlContent($element, self::TITLE); - $this->title = html_entity_decode(strip_tags($title)); + $this->title = html_entity_decode(strip_tags($title), ENT_QUOTES, 'UTF-8'); $this->source = $this->_getSource($element); $this->link = ActivityUtils::getPermalink($element); - } - // @fixme rationalize with Activity::_fromRssItem() + $this->id = $this->_childContent($element, self::ID); + + if (empty($this->id) && !empty($this->link)) { // fallback if there's no ID + $this->id = $this->link; + } + } + // @todo FIXME: rationalize with Activity::_fromRssItem() private function _fromRssItem($item) { $this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, Activity::RSS); @@ -429,7 +414,6 @@ class ActivityObject ); foreach ($sizes as $size) { - $alink = null; $avatar = $profile->getAvatar($size); @@ -441,6 +425,17 @@ class ActivityObject $alink->height = $size; $alink->width = $size; $alink->url = Avatar::defaultImage($size); + + if ($size == AVATAR_PROFILE_SIZE) { + // Hack for Twitter import: we don't have a 96x96 image, + // but we do have a 73x73 image. For now, fake it with that. + $avatar = $profile->getAvatar(73); + if ($avatar) { + $alink = AvatarLink::fromAvatar($avatar); + $alink->height= $size; + $alink->width = $size; + } + } } $object->avatarLinks[] = $alink;