From 3e3d1db9a378cec4856ce66dfc962b1daaaa5c90 Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 10 Aug 2008 11:41:13 +0000 Subject: [PATCH] Support multilanguage titles in plugin log entries, add correct links to sitelinks on install, fix naming error in plugin.php conversion --- e107_admin/admin_log.php | 15 ++++++++++++--- e107_files/utilities/pluginxmlgen.php | 6 +++--- e107_handlers/plugin_class.php | 24 ++++++++++++++++-------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index 867e1d32f..f48531818 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/admin_log.php,v $ -| $Revision: 1.16 $ -| $Date: 2008-08-01 20:25:34 $ +| $Revision: 1.17 $ +| $Date: 2008-08-10 11:41:01 $ | $Author: e107steved $ | | Preferences: @@ -67,7 +67,16 @@ if (e_QUERY) $action = varset($qs[0],'adminlog'); -include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_log_messages.php'); +// Load language files for log messages +include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_log_messages.php'); //... for core functions +if (is_array($pref['logLanguageFile'])) //... and for any plugins which support it +{ + foreach($pref['logLanguageFile'] as $path => $file) + { + $file = str_replace('--LAN--',e_LANGUAGE,$file); + include_lan(e_PLUGIN.$path.'/'.$file); + } +} diff --git a/e107_files/utilities/pluginxmlgen.php b/e107_files/utilities/pluginxmlgen.php index 05338a04d..923677eb0 100644 --- a/e107_files/utilities/pluginxmlgen.php +++ b/e107_files/utilities/pluginxmlgen.php @@ -4,8 +4,8 @@ | e107 website system - Converter for plugin.php to plugin.xml | | $Source: /cvs_backup/e107_0.8/e107_files/utilities/pluginxmlgen.php,v $ -| $Revision: 1.2 $ -| $Date: 2008-08-10 09:17:31 $ +| $Revision: 1.3 $ +| $Date: 2008-08-10 11:41:13 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -184,7 +184,7 @@ function makeXML($pluginDir, $extras=array()) } $baseFolder .= '/'; // 'commentID' tags needed - $adminText .= writeTag('configfile',$eplug_conffile,2); + $adminText .= writeTag('configFile',$eplug_conffile,2); $adminText .= writeTag('icon',str_replace($baseFolder,'',$eplug_icon),2); $adminText .= writeTag('iconSmall',str_replace($baseFolder,'',$eplug_icon_small),2); $adminText .= writeTag('caption',$eplug_caption,2); diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index aac53bd65..8d797c0e1 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ -| $Revision: 1.39 $ -| $Date: 2008-08-10 09:17:41 $ +| $Revision: 1.40 $ +| $Date: 2008-08-10 11:41:02 $ | $Author: e107steved $ Mods for extra plugin.xml variables @@ -150,7 +150,6 @@ class e107plugin $plug_info = $this->plug_vars; $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1); - // scan for addons. $eplug_addons = $this->getAddons($plugin_path); // Returns comma-separated list // $eplug_addons = $this->getAddons($plugin_path,'check'); // Checks opening/closing tags on addon files @@ -701,7 +700,14 @@ class e107plugin $canContinue = FALSE; } - // First of all, if installing or upgrading, check that any dependencies are met + + // First of all, see if there's a language file specific to install + if (isset($plug_vars['installLanguageFile']) && isset($plug_vars['installLanguageFile']['@attributes']['filename'])) + { + include_lan($path.$plug_vars['installLanguageFile']['@attributes']['filename']); + } + + // Next most important, if installing or upgrading, check that any dependencies are met if ($canContinue && ($function != 'uninstall') && isset($plug_vars['depends'])) { foreach ($plug_vars['depends'] as $dt => $dv) @@ -808,9 +814,10 @@ class e107plugin { $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) { case 'upgrade': @@ -818,9 +825,10 @@ class e107plugin // Add any active link if(!isset($attrib['active']) || $attrib['active'] == 'true') { + $addlink = e_PLUGIN.$attrib['url']; $perm = (isset($attrib['perm']) ? $attrib['perm'] : 0); - $txt .= "Adding link {$attrib['name']} with url [{$attrib['url']}] and perm {$perm}
"; - $this->manage_link('add', $attrib['url'], $attrib['name'], $perm); + $txt .= "Adding link {$attrib['name']} with url [{$addlink}] and perm {$perm}
"; + $this->manage_link('add', $addlink, $attrib['name'], $perm); } //remove inactive links on upgrade if($function == 'upgrade' && isset($attrib['active']) && $attrib['active'] == 'false')