diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 89bd802027..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 - */ - private 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; + } } diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 3abf2cedd4..c2a59b1d4f 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: 2023.05-rc\n" +"Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-21 17:30+0000\n" +"POT-Creation-Date: 2023-05-26 07:34+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1614,7 +1614,7 @@ msgstr "" msgid "show more" msgstr "" -#: src/Content/Item.php:327 src/Model/Item.php:2927 +#: src/Content/Item.php:327 src/Model/Item.php:2931 msgid "event" msgstr "" @@ -1622,7 +1622,7 @@ msgstr "" msgid "status" msgstr "" -#: src/Content/Item.php:336 src/Model/Item.php:2929 +#: src/Content/Item.php:336 src/Model/Item.php:2933 #: src/Module/Post/Tag/Add.php:123 msgid "photo" msgstr "" @@ -2028,8 +2028,8 @@ msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:956 src/Model/Item.php:3645 -#: src/Model/Item.php:3651 src/Model/Item.php:3652 +#: src/Content/Text/BBCode.php:956 src/Model/Item.php:3649 +#: src/Model/Item.php:3655 src/Model/Item.php:3656 msgid "Link to source" msgstr "" @@ -3203,76 +3203,76 @@ msgstr "" msgid "Detected languages in this post:\\n%s" msgstr "" -#: src/Model/Item.php:2931 +#: src/Model/Item.php:2935 msgid "activity" msgstr "" -#: src/Model/Item.php:2933 +#: src/Model/Item.php:2937 msgid "comment" msgstr "" -#: src/Model/Item.php:2936 src/Module/Post/Tag/Add.php:123 +#: src/Model/Item.php:2940 src/Module/Post/Tag/Add.php:123 msgid "post" msgstr "" -#: src/Model/Item.php:3105 -#, php-format -msgid "%s is blocked" -msgstr "" - -#: src/Model/Item.php:3107 -#, php-format -msgid "%s is ignored" -msgstr "" - #: src/Model/Item.php:3109 #, php-format -msgid "Content from %s is collapsed" +msgid "%s is blocked" +msgstr "" + +#: src/Model/Item.php:3111 +#, php-format +msgid "%s is ignored" msgstr "" #: src/Model/Item.php:3113 #, php-format +msgid "Content from %s is collapsed" +msgstr "" + +#: src/Model/Item.php:3117 +#, php-format msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3557 +#: src/Model/Item.php:3561 msgid "bytes" msgstr "" -#: src/Model/Item.php:3588 +#: src/Model/Item.php:3592 #, php-format msgid "%2$s (%3$d%%, %1$d vote)" msgid_plural "%2$s (%3$d%%, %1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3590 +#: src/Model/Item.php:3594 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3595 +#: src/Model/Item.php:3599 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3597 +#: src/Model/Item.php:3601 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3599 +#: src/Model/Item.php:3603 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3633 src/Model/Item.php:3634 +#: src/Model/Item.php:3637 src/Model/Item.php:3638 msgid "View on separate page" msgstr ""