1
0
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:
Cameron
2020-07-03 13:49:12 -07:00
parent 07f92d92cc
commit 23f6a52f08
4 changed files with 101 additions and 90 deletions

View File

@@ -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);

View File

@@ -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>';

View File

@@ -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,7 +22,8 @@ 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
{ {
@@ -101,9 +104,8 @@ 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);
@@ -134,4 +136,3 @@ e107::getRender()->tablerender($caption, $start.$text.$end, 'tagcloud_menu');
?>

View File

@@ -188,6 +188,16 @@ while(&#036;row = &#036;sql-&gt;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()
{ {