]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
Merge pull request #4365 from MrPetovan/task/4116-add-autoload-to-library
[friendica.git] / include / bbcode.php
index dfaed8ef78233c5df79f07301534ff246c9e1038..20631818a2503fbe8167130edd644e1cccd6a41b 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Model\Contact;
 use Friendica\Util\Map;
+use Friendica\Util\Network;
 
 require_once 'include/event.php';
 require_once 'mod/proxy.php';
@@ -688,7 +689,7 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
                $StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
                if ($StatusnetUser != $profile) {
                        /// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
-                       $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
+                       $UserData = Network::fetchUrl("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
                        $user = json_decode($UserData);
                        if ($user) {
                                if ($getnetwork) {
@@ -747,9 +748,7 @@ function bb_RemovePictureLinks($match) {
                        $text = "[url=".$match[2]."]".$match[2]."[/url]";
 
                        // if its not a picture then look if its a page that contains a picture link
-                       require_once("include/network.php");
-
-                       $body = fetch_url($match[1]);
+                       $body = Network::fetchUrl($match[1]);
 
                        $doc = new DOMDocument();
                        @$doc->loadHTML($body);
@@ -804,9 +803,7 @@ function bb_CleanPictureLinksSub($match) {
                        $text = "[img]".$match[2]."[/img]";
 
                        // if its not a picture then look if its a page that contains a picture link
-                       require_once("include/network.php");
-
-                       $body = fetch_url($match[1]);
+                       $body = Network::fetchUrl($match[1]);
 
                        $doc = new DOMDocument();
                        @$doc->loadHTML($body);
@@ -1000,8 +997,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
        if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, [3, 7])) {
                $Text = preg_replace("/([#@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
        } elseif ($simplehtml == 3) {
+               // The ! is converted to @ since Diaspora only understands the @
                $Text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
-                       '$1<a href="$2">$3</a>',
+                       '@<a href="$2">$3</a>',
                        $Text);
        } elseif ($simplehtml == 7) {
                $Text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",