1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Fix for tagcloud word limit.

This commit is contained in:
Cameron 2021-09-19 11:40:40 -07:00
parent 92f6c54c9c
commit 34b9e454da

View File

@ -59,12 +59,13 @@ if(!class_exists('tagcloud_menu'))
e107::getCache()->setMD5(e_LANGUAGE);
if ($text = e107::getCache()->retrieve('tagcloud', 5, false))
if ($text = e107::getCache()->retrieve('tagcloud', 5))
{
return $text;
}
$nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|$)'";
$wordCount = 0;
if ($result = $sql->retrieve('news', 'news_id,news_meta_keywords', "news_meta_keywords !='' AND news_class REGEXP '" . e_CLASS_REGEXP . "' AND NOT (news_class REGEXP " . $nobody_regexp . ")
AND news_start < " . time() . " AND (news_end=0 || news_end>" . time() . ")", true))
@ -73,20 +74,24 @@ if(!class_exists('tagcloud_menu'))
{
$tmp = explode(",", $row['news_meta_keywords']);
$c = 0;
foreach ($tmp as $word)
{
//$newsUrlparms = array('id'=> $row['news_id'], 'name'=>'a name');
$url = e107::getUrl()->create('news/list/tag', array('tag' => $word)); // SITEURL."news.php?tag=".$word;
$cloud->addTag(array('tag' => $word, 'url' => $url));
$c++;
if($c >= $words)
{
continue;
}
//$newsUrlparms = array('id'=> $row['news_id'], 'name'=>'a name');
$url = e107::getUrl()->create('news/list/tag', array('tag' => $word)); // SITEURL."news.php?tag=".$word;
$cloud->addTag(array('tag' => $word, 'url' => $url));
$c++;
$wordCount++;
}
}
@ -96,6 +101,12 @@ if(!class_exists('tagcloud_menu'))
$text = "No tags Found";
}
if(empty($wordCount))
{
e107::getCache()->clear('tagcloud');
return "No Tags Found";
}
$cloud->setHtmlizeTagFunction(function ($tag, $size)
{
$tp = e107::getParser();
@ -105,10 +116,9 @@ if(!class_exists('tagcloud_menu'))
'TAG_COUNT' => $tag['size'],
);
$text = $tp->simpleParse($this->template['item'], $var);
return $tp->simpleParse($this->template['item'], $var);
//$text = "<a class='tag' href='".$tag['url']."'><span class='size".$size."'>".$tag['tag']."</span></a> ";
return $text;
});
@ -150,6 +160,10 @@ if(!class_exists('tagcloud_menu'))
if(class_exists('tagcloud_menu'))
{
$tag = new tagcloud_menu;
if(!isset($parm))
{
$parm = null;
}
$text = $tag->render($parm);
}
else
@ -157,6 +171,8 @@ else
$text = '';
}
$caption = LAN_PLUGIN_TAGCLOUD_NAME;
if (!empty($parm))
{
@ -165,10 +181,6 @@ if (!empty($parm))
$caption = $parm['tagcloud_caption'][e_LANGUAGE];
}
}
else
{
$caption = LAN_PLUGIN_TAGCLOUD_NAME;
}
$var = array('TAGCLOUD_MENU_CAPTION' => $caption);