From 0276b7fd43db5c2af2036a89fea2e66c1de3fa21 Mon Sep 17 00:00:00 2001
From: secretr <m.yovchev@gmail.com>
Date: Fri, 4 May 2012 15:00:33 +0000
Subject: [PATCH] minor menu render related problems

---
 e107_core/shortcodes/single/plugin.php | 12 ++++++++----
 e107_handlers/menu_class.php           | 16 +++++++++-------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/e107_core/shortcodes/single/plugin.php b/e107_core/shortcodes/single/plugin.php
index 92e45daa3..8b904bd77 100644
--- a/e107_core/shortcodes/single/plugin.php
+++ b/e107_core/shortcodes/single/plugin.php
@@ -5,17 +5,21 @@ function plugin_shortcode($parm = '')
 {
 	$tp = e107::getParser();
 
-	@list($menu,$parms) = explode('|',$parm.'|');
+	@list($menu,$parms) = explode('|',$parm.'|', 2);
 
-	$path = $tp -> toDB(dirname($menu));
-	$name = $tp -> toDB(basename($menu));
+	$path = $tp->toDB(dirname($menu));
+	$name = $tp->toDB(basename($menu));
 
 	if($path == '.')
 	{
 	  $path = $menu;
 	}
+	/**
+	 * @todo check if plugin is installed when installation required
+	 */
+	
 	/**
 	 *	fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters
 	 */
-    return e107::getMenu()->renderMenu($path,$name,$parms,true);
+    return e107::getMenu()->renderMenu($path,$name, trim($parms, '|'),true);
 }
diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php
index 410d872fb..3c87355fb 100644
--- a/e107_handlers/menu_class.php
+++ b/e107_handlers/menu_class.php
@@ -263,15 +263,17 @@ class e_menu
 		}
 		else
 		{
-			e107::loadLanFiles($mpath);
-
+			// not sure what would break this, but it's good idea to go away
+			//e107::loadLanFiles($mpath);
+			
 			//include once is not an option anymore
-			//e107_include will break many old menus (evel globals), so we'll wait for a while...
+			//e107_include will break many old menus (evil globals), so we'll wait for a while...
 			//e107_include(e_PLUGIN.$mpath."/".$mname.".php");
-			if(substr($mpath,-1)!='/')
-			{
-				$mpath .= '/';
-			}
+			//if(substr($mpath,-1)!='/')
+			//{
+			//	$mpath .= '/';
+			//}
+			$mpath = trim($mpath, '/').'/'; // faster...
 			$e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
 
 			/*if(file_exists(e_PLUGIN.$mpath."/".$mname.".php"))