From: Michael Date: Fri, 26 May 2023 14:26:55 +0000 (+0000) Subject: Function moved to the "Strings" class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5966f0cc6295dca97e40d5539238f34258c1cb55;p=friendica.git Function moved to the "Strings" class --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index eae0bc4326..0e5ee9d4e2 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -508,26 +508,7 @@ class BBCode */ private static function convertUrlForActivityPub(string $url): string { - return sprintf('%s', $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('%s', $url, Strings::getStyledURL($url)); } /* diff --git a/src/Util/Strings.php b/src/Util/Strings.php index 1ce1ac8c7d..c3b77ab48c 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -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; + } }