From a059eff25d3e4975f39ad04181039d4544e47059 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 10 Jul 2009 13:11:49 +0800 Subject: Make the tag event handle the iptc keywords consistently with other tag add mechanisms Signed-off-by: Tim Almdal --- modules/tag/helpers/tag_event.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 946326c0..7a170bf8 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -34,10 +34,13 @@ class tag_event_Core { if (!empty($iptc["2#025"])) { foreach($iptc["2#025"] as $tag) { $tag = str_replace("\0", "", $tag); - if (function_exists("mb_detect_encoding") && mb_detect_encoding($tag) != "UTF-8") { - $tag = utf8_encode($tag); + foreach (preg_split("/[,;]/", $tag) as $word) { + $word = preg_replace('/\s+/', '.', trim($word)); + if (function_exists("mb_detect_encoding") && mb_detect_encoding($word) != "UTF-8") { + $word = utf8_encode($word); + } + $tags[$word] = 1; } - $tags[$tag] = 1; } } } -- cgit v1.2.3