From f5bb80607a304ea8dc2270b7600140a0fe3c4834 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Sep 2021 13:20:51 -0700 Subject: [PATCH] word limit per record added. --- e107_plugins/tagcloud/tagcloud_menu.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/e107_plugins/tagcloud/tagcloud_menu.php b/e107_plugins/tagcloud/tagcloud_menu.php index 4852e8ac7..da17edc51 100644 --- a/e107_plugins/tagcloud/tagcloud_menu.php +++ b/e107_plugins/tagcloud/tagcloud_menu.php @@ -21,6 +21,7 @@ if (!e107::isInstalled('tagcloud')) /** * @example {MENU: path=tagcloud&order=size,desc} * @example {MENU: path=tagcloud&order=tag,asc&limit=20} + * @example {MENU: path=tagcloud&order=tag,asc&words=2} */ require_once('tagcloud_class.php'); @@ -44,12 +45,18 @@ if(!class_exists('tagcloud_menu')) $cloud = new TagCloud(); $sql = e107::getDb(); + $words = 25; // Number of words to read from each record. if(is_string($parm)) { parse_str($parm,$parm); } + if(!empty($parm['words'])) + { + $words = (int) $parm['words']; + } + e107::getCache()->setMD5(e_LANGUAGE); if ($text = e107::getCache()->retrieve('tagcloud', 5, false)) @@ -66,12 +73,20 @@ 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; + } + } }