Improved parsing of tags

This commit is contained in:
Tobias Reich 2014-04-18 21:27:52 +02:00
parent a3970ce69a
commit 92d894783e
2 changed files with 2 additions and 2 deletions

View File

@ -408,7 +408,7 @@ photo = {
// Parse tags
tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ',');
tags = tags.replace(/,$|^,/g, '');
tags = tags.replace(/,$|^,|(\ ){0,}$/g, '');
if (visible.photo()) {
photo.json.tags = tags;

View File

@ -639,7 +639,7 @@ class Photo extends Module {
# Parse tags
$tags = preg_replace('/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/', ',', $tags);
$tags = preg_replace('/,$|^,/', ',', $tags);
$tags = preg_replace('/,$|^,|(\ ){0,}$/', '', $tags);
if (strlen($tags)>1000) return false;
# Set tags