*/
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));
}
/*
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;
+ }
}