forked from friendica/friendica-addons
Use "convertForUriId" when possible
This commit is contained in:
parent
b164910032
commit
9eaa6a2c08
|
@ -186,7 +186,7 @@ function blogger_send(App $a, array &$b)
|
|||
|
||||
if ($bl_username && $bl_password && $bl_blog) {
|
||||
$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);
|
||||
|
||||
$xml = <<< EOT
|
||||
|
|
|
@ -183,7 +183,7 @@ function dwpost_send(App $a, array &$b)
|
|||
|
||||
if ($dw_username && $dw_password && $dw_blog) {
|
||||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
|
||||
$post = XML::escape($post);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ function ijpost_send(&$a, &$b)
|
|||
|
||||
if ($ij_username && $ij_password && $ij_blog) {
|
||||
$title = $b['title'];
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
|
||||
$post = XML::escape($post);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ function ljpost_send(&$a,&$b) {
|
|||
|
||||
if($lj_username && $lj_password && $lj_blog) {
|
||||
$title = XML::escape($b['title']);
|
||||
$post = BBCode::convert($b['body']);
|
||||
$post = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
|
||||
$post = XML::escape($post);
|
||||
$tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ function mailstream_send($message_id, $item, $user)
|
|||
$mail->CharSet = 'utf-8';
|
||||
$template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
|
||||
$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'];
|
||||
$mail->Body = Renderer::replaceMacros($template, [
|
||||
'$upstream' => DI::l10n()->t('Upstream'),
|
||||
|
|
|
@ -514,7 +514,7 @@ function pumpio_send(App $a, array &$b)
|
|||
if ($oauth_token && $oauth_token_secret) {
|
||||
$title = trim($b['title']);
|
||||
|
||||
$content = BBCode::convert($b['body'], false, BBCode::CONNECTORS);
|
||||
$content = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
|
||||
|
||||
$params = [];
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ function tumblr_send(App $a, array &$b) {
|
|||
switch ($siteinfo["type"]) {
|
||||
case "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"])) {
|
||||
$params['link'] = $siteinfo["url"];
|
||||
|
@ -428,25 +428,25 @@ function tumblr_send(App $a, array &$b) {
|
|||
$params['type'] = "link";
|
||||
$params['title'] = $title;
|
||||
$params['url'] = $siteinfo["url"];
|
||||
$params['description'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||
$params['description'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
|
||||
break;
|
||||
|
||||
case "audio":
|
||||
$params['type'] = "audio";
|
||||
$params['external_url'] = $siteinfo["url"];
|
||||
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||
$params['caption'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
|
||||
break;
|
||||
|
||||
case "video":
|
||||
$params['type'] = "video";
|
||||
$params['embed'] = $siteinfo["url"];
|
||||
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||
$params['caption'] = BBCode::convertForUriId($b['uri-id'], $body, BBCode::CONNECTORS);
|
||||
break;
|
||||
|
||||
default:
|
||||
$params['type'] = "text";
|
||||
$params['title'] = $title;
|
||||
$params['body'] = BBCode::convert($b['body'], false, BBCode::CONNECTORS);
|
||||
$params['body'] = BBCode::convertForUriId($b['uri-id'], $b['body'], BBCode::CONNECTORS);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ function tumblr_send(App $a, array &$b) {
|
|||
}
|
||||
|
||||
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');
|
||||
|
|
|
@ -185,7 +185,7 @@ function windowsphonepush_cron()
|
|||
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
|
||||
if ($senditemtext == 1) {
|
||||
// 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
|
||||
// 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") {
|
||||
$body = "URL/Image ...";
|
||||
} else {
|
||||
$body = BBCode::convert($body, false, BBCode::API, true);
|
||||
$body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::API);
|
||||
$body = HTML::toPlaintext($body, 0);
|
||||
$body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ function wppost_send(&$a, &$b)
|
|||
// Remove the share element before fetching the first line
|
||||
$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");
|
||||
$trailer = "";
|
||||
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>';
|
||||
$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
|
||||
$post = preg_replace('/<a.*?href="(https?:\/\/www.youtube.com\/.*?)".*?>(.*?)<\/a>/ism', "\n$1\n", $post);
|
||||
|
|
Loading…
Reference in a new issue