Use "convertForUriId" when possible

pull/1144/head
Michael 2021-07-10 07:40:39 +00:00
parent b164910032
commit 9eaa6a2c08
9 changed files with 16 additions and 16 deletions

View File

@ -186,7 +186,7 @@ function blogger_send(App $a, array &$b)
if ($bl_username && $bl_password && $bl_blog) { if ($bl_username && $bl_password && $bl_blog) {
$title = '<title>' . (($b['title']) ? $b['title'] : DI::l10n()->t('Post from Friendica')) . '</title>'; $title = '<title>' . (($b['title']) ? $b['title'] : DI::l10n()->t('Post from Friendica')) . '</title>';
$post = $title . BBCode::convert($b['body']); $post = $title . BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
$post = XML::escape($post); $post = XML::escape($post);
$xml = <<< EOT $xml = <<< EOT

View File

@ -183,7 +183,7 @@ function dwpost_send(App $a, array &$b)
if ($dw_username && $dw_password && $dw_blog) { if ($dw_username && $dw_password && $dw_blog) {
$title = $b['title']; $title = $b['title'];
$post = BBCode::convert($b['body']); $post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
$post = XML::escape($post); $post = XML::escape($post);
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]); $tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);

View File

@ -178,7 +178,7 @@ function ijpost_send(&$a, &$b)
if ($ij_username && $ij_password && $ij_blog) { if ($ij_username && $ij_password && $ij_blog) {
$title = $b['title']; $title = $b['title'];
$post = BBCode::convert($b['body']); $post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
$post = XML::escape($post); $post = XML::escape($post);
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]); $tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);

View File

@ -180,7 +180,7 @@ function ljpost_send(&$a,&$b) {
if($lj_username && $lj_password && $lj_blog) { if($lj_username && $lj_password && $lj_blog) {
$title = XML::escape($b['title']); $title = XML::escape($b['title']);
$post = BBCode::convert($b['body']); $post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
$post = XML::escape($post); $post = XML::escape($post);
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]); $tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);

View File

@ -401,7 +401,7 @@ function mailstream_send($message_id, $item, $user)
$mail->CharSet = 'utf-8'; $mail->CharSet = 'utf-8';
$template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/'); $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
$mail->AltBody = BBCode::toPlaintext($item['body']); $mail->AltBody = BBCode::toPlaintext($item['body']);
$item['body'] = BBCode::convert($item['body'], false, BBCode::CONNECTORS); $item['body'] = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::CONNECTORS);
$item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid']; $item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
$mail->Body = Renderer::replaceMacros($template, [ $mail->Body = Renderer::replaceMacros($template, [
'$upstream' => DI::l10n()->t('Upstream'), '$upstream' => DI::l10n()->t('Upstream'),

View File

@ -514,7 +514,7 @@ function pumpio_send(App $a, array &$b)
if ($oauth_token && $oauth_token_secret) { if ($oauth_token && $oauth_token_secret) {
$title = trim($b['title']); $title = trim($b['title']);
$content = BBCode::convert($b['body'], false, BBCode::CONNECTORS); $content = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
$params = []; $params = [];

View File

@ -415,7 +415,7 @@ function tumblr_send(App $a, array &$b) {
switch ($siteinfo["type"]) { switch ($siteinfo["type"]) {
case "photo": case "photo":
$params['type'] = "photo"; $params['type'] = "photo";
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS); $params['caption'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);;
if (isset($siteinfo["url"])) { if (isset($siteinfo["url"])) {
$params['link'] = $siteinfo["url"]; $params['link'] = $siteinfo["url"];
@ -428,25 +428,25 @@ function tumblr_send(App $a, array &$b) {
$params['type'] = "link"; $params['type'] = "link";
$params['title'] = $title; $params['title'] = $title;
$params['url'] = $siteinfo["url"]; $params['url'] = $siteinfo["url"];
$params['description'] = BBCode::convert($body, false, BBCode::CONNECTORS); $params['description'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
break; break;
case "audio": case "audio":
$params['type'] = "audio"; $params['type'] = "audio";
$params['external_url'] = $siteinfo["url"]; $params['external_url'] = $siteinfo["url"];
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS); $params['caption'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
break; break;
case "video": case "video":
$params['type'] = "video"; $params['type'] = "video";
$params['embed'] = $siteinfo["url"]; $params['embed'] = $siteinfo["url"];
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS); $params['caption'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
break; break;
default: default:
$params['type'] = "text"; $params['type'] = "text";
$params['title'] = $title; $params['title'] = $title;
$params['body'] = BBCode::convert($b['body'], false, BBCode::CONNECTORS); $params['body'] = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
break; break;
} }
@ -456,7 +456,7 @@ function tumblr_send(App $a, array &$b) {
} }
if (empty($params['caption']) && !empty($siteinfo["description"])) { if (empty($params['caption']) && !empty($siteinfo["description"])) {
$params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, BBCode::CONNECTORS); $params['caption'] = BBCode::convertForUriId($b['uri-id'], "[quote]" . $siteinfo["description"] . "[/quote]", BBCode::CONNECTORS);
} }
$consumer_key = DI::config()->get('tumblr','consumer_key'); $consumer_key = DI::config()->get('tumblr','consumer_key');

View File

@ -185,7 +185,7 @@ function windowsphonepush_cron()
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext'); $senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
if ($senditemtext == 1) { if ($senditemtext == 1) {
// load item with the max id // load item with the max id
$item = Post::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]); $item = Post::selectFirst(['author-name', 'body', 'uri-id'], ['id' => $count[0]['max']]);
// as user allows to send the item, we want to show the sender of the item in the toast // as user allows to send the item, we want to show the sender of the item in the toast
// toasts are limited to one line, therefore place is limited - author shall be in // toasts are limited to one line, therefore place is limited - author shall be in
@ -201,7 +201,7 @@ function windowsphonepush_cron()
if (substr($body, 0, 4) == "[url") { if (substr($body, 0, 4) == "[url") {
$body = "URL/Image ..."; $body = "URL/Image ...";
} else { } else {
$body = BBCode::convert($body, false, BBCode::API, true); $body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::API);
$body = HTML::toPlaintext($body, 0); $body = HTML::toPlaintext($body, 0);
$body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body); $body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
} }

View File

@ -276,7 +276,7 @@ function wppost_send(&$a, &$b)
// Remove the share element before fetching the first line // Remove the share element before fetching the first line
$title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism", "\n$1\n", $b['body'])); $title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism", "\n$1\n", $b['body']));
$title = HTML::toPlaintext(BBCode::convert($title, false), 0, true)."\n"; $title = BBCode::toPlaintext($title)."\n";
$pos = strpos($title, "\n"); $pos = strpos($title, "\n");
$trailer = ""; $trailer = "";
if (($pos == 0) || ($pos > 100)) { if (($pos == 0) || ($pos > 100)) {
@ -289,7 +289,7 @@ function wppost_send(&$a, &$b)
} }
$title = '<title>' . (($wptitle) ? $wptitle : DI::l10n()->t('Post from Friendica')) . '</title>'; $title = '<title>' . (($wptitle) ? $wptitle : DI::l10n()->t('Post from Friendica')) . '</title>';
$post = BBCode::convert($b['body'], false, BBCode::CONNECTORS); $post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
// If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it // If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it
$post = preg_replace('/<a.*?href="(https?:\/\/www.youtube.com\/.*?)".*?>(.*?)<\/a>/ism', "\n$1\n", $post); $post = preg_replace('/<a.*?href="(https?:\/\/www.youtube.com\/.*?)".*?>(.*?)<\/a>/ism', "\n$1\n", $post);