diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-28 04:54:20 +0800 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-28 06:28:31 +0800 |
| commit | ecc9203c2352bdfa3738998f27268293345ec0e9 (patch) | |
| tree | 94d28284c49fd12d9e9b8fd50f0885a7195f7b59 /modules/tag/helpers | |
| parent | 7efb4b4cdfba4c0280b18d1980cd8ad011360b87 (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.
Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
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(); |
