diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/LinkFilter.php | 2 | ||||
-rw-r--r-- | application/Utils.php | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/application/LinkFilter.php b/application/LinkFilter.php index daa6d9cc..57ebfd5c 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php | |||
@@ -348,7 +348,7 @@ class LinkFilter | |||
348 | $tagsOut = $casesensitive ? $tags : mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8'); | 348 | $tagsOut = $casesensitive ? $tags : mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8'); |
349 | $tagsOut = str_replace(',', ' ', $tagsOut); | 349 | $tagsOut = str_replace(',', ' ', $tagsOut); |
350 | 350 | ||
351 | return array_values(array_filter(explode(' ', trim($tagsOut)), 'strlen')); | 351 | return preg_split('/\s+/', $tagsOut, -1, PREG_SPLIT_NO_EMPTY); |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
diff --git a/application/Utils.php b/application/Utils.php index 62902341..35d65224 100644 --- a/application/Utils.php +++ b/application/Utils.php | |||
@@ -257,3 +257,16 @@ function generate_api_secret($username, $salt) | |||
257 | 257 | ||
258 | return str_shuffle(substr(hash_hmac('sha512', uniqid($salt), $username), 10, 12)); | 258 | return str_shuffle(substr(hash_hmac('sha512', uniqid($salt), $username), 10, 12)); |
259 | } | 259 | } |
260 | |||
261 | /** | ||
262 | * Trim string, replace sequences of whitespaces by a single space. | ||
263 | * PHP equivalent to `normalize-space` XSLT function. | ||
264 | * | ||
265 | * @param string $string Input string. | ||
266 | * | ||
267 | * @return mixed Normalized string. | ||
268 | */ | ||
269 | function normalize_spaces($string) | ||
270 | { | ||
271 | return preg_replace('/\s{2,}/', ' ', trim($string)); | ||
272 | } | ||