1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Multisite navigation support (when multisite plugin installed)

This commit is contained in:
Cameron
2017-10-11 18:57:32 -07:00
parent 166837f053
commit e35259afe9
4 changed files with 61 additions and 2 deletions

View File

@@ -803,6 +803,52 @@ class admin_shortcodes
}
function sc_admin_multisite($parm=null)
{
$file = e_SYSTEM_BASE."multisite.json";
if(!getperms('0') || !file_exists($file))
{
return null;
}
$tp = e107::getParser();
$parsed = file_get_contents($file);
$tmp = e107::unserialize($parsed);
// e107::getDebug()->log($tmp);
$text = '<ul class="nav nav-admin navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" title="Multisite" role="button" data-toggle="dropdown" href="#" >
'.$tp->toGlyph('fa-clone').'
</a>
<ul class="dropdown-menu" role="menu" >';
$srch = array();
foreach($tmp as $k=>$val)
{
$srch[] = '/'.$val['match'].'/';
}
foreach($tmp as $k=>$val)
{
$active = (e_MULTISITE_MATCH === $val['match']) ? ' class="active"' : '';
$url = str_replace($srch,'/'.$val['match'].'/',e_REQUEST_SELF);
$text .= '<li '.$active.'><a href="'.$url.'">'.$val['name'].'</a></li>';
}
$text .= '
</ul>
</li>
</ul>
';
// e107::getDebug()->log(e_MULTISITE_IN_USE);
return $text;
}
function sc_admin_msg($parm)