diff --git a/e107_core/templates/footer_default.php b/e107_core/templates/footer_default.php
index 6f0e705e3..635bc7a3d 100644
--- a/e107_core/templates/footer_default.php
+++ b/e107_core/templates/footer_default.php
@@ -56,6 +56,7 @@ if(!defined('e_NOCACHE'))
$e107 = e107::getInstance();
$sql = e107::getDb();
$pref = e107::getPref();
+$tp = e107::getParser();
if (varset($e107_popup) != 1)
{
diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php
index f57b32ecc..d04770c97 100644
--- a/e107_handlers/menumanager_class.php
+++ b/e107_handlers/menumanager_class.php
@@ -2046,37 +2046,15 @@ class e_menu_layout
return false;
}
+
+
e107::set('css_enabled',false);
e107::set('js_enabled',false);
- $themeFileContent = file_get_contents($file);
- $srch = array('');
-
- $themeFileContent = preg_replace('/\(\s?THEME\s?\./', '( e_THEME. "'.$theme.'/" .', str_replace($srch, '', $themeFileContent));
-
- $themeFileContent = str_replace('tablestyle', $tp->filter($theme, 'wd')."_tablestyle",$themeFileContent); // rename function to avoid conflicts while parsing.
-
- try
- {
- @eval($themeFileContent);
- }
- catch (ParseError $e)
- {
- echo "
Couldn't parse theme.php: ". $e->getMessage()."
";
- }
-
-
- // @eval($themeFileContent);
-
- e107::set('css_enabled',true);
- e107::set('js_enabled',true);
-
- $head = array();
- $foot = array();
// new v2.2.2 HTML layout support.
- if(empty($LAYOUT) && is_dir($path."layouts"))
+ if(is_dir($path."layouts"))
{
$lyt = scandir($path."layouts");
$LAYOUT = array();
@@ -2098,6 +2076,37 @@ class e_menu_layout
}
}
+ else // prior to v2.2.2
+ {
+
+ $themeFileContent = file_get_contents($file);
+
+ $srch = array('');
+
+ $themeFileContent = preg_replace('/\(\s?THEME\s?\./', '( e_THEME. "'.$theme.'/" .', str_replace($srch, '', $themeFileContent));
+
+ $themeFileContent = str_replace('tablestyle', $tp->filter($theme, 'wd')."_tablestyle",$themeFileContent); // rename function to avoid conflicts while parsing.
+
+ $themeFileContent = str_replace("class ".$theme."_theme", "class ".$theme."__theme", $themeFileContent); // rename class to avoid conflicts while parsing.
+
+ try
+ {
+ @eval($themeFileContent);
+ }
+ catch (ParseError $e)
+ {
+ echo "Couldn't parse theme.php: ". $e->getMessage()."
";
+ }
+ }
+
+
+ e107::set('css_enabled',true);
+ e107::set('js_enabled',true);
+
+ $head = array();
+ $foot = array();
+
+
if(isset($LAYOUT) && (isset($HEADER) || isset($FOOTER)))