1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

adminLinks function cleanup

This commit is contained in:
Cameron 2013-02-26 18:57:33 -08:00
parent 710b21823a
commit 4941a1156d
11 changed files with 76 additions and 30 deletions

View File

@ -635,7 +635,7 @@ $array_functions = array(
);
*/
$array_functions = e107::getNav()->adminLinks(); // replacement see e107_handlers/sitelinks.php
$array_functions = e107::getNav()->adminLinks('legacy'); // replacement see e107_handlers/sitelinks.php
// SecretR - BC only, obsolete meta title auto detection

View File

@ -12,7 +12,6 @@
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage();
if($_GET['mode'] == "e_advanced"){

View File

@ -12,7 +12,7 @@
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage();
$text = "<div style='text-align:center'>

View File

@ -12,7 +12,6 @@
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage();
$text = "<div style='text-align:center'>

View File

@ -12,7 +12,6 @@
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage();
$buts = "";

View File

@ -12,9 +12,12 @@
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage();
$newarray = e107::getNav()->adminLinks('core');
$buts = "";
$text = "<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>";

View File

@ -72,10 +72,10 @@ EOF;
}
$array_functions_assoc = e107::getNav()->adminLinks('assoc');
// $array_functions_assoc = e107::getNav()->adminLinks('assoc');
$this->iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"));
// $this->iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"));
$this->iconlist = e107::getNav()->adminLinks();
}
@ -158,7 +158,7 @@ EOF;
}
// "<form method='post' action='".e_SELF."?".e_QUERY."'>";
@ -184,6 +184,9 @@ EOF;
</span>';
*/
// print_a($user_pref['core-infopanel-mye107']);
$mainPanel .= "
@ -597,6 +600,8 @@ EOF;
global $user_pref;
$text = "";
foreach ($this->iconlist as $key=>$icon)

View File

@ -24,11 +24,13 @@ class tabbed
function __construct()
{
$core = e107::getNav()->adminLinks('assoc');
$plugs = e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array");
// $core = e107::getNav()->adminLinks('assoc');
// $plugs = e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array");
$this->links = array_merge($core,$plugs);
$this->links = multiarray_sort($this->links,'title'); //XXX Move this function in e107_class?
// $this->links = array_merge($core,$plugs);
// $this->links = multiarray_sort($this->links,'title'); //XXX Move this function in e107_class?
$this->links = e107::getNav()->adminLinks();
$this->render();
}

View File

@ -1273,7 +1273,7 @@ class admin_shortcodes
$pref = e107::getPref();
$admin_cat = e107::getNav()->adminCats();
$array_functions = e107::getNav()->adminLinks();
$array_functions = e107::getNav()->adminLinks('legacy');
$array_sub_functions = e107::getNav()->adminLinks('sub');
$tp = e107::getParser();

View File

@ -642,7 +642,11 @@ class e_navigation
// Previously $array_functions variable.
function adminLinks($mode=false)
{
if($mode == 'plugin')
{
return $this->pluginLinks(E_16_PLUGMANAGER, "array") ;
}
if($mode=='sub')
{
@ -717,26 +721,58 @@ class e_navigation
38 => array(e_ADMIN.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
);
if($mode == 'assoc')
{
$newarray = asortbyindex($array_functions, 1);
$array_functions_assoc = $this->convert_core_icons($newarray);
return $array_functions_assoc;
}
return $array_functions;
if($mode == 'legacy')
{
return $array_functions; // Old BC format.
}
$newarray = asortbyindex($array_functions, 1);
$array_functions_assoc = $this->convert_core_icons($newarray);
if($mode == 'core') // Core links only.
{
return $array_functions_assoc;
}
$merged = array_merge($array_functions_assoc, $this->pluginLinks(E_16_PLUGMANAGER, "array"));
$sorted = multiarray_sort($merged,'title'); // this deleted the e-xxxx and p-xxxxx keys.
return $this->restoreKeys($sorted); // we restore the keys with this.
}
function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.
private function restoreKeys($newarray) // Put core button array in the same format as plugin button array.
{
$array_functions_assoc = array();
foreach($newarray as $key=>$val)
{
if(varset($val['key'])) // Plugin Array.
{
$key = $val['key'];
$array_functions_assoc[$key] = $val;
}
}
return $array_functions_assoc;
}
private function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.
{
$array_functions_assoc = array();
foreach($newarray as $key=>$val)
{
if(varset($val[0]))
{
$key = "e-".basename($val[0],".php");
$val['key'] = $key;
$val['icon'] = $val[5];
$val['icon_32'] = $val[6];
$val['title'] = $val[1];
@ -746,6 +782,7 @@ class e_navigation
$val['perms'] = $val['3'];
$array_functions_assoc[$key] = $val;
}
}
return $array_functions_assoc;
@ -836,6 +873,7 @@ class e_navigation
$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(
'key' => 'p-'.$plugin_path,
'link' => e_PLUGIN.$plugin_path."/".$eplug_conffile,
'title' => $eplug_name, 'caption' => $eplug_caption,
'perms' => "P".varset($plug_id[$plugin_path]),

View File

@ -25,10 +25,11 @@ if (ADMIN == TRUE)
$nav = e107::getNav();
$admin = $nav->adminLinks('assoc');
$plugins = $nav->pluginLinks('assoc');
// $admin = $nav->adminLinks('assoc');
// $plugins = $nav->pluginLinks('assoc');
$array_functions = array_merge($admin, $plugins);
// $array_functions = array_merge($admin, $plugins);
$array_functions = $nav->adminLinks();
// print_a($array_functions);