mirror of
https://github.com/friendica/friendica
synced 2025-01-09 22:44:44 +00:00
No display improvements for regular posts
This commit is contained in:
parent
318de2f590
commit
dccfc83a2d
1 changed files with 0 additions and 45 deletions
|
@ -826,48 +826,6 @@ class BBCode
|
||||||
return sprintf($html, $url, $styled_url);
|
return sprintf($html, $url, $styled_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Shortens [url] BBCodes in a format that looks less ugly than the full address. (callback function)
|
|
||||||
* @param array $match Array with the matching values
|
|
||||||
* @return string reformatted link including HTML codes
|
|
||||||
*/
|
|
||||||
private static function shortenVisibleUrlCallback($match)
|
|
||||||
{
|
|
||||||
$url = $match[1];
|
|
||||||
|
|
||||||
if (isset($match[2]) && ($match[1] != $match[2])) {
|
|
||||||
return $match[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$parts = parse_url($url);
|
|
||||||
if (!isset($parts['scheme'])) {
|
|
||||||
return $match[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::shortenVisibleUrl($url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Shortens [url] BBCodes in a format that looks less ugly than the full address.
|
|
||||||
* @param string $url URL that is about to be reformatted
|
|
||||||
* @return string reformatted link including HTML codes
|
|
||||||
*/
|
|
||||||
private static function shortenVisibleUrl($url)
|
|
||||||
{
|
|
||||||
$parts = parse_url($url);
|
|
||||||
$scheme = $parts['scheme'] . '://';
|
|
||||||
$styled_url = str_replace($scheme, '', $url);
|
|
||||||
|
|
||||||
// Currently deactivated, due to preview problems inside of Diaspora
|
|
||||||
// if (strlen($styled_url) > 30) {
|
|
||||||
// $styled_url = substr($styled_url, 0, 30) . "…";
|
|
||||||
// }
|
|
||||||
|
|
||||||
$html = '<a href="%s" target="_blank">%s</a>';
|
|
||||||
|
|
||||||
return sprintf($html, $url, $styled_url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* [noparse][i]italic[/i][/noparse] turns into
|
* [noparse][i]italic[/i][/noparse] turns into
|
||||||
* [noparse][ i ]italic[ /i ][/noparse],
|
* [noparse][ i ]italic[ /i ][/noparse],
|
||||||
|
@ -1496,9 +1454,6 @@ class BBCode
|
||||||
if ($simple_html == 7) {
|
if ($simple_html == 7) {
|
||||||
$text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
|
$text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
|
||||||
$text = preg_replace_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
|
$text = preg_replace_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'self::convertUrlForOStatusCallback', $text);
|
||||||
} else {
|
|
||||||
$text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism", 'self::shortenVisibleUrlCallback', $text);
|
|
||||||
$text = preg_replace_callback("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", 'self::shortenVisibleUrlCallback', $text);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$text = preg_replace("(\[url\]([$URLSearchString]*)\[\/url\])ism", " $1 ", $text);
|
$text = preg_replace("(\[url\]([$URLSearchString]*)\[\/url\])ism", " $1 ", $text);
|
||||||
|
|
Loading…
Reference in a new issue