diff options
author | Brion Vibber <brion@pobox.com> | 2010-04-29 15:12:02 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-04-29 15:12:02 -0700 |
commit | 50d5f5e04c9c37eb5ba20e1dbcd8ceb832d8be81 (patch) | |
tree | dc7235fe2ec25e65f160950b86c0572ad0584bac /lib/activity.php | |
parent | dd7b95c2cffe7e33f32d841ed8950e09b44b853d (diff) | |
parent | cb5d6d5c30ab6235283005530fadd0d185b38499 (diff) |
Merge branch 'master' into testing
Diffstat (limited to 'lib/activity.php')
-rw-r--r-- | lib/activity.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/activity.php b/lib/activity.php index 5d6230c6d..27f09ab4d 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -83,6 +83,7 @@ class Activity const CREATOR = 'creator'; const CONTENTNS = 'http://purl.org/rss/1.0/modules/content/'; + const ENCODED = 'encoded'; public $actor; // an ActivityObject public $verb; // a string (the URL) @@ -268,14 +269,21 @@ class Activity $this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, self::RSS); - $contentEl = ActivityUtils::child($item, ActivityUtils::CONTENT, self::CONTENTNS); + $contentEl = ActivityUtils::child($item, self::ENCODED, self::CONTENTNS); if (!empty($contentEl)) { - $this->content = htmlspecialchars_decode($contentEl->textContent, ENT_QUOTES); + // <content:encoded> XML node's text content is HTML; no further processing needed. + $this->content = $contentEl->textContent; } else { $descriptionEl = ActivityUtils::child($item, self::DESCRIPTION, self::RSS); if (!empty($descriptionEl)) { - $this->content = htmlspecialchars_decode($descriptionEl->textContent, ENT_QUOTES); + // Per spec, <description> must be plaintext. + // In practice, often there's HTML... but these days good + // feeds are using <content:encoded> which is explicitly + // real HTML. + // We'll treat this following spec, and do HTML escaping + // to convert from plaintext to HTML. + $this->content = htmlspecialchars($descriptionEl->textContent); } } |