1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-22 06:03:27 +02:00

Moved parseheader() to e107 class as renderLayout() Added test.

This commit is contained in:
Cameron
2020-12-20 13:25:03 -08:00
parent 601df26d51
commit bdb4104f9c
6 changed files with 64 additions and 35 deletions

View File

@@ -78,7 +78,7 @@ if (varset($e107_popup) != 1)
'{---FOOTER---}' => $tp->parseTemplate('{FOOTER}',true)
);
parseheader($FOOTER, $psc);
e107::renderLayout($FOOTER, $psc);
}
$eTimingStop = microtime();

View File

@@ -79,33 +79,6 @@ $js_body_onload = array(); // Legacy array of code to load with page.
// A: Define themeable header parsing
//
if (!function_exists("parseheader"))
{
function parseheader($LAYOUT, $opts=array())
{
$tp = e107::getParser();
$tmp = explode("\n", $LAYOUT);
$sc = e107::getScBatch('_theme_');
$search = array_keys($opts);
$replace = array_values($opts);
foreach ($tmp as $line)
{
$line = str_replace($search, $replace, $line); // Quick-fix allow for use of {THEME} shortcode.
if (preg_match("/{.+?}/", $line))
{
echo $tp->parseTemplate($line, true, $sc)."\n"; // retain line-breaks.
}
else
{
echo $line."\n"; // retain line-breaks.
}
}
}
}
//
// B: Send HTTP headers (these come before ANY html)
@@ -763,10 +736,11 @@ if ($e107_popup != 1) {
//
// M: Send top of body for custom pages and for news
//
e107::getDebug()->logTime('Render Layout');
// BC Fix
if (defset('e_PAGE') == 'news.php' && isset($NEWSHEADER))
{
parseheader($NEWSHEADER);
e107::renderLayout($NEWSHEADER);
}
else
{
@@ -786,7 +760,7 @@ if ($e107_popup != 1) {
'{---FOOTER---}' => e107::getParser()->parseTemplate('{FOOTER}',true),
);
parseheader($HEADER, $psc);
e107::renderLayout($HEADER, $psc);
// echo $HEADER;
}
@@ -798,6 +772,7 @@ if ($e107_popup != 1) {
//
// N: Send other top-of-body HTML
//
e107::getDebug()->logTime('Render Other');
if(ADMIN && !vartrue($_SERVER['E_DEV']) && file_exists(e_BASE.'install.php'))
{