FormatHTML = false; $this->ShowRuntimeInfo = false; $this->Encoding = 'utf-8'; $this->Style = 'new'; } function SystemMessage(string $Title, string $Text): string { return '

'.$Title.'

'.$Text.'
'; //ShowFooter(); //die(); } function ShowNavigation(Page $Page): string { if (array_key_exists('REQUEST_URI', $_SERVER)) $ScriptName = $_SERVER['REQUEST_URI']; else $ScriptName = ''; while (strpos($ScriptName, '//') !== false) $ScriptName = str_replace('//', '/', $ScriptName); if (strpos($ScriptName, '?') !== false) $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '?')); $ScriptName = substr($ScriptName, strlen($this->System->Link(''))); if (substr($ScriptName, -1, 1) == '/') $ScriptName = substr($ScriptName, 0, -1); $Output = ''; while ($Page) { $Output = ' > '.$Page->Title.''.$Output; if (($Page->ParentClass != null) and class_exists($Page->ParentClass)) { $PageClass = $Page->ParentClass; $Page = new $PageClass($this->System); $ScriptName = substr($ScriptName, 0, strrpos($ScriptName, '/')); } else $Page = null; } $Output = substr($Output, 6); return $Output; } function ShowHeader(Page $Page): string { $Path = $Page->Title; $Navigation = $this->ShowNavigation($Page); $BodyParam = ''; if (isset($Page->Load)) $BodyParam .= ' onload="'.$Page->Load.'"'; if (isset($Page->Unload)) $BodyParam .= ' onunload="'.$Page->Unload.'"'; $Output = 'Encoding.'"?>'."\n". ''. ''. ''. ''. ''. ''. ''. ''.$Path.' - '.Core::Cast($this->System)->Config['Web']['Title'].''; // Show page headers $Bar = ''; foreach (Core::Cast($this->System)->PageHeaders as $Item) $Output .= call_user_func($Item); $Output .= ''; if ($Page->BasicHTML == false) { //$Output .= '
'.$Title.'
'; $Output .= '
Navigace :: '.$Navigation.'
'; } return $Output; } function ShowFooter(Page $Page): string { global $Revision, $ReleaseTime; $Time = round(GetMicrotime() - Core::Cast($this->System)->ScriptTimeStart, 2); $Output = ''; if ($Page->BasicHTML == false) { $Output .= ''; } $Output .= ''; return $Output; } function GetOutput(Page $Page): string { $Page->OnSystemMessage = array(Core::Cast($this->System)->BaseView, 'SystemMessage'); $Output = $Page->Show(); if ($Page->RawPage == false) { $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter($Page); if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output); } return $Output; } function NewPage(string $ClassName): Page { $Page = new $ClassName(); $Page->System = $this->System; $Page->Database = $this->Database; $Page->FormatHTML = $this->FormatHTML; return $Page; } // XML formating function function FormatOutput(string $s): string { $out = ''; $nn = 0; $n = 0; while ($s != '') { $start = strpos($s, '<'); $end = strpos($s, '>'); if ($start != 0) { $end = $start - 1; $start = 0; } $line = trim(substr($s, $start, $end + 1)); if (strlen($line) > 0) if ($line[0] == '<') { if ($s[$start + 1] == '/') { $n = $n - 2; $nn = $n; } else { if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); else $cmd = substr($line, 1, strlen($line) - 2); if (strpos($s, '')) $n = $n + 2; } } if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); $s = substr($s, $end + 1, strlen($s)); $nn = $n; } return $out; } }