summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2010-02-06 13:05:44 -0800
committerAndy Staudacher <andy.st@gmail.com>2010-02-06 13:05:44 -0800
commit7099fc71f11ef8d3dd613d96a04a4824a827c714 (patch)
tree56a0cdde8af26c66b27095f15107294c9c75a52c /modules/tag
parent5c0c33782d7dd3556adecb9593f25f2cff06401a (diff)
Fix for ticket 1004: Replace all uses of split with explode (none actually required regular expressions). Thanks to Brian Hartsock for providing a patch!
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/tags.php6
-rw-r--r--modules/tag/helpers/tag_event.php6
-rw-r--r--modules/tag/helpers/tag_item_rest.php2
3 files changed, 7 insertions, 7 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index 1eede907..04400d73 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -60,7 +60,7 @@ class Tags_Controller extends Controller {
$form = tag::get_add_form($item);
if ($form->validate()) {
- foreach (split(",", $form->add_tag->inputs["name"]->value) as $tag_name) {
+ foreach (explode(",", $form->add_tag->inputs["name"]->value) as $tag_name) {
$tag_name = trim($tag_name);
if ($tag_name) {
$tag = tag::add($item, $tag_name);
@@ -77,9 +77,9 @@ class Tags_Controller extends Controller {
public function autocomplete() {
$tags = array();
- $tag_parts = preg_split("#,#", Input::instance()->get("q"));
+ $tag_parts = explode(",", Input::instance()->get("q"));
$limit = Input::instance()->get("limit");
- $tag_part = end($tag_parts);
+ $tag_part = ltrim(end($tag_parts));
$tag_list = ORM::factory("tag")
->where("name", "LIKE", "{$tag_part}%")
->order_by("name", "ASC")
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)) {