1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 05:11:42 +02:00

Introduction of e_navigation class to handle all links site-wide. Large-scale cleanup of global admin links, plugin links etc.

This commit is contained in:
Cameron
2012-12-03 01:40:47 -08:00
parent 872cd7901b
commit d20af73bc5
39 changed files with 623 additions and 230 deletions

View File

@@ -337,142 +337,8 @@ function log_request()
}
}
// getPlugLinks() - moved to sitelinks_class.php : pluginLinks();
// Function renders all the plugin links according to the required icon size and layout style
// - common to the various admin layouts.
function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
{
global $sql, $tp;
$plug_id = array();
$plugin_array = array();
e107::getDb()->db_Select("plugin", "*", "plugin_installflag = 1"); // Grab plugin IDs.
while ($row = e107::getDb()->db_Fetch())
{
$pth = $row['plugin_path'];
$plug_id[$pth] = $row['plugin_id'];
}
$pref = e107::getConfig('core')->getPref();
$text = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", $iconSize, $linkStyle);
$plugs = e107::getObject('e107plugin');
foreach($pref['plug_installed'] as $plug=>$vers)
{
$plugs->parse_plugin($plug);
$plugin_path = $plug;
$name = $plugs->plug_vars['@attributes']['name'];
/* echo "<h1>".$name." ($plug)</h1>";
print_a($plugs->plug_vars);*/
foreach($plugs->plug_vars['adminLinks']['link'] as $tag)
{
if(varset($tag['@attributes']['primary']) !='true')
{
continue;
}
loadLanFiles($plugin_path, 'admin');
$att = $tag['@attributes'];
$eplug_name = $tp->toHTML($name,FALSE,"defs, emotes_off");
$eplug_conffile = $att['url'];
$eplug_icon_small = $plugin_path.'/'.$att['iconSmall'];
$eplug_icon = $plugin_path.'/'.$att['icon'];
$eplug_caption = str_replace("'", '', $tp->toHTML($att['description'], FALSE, 'defs, emotes_off'));
if (varset($eplug_conffile))
{
$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
$plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN;
$plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN;
$plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plug_id[$plugin_path], 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32);
}
}
}
// print_a($plugs->plug_vars['adminLinks']['link']);
/* echo "hello there";
$xml = e107::getXml();
$xml->filter = array('@attributes' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter
if ($sql->db_Select("plugin", "*", "plugin_installflag=1"))
{
while ($row = $sql->db_Fetch())
{
extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment,
// plugin_name varchar(100) NOT NULL default '',
// plugin_version varchar(10) NOT NULL default '',
// plugin_path varchar(100) NOT NULL default '',
// plugin_installflag tinyint(1) unsigned NOT NULL default '0',
// plugin_addons text NOT NULL,
if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml"))
{
$readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true);
if ($readFile === FALSE)
{
echo 'Error in file: '.e_PLUGIN.$plugin_path.'/plugin.xml'.'<br />';
}
else
{
loadLanFiles($plugin_path, 'admin');
$eplug_name = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off");
$eplug_conffile = $readFile['administration']['configFile'];
$eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall'];
$eplug_icon = $plugin_path.'/'.$readFile['administration']['icon'];
$eplug_caption = str_replace("'", '', $tp->toHTML($readFile['description'], FALSE, 'defs, emotes_off'));
}
}
elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php"))
{
include(e_PLUGIN.$plugin_path."/plugin.php");
}
if (varset($eplug_conffile))
{
$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
$plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN;
$plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN;
$plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32);
}
unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small);
}
}
else
{
$plugin_array = array();
}
*/
ksort($plugin_array, SORT_STRING); // To FIX, without changing the current key format, sort by 'title'
if($linkStyle == "array")
{
return $plugin_array;
}
foreach ($plugin_array as $plug_key => $plug_value)
{
$the_icon = ($iconSize == E_16_PLUGMANAGER) ? $plug_value['icon'] : $plug_value['icon_32'];
$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $the_icon, $linkStyle);
}
return $text;
}
require_once("footer.php");