]> git.mxchange.org Git - friendica.git/commitdiff
Function moved to the "Strings" class
authorMichael <heluecht@pirati.ca>
Fri, 26 May 2023 14:26:55 +0000 (14:26 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 26 May 2023 14:26:55 +0000 (14:26 +0000)
src/Content/Text/BBCode.php
src/Util/Strings.php

index eae0bc43267976566475024656d9c651593aa41e..0e5ee9d4e2e03600e470e8ad9a5f5fcb91a0f79e 100644 (file)
@@ -508,26 +508,7 @@ class BBCode
         */
        private static function convertUrlForActivityPub(string $url): string
        {
-               return sprintf('<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>', $url, self::getStyledURL($url));
-       }
-
-       /**
-        * Converts an URL in a nicer format (without the scheme and possibly shortened)
-        *
-        * @param string $url URL that is about to be reformatted
-        * @return string reformatted link
-        */
-       public static function getStyledURL(string $url): string
-       {
-               $parts = parse_url($url);
-               $scheme = $parts['scheme'] . '://';
-               $styled_url = str_replace($scheme, '', $url);
-
-               if (strlen($styled_url) > 30) {
-                       $styled_url = substr($styled_url, 0, 30) . "…";
-               }
-
-               return $styled_url;
+               return sprintf('<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>', $url, Strings::getStyledURL($url));
        }
 
        /*
index 1ce1ac8c7d17a05f6788dcf5b3fd8dc7991b3396..c3b77ab48c919c4d3b3a120e728862f30f474246 100644 (file)
@@ -561,4 +561,22 @@ class Strings
                return $shorthand;
        }
 
+       /**
+        * Converts an URL in a nicer format (without the scheme and possibly shortened)
+        *
+        * @param string $url URL that is about to be reformatted
+        * @return string reformatted link
+        */
+       public static function getStyledURL(string $url): string
+       {
+               $parts = parse_url($url);
+               $scheme = $parts['scheme'] . '://';
+               $styled_url = str_replace($scheme, '', $url);
+
+               if (strlen($styled_url) > 30) {
+                       $styled_url = substr($styled_url, 0, 30) . "…";
+               }
+
+               return $styled_url;
+       }
 }