mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Bugfix. Sitelinks was only rendering sublinks to one level deep. Added link highlighting fix for mod_rewrite.
This commit is contained in:
parent
b540365c69
commit
12412de469
@ -141,28 +141,8 @@ class sitelinks
|
||||
$render_link[$key] = $this->makeLink($link,'', $style, $css_class);
|
||||
|
||||
if(!defined("LINKSRENDERONLYMAIN") && !varset($style['linkmainonly'])) /* if this is defined in theme.php only main links will be rendered */
|
||||
{ // if there's a submenu. :
|
||||
if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid]))
|
||||
{
|
||||
foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
|
||||
{
|
||||
if($this->hilite($val['link_url'],TRUE)== TRUE || $link['link_expand'] == FALSE)
|
||||
{
|
||||
$substyle = "block"; // previously (non-W3C compliant): compact
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$substyle = "none";
|
||||
}
|
||||
}
|
||||
$render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
|
||||
foreach ($this->eLinkList[$main_linkid] as $sub)
|
||||
{
|
||||
$render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
|
||||
}
|
||||
$render_link[$key] .= "\n</div>\n\n";
|
||||
}
|
||||
$render_link[$key] .= $this->subLink($main_linkid,$aSubStyle,$css_class);
|
||||
}
|
||||
}
|
||||
$text .= implode($style['linkseparator'], $render_link);
|
||||
@ -205,6 +185,53 @@ class sitelinks
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage Sublink Rendering
|
||||
* @param object $main_linkid
|
||||
* @param object $aSubStyle
|
||||
* @param object $css_class
|
||||
* @param object $level [optional]
|
||||
* @return
|
||||
*/
|
||||
function subLink($main_linkid,$aSubStyle,$css_class='',$level=0)
|
||||
{
|
||||
global $pref;
|
||||
if(!isset($this->eLinkList[$main_linkid]) || !is_array($this->eLinkList[$main_linkid]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$sub['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !varsettrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ? TRUE : FALSE;
|
||||
|
||||
foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
|
||||
{
|
||||
if($this->hilite($val['link_url'],TRUE)== TRUE || $sub['link_expand'] == FALSE)
|
||||
{
|
||||
$substyle = "block"; // previously (non-W3C compliant): compact
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$substyle = "none";
|
||||
}
|
||||
}
|
||||
|
||||
$text = "";
|
||||
$text .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
|
||||
foreach ($this->eLinkList[$main_linkid] as $sub)
|
||||
{
|
||||
$id = "sub_".$sub['link_id'];
|
||||
$sub['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !varsettrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$id]) && is_array($this->eLinkList[$id])) ? TRUE : FALSE;
|
||||
$class = "sublink-level-".($level+1);
|
||||
$class .= ($css_class) ? " ".$css_class : "";
|
||||
$text .= $this->makeLink($sub, TRUE, $aSubStyle,$class );
|
||||
$text .= $this->subLink($id,$aSubStyle,$css_class,($level+1));
|
||||
}
|
||||
$text .= "\n</div>\n\n";
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function makeLink($linkInfo, $submenu = FALSE, $style='', $css_class = false)
|
||||
{
|
||||
global $pref,$tp;
|
||||
@ -485,7 +512,14 @@ class sitelinks
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if($link_pge == basename($_SERVER['REQUEST_URI'])) // mod_rewrite support
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user