From a9dabbe77e8ab575aaf5c3742e2cddb4874e6881 Mon Sep 17 00:00:00 2001 From: James Walker Date: Sat, 13 Mar 2010 10:37:08 -0500 Subject: * wrong param order to in_array * in getContent() if "type" isn't set, assume text (per atom spec) --- lib/activity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/activity.php b/lib/activity.php index 125d391b0..738200c0b 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -457,7 +457,7 @@ class ActivityUtils // slavishly following http://atompub.org/rfc4287.html#rfc.section.4.1.3.3 - if ($type == 'text') { + if (empty($type) || $type == 'text') { return $contentEl->textContent; } else if ($type == 'html') { $text = $contentEl->textContent; @@ -476,7 +476,7 @@ class ActivityUtils $text .= $doc->saveXML($child); } return trim($text); - } else if (in_array(array('text/xml', 'application/xml'), $type) || + } else if (in_array($type, array('text/xml', 'application/xml')) || preg_match('#(+|/)xml$#', $type)) { throw new ClientException(_("Can't handle embedded XML content yet.")); } else if (strncasecmp($type, 'text/', 5)) { -- cgit v1.2.3-54-g00ecf From c4f89b06f1e7fe969e049c7dfe672bdfd6e5c8f9 Mon Sep 17 00:00:00 2001 From: James Walker Date: Sun, 14 Mar 2010 12:57:24 -0400 Subject: give preference to rel="photo" (per latest ActivityStreams spec), but still support rel="avatar" for compat --- lib/activity.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/activity.php b/lib/activity.php index 738200c0b..6acf37a8a 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -681,9 +681,16 @@ class ActivityObject if ($this->type == self::PERSON || $this->type == self::GROUP) { $this->displayName = $this->title; - $avatars = ActivityUtils::getLinks($element, 'avatar'); - foreach ($avatars as $link) { - $this->avatarLinks[] = new AvatarLink($link); + $photos = ActivityUtils::getLinks($element, 'photo'); + if (count($photos)) { + foreach ($photos as $link) { + $this->avatarLinks[] = new AvatarLink($link); + } + } else { + $avatars = ActivityUtils::getLinks($element, 'avatar'); + foreach ($avatars as $link) { + $this->avatarLinks[] = new AvatarLink($link); + } } $this->poco = new PoCo($element); -- cgit v1.2.3-54-g00ecf