mirror of
https://github.com/friendica/friendica
synced 2025-04-25 18:30:11 +00:00
Some more "convertForUriId" replacements
This commit is contained in:
parent
c151376596
commit
07d2dfcd60
15 changed files with 33 additions and 133 deletions
|
@ -486,11 +486,11 @@ class Profile
|
|||
}
|
||||
|
||||
if (isset($p['about'])) {
|
||||
$p['about'] = BBCode::convert($p['about']);
|
||||
$p['about'] = BBCode::convertForUriId($profile['uri-id'] ?? 0, $p['about']);
|
||||
}
|
||||
|
||||
if (isset($p['address'])) {
|
||||
$p['address'] = BBCode::convert($p['address']);
|
||||
$p['address'] = BBCode::convertForUriId($profile['uri-id'] ?? 0, $p['address']);
|
||||
}
|
||||
|
||||
$p['photo'] = Contact::getAvatarUrlForId($cid, ProxyUtils::SIZE_SMALL);
|
||||
|
@ -670,13 +670,13 @@ class Profile
|
|||
$istoday = true;
|
||||
}
|
||||
|
||||
$title = strip_tags(html_entity_decode(BBCode::convert($rr['summary']), ENT_QUOTES, 'UTF-8'));
|
||||
$title = strip_tags(html_entity_decode(BBCode::convertForUriId($rr['uri-id'], $rr['summary']), ENT_QUOTES, 'UTF-8'));
|
||||
|
||||
if (strlen($title) > 35) {
|
||||
$title = substr($title, 0, 32) . '... ';
|
||||
}
|
||||
|
||||
$description = substr(strip_tags(BBCode::convert($rr['desc'])), 0, 32) . '... ';
|
||||
$description = substr(strip_tags(BBCode::convertForUriId($rr['uri-id'], $rr['desc'])), 0, 32) . '... ';
|
||||
if (!$description) {
|
||||
$description = DI::l10n()->t('[No description]');
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class Index extends BaseApi
|
|||
'cid' => $event['cid'],
|
||||
'uri' => $event['uri'],
|
||||
'name' => $event['summary'],
|
||||
'desc' => BBCode::convert($event['desc']),
|
||||
'desc' => BBCode::convertForUriId($event['uri-id'], $event['desc']),
|
||||
'startTime' => $event['start'],
|
||||
'endTime' => $event['finish'],
|
||||
'type' => $event['type'],
|
||||
|
|
|
@ -169,7 +169,7 @@ class Profile extends BaseProfile
|
|||
}
|
||||
|
||||
if ($a->profile['about']) {
|
||||
$basic_fields += self::buildField('about', DI::l10n()->t('Description:'), BBCode::convert($a->profile['about']));
|
||||
$basic_fields += self::buildField('about', DI::l10n()->t('Description:'), BBCode::convertForUriId($a->profile['uri-id'], $a->profile['about']));
|
||||
}
|
||||
|
||||
if ($a->profile['xmpp']) {
|
||||
|
@ -218,7 +218,7 @@ class Profile extends BaseProfile
|
|||
$custom_fields += self::buildField(
|
||||
'custom_' . $profile_field->order,
|
||||
$profile_field->label,
|
||||
BBCode::convert($profile_field->value),
|
||||
BBCode::convertForUriId($a->profile['uri-id'], $profile_field->value),
|
||||
'aprofile custom'
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1345,8 +1345,7 @@ class Receiver
|
|||
// Some AP software allow formatted text in post location, so we run all the text converters we have to boil
|
||||
// down to HTML and then finally format to plaintext.
|
||||
$location = Markdown::convert($location);
|
||||
$location = BBCode::convert($location);
|
||||
$location = HTML::toPlaintext($location);
|
||||
$location = BBCode::toPlaintext($location);
|
||||
}
|
||||
|
||||
$object_data['sc:identifier'] = JsonLD::fetchElement($object, 'sc:identifier', '@value');
|
||||
|
|
|
@ -345,7 +345,7 @@ class Transmitter
|
|||
}
|
||||
|
||||
if (!empty($owner['about'])) {
|
||||
$data['summary'] = BBCode::convert($owner['about'], false);
|
||||
$data['summary'] = BBCode::convertForUriId($owner['uri-id'], $owner['about'], BBCode::EXTERNAL);
|
||||
}
|
||||
|
||||
$data['url'] = $owner['url'];
|
||||
|
|
|
@ -765,12 +765,13 @@ class DFRN
|
|||
* @param DOMDocument $doc XML document
|
||||
* @param string $element Element name for the activity
|
||||
* @param string $activity activity value
|
||||
* @param int $uriid Uri-Id of the post
|
||||
*
|
||||
* @return \DOMElement XML activity object
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @todo Find proper type-hints
|
||||
*/
|
||||
private static function createActivity(DOMDocument $doc, $element, $activity)
|
||||
private static function createActivity(DOMDocument $doc, $element, $activity, $uriid)
|
||||
{
|
||||
if ($activity) {
|
||||
$entry = $doc->createElement($element);
|
||||
|
@ -817,7 +818,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
if ($r->content) {
|
||||
XML::addElement($doc, $entry, "content", BBCode::convert($r->content), ["type" => "html"]);
|
||||
XML::addElement($doc, $entry, "content", BBCode::convertForUriId($uriid, $r->content, BBCode::EXTERNAL), ["type" => "html"]);
|
||||
}
|
||||
|
||||
return $entry;
|
||||
|
@ -918,7 +919,7 @@ class DFRN
|
|||
$htmlbody = "[b]" . $item['title'] . "[/b]\n\n" . $htmlbody;
|
||||
}
|
||||
|
||||
$htmlbody = BBCode::convertForUriId($item['uri-id'], $htmlbody, BBCode::OSTATUS);
|
||||
$htmlbody = BBCode::convertForUriId($item['uri-id'], $htmlbody, BBCode::ACTIVITYPUB);
|
||||
}
|
||||
|
||||
$author = self::addEntryAuthor($doc, "author", $item["author-link"], $item);
|
||||
|
@ -1033,12 +1034,12 @@ class DFRN
|
|||
XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::COMMENT);
|
||||
}
|
||||
|
||||
$actobj = self::createActivity($doc, "activity:object", $item['object']);
|
||||
$actobj = self::createActivity($doc, "activity:object", $item['object'], $item['uri-id']);
|
||||
if ($actobj) {
|
||||
$entry->appendChild($actobj);
|
||||
}
|
||||
|
||||
$actarg = self::createActivity($doc, "activity:target", $item['target']);
|
||||
$actarg = self::createActivity($doc, "activity:target", $item['target'], $item['uri-id']);
|
||||
if ($actarg) {
|
||||
$entry->appendChild($actarg);
|
||||
}
|
||||
|
|
|
@ -1109,7 +1109,7 @@ class Feed
|
|||
|
||||
$body = OStatus::formatPicturePost($item['body'], $item['uri-id']);
|
||||
|
||||
$body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::OSTATUS, false);
|
||||
$body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::ACTIVITYPUB);
|
||||
|
||||
XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ class Feed
|
|||
private static function getTitle(array $item)
|
||||
{
|
||||
if ($item['title'] != '') {
|
||||
return BBCode::convertForUriId($item['uri-id'], $item['title'], BBCode::OSTATUS);
|
||||
return BBCode::convertForUriId($item['uri-id'], $item['title'], BBCode::ACTIVITYPUB);
|
||||
}
|
||||
|
||||
// Fetch information about the post
|
||||
|
|
|
@ -1418,7 +1418,7 @@ class OStatus
|
|||
XML::addElement($doc, $author, "name", $owner["nick"]);
|
||||
XML::addElement($doc, $author, "email", $owner["addr"]);
|
||||
if ($show_profile) {
|
||||
XML::addElement($doc, $author, "summary", BBCode::convert($owner["about"], false, BBCode::OSTATUS));
|
||||
XML::addElement($doc, $author, "summary", BBCode::convertForUriId($owner['uri-id'], $owner["about"], BBCode::OSTATUS));
|
||||
}
|
||||
|
||||
$attributes = ["rel" => "alternate", "type" => "text/html", "href" => $owner["url"]];
|
||||
|
@ -1445,7 +1445,7 @@ class OStatus
|
|||
XML::addElement($doc, $author, "poco:preferredUsername", $owner["nick"]);
|
||||
XML::addElement($doc, $author, "poco:displayName", $owner["name"]);
|
||||
if ($show_profile) {
|
||||
XML::addElement($doc, $author, "poco:note", BBCode::convert($owner["about"], false, BBCode::OSTATUS));
|
||||
XML::addElement($doc, $author, "poco:note", BBCode::convertForUriId($owner['uri-id'], $owner["about"], BBCode::OSTATUS));
|
||||
|
||||
if (trim($owner["location"]) != "") {
|
||||
$element = $doc->createElement("poco:address");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue