OStatus: fixes for link/id and text extraction gets import of Buzz feeds working.
This commit is contained in:
parent
5f9a8ca64b
commit
d6ad733247
|
@ -287,15 +287,21 @@ class OStatusPlugin extends Plugin
|
||||||
function onStartNoticeSourceLink($notice, &$name, &$url, &$title)
|
function onStartNoticeSourceLink($notice, &$name, &$url, &$title)
|
||||||
{
|
{
|
||||||
if ($notice->source == 'ostatus') {
|
if ($notice->source == 'ostatus') {
|
||||||
$bits = parse_url($notice->uri);
|
if ($notice->url) {
|
||||||
|
$bits = parse_url($notice->url);
|
||||||
$domain = $bits['host'];
|
$domain = $bits['host'];
|
||||||
|
if (substr($domain, 0, 4) == 'www.') {
|
||||||
|
$name = substr($domain, 4);
|
||||||
|
} else {
|
||||||
$name = $domain;
|
$name = $domain;
|
||||||
$url = $notice->uri;
|
}
|
||||||
|
|
||||||
|
$url = $notice->url;
|
||||||
$title = sprintf(_m("Sent from %s via OStatus"), $domain);
|
$title = sprintf(_m("Sent from %s via OStatus"), $domain);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send incoming PuSH feeds for OStatus endpoints in for processing.
|
* Send incoming PuSH feeds for OStatus endpoints in for processing.
|
||||||
|
@ -509,12 +515,8 @@ class OStatusPlugin extends Plugin
|
||||||
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
|
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
|
||||||
if ($oprofile) {
|
if ($oprofile) {
|
||||||
// Drop the PuSH subscription if there are no other subscribers.
|
// Drop the PuSH subscription if there are no other subscribers.
|
||||||
|
$oprofile->garbageCollect();
|
||||||
|
|
||||||
$members = $group->getMembers(0, 1);
|
|
||||||
if ($members->N == 0) {
|
|
||||||
common_log(LOG_INFO, "Unsubscribing from now-unused group feed $oprofile->feeduri");
|
|
||||||
$oprofile->unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
$member = Profile::staticGet($user->id);
|
$member = Profile::staticGet($user->id);
|
||||||
|
|
||||||
|
|
|
@ -556,17 +556,28 @@ class Ostatus_profile extends Memcached_DataObject
|
||||||
|
|
||||||
if ($activity->object->link) {
|
if ($activity->object->link) {
|
||||||
$sourceUrl = $activity->object->link;
|
$sourceUrl = $activity->object->link;
|
||||||
|
} else if ($activity->link) {
|
||||||
|
$sourceUrl = $activity->link;
|
||||||
} else if (preg_match('!^https?://!', $activity->object->id)) {
|
} else if (preg_match('!^https?://!', $activity->object->id)) {
|
||||||
$sourceUrl = $activity->object->id;
|
$sourceUrl = $activity->object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @fixme sanitize and save HTML content if available
|
// Get (safe!) HTML and text versions of the content
|
||||||
|
|
||||||
$content = $activity->object->title;
|
require_once(INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php');
|
||||||
|
|
||||||
|
$html = $activity->object->content;
|
||||||
|
|
||||||
|
$purifier = new HTMLPurifier();
|
||||||
|
|
||||||
|
$rendered = $purifier->purify($html);
|
||||||
|
|
||||||
|
$content = html_entity_decode(strip_tags($rendered));
|
||||||
|
|
||||||
$params = array('is_local' => Notice::REMOTE_OMB,
|
$params = array('is_local' => Notice::REMOTE_OMB,
|
||||||
'url' => $sourceUrl,
|
'url' => $sourceUrl,
|
||||||
'uri' => $sourceUri);
|
'uri' => $sourceUri,
|
||||||
|
'rendered' => $rendered);
|
||||||
|
|
||||||
$location = $activity->context->location;
|
$location = $activity->context->location;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user