Function renamed to better reflect the functionality
parent
17ae9b71af
commit
d8974c9a2a
|
@ -1264,7 +1264,7 @@ class BBCode
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a BBCode message for a given ID to a HTML message
|
||||
* Converts a BBCode message for a given URI-ID to a HTML message
|
||||
*
|
||||
* BBcode 2 HTML was written by WAY2WEB.net
|
||||
* extended to work with Mistpark/Friendica - Mike Macgirvin
|
||||
|
@ -1287,7 +1287,7 @@ class BBCode
|
|||
* @return string
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function convertForItem(int $uriid = 0, string $text = null, int $simple_html = self::INTERNAL)
|
||||
public static function convertForUriId(int $uriid = 0, string $text = null, int $simple_html = self::INTERNAL)
|
||||
{
|
||||
$try_oembed = ($simple_html == self::INTERNAL);
|
||||
|
||||
|
|
|
@ -69,11 +69,11 @@ class Event
|
|||
$o = '';
|
||||
|
||||
if (!empty($event['summary'])) {
|
||||
$o .= "<h3>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . "</h3>";
|
||||
$o .= "<h3>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['summary']), $simple) . "</h3>";
|
||||
}
|
||||
|
||||
if (!empty($event['desc'])) {
|
||||
$o .= "<div>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . "</div>";
|
||||
$o .= "<div>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['desc']), $simple) . "</div>";
|
||||
}
|
||||
|
||||
$o .= "<h4>" . DI::l10n()->t('Starts:') . "</h4><p>" . $event_start . "</p>";
|
||||
|
@ -83,7 +83,7 @@ class Event
|
|||
}
|
||||
|
||||
if (!empty($event['location'])) {
|
||||
$o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple) . "</p>";
|
||||
$o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['location']), $simple) . "</p>";
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
@ -91,7 +91,7 @@ class Event
|
|||
|
||||
$o = '<div class="vevent">' . "\r\n";
|
||||
|
||||
$o .= '<div class="summary event-summary">' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . '</div>' . "\r\n";
|
||||
$o .= '<div class="summary event-summary">' . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['summary']), $simple) . '</div>' . "\r\n";
|
||||
|
||||
$o .= '<div class="event-start"><span class="event-label">' . DI::l10n()->t('Starts:') . '</span> <span class="dtstart" title="'
|
||||
. DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
|
||||
|
@ -106,12 +106,12 @@ class Event
|
|||
}
|
||||
|
||||
if (!empty($event['desc'])) {
|
||||
$o .= '<div class="description event-description">' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . '</div>' . "\r\n";
|
||||
$o .= '<div class="description event-description">' . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['desc']), $simple) . '</div>' . "\r\n";
|
||||
}
|
||||
|
||||
if (!empty($event['location'])) {
|
||||
$o .= '<div class="event-location"><span class="event-label">' . DI::l10n()->t('Location:') . '</span> <span class="location">'
|
||||
. BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple)
|
||||
. BBCode::convertForUriId($uriid, Strings::escapeHtml($event['location']), $simple)
|
||||
. '</span></div>' . "\r\n";
|
||||
|
||||
// Include a map of the location if the [map] BBCode is used.
|
||||
|
@ -623,9 +623,9 @@ class Event
|
|||
$drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , DI::l10n()->t('Delete event') , '', ''];
|
||||
}
|
||||
|
||||
$title = BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']));
|
||||
$title = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['summary']));
|
||||
if (!$title) {
|
||||
list($title, $_trash) = explode("<br", BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc'])), BBCode::API);
|
||||
list($title, $_trash) = explode("<br", BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc'])), BBCode::API);
|
||||
}
|
||||
|
||||
$author_link = $event['author-link'];
|
||||
|
@ -633,9 +633,9 @@ class Event
|
|||
$event['author-link'] = Contact::magicLink($author_link);
|
||||
|
||||
$html = self::getHTML($event);
|
||||
$event['summary'] = BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']));
|
||||
$event['desc'] = BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc']));
|
||||
$event['location'] = BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['location']));
|
||||
$event['summary'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['summary']));
|
||||
$event['desc'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc']));
|
||||
$event['location'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['location']));
|
||||
$event_list[] = [
|
||||
'id' => $event['id'],
|
||||
'start' => $start,
|
||||
|
@ -940,7 +940,7 @@ class Event
|
|||
$tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
|
||||
$return = Renderer::replaceMacros($tpl, [
|
||||
'$id' => $item['event-id'],
|
||||
'$title' => BBCode::convertForItem($item['uri-id'], $item['event-summary']),
|
||||
'$title' => BBCode::convertForUriId($item['uri-id'], $item['event-summary']),
|
||||
'$dtstart_label' => DI::l10n()->t('Starts:'),
|
||||
'$dtstart_title' => $dtstart_title,
|
||||
'$dtstart_dt' => $dtstart_dt,
|
||||
|
@ -958,7 +958,7 @@ class Event
|
|||
'$author_name' => $item['author-name'],
|
||||
'$author_link' => $profile_link,
|
||||
'$author_avatar' => $item['author-avatar'],
|
||||
'$description' => BBCode::convertForItem($item['uri-id'], $item['event-desc']),
|
||||
'$description' => BBCode::convertForUriId($item['uri-id'], $item['event-desc']),
|
||||
'$location_label' => DI::l10n()->t('Location:'),
|
||||
'$show_map_label' => DI::l10n()->t('Show map'),
|
||||
'$hide_map_label' => DI::l10n()->t('Hide map'),
|
||||
|
|
|
@ -2640,7 +2640,7 @@ class Item
|
|||
) {
|
||||
self::addRedirToImageTags($item);
|
||||
|
||||
$item['rendered-html'] = BBCode::convertForItem($item['uri-id'], $item['body']);
|
||||
$item['rendered-html'] = BBCode::convertForUriId($item['uri-id'], $item['body']);
|
||||
$item['rendered-hash'] = hash('md5', BBCode::VERSION . '::' . $body);
|
||||
|
||||
$hook_data = ['item' => $item, 'rendered-html' => $item['rendered-html'], 'rendered-hash' => $item['rendered-hash']];
|
||||
|
|
|
@ -650,11 +650,11 @@ class Contact extends BaseModule
|
|||
'$profileurllabel'=> DI::l10n()->t('Profile URL'),
|
||||
'$profileurl' => $contact['url'],
|
||||
'$account_type' => Model\Contact::getAccountType($contact),
|
||||
'$location' => BBCode::convertForItem($contact['uri-id'] ?? 0, $contact['location']),
|
||||
'$location' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['location']),
|
||||
'$location_label' => DI::l10n()->t('Location:'),
|
||||
'$xmpp' => BBCode::convertForItem($contact['uri-id'] ?? 0, $contact['xmpp']),
|
||||
'$xmpp' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['xmpp']),
|
||||
'$xmpp_label' => DI::l10n()->t('XMPP:'),
|
||||
'$about' => BBCode::convertForItem($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
|
||||
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
|
||||
'$about_label' => DI::l10n()->t('About:'),
|
||||
'$keywords' => $contact['keywords'],
|
||||
'$keywords_label' => DI::l10n()->t('Tags:'),
|
||||
|
|
|
@ -111,7 +111,7 @@ class Account extends BaseDataTransferObject
|
|||
$created = $userContactCreated < $publicContactCreated && ($userContactCreated != DBA::NULL_DATETIME) ? $userContactCreated : $publicContactCreated;
|
||||
$this->created_at = DateTimeFormat::utc($created, DateTimeFormat::JSON);
|
||||
|
||||
$this->note = BBCode::convertForItem($publicContact['uri-id'] ?? 0, $publicContact['about'], BBCode::EXTERNAL);
|
||||
$this->note = BBCode::convertForUriId($publicContact['uri-id'] ?? 0, $publicContact['about'], BBCode::EXTERNAL);
|
||||
$this->url = $publicContact['url'];
|
||||
$this->avatar = Contact::getAvatarUrlForId($userContact['id'] ?? 0 ?: $publicContact['id'], Proxy::SIZE_SMALL, $userContact['updated'] ?? '' ?: $publicContact['updated']);
|
||||
$this->avatar_static = $this->avatar;
|
||||
|
|
|
@ -131,7 +131,7 @@ class Status extends BaseDataTransferObject
|
|||
$this->muted = $userAttributes->muted;
|
||||
$this->bookmarked = $userAttributes->bookmarked;
|
||||
$this->pinned = $userAttributes->pinned;
|
||||
$this->content = BBCode::convertForItem($item['uri-id'], ($item['raw-body'] ?? $item['body']), BBCode::EXTERNAL);
|
||||
$this->content = BBCode::convertForUriId($item['uri-id'], ($item['raw-body'] ?? $item['body']), BBCode::EXTERNAL);
|
||||
$this->reblog = $reblog;
|
||||
$this->application = $application->toArray();
|
||||
$this->account = $account->toArray();
|
||||
|
|
|
@ -1464,7 +1464,7 @@ class Transmitter
|
|||
{
|
||||
$event = [];
|
||||
$event['name'] = $item['event-summary'];
|
||||
$event['content'] = BBCode::convertForItem($item['uri-id'], $item['event-desc'], BBCode::ACTIVITYPUB);
|
||||
$event['content'] = BBCode::convertForUriId($item['uri-id'], $item['event-desc'], BBCode::ACTIVITYPUB);
|
||||
$event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
|
||||
|
||||
if (!$item['event-nofinish']) {
|
||||
|
@ -1571,7 +1571,7 @@ class Transmitter
|
|||
$regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
|
||||
$body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
|
||||
|
||||
$data['content'] = BBCode::convertForItem($item['uri-id'], $body, BBCode::ACTIVITYPUB);
|
||||
$data['content'] = BBCode::convertForUriId($item['uri-id'], $body, BBCode::ACTIVITYPUB);
|
||||
}
|
||||
|
||||
// The regular "content" field does contain a minimized HTML. This is done since systems like
|
||||
|
@ -1583,7 +1583,7 @@ class Transmitter
|
|||
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
|
||||
$richbody = BBCode::removeAttachment($richbody);
|
||||
|
||||
$data['contentMap'][$language] = BBCode::convertForItem($item['uri-id'], $richbody, BBCode::EXTERNAL);
|
||||
$data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL);
|
||||
}
|
||||
|
||||
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];
|
||||
|
|
|
@ -918,7 +918,7 @@ class DFRN
|
|||
$htmlbody = "[b]" . $item['title'] . "[/b]\n\n" . $htmlbody;
|
||||
}
|
||||
|
||||
$htmlbody = BBCode::convertForItem($item['uri-id'], $htmlbody, BBCode::OSTATUS);
|
||||
$htmlbody = BBCode::convertForUriId($item['uri-id'], $htmlbody, BBCode::OSTATUS);
|
||||
}
|
||||
|
||||
$author = self::addEntryAuthor($doc, "author", $item["author-link"], $item);
|
||||
|
|
|
@ -1109,7 +1109,7 @@ class Feed
|
|||
|
||||
$body = OStatus::formatPicturePost($item['body'], $item['uri-id']);
|
||||
|
||||
$body = BBCode::convertForItem($item['uri-id'], $body, BBCode::OSTATUS, false);
|
||||
$body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::OSTATUS, false);
|
||||
|
||||
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::convertForItem($item['uri-id'], $item['title'], BBCode::OSTATUS);
|
||||
return BBCode::convertForUriId($item['uri-id'], $item['title'], BBCode::OSTATUS);
|
||||
}
|
||||
|
||||
// Fetch information about the post
|
||||
|
|
|
@ -1803,7 +1803,7 @@ class OStatus
|
|||
|
||||
if (!$toplevel) {
|
||||
if (!empty($item['title'])) {
|
||||
$title = BBCode::convertForItem($item['uri-id'], $item['title'], BBCode::OSTATUS);
|
||||
$title = BBCode::convertForUriId($item['uri-id'], $item['title'], BBCode::OSTATUS);
|
||||
} else {
|
||||
$title = sprintf("New note by %s", $owner["nick"]);
|
||||
}
|
||||
|
@ -1892,7 +1892,7 @@ class OStatus
|
|||
$body = "[b]".$item['title']."[/b]\n\n".$body;
|
||||
}
|
||||
|
||||
$body = BBCode::convertForItem($item['uri-id'], $body, BBCode::OSTATUS);
|
||||
$body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::OSTATUS);
|
||||
|
||||
XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue