17 if (!defined(
"PSF_ENTRY_POINT"))
18 die(
"Not a valid psf entry point");
20 require_once (dirname(__FILE__) .
"/../default_config.php");
21 require_once (dirname(__FILE__) .
"/html/container.php");
22 require_once (dirname(__FILE__) .
"/html/primitive_object.php");
23 require_once (dirname(__FILE__) .
"/csspage.php");
42 public $CssFile = NULL;
43 public $InternalCss = array();
44 public $ExternalCss = array();
46 public $ExternalJs = array();
47 public $Prefix_Head =
'';
48 public $Suffix_Head =
'';
49 public $InternalJs = array();
50 public $HtmlVersion = 5;
51 public $Encoding =
"UTF-8";
52 public $AutoRefresh = 0;
53 public $Header_Meta = array();
55 function __construct($_title, $_parent = NULL)
57 parent::__construct($_parent);
58 global $psf_language, $psf_encoding;
60 $this->TextEncoding = $psf_encoding;
62 $this->Title = $_title;
65 private function getHeader()
67 $_header =
"<!DOCTYPE html>\n";
68 $_header .=
"<html lang=\"$this->Language\">\n";
69 $_header .=
" <head>\n";
70 $_header .= $this->Prefix_Head;
71 if ($this->HtmlVersion == 4)
72 $_header .=
" <meta http-equiv=\"Content-Type\" content=\"text/html;charset=$this->Encoding\">\n";
73 else if ($this->HtmlVersion > 4)
74 $_header .=
" <meta charset=\"$this->Encoding\">\n";
76 $_header .=
" <!-- Unsupported html version: $this->HtmlVersion -->\n";
77 if ($this->AutoRefresh > 0)
78 $_header .=
" <meta http-equiv=\"refresh\" content=\"" . $this->AutoRefresh .
"\">\n";
79 foreach ($this->Header_Meta as $key => $value)
80 $_header .=
" <meta name=\"" . $key .
"\" content=\"" . $value .
"\">\n";
81 $_header .=
" <title>$this->Title</title>\n";
82 foreach ($this->ExternalCss as $style)
83 $_header .=
" <link rel='stylesheet' type='text/css' href='$style'>\n";
84 foreach ($this->ExternalJs as $js)
85 $_header .=
" <script src='$js'></script>\n";
86 foreach ($this->InternalJs as $script)
88 $_header .=
" <script type=\"text/javascript\">\n";
89 $_header .= psf_indent_text($script, 6);
90 $_header .=
" </script>\n";
92 if ($this->CssFile !== NULL)
93 $_header .=
" <link rel='stylesheet' type='text/css' href='$this->CssFile'>\n";
94 foreach ($this->InternalCss as $style)
96 $_header .=
" <style>\n";
97 $_header .= psf_indent_text($style, 6);
98 $_header .=
" </style>\n";
100 if ($this->Style !== NULL)
102 $_header .=
" <style>\n";
103 $_header .= $this->Style->FetchCss(8);
104 $_header .=
" </style>\n";
106 $_header .= $this->Suffix_Head;
107 $_header .=
" </head>\n";
111 private function getBody()
116 foreach ($this->Items as $html)
119 if ($this->Indent && $html->Indent)
120 $_b .= psf_indent_text($html->ToHtml(), $indent);
122 $_b .= $html->ToHtml() .
"\n";
128 private function getFooter()
145 $_header = $this->getHeader();
146 $_body = $this->getBody();
147 $_footer = $this->getFooter();
151 $config = array(
'indent' =>
true,
'wrap' => 800 );
152 $tidy->parseString($_header . $_body . $_footer, $config,
'utf8');
153 return tidy_get_output($tidy);
156 return ($_header . $_body . $_footer);
$Body
Body of a page (not a full html source code, but user defined body), in most cases you never need to ...
$UseTidy
If enabled php module "tidy" will be used to format the output source code, it needs to be installed ...
PrintHtml()
Prints a html source code of a page into stdout.
Represent a single Html page.
Represent a single Html container, usually used by htmlpage or htmltable or any other element that is...
ToHtml()
Return whole html page as a string.