From 7099fc71f11ef8d3dd613d96a04a4824a827c714 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sat, 6 Feb 2010 13:05:44 -0800 Subject: Fix for ticket 1004: Replace all uses of split with explode (none actually required regular expressions). Thanks to Brian Hartsock for providing a patch! --- modules/tag/helpers/tag_event.php | 6 +++--- modules/tag/helpers/tag_item_rest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 403ccd52..10075c02 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -34,7 +34,7 @@ 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) { + foreach (explode(",", $tag) as $word) { $word = trim($word); if (function_exists("mb_detect_encoding") && mb_detect_encoding($word) != "UTF-8") { $word = utf8_encode($word); @@ -82,7 +82,7 @@ class tag_event_Core { static function item_edit_form_completed($item, $form) { tag::clear_all($item); - foreach (preg_split("/,/", $form->edit_item->tags->value) as $tag_name) { + foreach (explode(",", $form->edit_item->tags->value) as $tag_name) { if ($tag_name) { tag::add($item, trim($tag_name)); } @@ -124,7 +124,7 @@ class tag_event_Core { } static function add_photos_form_completed($album, $form) { - foreach (split(",", $form->add_photos->tags->value) as $tag_name) { + foreach (explode(",", $form->add_photos->tags->value) as $tag_name) { $tag_name = trim($tag_name); if ($tag_name) { $tag = tag::add($album, $tag_name); diff --git a/modules/tag/helpers/tag_item_rest.php b/modules/tag/helpers/tag_item_rest.php index 672cec53..fe07fefb 100644 --- a/modules/tag/helpers/tag_item_rest.php +++ b/modules/tag/helpers/tag_item_rest.php @@ -34,7 +34,7 @@ class tag_item_rest_Core { } static function resolve($tuple) { - list ($tag_id, $item_id) = split(",", $tuple); + list ($tag_id, $item_id) = explode(",", $tuple); $tag = ORM::factory("tag", $tag_id); $item = ORM::factory("item", $item_id); if (!$tag->loaded() || !$item->loaded() || !$tag->has($item) || !access::can("view", $item)) { -- cgit v1.2.3