| 85 |
*/ |
*/ |
| 86 |
var $_charset = "iso-8859-1"; |
var $_charset = "iso-8859-1"; |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
/** |
| 90 |
|
* The encoding of the XHTML |
| 91 |
|
* XML tag |
| 92 |
|
*/ |
| 93 |
|
var $_xml_encoding = "UTF-8"; |
| 94 |
|
|
| 95 |
/** |
/** |
| 96 |
* BODYtag object that holds all content |
* BODYtag object that holds all content |
| 97 |
* for the body tag. |
* for the body tag. |
| 206 |
case HTML: |
case HTML: |
| 207 |
default: |
default: |
| 208 |
$this->build_doctype("-//W3C//DTD HTML 4.01 Transitional//EN"); |
$this->build_doctype("-//W3C//DTD HTML 4.01 Transitional//EN"); |
| 209 |
define("HTML_RENDER_TYPE", HTML); |
$GLOBALS["HTML_RENDER_TYPE"] = HTML; |
| 210 |
break; |
break; |
| 211 |
|
|
| 212 |
case XHTML_STRICT: |
case XHTML_STRICT: |
| 213 |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Strict//EN", |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Strict//EN", |
| 214 |
"DTD/xhtml1-strict.dtd"); |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); |
| 215 |
define("HTML_RENDER_TYPE", XHTML_STRICT); |
$GLOBALS["HTML_RENDER_TYPE"] = XHTML_STRICT; |
| 216 |
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml", |
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml", |
| 217 |
"xml:lang" => "en", |
"xml:lang" => "en", |
| 218 |
"lang" => "en") ); |
"lang" => "en") ); |
| 221 |
case XHTML: |
case XHTML: |
| 222 |
case XHTML_TRANSITIONAL: |
case XHTML_TRANSITIONAL: |
| 223 |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Transitional//EN", |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Transitional//EN", |
| 224 |
"DTD/xhtml1-transitional.dtd"); |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"); |
| 225 |
define("HTML_RENDER_TYPE", XHTML); |
$GLOBALS["HTML_RENDER_TYPE"] = XHTML; |
| 226 |
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml", |
$this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml", |
| 227 |
"xml:lang" => "en", |
"xml:lang" => "en", |
| 228 |
"lang" => "en") ); |
"lang" => "en") ); |
| 232 |
//XHTML frameset? TODO LIST for 1.1 |
//XHTML frameset? TODO LIST for 1.1 |
| 233 |
case XHTML_FRAMESET: |
case XHTML_FRAMESET: |
| 234 |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Frameset//EN", |
$this->build_doctype("-//W3C//DTD XHTML 1.0 Frameset//EN", |
| 235 |
"DTD/xhtml1-frameset.dtd"); |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"); |
| 236 |
define("HTML_RENDER_TYPE", XHTML_FRAMESET); |
$GLOBALS["HTML_RENDER_TYPE"] = XHTML_FRAMESET; |
| 237 |
break; |
break; |
| 238 |
} |
} |
| 239 |
|
|
| 350 |
} |
} |
| 351 |
|
|
| 352 |
/** |
/** |
| 353 |
* pushes an link to an externally referenced javascript |
* This adds a link to an external Javascript |
| 354 |
* file, which will get rendered in the head. |
* file, which will get rendered in the head. |
|
* @param mixed $link - script tag object or $url of .js file. |
|
| 355 |
* |
* |
| 356 |
|
* @param mixed $link - script tag object or $url of .js file. |
| 357 |
*/ |
*/ |
| 358 |
function push_js_link( $link ) { |
function add_js_link( $link ) { |
| 359 |
if (is_object($link)) { |
if (is_object($link)) { |
| 360 |
$js = $link; |
$js = $link; |
| 361 |
} else { |
} else { |
| 365 |
} |
} |
| 366 |
|
|
| 367 |
/** |
/** |
| 368 |
|
* same as add_js_link() |
| 369 |
|
* |
| 370 |
|
* @deprecated |
| 371 |
|
*/ |
| 372 |
|
function push_js_link( $link ) { |
| 373 |
|
$this->add_js_link( $link ); |
| 374 |
|
} |
| 375 |
|
|
| 376 |
|
/** |
| 377 |
* Automatically set a page meta tag refresh |
* Automatically set a page meta tag refresh |
| 378 |
* @param int $time - time in seconds to refresh |
* @param int $time - time in seconds to refresh |
| 379 |
* @param string $url - the url to go to. |
* @param string $url - the url to go to. |
| 395 |
} |
} |
| 396 |
|
|
| 397 |
/** |
/** |
| 398 |
|
* This sets the encoding type for |
| 399 |
|
* XHTML documents |
| 400 |
|
* |
| 401 |
|
* @param string - the encoding parameter |
| 402 |
|
*/ |
| 403 |
|
function set_encoding( $encoding ) { |
| 404 |
|
$this->_xml_encoding = $encoding; |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
/** |
| 408 |
|
* This method sets the lang, and xml:lang |
| 409 |
|
* setting in the HTML tag. |
| 410 |
|
* |
| 411 |
|
* @param string - the language |
| 412 |
|
*/ |
| 413 |
|
function set_language( $language ) { |
| 414 |
|
$this->_html_attributes["xml:lang"] = $language; |
| 415 |
|
$this->_html_attributes["lang"] = $language; |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
/** |
| 419 |
* This function is used to set the FRAMSETtag |
* This function is used to set the FRAMSETtag |
| 420 |
* object for this page. This automatically |
* object for this page. This automatically |
| 421 |
* sets the output for this page object to |
* sets the output for this page object to |
| 453 |
*/ |
*/ |
| 454 |
function set_html_attributes( $attributes ) { |
function set_html_attributes( $attributes ) { |
| 455 |
$this->_html_attributes = $attributes; |
$this->_html_attributes = $attributes; |
| 456 |
} |
} |
| 457 |
|
|
| 458 |
|
|
| 459 |
/** |
/** |
| 537 |
function _create_body() { |
function _create_body() { |
| 538 |
if ($this->_body == NULL) { |
if ($this->_body == NULL) { |
| 539 |
$this->_body = new BODYtag; |
$this->_body = new BODYtag; |
| 540 |
$this->_body->add( "\n" ); |
//$this->_body->add( " " ); |
| 541 |
} |
} |
| 542 |
} |
} |
| 543 |
|
|
| 591 |
|
|
| 592 |
$this->_head->add( $this->_build_content_type_tag() ); |
$this->_head->add( $this->_build_content_type_tag() ); |
| 593 |
|
|
| 594 |
$this->_head->add( $this->_title ); |
if ($this->_title) { |
| 595 |
|
$this->_head->add( $this->_title ); |
| 596 |
|
} |
| 597 |
|
|
| 598 |
if ( $this->_head_style->count_content() ) { |
if ( $this->_head_style->count_content() ) { |
| 599 |
$this->_head->add( $this->_head_style ); |
$this->_head->add( $this->_head_style ); |
| 600 |
} |
} |
| 643 |
$page->add_css_link("/phphtmllib/css/HTMLPageClass.css"); |
$page->add_css_link("/phphtmllib/css/HTMLPageClass.css"); |
| 644 |
} |
} |
| 645 |
|
|
| 646 |
$newline = "\n"; |
$newline = " "; |
| 647 |
$attributes = $this->get_html_attributes(); |
$attributes = $this->get_html_attributes(); |
| 648 |
$html = new HTMLtag( $attributes ); |
$html = new HTMLtag( $attributes ); |
| 649 |
$html->add( $newline ); |
$html->add( $newline ); |
| 662 |
$html->add( $this->_frameset_wrap_body() ); |
$html->add( $this->_frameset_wrap_body() ); |
| 663 |
} else { |
} else { |
| 664 |
$html->add( $newline ); |
$html->add( $newline ); |
| 665 |
$this->_body->add( $newline ); |
//$this->_body->add( $newline ); |
| 666 |
$html->add( $this->_body ); |
$html->add( $this->_body ); |
| 667 |
} |
} |
| 668 |
|
|
| 669 |
$html-> add( $newline ); |
$html-> add( $newline ); |
| 670 |
|
|
| 671 |
if ($this->_text_debug) { |
if ($this->_text_debug) { |
| 672 |
if (HTML_RENDER_TYPE == XHTML_STRICT) { |
if ($GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT) { |
| 673 |
$xml = new XMLtag(array("version" => "1.0", |
$xml = new XMLtag(array("version" => "1.0", |
| 674 |
"encoding"=>"UTF-8")); |
"encoding"=>$this->_xml_encoding)); |
| 675 |
$page->add( $xml->render(0,1) ); |
$page->add( $xml->render(0,1) ); |
| 676 |
} |
} |
| 677 |
$page->add( $this->_doctype->render(0,1) ); |
$page->add( $this->_doctype->render(0,1) ); |
| 679 |
return $page->render(); |
return $page->render(); |
| 680 |
} else { |
} else { |
| 681 |
$output = ''; |
$output = ''; |
| 682 |
if (HTML_RENDER_TYPE == XHTML_STRICT) { |
if ($GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT) { |
| 683 |
$xml = new XMLtag(array("version" => "1.0", |
$xml = new XMLtag(array("version" => "1.0", |
| 684 |
"encoding"=>"UTF-8")); |
"encoding"=>$this->_xml_encoding)); |
| 685 |
$output = $xml->render(0); |
$output = $xml->render(0); |
| 686 |
} |
} |
| 687 |
$output .= $this->_doctype->render(); |
$output .= $this->_doctype->render(); |