aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2017-01-03 09:57:52 +0100
committerGitHub <noreply@github.com>2017-01-03 09:57:52 +0100
commit64497fb3020e9d2e2c0f9c55c4d10fedbc7a9f79 (patch)
treebefc1823dfc935fd827e6753b48f53d8150c3493 /application/Utils.php
parente0177549c760b143efdd17b1579e0c0199dce939 (diff)
parentb3051a6aae446e063c3b6fa4a6a600357a9f24af (diff)
downloadShaarli-64497fb3020e9d2e2c0f9c55c4d10fedbc7a9f79.tar.gz
Shaarli-64497fb3020e9d2e2c0f9c55c4d10fedbc7a9f79.tar.zst
Shaarli-64497fb3020e9d2e2c0f9c55c4d10fedbc7a9f79.zip
Merge pull request #725 from ArthurHoaro/hotfix/privatetags-split
Fixes presence of empty tags for private tags and in search results
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php13
1 files changed, 13 insertions, 0 deletions
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 */
269function normalize_spaces($string)
270{
271 return preg_replace('/\s{2,}/', ' ', trim($string));
272}