mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Issue #4206 - news category menu {active} shortcode typo fix.
This commit is contained in:
@@ -1099,18 +1099,18 @@ class e_news_category_tree extends e_front_tree_model
|
|||||||
if(e_PAGE == 'news.php')
|
if(e_PAGE == 'news.php')
|
||||||
{
|
{
|
||||||
$tmp = explode('.', e_QUERY);
|
$tmp = explode('.', e_QUERY);
|
||||||
if(vartrue($tmp[1])) $active = $tmp[1];
|
if(!empty($tmp[1])) $active = $tmp[1];
|
||||||
}
|
}
|
||||||
$bullet = defined('BULLET') ? THEME_ABS.'images/'.BULLET : THEME_ABS.'images/bullet2.gif';
|
$bullet = defined('BULLET') ? THEME_ABS.'images/'.BULLET : THEME_ABS.'images/bullet2.gif';
|
||||||
$obj = new e_vars(array('bullet' => $bullet));
|
$obj = new e_vars(array('BULLET' => $bullet));
|
||||||
|
|
||||||
/** @var e_tree_model $cat */
|
/** @var e_tree_model $cat */
|
||||||
foreach ($this->getTree() as $cat)
|
foreach ($this->getTree() as $cat)
|
||||||
{
|
{
|
||||||
$obj->active = '';
|
$obj->ACTIVE = '';
|
||||||
if($active && $active == $cat->getId())
|
if($active && $active == $cat->getId())
|
||||||
{
|
{
|
||||||
$obj->active = ' active';
|
$obj->ACTIVE = ' active';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret[] = $cat->toHTML($template['item'], $parsesc, $obj);
|
$ret[] = $cat->toHTML($template['item'], $parsesc, $obj);
|
||||||
|
@@ -19,14 +19,14 @@ global $sc_style;
|
|||||||
$NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="news-menu-category">';
|
$NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="news-menu-category">';
|
||||||
$NEWS_MENU_TEMPLATE['category']['end'] = '</ul>';
|
$NEWS_MENU_TEMPLATE['category']['end'] = '</ul>';
|
||||||
$NEWS_MENU_TEMPLATE['category']['item'] = '
|
$NEWS_MENU_TEMPLATE['category']['item'] = '
|
||||||
<li><a class="e-menu-link newscats{active}" href="{NEWS_CATEGORY_URL}">{NEWS_CATEGORY_TITLE}{NEWS_CATEGORY_NEWS_COUNT}</a></li>
|
<li><a class="e-menu-link newscats{ACTIVE}" href="{NEWS_CATEGORY_URL}">{NEWS_CATEGORY_TITLE}{NEWS_CATEGORY_NEWS_COUNT}</a></li>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// months menu
|
// @deprecated months menu - use news archive instead.
|
||||||
$NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="news-menu-months">';
|
$NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="news-menu-months">';
|
||||||
$NEWS_MENU_TEMPLATE['months']['end'] = '</ul>';
|
$NEWS_MENU_TEMPLATE['months']['end'] = '</ul>';
|
||||||
$NEWS_MENU_TEMPLATE['months']['item'] = '
|
$NEWS_MENU_TEMPLATE['months']['item'] = '
|
||||||
@@ -130,7 +130,7 @@ $NEWS_MENU_TEMPLATE['carousel']['item'] = '<!-- Start Item -->
|
|||||||
$NEWS_MENU_TEMPLATE['carousel']['nav'] = '<li data-target="#news-carousel" data-slide-to="{COUNT}" class="{ACTIVE}"><a href="#">{NEWS_SUMMARY}</a></li>';
|
$NEWS_MENU_TEMPLATE['carousel']['nav'] = '<li data-target="#news-carousel" data-slide-to="{COUNT}" class="{ACTIVE}"><a href="#">{NEWS_SUMMARY}</a></li>';
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
$NEWS_MENU_TEMPLATE['archive']['start'] = '<ul class="news-archive-menu">';
|
$NEWS_MENU_TEMPLATE['archive']['start'] = '<ul class="news-archive-menu">';
|
||||||
$NEWS_MENU_TEMPLATE['archive']['end'] = '</ul>';
|
$NEWS_MENU_TEMPLATE['archive']['end'] = '</ul>';
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
@@ -9,7 +8,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!e107::isInstalled('tagcloud'))
|
if (!e107::isInstalled('tagcloud'))
|
||||||
{
|
{
|
||||||
@@ -20,19 +22,20 @@ require_once('tagcloud_class.php');
|
|||||||
|
|
||||||
|
|
||||||
// http://lotsofcode.github.io/tag-cloud/
|
// http://lotsofcode.github.io/tag-cloud/
|
||||||
|
if (!class_exists('tagcloud_menu'))
|
||||||
class tagcloud_menu
|
|
||||||
{
|
{
|
||||||
|
class tagcloud_menu
|
||||||
|
{
|
||||||
|
|
||||||
public $template = array();
|
public $template = array();
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->template = e107::getTemplate('tagcloud','tagcloud_menu','default');
|
$this->template = e107::getTemplate('tagcloud', 'tagcloud_menu', 'default');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function render($parm=null)
|
function render($parm = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$cloud = new TagCloud();
|
$cloud = new TagCloud();
|
||||||
@@ -40,24 +43,24 @@ class tagcloud_menu
|
|||||||
|
|
||||||
e107::getCache()->setMD5(e_LANGUAGE);
|
e107::getCache()->setMD5(e_LANGUAGE);
|
||||||
|
|
||||||
if($text = e107::getCache()->retrieve('tagcloud',5,false))
|
if ($text = e107::getCache()->retrieve('tagcloud', 5, false))
|
||||||
{
|
{
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
$nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|$)'";
|
||||||
|
|
||||||
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.")
|
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))
|
AND news_start < " . time() . " AND (news_end=0 || news_end>" . time() . ")", true))
|
||||||
{
|
{
|
||||||
foreach($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
|
|
||||||
$tmp = explode(",", $row['news_meta_keywords']);
|
$tmp = explode(",", $row['news_meta_keywords']);
|
||||||
foreach($tmp as $word)
|
foreach ($tmp as $word)
|
||||||
{
|
{
|
||||||
//$newsUrlparms = array('id'=> $row['news_id'], 'name'=>'a name');
|
//$newsUrlparms = array('id'=> $row['news_id'], 'name'=>'a name');
|
||||||
$url = e107::getUrl()->create('news/list/tag',array('tag'=>$word)); // SITEURL."news.php?tag=".$word;
|
$url = e107::getUrl()->create('news/list/tag', array('tag' => $word)); // SITEURL."news.php?tag=".$word;
|
||||||
$cloud->addTag(array('tag' => $word, 'url' => $url));
|
$cloud->addTag(array('tag' => $word, 'url' => $url));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -69,7 +72,7 @@ class tagcloud_menu
|
|||||||
$text = "No tags Found";
|
$text = "No tags Found";
|
||||||
}
|
}
|
||||||
|
|
||||||
$cloud->setHtmlizeTagFunction( function($tag, $size)
|
$cloud->setHtmlizeTagFunction(function ($tag, $size)
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$var = array('TAG_URL' => $tag['url'],
|
$var = array('TAG_URL' => $tag['url'],
|
||||||
@@ -84,7 +87,7 @@ class tagcloud_menu
|
|||||||
return $text;
|
return $text;
|
||||||
});
|
});
|
||||||
|
|
||||||
$cloud->setOrder('size','DESC');
|
$cloud->setOrder('size', 'DESC');
|
||||||
|
|
||||||
$limit = !empty($parm['tagcloud_limit']) ? intval($parm['tagcloud_limit']) : 50;
|
$limit = !empty($parm['tagcloud_limit']) ? intval($parm['tagcloud_limit']) : 50;
|
||||||
|
|
||||||
@@ -101,18 +104,17 @@ class tagcloud_menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: add template type as parm, now always default */
|
/* TODO: add template type as parm, now always default */
|
||||||
$tag = new tagcloud_menu;
|
$tag = new tagcloud_menu;
|
||||||
$text = $tag->render($parm);
|
$text = $tag->render($parm);
|
||||||
|
|
||||||
|
|
||||||
if(!empty($parm))
|
if (!empty($parm))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(isset($parm['tagcloud_caption'][e_LANGUAGE]))
|
if (isset($parm['tagcloud_caption'][e_LANGUAGE]))
|
||||||
{
|
{
|
||||||
$caption = $parm['tagcloud_caption'][e_LANGUAGE];
|
$caption = $parm['tagcloud_caption'][e_LANGUAGE];
|
||||||
}
|
}
|
||||||
@@ -129,9 +131,8 @@ $caption = e107::getParser()->simpleParse($tag->template['caption'], $var);
|
|||||||
$start = $tag->template['start'];
|
$start = $tag->template['start'];
|
||||||
$end = $tag->template['end'];
|
$end = $tag->template['end'];
|
||||||
|
|
||||||
e107::getRender()->tablerender($caption, $start.$text.$end, 'tagcloud_menu');
|
e107::getRender()->tablerender($caption, $start . $text . $end, 'tagcloud_menu');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@@ -188,6 +188,16 @@ while($row = $sql->fetch())
|
|||||||
$this->assertEmpty($result);
|
$this->assertEmpty($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseTemplateWithEvars()
|
||||||
|
{
|
||||||
|
$obj = new e_vars(array('ACTIVE' => "yes"));
|
||||||
|
$result = $this->tp->parseTemplate('<div>something {ACTIVE}</div>', true, null, $obj);
|
||||||
|
$expected = '<div>something yes</div>';
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public function testCreateConstants()
|
public function testCreateConstants()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user