From 6811c479d1b05fa71ecac9fecc823983caa6a36a Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 12 Feb 2015 13:09:56 -0800 Subject: [PATCH] Reduced the number of file includes. Only load admin language files when necessary. --- class2.php | 2 ++ e107_admin/boot.php | 9 +++++++-- e107_core/shortcodes/batch/admin_shortcodes.php | 2 +- e107_handlers/sitelinks_class.php | 8 +++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/class2.php b/class2.php index 7b3ebf87a..3582c39b7 100644 --- a/class2.php +++ b/class2.php @@ -1941,6 +1941,8 @@ function include_lan_admin($path) //DEPRECATED - use e107::loadLanFiles(); function loadLanFiles($unitName, $type='runtime') { + $info = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2); + e107::getMessage()->addDebug("Using deprecated function loanLanFiles(). Replace with e107::loadLanFiles().".print_a($info,true)); return e107::loadLanFiles($unitName, $type); } diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 3f216f5c0..248bb7d0d 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -29,13 +29,18 @@ e107::coreLan('footer', true); // here mostly because of BC reasons //if(!deftrue('e_MINIMAL')) { - + $_globalLans = e107::pref('core', 'lan_global_list'); $_plugins = e107::getPref('plug_installed'); if(is_array($_plugins) && count($_plugins) > 0) { $_plugins = array_keys($_plugins); + foreach ($_plugins as $_p) { + if(in_array($_p, $_globalLans) && e_CURRENT_PLUGIN != $_p) // filter out those with globals unless we are in a plugin folder. + { + continue; + } e107::loadLanFiles($_p, 'admin'); } } @@ -57,7 +62,7 @@ if(!defset('e_ADMIN_UI') && !defset('e_PAGETITLE')) $link = str_replace("../","",$val[0]); if(strpos(e_SELF,$link)!==FALSE) { - define('e_PAGETITLE',$val[1]); + // define('e_PAGETITLE',$val[1]); } } } diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 088a2182e..679a90c0b 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -825,7 +825,7 @@ class admin_shortcodes if (is_readable(e_PLUGIN.$plugin_path.'/plugin.xml')) { $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); - e107::loadLanFiles($plugin_path, 'admin'); + // e107::loadLanFiles($plugin_path, 'admin'); $eplug_caption = $tp->toHTML($readFile['@attributes']['name'], FALSE, 'defs, emotes_off'); $eplug_conffile = $readFile['administration']['configFile']; } diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 5f036f8b0..8f9509f33 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -943,6 +943,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $plugs = e107::getObject('e107plugin'); + + if(vartrue($pref['plug_installed'])) { foreach($pref['plug_installed'] as $plug=>$vers) @@ -969,8 +971,12 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } { continue; } - loadLanFiles($plugin_path, 'admin'); + if(!in_array($plugin_path, $pref['lan_global_list'])) + { + e107::loadLanFiles($plugin_path, 'admin'); + } + $att = $tag['@attributes'];