Improved formatting

This commit is contained in:
Michael 2020-01-19 09:46:31 +00:00
parent 0a4119adaf
commit 4e5db36177
3 changed files with 71 additions and 65 deletions

View File

@ -712,6 +712,7 @@ class BBCode
/** /**
* Converts [url] BBCodes in a format that looks fine on ActivityPub systems. * Converts [url] BBCodes in a format that looks fine on ActivityPub systems.
*
* @param string $url URL that is about to be reformatted * @param string $url URL that is about to be reformatted
* @return string reformatted link including HTML codes * @return string reformatted link including HTML codes
*/ */
@ -723,6 +724,7 @@ class BBCode
/** /**
* Converts an URL in a nicer format (without the scheme and possibly shortened) * Converts an URL in a nicer format (without the scheme and possibly shortened)
*
* @param string $url URL that is about to be reformatted * @param string $url URL that is about to be reformatted
* @return string reformatted link * @return string reformatted link
*/ */
@ -2118,13 +2120,16 @@ class BBCode
// we might be inside a bbcode color tag - leave it alone // we might be inside a bbcode color tag - leave it alone
continue; continue;
} }
if (substr($match, -1, 1) === '.') { if (substr($match, -1, 1) === '.') {
$match = substr($match,0,-1); $match = substr($match,0,-1);
} }
// ignore strictly numeric tags like #1 // ignore strictly numeric tags like #1
if ((strpos($match, '#') === 0) && ctype_digit(substr($match, 1))) { if ((strpos($match, '#') === 0) && ctype_digit(substr($match, 1))) {
continue; continue;
} }
// try not to catch url fragments // try not to catch url fragments
if (strpos($string, $match) && preg_match('/[a-zA-z0-9\/]/', substr($string, strpos($string, $match) - 1, 1))) { if (strpos($string, $match) && preg_match('/[a-zA-z0-9\/]/', substr($string, strpos($string, $match) - 1, 1))) {
continue; continue;

View File

@ -1228,6 +1228,7 @@ class GContact
/** /**
* Asking GNU Social server on a regular base for their user data * Asking GNU Social server on a regular base for their user data
*
* @return void * @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException