summaryrefslogtreecommitdiff
path: root/lib/activity.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-04-29 15:14:51 -0700
committerBrion Vibber <brion@pobox.com>2010-04-29 15:14:51 -0700
commit2260d6ec7c1f2b9c63196a4d8c6c99750a89eb10 (patch)
treecac824e9986caf03fd43bd967663ab1ef4b8bede /lib/activity.php
parent42348bc16711316918efef634d6d83bf19b0b1fe (diff)
parent50d5f5e04c9c37eb5ba20e1dbcd8ceb832d8be81 (diff)
Merge branch 'testing' into 0.9.x
Conflicts: index.php
Diffstat (limited to 'lib/activity.php')
-rw-r--r--lib/activity.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/activity.php b/lib/activity.php
index 365bb6258..8e2da99bb 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)
@@ -269,14 +270,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);
}
}