mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Isse #2308 Remove the need for the BODYTAG constant.
This commit is contained in:
parent
8ffe5f4fca
commit
1cb3f934ea
@ -68,7 +68,12 @@ if (varset($e107_popup) != 1)
|
||||
//
|
||||
if(!deftrue('e_IFRAME'))
|
||||
{
|
||||
parseheader($FOOTER);
|
||||
|
||||
$psc = array(
|
||||
'</body>' => '',
|
||||
);
|
||||
|
||||
parseheader($FOOTER, $psc);
|
||||
}
|
||||
|
||||
$eTimingStop = microtime();
|
||||
|
@ -81,18 +81,22 @@ $js_body_onload = array(); // Legacy array of code to load with page.
|
||||
|
||||
if (!function_exists("parseheader"))
|
||||
{
|
||||
function parseheader($LAYOUT)
|
||||
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))
|
||||
{
|
||||
$line = str_replace('{THEME}',THEME_ABS, $line); // Quick-fix allow for use of {THEME} shortcode.
|
||||
echo $tp->parseTemplate($line, true, $sc)."\n"; // retain line-breaks.
|
||||
}
|
||||
else
|
||||
@ -623,11 +627,12 @@ echo "</head>\n";
|
||||
|
||||
|
||||
$def = THEME_LAYOUT; // The active layout based on custompage matches.
|
||||
|
||||
$noBody = false;
|
||||
// v2.2.2 --- Experimental --
|
||||
if($tmp = e_theme::loadLayout(THEME_LAYOUT))
|
||||
{
|
||||
$LAYOUT = $tmp;
|
||||
$noBody = true;
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
@ -699,9 +704,11 @@ echo "</head>\n";
|
||||
|
||||
//$body_onload .= " id='layout-".e107::getForm()->name2id(THEME_LAYOUT)."' ";
|
||||
|
||||
|
||||
|
||||
if(!deftrue('BODYTAG')) //TODO Discuss a better way?
|
||||
if($noBody === true) // New in v2.2.2 - remove need for BODYTAG.
|
||||
{
|
||||
echo "\n<!-- Start theme.html -->\n";
|
||||
}
|
||||
elseif(!deftrue('BODYTAG')) //TODO Discuss a better way?
|
||||
{
|
||||
$body_onload .= " id='layout-".e107::getForm()->name2id(THEME_LAYOUT)."' ";
|
||||
echo "<body".$body_onload.">\n";
|
||||
@ -746,7 +753,10 @@ if(deftrue('BOOTSTRAP'))
|
||||
|
||||
}
|
||||
|
||||
echo $LAYOUT['_modal_'];
|
||||
if($noBody === false)
|
||||
{
|
||||
echo $LAYOUT['_modal_'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -787,13 +797,21 @@ if ($e107_popup != 1) {
|
||||
$HEADER = preg_replace('#(src|href)=("|\')([^:\'"]*)("|\')#','$1=$2'.THEME.'$3$4', $HEADER);
|
||||
$FOOTER = preg_replace('#(src|href)=("|\')([^:\'"]*)("|\')#','$1=$2'.THEME.'$3$4', $FOOTER);
|
||||
}
|
||||
|
||||
|
||||
$psc = array(
|
||||
'{THEME}' => THEME_ABS,
|
||||
'{BODY_ONLOAD}' => $body_onload,
|
||||
'{LAYOUT_ID}' => 'layout-'.e107::getForm()->name2id(THEME_LAYOUT),
|
||||
'{---MODAL---}' => $LAYOUT['_modal_'],
|
||||
);
|
||||
|
||||
parseheader($HEADER);
|
||||
|
||||
parseheader($HEADER, $psc);
|
||||
|
||||
// echo $HEADER;
|
||||
}
|
||||
|
||||
unset($def);
|
||||
unset($def, $noBody, $psc);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
@ -1345,7 +1345,7 @@ class e_menuManager {
|
||||
echo $rs->form_close();
|
||||
echo "</div>";
|
||||
|
||||
|
||||
$FOOTER = str_replace('</body>','', $FOOTER);
|
||||
|
||||
$this->parseheader($FOOTER);
|
||||
if($this->debug)
|
||||
@ -1402,11 +1402,20 @@ class e_menuManager {
|
||||
{
|
||||
|
||||
// $tmp = explode("\n", $LAYOUT);
|
||||
|
||||
if(strpos($LAYOUT,'<body ') !== false) // FIXME Find a way to remove the <body> tag from the admin header when menu-manager is active.
|
||||
{
|
||||
$LAYOUT = preg_replace('/<body[^>]*>/','', $LAYOUT);
|
||||
}
|
||||
|
||||
// Split up using the same function as the shortcode handler
|
||||
$tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
$str = array();
|
||||
for($c = 0; $c < count($tmp); $c++)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if(preg_match("/[\{|\}]/", $tmp[$c]))
|
||||
{
|
||||
if($check)
|
||||
@ -1501,6 +1510,12 @@ class e_menuManager {
|
||||
// $tp->parseTemplate("{NAVIGATION".$cust."}",true);
|
||||
// echo "<span class='label label-info'>Navigation Area</span>";
|
||||
// }
|
||||
elseif(strstr($str, '{---MODAL---}'))
|
||||
{
|
||||
echo "\n<!-- Modal would appear here --> \n";
|
||||
//echo '<div id="uiAlert" class="notifications center"><!-- empty --></div>';
|
||||
//echo getAlert();
|
||||
}
|
||||
elseif(strstr($str, "ALERT"))
|
||||
{
|
||||
//echo "[Navigation Area]";
|
||||
|
Loading…
x
Reference in New Issue
Block a user