From 11bbc5adcdbb479b3ac1c7826d0cfd1e2eea24c7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 5 Apr 2011 18:36:49 -0400 Subject: [PATCH] a little more protection against empty tags --- plugins/TagSub/TagSub.php | 6 ++++-- plugins/TagSub/tagsubmenu.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/TagSub/TagSub.php b/plugins/TagSub/TagSub.php index c2da072693..9662811bf9 100644 --- a/plugins/TagSub/TagSub.php +++ b/plugins/TagSub/TagSub.php @@ -147,7 +147,7 @@ class TagSub extends Managed_DataObject $keypart = sprintf('tagsub:by_profile:%d', $profile->id); $tagstring = self::cacheGet($keypart); - if ($tagstring !== false) { + if ($tagstring !== false && !empty($tagstring)) { $tags = explode(',', $tagstring); } else { $tagsub = new TagSub(); @@ -155,7 +155,9 @@ class TagSub extends Managed_DataObject if ($tagsub->find()) { while ($tagsub->fetch()) { - $tags[] = $tagsub->tag; + if (!empty($tagsub->tag)) { + $tags[] = $tagsub->tag; + } } } diff --git a/plugins/TagSub/tagsubmenu.php b/plugins/TagSub/tagsubmenu.php index e2ddf04ef9..e57a8a8a97 100644 --- a/plugins/TagSub/tagsubmenu.php +++ b/plugins/TagSub/tagsubmenu.php @@ -62,12 +62,14 @@ class TagSubMenu extends Menu $this->out->elementStart('ul', array('class' => 'nav')); foreach ($this->tags as $tag) { + if (!empty($tag)) { $this->out->menuItem(common_local_url('tag', array('tag' => $tag)), sprintf('#%s', $tag), sprintf(_('Notices tagged with %s'), $tag), $this->actionName == 'tag' && $this->action->arg('tag') == $tag, 'nav_streams_tag_'.$tag); + } } $this->out->elementEnd('ul'); -- 2.39.5