1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Handle standard LAN files, differences between single/multiple elements in a section

This commit is contained in:
e107steved
2008-08-10 16:06:15 +00:00
parent 3e3d1db9a3
commit 526ec11746
2 changed files with 22 additions and 15 deletions

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $
| $Revision: 1.15 $ | $Revision: 1.16 $
| $Date: 2008-05-23 21:14:38 $ | $Date: 2008-08-10 16:06:15 $
| $Author: e107steved $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@@ -459,6 +459,15 @@ function admin_purge_related($table, $id)
} }
} }
// Searches a defined set of paths and file names to load language files used for admin (including install etc)
function include_lan_admin($path)
{
include_lan($path.'languages/'.e_LANGUAGE.'/lan_config.php');
include_lan($path.'languages/admin/'.e_LANGUAGE.'.php');
}
$sql->db_Mark_Time('Parse Admin Header'); $sql->db_Mark_Time('Parse Admin Header');
if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) { if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
parse_admin($ADMIN_HEADER); parse_admin($ADMIN_HEADER);

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.40 $ | $Revision: 1.41 $
| $Date: 2008-08-10 11:41:02 $ | $Date: 2008-08-10 16:06:15 $
| $Author: e107steved $ | $Author: e107steved $
Mods for extra plugin.xml variables Mods for extra plugin.xml variables
@@ -809,15 +809,14 @@ class e107plugin
//main menu items //main menu items
if(isset($plug_vars['menuLink'])) if(isset($plug_vars['menuLink']))
{ {
//Ensure it is an array for use with foreach() //Ensure it is the right sort of array for use with foreach()
if(!is_array($plug_vars['menuLink'])) if(count($plug_vars['menuLink']) <= 1)
{ {
$plug_vars['menuLink'] = array($plug_vars['menuLink']); $plug_vars['menuLink'] = array($plug_vars['menuLink']);
} }
// foreach($plug_vars['menuLink'] as $link) foreach($plug_vars['menuLink'] as $link)
foreach($plug_vars['menuLink'] as $attrib)
{ {
// $attrib = $link['@attributes']; $attrib = $link['@attributes'];
switch($function) switch($function)
{ {
case 'upgrade': case 'upgrade':
@@ -1010,11 +1009,10 @@ class e107plugin
if($what == '' || $when == '') { return true; } if($what == '' || $when == '') { return true; }
if(!isset($this->plug_vars['management'][$what])) { return true; } if(!isset($this->plug_vars['management'][$what])) { return true; }
$vars = $this->plug_vars['management'][$what]; $vars = $this->plug_vars['management'][$what];
if(!is_array($vars)) { $vars = array($vars); } if(count($vars) <= 1) { $vars = array($vars); }
// foreach($vars as $var) foreach($vars as $var)
foreach($vars as $attrib)
{ {
// $attrib = $var['@attributes']; $attrib = $var['@attributes'];
if(isset($attrib['when']) && $attrib['when'] == $when) if(isset($attrib['when']) && $attrib['when'] == $when)
{ {
if(is_readable($path.$attrib['file'])) if(is_readable($path.$attrib['file']))
@@ -1384,6 +1382,7 @@ class e107plugin
$this->plug_vars = $this->parsed_plugin[$path]; $this->plug_vars = $this->parsed_plugin[$path];
return true; return true;
} }
unset($this->parsed_plugin[$path]); // In case forced parsing which fails
if(file_exists($path.'plugin.xml')) if(file_exists($path.'plugin.xml'))
{ {
$ret = $this->parse_plugin_xml($path); $ret = $this->parse_plugin_xml($path);
@@ -1437,8 +1436,7 @@ class e107plugin
function parse_plugin_xml($path) function parse_plugin_xml($path)
{ {
global $tp; global $tp;
include_lan($path.'languages/'.e_LANGUAGE.'/lan_config.php'); include_lan_admin($path); // Look for LAN files on default paths
include_lan($path.'languages/admin/'.e_LANGUAGE.'.php');
require_once(e_HANDLER.'xml_class.php'); require_once(e_HANDLER.'xml_class.php');
$xml = new xmlClass; $xml = new xmlClass;
$this->plug_vars = $xml->loadXMLfile($path.'plugin.xml', true, true); $this->plug_vars = $xml->loadXMLfile($path.'plugin.xml', true, true);