Short circuit if we have an empty $tag
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 14 Sep 2010 15:33:00 +0000 (11:33 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 14 Sep 2010 15:33:00 +0000 (11:33 -0400)
ansel/lib/Tagger.php
ansel/lib/View/GalleryProperties.php

index f4c90cf..bd754bd 100644 (file)
@@ -71,6 +71,10 @@ class Ansel_Tagger
      */
     public function tag($localId, $tags, $owner, $content_type = 'image')
     {
+        if (empty($tags)) {
+            return;
+        }
+
         if (!is_array($tags)) {
             $tags = $this->_tagger->splitTags($tags);
         }
index 6ed9ba6..6851cf5 100644 (file)
@@ -252,7 +252,7 @@ class Ansel_View_GalleryProperties
                     $gallery->set('name', $gallery_name);
                 }
                 $gallery->set('desc', $gallery_desc);
-                $gallery->setTags(explode(',', $gallery_tags));
+                $gallery->setTags(!empty($gallery_tags) ? explode(',', $gallery_tags) : '');
                 //$gallery->set('style', $style);
                 $gallery->set('slug', $gallery_slug);
                 $gallery->set('age', $gallery_age);
@@ -318,7 +318,6 @@ class Ansel_View_GalleryProperties
                     'horde.warning');
                 $actionId = 'add';
                 $title = _("Adding A New Gallery");
-                break;
             }
 
             // Create the new gallery.