mirror of
https://github.com/e107inc/e107.git
synced 2025-08-22 14:13:03 +02:00
Issue #3068 - Added a warning for misconfigured theme layouts.
Moved e_layout class to menumanager_class.php file. Closes #4030 - Menu Layout detection test. themeLan() was failing with themes containing hyphens in the folder name.
This commit is contained in:
@@ -2038,7 +2038,12 @@ class e_menuManager
|
||||
// TODO Sorting, visibility, parameters and delete.
|
||||
// TODO Get THIS http://jsbin.com/odiqi3 working with iFrames!! XXX XXX
|
||||
|
||||
class e_layout
|
||||
|
||||
/**
|
||||
* Used only for the menu-selector at the moment.
|
||||
* Class e_layout
|
||||
*/
|
||||
class e_mm_layout
|
||||
{
|
||||
private $menuData = array();
|
||||
private $iframe = false;
|
||||
@@ -2436,8 +2441,19 @@ class e_layout
|
||||
|
||||
$srch = array('<?php', '?>');
|
||||
|
||||
// replace LAN file load.
|
||||
$themeFileContent = preg_replace("/e107::lan\(['|\"]theme.*\);/","e107::themeLan(null, '".$theme."');", $themeFileContent);
|
||||
// $themeFileContent = preg_replace("/define\(['|\"]BOOTSTRAP['|\"].*;/", '', $themeFileContent);
|
||||
// $themeFileContent = preg_replace("/define\(['|\"]FONTAWESOME['|\"].*;/", '', $themeFileContent);
|
||||
$themeFileContent = preg_replace("/LAN_[\w]*/", '""', $themeFileContent);
|
||||
$themeFileContent = preg_replace("/include_lan\(.*;/", '', $themeFileContent);
|
||||
|
||||
$themeFileContent = preg_replace("/define\(.*;/", '', $themeFileContent);
|
||||
|
||||
$themeFileContent = preg_replace('/\(\s?THEME\s?\./', '( e_THEME. "' . $theme . '/" .', str_replace($srch, '', $themeFileContent));
|
||||
|
||||
$themeFileContent = str_replace('USER_WIDTH', "''", $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.
|
||||
@@ -2445,13 +2461,35 @@ class e_layout
|
||||
$themeFileContent = str_replace('__DIR__', var_export(dirname($file), true), $themeFileContent);
|
||||
$themeFileContent = str_replace('__FILE__', var_export($file, true), $themeFileContent);
|
||||
|
||||
try
|
||||
|
||||
|
||||
if(PHP_MAJOR_VERSION > 6)
|
||||
{
|
||||
@eval($themeFileContent);
|
||||
try
|
||||
{
|
||||
eval($themeFileContent);
|
||||
}
|
||||
catch(Error $e)
|
||||
{
|
||||
|
||||
trigger_error("Couldn't parse theme.php file. ". $e->getMessage()."\n\n".$themeFileContent);
|
||||
echo "<div class='alert alert-danger'>Couldn't parse theme.php: " . $e->getMessage() . " </div>";
|
||||
file_put_contents(e_LOG."menuManagerParseDebug.log", $themeFileContent);
|
||||
}
|
||||
}
|
||||
catch(ParseError $e)
|
||||
else
|
||||
{
|
||||
echo "<div class='alert alert-danger'>Couldn't parse theme.php: " . $e->getMessage() . " </div>";
|
||||
try
|
||||
{
|
||||
eval($themeFileContent);
|
||||
}
|
||||
catch(ParseError $e)
|
||||
{
|
||||
trigger_error("Couldn't parse theme.php file.". $e->getMessage());
|
||||
echo "<div class='alert alert-danger'>Couldn't parse theme.php: " . $e->getMessage() . " </div>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3050,3 +3088,5 @@ class e_layout
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user