diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-27 13:54:20 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-27 13:54:20 -0700 |
| commit | f21044ae1d4574daa992818afec85045598cd057 (patch) | |
| tree | ee190a23582345434638e74755e11102ffc2bfff /modules/tag/helpers | |
| parent | 1f014aae6c16bbda62d8f5937180f11ccb0eb1b1 (diff) | |
Standardize the specification of tags.
With this patch a comma(,) is the only valid tag separator. Spaces
are allowed in tags and phrases no longer need to be specified with a
dot.
Diffstat (limited to 'modules/tag/helpers')
| -rw-r--r-- | modules/tag/helpers/tag_event.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index bf60978d..7becf36f 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -34,8 +34,8 @@ class tag_event_Core { if (!empty($iptc["2#025"])) { foreach($iptc["2#025"] as $tag) { $tag = str_replace("\0", "", $tag); - foreach (preg_split("/[,;]/", $tag) as $word) { - $word = preg_replace('/\s+/', '.', trim($word)); + foreach (preg_split("/,/", $tag) as $word) { + $word = trim($word); if (function_exists("mb_detect_encoding") && mb_detect_encoding($word) != "UTF-8") { $word = utf8_encode($word); } @@ -71,16 +71,16 @@ class tag_event_Core { '$url', {max: 30, formatResult: formatTagAutoCompleteResult} ); });"; - $tag_value = implode("; ", tag::item_tags($item)); - $view->form->edit_item->input("tags")->label(t("Tags (comma or semicolon separated)")) + $tag_value = implode(", ", tag::item_tags($item)); + $view->form->edit_item->input("tags")->label(t("Tags (comma separated)")) ->value($tag_value); } static function item_edit_form_completed($item, $form) { tag::clear_all($item); - foreach (preg_split("/[,;]/", $form->edit_item->tags->value) as $tag_name) { + foreach (preg_split("/,/", $form->edit_item->tags->value) as $tag_name) { if ($tag_name) { - tag::add($item, str_replace(" ", ".", $tag_name)); + tag::add($item, trim($tag_name)); } } tag::compact(); |
