X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FOstatus_profile.php;h=8ba2ce0c313fffe4f30d9b8a3c32160bdba1c4df;hb=6046a6cc6ae72edfde90719d6e1f9dc39e0fa7ab;hp=df937643bf89c603be4e53d870de6d7aff79fd7a;hpb=b8e97ac7098783f0380c7f8f61c20a100e814dc0;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index df937643bf..8ba2ce0c31 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -442,7 +442,8 @@ class Ostatus_profile extends Memcached_DataObject { $activity = new Activity($entry, $feed); - switch ($activity->object->type) { + // @todo process all activity objects + switch ($activity->objects[0]->type) { case ActivityObject::ARTICLE: case ActivityObject::BLOGENTRY: case ActivityObject::NOTE: @@ -549,14 +550,22 @@ class Ostatus_profile extends Memcached_DataObject } $shortSummary = common_shorten_links($summary); if (Notice::contentTooLong($shortSummary)) { - $url = common_shorten_url(common_local_url('attachment', - array('attachment' => $attachment->id))); + $url = common_shorten_url($sourceUrl); $shortSummary = substr($shortSummary, 0, Notice::maxContent() - (mb_strlen($url) + 2)); - $shortSummary .= '… ' . $url; - $content = $shortSummary; - $rendered = common_render_text($content); + $content = $shortSummary . ' ' . $url; + + // We mark up the attachment link specially for the HTML output + // so we can fold-out the full version inline. + $attachUrl = common_local_url('attachment', + array('attachment' => $attachment->id)); + $rendered = common_render_text($shortSummary) . + '' . + '…' . + ''; } } @@ -1666,10 +1675,22 @@ class Ostatus_profile extends Memcached_DataObject throw new Exception("Couldn't find a valid profile for '$addr'"); } + /** + * Store the full-length scrubbed HTML of a remote notice to an attachment + * file on our server. We'll link to this at the end of the cropped version. + * + * @param string $title plaintext for HTML page's title + * @param string $rendered HTML fragment for HTML page's body + * @return File + */ function saveHTMLFile($title, $rendered) { - $final = sprintf("\n%s". - '
%s
', + $final = sprintf("\n" . + '' . + '' . + '%s' . + '' . + '%s', htmlspecialchars($title), $rendered);