]> git.mxchange.org Git - friendica-addons.git/commitdiff
Use "convertForUriId" when possible
authorMichael <heluecht@pirati.ca>
Sat, 10 Jul 2021 07:40:39 +0000 (07:40 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 10 Jul 2021 07:40:39 +0000 (07:40 +0000)
blogger/blogger.php
dwpost/dwpost.php
ijpost/ijpost.php
ljpost/ljpost.php
mailstream/mailstream.php
pumpio/pumpio.php
tumblr/tumblr.php
windowsphonepush/windowsphonepush.php
wppost/wppost.php

index 5cf0d27b3f22397a717bd42437ed5c1fd5192e76..38470f187e39a167659626300ed49ca37fc2dba8 100644 (file)
@@ -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
index ce4d90968be64823698e817508367e1f4f2ae654..56e04f783c2be41e7925a903e093d0cddf58f1b6 100644 (file)
@@ -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]);
 
index 15f2b41e63e55bf9ff70c3bbfcb7423cf3e9c883..aad2a696945e854b4ddf1b118607eb6a2c3e0494 100644 (file)
@@ -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]);
 
index be831fa50c991758b0cd7beb3f011a4bbe9a8f16..0cab2aa4792bb60f7a3d539c951b0be1f65c8aa2 100644 (file)
@@ -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]);
 
index d825979b840e22029ea6a55c91091f444325f629..a9fbc2b41c10d4df162098eb3dac8ffb17d0b180 100644 (file)
@@ -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'),
index 5f03c6c57f499c766508af48e37a27420509b4e2..be2c5587b50e4fc1a291c39205234b6600cd9a91 100644 (file)
@@ -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 = [];
 
index 3dc89a37258738457e18b079b0f7fbc5e3dae0d9..4be767f9ee1296cd2205daeb30db2cb3a11e55b1 100644 (file)
@@ -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');
index bf160f0a4b1fcb949e0641cc482b6222202faf59..12bc5c9940b8d1f8f2da72e2f1bac366018d7606 100644 (file)
@@ -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);
                                                }
index 1d24dbcfc7db137ae7f4c3088254c033cee11891..637394d84e673fa58d30cf0ab7cac8d4077f1cbf 100644 (file)
@@ -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);