1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Improved performance on getLayouts when using the new 'layouts' folder in the theme's directory.

Possible fix for missing class in footer_default.php
This commit is contained in:
Cameron 2019-09-03 05:56:38 -07:00
parent 1d9be344af
commit 609496ab4c
2 changed files with 35 additions and 25 deletions

View File

@ -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)
{

View File

@ -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('<?php','?>');
$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 "<div class='alert alert-danger'>Couldn't parse theme.php: ". $e->getMessage()." </div>";
}
// @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('<?php','?>');
$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 "<div class='alert alert-danger'>Couldn't parse theme.php: ". $e->getMessage()." </div>";
}
}
e107::set('css_enabled',true);
e107::set('js_enabled',true);
$head = array();
$foot = array();
if(isset($LAYOUT) && (isset($HEADER) || isset($FOOTER)))