1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Admin navigation speed.

This commit is contained in:
Cameron 2017-02-03 20:18:45 -08:00
parent 645bc2a791
commit 8dadf11e7a
5 changed files with 794 additions and 18 deletions

View File

@ -254,7 +254,9 @@ class pluginManager{
{
global $user_pref,$admin_log;
$tmp = explode('.', e_QUERY);
$qry = str_replace('XDEBUG_PROFILE', '', e_QUERY);
$tmp = explode('.',$qry);
$this -> action = ($tmp[0]) ? $tmp[0] : "installed";
$this -> id = !empty($tmp[1]) ? intval($tmp[1]) : "";
@ -1261,10 +1263,20 @@ class pluginManager{
$plug_vars = false;
$plugin_config_icon = "";
if($plugin->parse_plugin($plug['plugin_path']))
if(deftrue('e_DEBUG_PLUGMANAGER'))
{
$plug_vars = $plugin->plug_vars;
$plug_vars = e107::getPlug()->getMeta($plug['plugin_path']);
}
else
{
if($plugin->parse_plugin($plug['plugin_path']))
{
$plug_vars = $plugin->plug_vars;
}
}
if(varset($plug['plugin_category']) == "menu") // Hide "Menu Only" plugins.
{

View File

@ -1517,9 +1517,9 @@ Inverse 10 <span class="badge badge-inverse">10</span>
/**
* New Admin Navigation Routine.
* Old Admin Navigation Routine.
*/
function sc_admin_navigation($parm)
function sc_admin_navigationOld($parm=null)
{
if (!ADMIN) return '';
@ -1722,6 +1722,8 @@ Inverse 10 <span class="badge badge-inverse">10</span>
}
}
$menu_vars['plugMenu']['sub'] = multiarray_sort($tmp, 'text');
}
@ -1787,6 +1789,209 @@ Inverse 10 <span class="badge badge-inverse">10</span>
}
/**
* New Admin Navigation Routine. v2.1.5
*/
function sc_admin_navigation($parm=null)
{
if (!ADMIN) return '';
// global $admin_cat, $array_functions, $array_sub_functions, $pref;
$pref = e107::getPref();
$admin_cat = e107::getNav()->adminCats();
$array_functions = e107::getNav()->adminLinks('legacy');
$array_sub_functions = e107::getNav()->adminLinks('sub');
$array_plugins = e107::getNav()->adminLinks('plugin2');
$tp = e107::getParser();
$e107 = e107::getInstance();
$sql = e107::getDb('sqlp');
parse_str($parm, $parms);
$tmpl = strtoupper(varset($parms['tmpl'], 'E_ADMIN_NAVIGATION'));
global $$tmpl;
if($parm == self::ADMIN_NAV_HOME || $parm == self::ADMIN_NAV_LOGOUT || $parm == self::ADMIN_NAV_LANGUAGE || $parm == 'pm')
{
$template = $$tmpl;
$template['start'] = $template['start_other'];
$menu_vars = $this->getOtherNav($parm);
return e107::getNav()->admin('', '', $menu_vars, $template, FALSE, FALSE);
}
// MAIN LINK
if($parm != 'no-main')
{
$menu_vars = array();
$menu_vars['adminhome']['text'] = ADLAN_151;
$menu_vars['adminhome']['link'] = e_ADMIN_ABS.'admin.php';
$menu_vars['adminhome']['image'] = "<img src='".E_16_NAV_MAIN."' alt='".ADLAN_151."' class='icon S16' />";
$menu_vars['adminhome']['image_src'] = ADLAN_151;
$menu_vars['adminhome']['perm'] = '';
}
//ALL OTHER ROOT LINKS - temporary data transformation - data structure will be changed in the future and this block will be removed
foreach($admin_cat['id'] as $i => $cat)
{
$id = $admin_cat['id'][$i];
$menu_vars[$id]['text'] = $admin_cat['title'][$i];
$menu_vars[$id]['description'] = $admin_cat['title'][$i];
$menu_vars[$id]['link'] = '#';
$menu_vars[$id]['image'] = "<img src='".$admin_cat['img'][$i]."' alt='".$admin_cat['title'][$i]."' class='icon S16' />";
$menu_vars[$id]['image_large'] = "<img src='".$admin_cat['lrg_img'][$i]."' alt='".$admin_cat['title'][$i]."' class='icon S32' />";
$menu_vars[$id]['image_src'] = $admin_cat['img'][$i];
$menu_vars[$id]['image_large_src'] = $admin_cat['lrg_img'][$i];
// FIX - 'perm' should not be set or navigation->admin() will be broken (bad permissions) for non main administrators
//$menu_vars[$id]['perm'] = '';
$menu_vars[$id]['sort'] = $admin_cat['sort'][$i];
}
//CORE SUBLINKS
$active = '';
foreach ($array_functions as $key => $subitem)
{
if(!empty($subitem[3]) && !getperms($subitem[3]))
{
continue;
}
$catid = $admin_cat['id'][$subitem[4]];
$tmp = array();
$tmp['text'] = $subitem[1];
$tmp['description'] = $subitem[2];
$tmp['link'] = $subitem[0];
$tmp['image'] = $subitem[5];
$tmp['image_large'] = $subitem[6];
$tmp['image_src'] = '';
$tmp['image_large_src'] = '';
$tmp['perm'] = $subitem[3];
$tmp['sub_class'] = '';
$tmp['sort'] = false;
if(strpos(e_REQUEST_SELF,$tmp['link'])!==false)
{
$active = $catid;
}
// e107::getDebug()->log($catid);
if(vartrue($pref['admin_slidedown_subs']) && vartrue($array_sub_functions[$key]))
{
$tmp['sub_class'] = 'sub';
foreach ($array_sub_functions[$key] as $subkey => $subsubitem)
{
$subid = $key.'_'.$subkey;
$tmp['sub'][$subid]['text'] = $subsubitem[1];
$tmp['sub'][$subid]['description'] = $subsubitem[2];
$tmp['sub'][$subid]['link'] = $subsubitem[0];
$tmp['sub'][$subid]['image'] = $subsubitem[5];
$tmp['sub'][$subid]['image_large'] = $subsubitem[6];
$tmp['sub'][$subid]['image_src'] = '';
$tmp['sub'][$subid]['image_large_src'] = '';
$tmp['sub'][$subid]['perm'] = $subsubitem[3];
}
}
if($tmp) $menu_vars[$catid]['sub'][$key] = $tmp;
}
//PLUGINS ----------------------------------------------------------
$tmp = array();
foreach($array_plugins as $key=>$p)
{
if(!getperms($p['perm']))
{
continue;
}
$tmp[$key]= $p;
}
$menu_vars['plugMenu']['sub'] = multiarray_sort($tmp, 'text');
// --------------------------------------------------------------------
if(empty($pref['admin_separate_plugins']))
{
// Convert Plugin Categories to Core Categories.
$convert = array(
'settings' => array(1,'setMenu'),
'users' => array(2,'userMenu'),
'content' => array(3,'contMenu'),
'tools' => array(4,'toolMenu'),
'manage' => array(6,'managMenu'),
'misc' => array(7,'miscMenu'),
'help' => array(20,'helpMenu')
);
foreach($tmp as $pg)
{
if(!empty($pg['category']))
{
$id = $convert[$pg['category']][1];
$menu_vars[$id]['sub'][] = $pg;
if(strpos(e_REQUEST_SELF,$pg['link'])!==false)
{
$active = $id;
}
}
}
// Clean up - remove empty main sections
foreach ($menu_vars as $_m => $_d)
{
if(!isset($_d['sub']) || empty($_d['sub']))
{
unset($menu_vars[$_m]);
}
}
unset($menu_vars['plugMenu']);
}
// ------------------------------------------------------------------
// print_a($menu_vars);
return e107::getNav()->admin('', $active, $menu_vars, $$tmpl, false, false);
}
function getOtherNav($type)
{
$tp = e107::getParser();

View File

@ -199,6 +199,7 @@ class e107
'e_parse' => '{e_HANDLER}e_parse_class.php',
'e_parser' => '{e_HANDLER}e_parse_class.php',
'e_parse_shortcode' => '{e_HANDLER}shortcode_handler.php',
'e_plugin' => '{e_HANDLER}plugin_class.php',
'e_ranks' => '{e_HANDLER}e_ranks_class.php',
'e_shortcode' => '{e_HANDLER}shortcode_handler.php',
'e_system_user' => '{e_HANDLER}user_model.php',
@ -1752,6 +1753,18 @@ class e107
{
return self::getSingleton('e107plugin', true);
}
/**
* Retrieve plugin class singleton object
* @return e_plugin
*/
public static function getPlug()
{
return self::getSingleton('e_plugin', true);
}
/**
* Retrieve online users handler singleton object
* @return e_online

View File

@ -19,10 +19,439 @@ if (!defined('e107_INIT')) { exit; }
* Plugin administration handler
*/
// TODO LAN
e107::coreLan('plugin', true);
// new in v2.1.5 - optimized for speed.
class e_plugin
{
protected $_data = array();
protected $_ids = array();
protected $_installed = array();
protected $_addons = array();
const CACHETIME = 120; // 2 hours
const CACHETAG = "Meta_plugin";
private $_accepted_categories = array('settings', 'users', 'content', 'tools', 'manage', 'misc', 'menu', 'about');
function __construct()
{
$this->load();
if(empty($this->_ids))
{
$this->loadIDs();
}
}
public function clearCache()
{
e107::getCache()->clear(self::CACHETAG);
}
public function getInstalled()
{
return $this->_installed;
}
public function getId($plugdir)
{
if(isset($this->_ids[$plugdir]))
{
return $this->_ids[$plugdir];
}
return false;
}
public function getCategory($plugdir)
{
if(!isset($this->_data[$plugdir]['category']))
{
return false;
}
return $this->_data[$plugdir]['category'];
}
public function getDescription($plugdir)
{
if(!isset($this->_data[$plugdir]['description']['@value']))
{
return false;
}
return $this->_data[$plugdir]['description']['@value'];
}
public function getIcon($plugdir, $size = 16)
{
$link = $this->_data[$plugdir]['adminLinks']['link'][0]['@attributes'];
$k = array(16 => 'iconSmall', 32 => 'icon', 128=>'icon128');
$def = array(16 => E_16_PLUGIN, 32 => E_32_PLUGIN);
$key = $k[$size];
if(empty($link[$key]))
{
return $def[$size];
}
$caption = $this->getName($plugdir);
return "<img src='".e_PLUGIN_ABS.$plugdir.'/'.$link[$key] ."' alt=\"".$caption."\" class='icon S".$size."' />";
}
public function getAdminCaption($plugdir)
{
$att = $this->_data[$plugdir]['adminLinks']['link'][0]['@attributes'];
if(empty($att['description']))
{
return false;
}
return str_replace("'", '', e107::getParser()->toHTML($att['description'], FALSE, 'defs, emotes_off'));
}
public function getAdminUrl($plugdir)
{
if(isset($this->_data[$plugdir]['administration']['configFile']))
{
return e_PLUGIN_ABS.$plugdir.'/'.$this->_data[$plugdir]['administration']['configFile'];
}
return false;
}
private function loadIDs()
{
$sql = e107::getDb();
if ($rows = $sql->retrieve("plugin", "plugin_id,plugin_path,plugin_installflag", "plugin_id != '' ORDER by plugin_path ", true))
{
foreach($rows as $row)
{
$path = $row['plugin_path'];
$this->_ids[$path] = (int) $row['plugin_id'];
if(!empty($row['plugin_installflag']))
{
$this->_installed[$path] = $path;
}
$this->_addons[$path] = !empty($row['plugin_addons']) ? explode(',',$row['plugin_addons']) : null;// $path;
}
}
}
private function load($force=false)
{
$cacheTag = self::CACHETAG;
if($force === false && $tmp = e107::getCache()->retrieve($cacheTag, self::CACHETIME, true, true))
{
$this->_data = e107::unserialize($tmp);
return true;
}
$dirs = scandir(e_PLUGIN);
$arr = array();
foreach($dirs as $plugName)
{
if($plugName === '.' || $plugName === '..' || !is_dir(e_PLUGIN.$plugName))
{
continue;
}
if (file_exists(e_PLUGIN.$plugName.'/plugin.xml'))
{
$ret = $this->parse_plugin_xml($plugName);
}
elseif (file_exists(e_PLUGIN.$plugName.'/plugin.php'))
{
$ret = $this->parse_plugin_php($plugName);
}
$arr[$plugName] = $ret;
}
if(empty($arr))
{
return false;
}
$cacheSet = e107::serialize($arr,'json');
e107::getCache()->set($cacheTag,$cacheSet,true,true,true);
$this->_data = $arr;
}
public function getMeta($plugdir)
{
if(isset($this->_data[$plugdir]))
{
return $this->_data[$plugdir];
}
return false;
}
public function getName($plugdir)
{
if(!empty($this->_data[$plugdir]['@attributes']['lan']))
{
return constant($this->_data[$plugdir]['@attributes']['lan']);
}
if(isset($this->_data[$plugdir]['@attributes']['name']))
{
return e107::getParser()->toHTML($this->_data[$plugdir]['@attributes']['name'],FALSE,"defs, emotes_off");
}
return false;
}
private function parse_plugin_xml($plugName)
{
$tp = e107::getParser();
// loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths
$xml = e107::getXml();
$mes = e107::getMessage();
e107::getDebug()->log("Parsing Plugin: ".$plugName);
// $xml->setOptArrayTags('extendedField,userclass,menuLink,commentID'); // always arrays for these tags.
// $xml->setOptStringTags('install,uninstall,upgrade');
// if(null === $where) $where = 'plugin.xml';
$where = 'plugin.xml';
$ret = $xml->loadXMLfile(e_PLUGIN.$plugName.'/'.$where, 'advanced');
if ($ret === FALSE)
{
$mes->addError("Error reading {$plugName}/plugin.xml");
return FALSE;
}
$ret['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml.
$ret['category'] = (isset($ret['category'])) ? $this->checkCategory($ret['category']) : "misc";
$ret['files'] = preg_grep('/^([^.])/', scandir(e_PLUGIN.$plugName,SCANDIR_SORT_ASCENDING));
if(varset($ret['description']))
{
if (is_array($ret['description']))
{
if (isset($ret['description']['@attributes']['lan']) && defined($ret['description']['@attributes']['lan']))
{
// Pick up the language-specific description if it exists.
$ret['description']['@value'] = constant($ret['description']['@attributes']['lan']);
}
}
else
{
$diz = $ret['description'];
unset($ret['description']);
$ret['description']['@value'] = $diz;
}
}
// Very useful debug code.to compare plugin.php vs plugin.xml
/*
$testplug = 'forum';
if($plugName == $testplug)
{
$plug_vars1 = $ret;
$this->parse_plugin_php($testplug);
$plug_vars2 = $ret;
ksort($plug_vars2);
ksort($plug_vars1);
echo "<table>
<tr><td><h1>PHP</h1></td><td><h1>XML</h1></td></tr>
<tr><td style='border-right:1px solid black'>";
print_a($plug_vars2);
echo "</td><td>";
print_a($plug_vars1);
echo "</table>";
}
*/
// TODO search for $ret['adminLinks']['link'][0]['@attributes']['primary']==true.
$ret['administration']['icon'] = varset($ret['adminLinks']['link'][0]['@attributes']['icon']);
$ret['administration']['caption'] = varset($ret['adminLinks']['link'][0]['@attributes']['description']);
$ret['administration']['iconSmall'] = varset($ret['adminLinks']['link'][0]['@attributes']['iconSmall']);
$ret['administration']['configFile'] = varset($ret['adminLinks']['link'][0]['@attributes']['url']);
return $ret;
}
private function parse_plugin_php($plugName)
{
$tp = e107::getParser();
$sql = e107::getDb(); // in case it is used inside plugin.php
$PLUGINS_FOLDER = '{e_PLUGIN}'; // Could be used in plugin.php file.
$eplug_conffile = null;
$eplug_table_names = null;
$eplug_prefs = null;
$eplug_module = null;
$eplug_userclass = null;
$eplug_status = null;
$eplug_latest = null;
$eplug_icon = null;
$eplug_icon_small = null;
ob_start();
if (include(e_PLUGIN.$plugName.'/plugin.php'))
{
//$mes->add("Loading ".e_PLUGIN.$plugName.'/plugin.php', E_MESSAGE_DEBUG);
}
ob_end_clean();
$ret = array();
// $ret['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest);
$ret['@attributes']['name'] = varset($eplug_name);
$ret['@attributes']['lan'] = varset($eplug_name);
$ret['@attributes']['version'] = varset($eplug_version);
$ret['@attributes']['date'] = varset($eplug_date);
$ret['@attributes']['compatibility'] = varset($eplug_compatible);
$ret['@attributes']['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) ? 'true' : '';
$ret['@attributes']['xhtmlcompliant'] = vartrue($eplug_compliant) ? 'true' : '';
$ret['folder'] = $plugName; // (varset($eplug_folder)) ? $eplug_folder : $plugName;
$ret['author']['@attributes']['name'] = varset($eplug_author);
$ret['author']['@attributes']['url'] = varset($eplug_url);
$ret['author']['@attributes']['email'] = varset($eplug_email);
$ret['description']['@value'] = varset($eplug_description);
$ret['description']['@attributes']['lan'] = varset($eplug_description);
$ret['category'] = !empty($eplug_category) ? $this->checkCategory($eplug_category) : "misc";
$ret['readme'] = !empty($eplug_readme);
$ret['menuName'] = varset($eplug_menu_name);
if (!empty($eplug_prefs) && is_array($eplug_prefs))
{
$c = 0;
foreach($eplug_prefs as $name => $value)
{
$ret['mainPrefs']['pref'][$c]['@attributes']['name'] = $name;
$ret['mainPrefs']['pref'][$c]['@value'] = $value;
$c++;
}
}
// For BC.
$ret['administration']['icon'] = str_replace($plugName."/","",$eplug_icon);
$ret['administration']['caption'] = varset($eplug_caption);
$ret['administration']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
$ret['administration']['configFile'] = varset($eplug_conffile);
if(isset($eplug_conffile))
{
$ret['adminLinks']['link'][0]['@attributes']['url'] = varset($eplug_conffile);
$ret['adminLinks']['link'][0]['@attributes']['description'] = LAN_CONFIGURE;
$ret['adminLinks']['link'][0]['@attributes']['icon'] = str_replace($plugName."/","",$eplug_icon);
$ret['adminLinks']['link'][0]['@attributes']['iconSmall'] = str_replace($plugName."/","",$eplug_icon_small);
$ret['adminLinks']['link'][0]['@attributes']['primary'] = 'true';
}
if(!empty($eplug_link) && isset($eplug_link_name) && isset($eplug_link_url))
{
$ret['siteLinks']['link'][0]['@attributes']['url'] = $tp->createConstants($eplug_link_url, 1);
$ret['siteLinks']['link'][0]['@attributes']['perm'] = varset($eplug_link_perms);
$ret['siteLinks']['link'][0]['@value'] = varset($eplug_link_name);
}
if(!empty($eplug_userclass) && !empty($eplug_userclass_description))
{
$ret['userClasses']['class'][0]['@attributes']['name'] = $eplug_userclass;
$ret['userClasses']['class'][0]['@attributes']['description'] = $eplug_userclass_description;
}
$ret['files'] = preg_grep('/^([^.])/', scandir(e_PLUGIN.$plugName,SCANDIR_SORT_ASCENDING));
return $ret;
}
private function checkCategory($cat)
{
if (!empty($cat) && in_array($cat, $this->_accepted_categories))
{
return $cat;
}
else
{
return 'misc';
}
}
}
class e107plugin
{
// Reserved Addon names.
@ -185,6 +614,11 @@ class e107plugin
private $options = array();
private $log = array();
function __construct()
{
//$parsed_plugin = array();
@ -1741,6 +2175,8 @@ class e107plugin
$event->trigger('admin_plugin_refresh', $plug);
}
return null;
}
@ -3005,7 +3441,9 @@ class e107plugin
e107::getMessage()->addDebug("Running Refresh of ".$_path);
$this->save_addon_prefs();
e107::getPlug()->clearCache();
return $text;
}
@ -3063,6 +3501,9 @@ class e107plugin
}
$this->log("Installation completed"); // no LANs
e107::getPlug()->clearCache();
return $text;
}
@ -3219,6 +3660,8 @@ class e107plugin
$this->log("Uninstall completed");
e107::getPlug()->clearCache();
return $text;
}
@ -3715,7 +4158,7 @@ class e107plugin
// loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths
$xml = e107::getXml();
$mes = e107::getMessage();
// $xml->setOptArrayTags('extendedField,userclass,menuLink,commentID'); // always arrays for these tags.
// $xml->setOptStringTags('install,uninstall,upgrade');
if(null === $where) $where = 'plugin.xml';
@ -3726,7 +4169,7 @@ class e107plugin
{
$mes->addError("Error reading {$plugName}/plugin.xml");
return FALSE;
}
}
$this->plug_vars['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml.
$this->plug_vars['category'] = (isset($this->plug_vars['category'])) ? $this->manage_category($this->plug_vars['category']) : "misc";
@ -3741,7 +4184,7 @@ class e107plugin
{
// Pick up the language-specific description if it exists.
$this->plug_vars['description']['@value'] = constant($this->plug_vars['description']['@attributes']['lan']);
}
}
}
else
{

View File

@ -726,7 +726,7 @@ class e_navigation
$this->admin_cat['title'][1] = LAN_SETTINGS;
$this->admin_cat['id'][1] = 'setMenu';
$this->admin_cat['img'][1] = 'fa-cogs.glyph';
$this->admin_cat['lrg_img'][1] = 'e-settings-32.glyph';
$this->admin_cat['lrg_img'][1] = $tp->toGlyph('e-settings-32');
$this->admin_cat['sort'][1] = true;
/*
@ -788,7 +788,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
$this->admin_cat['title'][20] = LAN_ABOUT;
$this->admin_cat['id'][20] = 'aboutMenu';
$this->admin_cat['img'][20] = 'fa-info-circle.glyph'; // E_16_CAT_ABOUT;//E_16_NAV_DOCS
$this->admin_cat['lrg_img'][20] = ''; // E_32_CAT_ABOUT;
$this->admin_cat['lrg_img'][20] = ''; // $tp->toGlyph('e-cat_about-32'); ; // E_32_CAT_ABOUT;
$this->admin_cat['sort'][20] = false;
@ -804,6 +804,13 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
{
return $this->pluginLinks(E_16_PLUGMANAGER, "array") ;
}
if($mode == 'plugin2')
{
return $this->pluginLinks(E_16_PLUGMANAGER, "standard") ;
}
$this->setIconArray();
@ -966,10 +973,105 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
return (int) vartrue($convert[$cat][0]);
}
/**
* Get Plugin Links - rewritten for v2.1.5
* @param string $iconSize
* @param string $linkStyle standard = new in v2.1.5 | array | adminb
* @return array|string
*/
function pluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
{
$plug = e107::getPlug();
$data = $plug->getInstalled();
$arr = array();
$pref = e107::getPref();
foreach($data as $path)
{
if(!e107::isInstalled($path))
{
continue;
}
if(!empty($pref['lan_global_list']) && !in_array($path, $pref['lan_global_list']))
{
e107::loadLanFiles($path, 'admin');
}
$key = ($linkStyle === 'standard') ? "plugnav-".$path : 'p-'.$path;
$url = $plug->getAdminUrl($path);
$cat = $plug->getCategory($path);
if(empty($url) || $cat === 'menu')
{
continue;
}
// Keys compatible with legacy and new admin layouts.
$arr[$key] = array(
'text' => $plug->getName($path),
'description' => $plug->getDescription($path),
'link' => $url,
'image' => $plug->getIcon($path,16),
'image_large' => $plug->getIcon($path,32),
'category' => $cat,
'perm' => "P".$plug->getId($path),
'sort' => 2,
'sub_class' => null,
// Legacy Keys.
'key' => $key,
'title' => $plug->getName($path),
'caption' => $plug->getAdminCaption($path),
'perms' => "P".$plug->getId($path),
'icon' => $plug->getIcon($path,16),
'icon_32' => $plug->getIcon($path,32),
'cat' => $this->plugCatToCoreCat($plug->getCategory($path))
);
}
//ksort($arr, SORT_STRING);
if($linkStyle === "array" || $iconSize === 'assoc' || $linkStyle === 'standard')
{
return $arr;
}
$text = '';
foreach ($arr as $plug_key => $plug_value)
{
$the_icon = ($iconSize == E_16_PLUGMANAGER) ? $plug_value['icon'] : $plug_value['icon_32'];
$text .= $this->renderAdminButton($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $the_icon, $linkStyle);
}
return $text;
}
// Function renders all the plugin links according to the required icon size and layout style
// - common to the various admin layouts such as infopanel, classis etc.
function pluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
/**
* @deprecated
* @param string $iconSize
* @param string $linkStyle
* @return array|string
*/
function pluginLinksOld($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
{
$sql = e107::getDb();
@ -991,13 +1093,13 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
$plugs = e107::getObject('e107plugin');
if(vartrue($pref['plug_installed']))
if(!empty($pref['plug_installed']))
{
foreach($pref['plug_installed'] as $plug=>$vers)
{
$plugs->parse_plugin($plug);
@ -1042,7 +1144,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
$plugin_array['p-'.$plugin_path] = array(
'key' => 'p-'.$plugin_path,
'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]),
'icon' => $plugin_icon,
'icon_32' => $plugin_icon_32,