a little more protection against empty tags
This commit is contained in:
parent
f2a9c9c26d
commit
11bbc5adcd
@ -147,7 +147,7 @@ class TagSub extends Managed_DataObject
|
|||||||
$keypart = sprintf('tagsub:by_profile:%d', $profile->id);
|
$keypart = sprintf('tagsub:by_profile:%d', $profile->id);
|
||||||
$tagstring = self::cacheGet($keypart);
|
$tagstring = self::cacheGet($keypart);
|
||||||
|
|
||||||
if ($tagstring !== false) {
|
if ($tagstring !== false && !empty($tagstring)) {
|
||||||
$tags = explode(',', $tagstring);
|
$tags = explode(',', $tagstring);
|
||||||
} else {
|
} else {
|
||||||
$tagsub = new TagSub();
|
$tagsub = new TagSub();
|
||||||
@ -155,9 +155,11 @@ class TagSub extends Managed_DataObject
|
|||||||
|
|
||||||
if ($tagsub->find()) {
|
if ($tagsub->find()) {
|
||||||
while ($tagsub->fetch()) {
|
while ($tagsub->fetch()) {
|
||||||
|
if (!empty($tagsub->tag)) {
|
||||||
$tags[] = $tagsub->tag;
|
$tags[] = $tagsub->tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self::cacheSet($keypart, implode(',', $tags));
|
self::cacheSet($keypart, implode(',', $tags));
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ class TagSubMenu extends Menu
|
|||||||
$this->out->elementStart('ul', array('class' => 'nav'));
|
$this->out->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
foreach ($this->tags as $tag) {
|
foreach ($this->tags as $tag) {
|
||||||
|
if (!empty($tag)) {
|
||||||
$this->out->menuItem(common_local_url('tag',
|
$this->out->menuItem(common_local_url('tag',
|
||||||
array('tag' => $tag)),
|
array('tag' => $tag)),
|
||||||
sprintf('#%s', $tag),
|
sprintf('#%s', $tag),
|
||||||
@ -69,6 +70,7 @@ class TagSubMenu extends Menu
|
|||||||
$this->actionName == 'tag' && $this->action->arg('tag') == $tag,
|
$this->actionName == 'tag' && $this->action->arg('tag') == $tag,
|
||||||
'nav_streams_tag_'.$tag);
|
'nav_streams_tag_'.$tag);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->out->elementEnd('ul');
|
$this->out->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user