1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +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 // SecretR - BC only, obsolete meta title auto detection

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,9 +12,12 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$mes = e107::getMessage(); $mes = e107::getMessage();
$newarray = e107::getNav()->adminLinks('core');
$buts = ""; $buts = "";
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>"; <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."'>"; // "<form method='post' action='".e_SELF."?".e_QUERY."'>";
@@ -184,6 +184,9 @@ EOF;
</span>'; </span>';
*/ */
// print_a($user_pref['core-infopanel-mye107']);
$mainPanel .= " $mainPanel .= "
@@ -597,6 +600,8 @@ EOF;
global $user_pref; global $user_pref;
$text = ""; $text = "";
foreach ($this->iconlist as $key=>$icon) foreach ($this->iconlist as $key=>$icon)

View File

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

View File

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

View File

@@ -642,7 +642,11 @@ class e_navigation
// Previously $array_functions variable. // Previously $array_functions variable.
function adminLinks($mode=false) function adminLinks($mode=false)
{ {
if($mode == 'plugin')
{
return $this->pluginLinks(E_16_PLUGMANAGER, "array") ;
}
if($mode=='sub') 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) 38 => array(e_ADMIN.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
); );
if($mode == 'legacy')
{
if($mode == 'assoc') return $array_functions; // Old BC format.
{ }
$newarray = asortbyindex($array_functions, 1);
$array_functions_assoc = $this->convert_core_icons($newarray); $newarray = asortbyindex($array_functions, 1);
return $array_functions_assoc; $array_functions_assoc = $this->convert_core_icons($newarray);
}
if($mode == 'core') // Core links only.
return $array_functions; {
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) foreach($newarray as $key=>$val)
{ {
if(varset($val[0])) if(varset($val[0]))
{ {
$key = "e-".basename($val[0],".php"); $key = "e-".basename($val[0],".php");
$val['key'] = $key;
$val['icon'] = $val[5]; $val['icon'] = $val[5];
$val['icon_32'] = $val[6]; $val['icon_32'] = $val[6];
$val['title'] = $val[1]; $val['title'] = $val[1];
@@ -746,6 +782,7 @@ class e_navigation
$val['perms'] = $val['3']; $val['perms'] = $val['3'];
$array_functions_assoc[$key] = $val; $array_functions_assoc[$key] = $val;
} }
} }
return $array_functions_assoc; 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 = $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_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN;
$plugin_array['p-'.$plugin_path] = array( $plugin_array['p-'.$plugin_path] = array(
'key' => 'p-'.$plugin_path,
'link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'link' => e_PLUGIN.$plugin_path."/".$eplug_conffile,
'title' => $eplug_name, 'caption' => $eplug_caption, 'title' => $eplug_name, 'caption' => $eplug_caption,
'perms' => "P".varset($plug_id[$plugin_path]), 'perms' => "P".varset($plug_id[$plugin_path]),

View File

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