]> git.mxchange.org Git - friendica.git/commitdiff
Revert "Move share content conversion before link handling in Text\BBCode::convert"
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 4 Jun 2020 15:11:44 +0000 (11:11 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 4 Jun 2020 15:11:44 +0000 (11:11 -0400)
This reverts commit 010ec99b35c2bee8f23060e96c2af3ba5849cf84.

src/Content/Text/BBCode.php
tests/src/Content/Text/BBCodeTest.php

index ac869d0d87ae48566dacbe54e718f59eb1086d08..67dbe3b19aa05a3e347f0d9cb6c170a5e4e46425 100644 (file)
@@ -1765,15 +1765,6 @@ class BBCode
                                $text);
                }
 
-               // Shared content conversion
-               // Notice: may create [bookmark] tags so this must be ran before the link handling
-               $text = self::convertShare(
-                       $text,
-                       function (array $attributes, array $author_contact, $content, $is_quote_share) use ($simple_html) {
-                               return self::convertShareCallback($attributes, $author_contact, $content, $is_quote_share, $simple_html);
-                       }
-               );
-
                // Bookmarks in red - will be converted to bookmarks in friendica
                $text = preg_replace("/#\^\[url\](.*?)\[\/url\]/ism", '[bookmark=$1]$1[/bookmark]', $text);
                $text = preg_replace("/#\^\[url\=(.*?)\](.*?)\[\/url\]/ism", '[bookmark=$1]$2[/bookmark]', $text);
@@ -1892,6 +1883,14 @@ class BBCode
                $regex = '#<([^>]*?)(href)="(?!' . implode('|', $allowed_link_protocols) . ')(.*?)"(.*?)>#ism';
                $text = preg_replace($regex, '<$1$2="javascript:void(0)"$4 data-original-href="$3" class="invalid-href" title="' . DI::l10n()->t('Invalid link protocol') . '">', $text);
 
+               // Shared content
+               $text = self::convertShare(
+                       $text,
+                       function (array $attributes, array $author_contact, $content, $is_quote_share) use ($simple_html) {
+                               return self::convertShareCallback($attributes, $author_contact, $content, $is_quote_share, $simple_html);
+                       }
+               );
+
                if ($saved_image) {
                        $text = self::interpolateSavedImagesIntoItemBody($text, $saved_image);
                }
index 28db30567d101e169399889c505de4e7121d0d9c..35dff87d9fc7b04fbb2278aaa5ac6d7225d957c8 100644 (file)
@@ -236,7 +236,7 @@ class BBCodeTest extends MockedTest
                        'bug-7808-code-amp' => [
                                'expectedHtml' => '<code>&amp;</code>',
                                'text' => '[code]&[/code]',
-                       ],
+                       ]
                ];
        }