html
[ class tree: html ] [ index: html ] [ all elements ]

Source for file HTMLDocument.class.php

Documentation is available at HTMLDocument.class.php

  1. <?php
  2. /**
  3.  * For including this file you have to define the constant "CLASSPATH".
  4.  * Because every include in the framework depends on the CLASSPATH definition.
  5.  * The CLASSPATH means the relative path to the folder that contains the
  6.  * framework GilliGan.
  7.  *
  8.  * @package html
  9.  */
  10. if!defined"CLASSPATH" ) )
  11. {
  12.   echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
  13.   echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
  14.   exit();
  15. }
  16.  
  17. /**
  18.  * Including the parent class.
  19.  */
  20. require_onceCLASSPATH."html/ABSTHTMLTag.class.php" );
  21. /**
  22.  * Including a class to format plain text.
  23.  */
  24. require_onceCLASSPATH."core/PlainTextFormatter.class.php" );
  25. /**
  26.  * Including a class to generate Javascripts or setting up little standard
  27.  * javascripts.
  28.  */
  29. include_onceCLASSPATH."html/JavaScript.class.php" );
  30.  
  31.  
  32. $gg_constant_code 0;
  33. /**
  34.  * Constant represents the standard mode for html to the gilligan-framework.
  35.  */
  36. define"HTML_STANDARD_MODE"$gg_constant_code++ );
  37. /**
  38.  * Constant represents the quirk mode for html to the gilligan-framework.
  39.  */
  40. define"HTML_QUIRK_MODE"$gg_constant_code++ );
  41.  
  42. /**
  43.  * Creating HTML-Documents
  44.  *
  45.  * @package   html
  46.  * @version   0.2.23
  47.  * @author    Daniel Plücken <daniel@debakel.net>
  48.  * @license   http://www.gnu.org/copyleft/lesser.html
  49.  *             GNU Lesser General Public License
  50.  * @copyright Copyright (c) 2003 Daniel Plücken <daniel@debakel.net>
  51.  *
  52.  *  This library is free software; you can redistribute it and/or
  53.  *  modify it under the terms of the GNU Lesser General Public
  54.  *  License as published by the Free Software Foundation; either
  55.  *  version 2.1 of the License.
  56.  *
  57.  *  This library is distributed in the hope that it will be useful,
  58.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  59.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  60.  *  GNU Lesser General Public License for more details.
  61.  *
  62.  *  You should have received a copy of the GNU Lesser General
  63.  *  Public License along with this library; if not, write to the
  64.  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  65.  *  Boston, MA 02111-1307 USA
  66.  */
  67. class HTMLDocument extends ABSTHTMLTag
  68. {
  69.   /**
  70.    * @var    array   $meta 
  71.    * @access private
  72.    */
  73.   var $meta;
  74.   /**
  75.    * The title of this document.
  76.    *
  77.    * @var    string  $title 
  78.    * @access private
  79.    */
  80.   var $title;
  81.   /**
  82.    * @var    string  $head 
  83.    * @access private
  84.    */
  85.   var $head;
  86.   /**
  87.    * The content of this HTML-document.
  88.    *
  89.    * @var    string  $body 
  90.    * @access private
  91.    */
  92.   var $body;
  93.   /**
  94.    * The space between </body> and </html>.
  95.    *
  96.    * @var    string $behindbody 
  97.    * @access public
  98.    */
  99.   var $behindbody;
  100.   /**
  101.    * Class variable to switch the mode of the document between quirk and
  102.    * standard.
  103.    *
  104.    * @var integer 
  105.    */
  106.   var $mode = HTML_STANDARD_MODE;
  107.  
  108.   var $docitems;
  109.   var $doctables;
  110.   var $docforms;
  111.  
  112.   ///////////////////////////////
  113.   // Attributes of the body-tag
  114.   /**
  115.    * Stores the value of the text-attribute of the body-tag.
  116.    *
  117.    * @var integer $text 
  118.    */
  119.   var $text;
  120.   /**
  121.    * Stores the value of the bgcolor-attribute of the body-tag to set the
  122.    * backgroundcolor of the Site.
  123.    *
  124.    * @var integer $bgcolor 
  125.    */
  126.   var $bgcolor;
  127.   /**
  128.    * Stores the value of the leftmargin-attribute of the body-tag.
  129.    *
  130.    * @var integer 
  131.    */
  132.   var $leftmargin = 0;
  133.   /**
  134.    * Stores the value of the topmargin-attribute of the body-tag.
  135.    *
  136.    * @var integer $topmargin 
  137.    */
  138.   var $topmargin = 0;
  139.   /**
  140.    * Stores the value of the marginwidth-attribute of the body-tag.
  141.    *
  142.    * @var integer $marginwidth 
  143.    */
  144.   var $marginwidth = 0;
  145.   /**
  146.    * Stores the value of the marginheight-attribute of the body-tag.
  147.    *
  148.    * @var integer $marginheight 
  149.    */
  150.   var $marginheight = 0;
  151.   /**
  152.    * Stores the javascript order that should execute when the browser loads
  153.    * the document.
  154.    *
  155.    * @var string $onload 
  156.    */
  157.   var $onload;
  158.   /**
  159.    * Stores the javascript order that should execute when the browser leaves
  160.    * the document.
  161.    *
  162.    * var string $onblur
  163.    */
  164.   var $onblur;
  165.   /**
  166.    * Stores the javascript order that should execute when the document will be
  167.    * scrolled.
  168.    *
  169.    * var string $onscroll
  170.    */
  171.   var $onscroll;
  172.   /**
  173.    * Stores the javascript order that should execute when the document will be
  174.    * resized.
  175.    *
  176.    * var string $onresize
  177.    */
  178.   var $onresize;
  179.   /**
  180.    * Stores the value of the background-attribute of the body-tag. For using
  181.    * a background image.
  182.    *
  183.    * @var integer $background 
  184.    */
  185.   var $background;
  186.   /**
  187.    * Standard is 4.01.
  188.    *
  189.    * @var double $version 
  190.    */
  191.   var $version = 4.01;
  192.   /**
  193.    * Valid values for example are "html", "math" or "svg". The standard value is
  194.    * "html".
  195.    *
  196.    * @var string $doctype 
  197.    */
  198.   var $doctype = "html";
  199.   /**
  200.    * Valid values for example are "HTML", "XHTML", "SVG" or "MathML". The
  201.    * standard value is "HTML".
  202.    *
  203.    * @var string $contenttype 
  204.    */
  205.   var $contenttype = "HTML";
  206.   /**
  207.    * Valid values for example are "Final", "Strict", "Transitional"
  208.    * or "Frameset". The standard value is "Transitional".
  209.    * If "Frameset" is set as value, the body-tag will not be add!
  210.    *
  211.    * @var string $behaviour 
  212.    */
  213.   var $behaviour = "Transitional";
  214.   /**
  215.    * Stores wether the doctype definition should include to the document or
  216.    * not.
  217.    *
  218.    * @var boolean $include_doctype 
  219.    */
  220.   var $include_doctype = true;
  221.   // Attributes of the body-tag /
  222.   ///////////////////////////////
  223.  
  224.   /**
  225.    * Stores whether the document should be formatted by the PlainTextFormatter
  226.    * or not.
  227.    *
  228.    * @var    boolean $noformat 
  229.    * @access private
  230.    */
  231.   var $noformat = false;
  232.  
  233.  
  234.  
  235.  
  236.  
  237.   /**
  238.    * Constructor.
  239.    *
  240.    * @access  public
  241.    * @version 1.1
  242.    * @since   0.1.0
  243.    *
  244.    * @param   $title      The title of the document.
  245.    * @param   $head       Javascripts, stylesheets etc.
  246.    * @param   $body       The content of the document.
  247.    * @param   $behindbody For example javascripts after the closing body-tag.
  248.    * @param   $meta_char  The value of the meta-charset of this document.
  249.    *
  250.    * @return HTMLDocument 
  251.    */
  252.   function HTMLDocument(
  253.                          $title =      "",
  254.                          $head  =      "",
  255.                          $body  =      "",
  256.                          $behindbody "",
  257.                          $meta_char  "ISO-8859-1"
  258.                        )
  259.   {
  260.       $this->title = $title;
  261.       $this->head  = $head;
  262.       $this->body  = $body;
  263.       $this->behindbody = $behindbody;
  264.       $this->meta["charset"$meta_char;
  265.   }
  266.  
  267.  
  268.  
  269.   /**
  270.    * Sets the title of this document.
  271.    *
  272.    * @access  public
  273.    * @version 1.0
  274.    * @since   0.1.0
  275.    *
  276.    * @param   string $string 
  277.    *
  278.    * @return  void 
  279.    */
  280.   function setTitle$string )
  281.   $this->title = $string}
  282.  
  283.  
  284.  
  285.   /**
  286.    * Sets the head of this document.
  287.    *
  288.    * @access  public
  289.    * @version 1.0
  290.    * @since   0.1.0
  291.    *
  292.    * @param   string $string 
  293.    *
  294.    * @return  void 
  295.    */
  296.   function setHead$string )
  297.   $this->head = $string}
  298.  
  299.  
  300.  
  301.   /**
  302.    * Sets the body's content of this document.
  303.    *
  304.    * @access  public
  305.    * @version 1.0
  306.    * @since   0.1.0
  307.    *
  308.    * @param   string $string 
  309.    *
  310.    * @return  void 
  311.    */
  312.   function setBody$string )
  313.   $this->body = $string}
  314.  
  315.  
  316.  
  317.   /**
  318.    * Sets the mode of this document to quirk or standard. Preselect on method
  319.    * call with no entered parameter is the quirk mode, because preselect of the
  320.    * class-initiation is the standard mode.
  321.    *
  322.    * @access  public
  323.    * @version 1.0
  324.    * @since   0.2.21
  325.    *
  326.    * @param   integer $int 
  327.    *
  328.    * @return  void 
  329.    */
  330.   function setMode$int HTML_QUIRK_MODE )
  331.   {
  332.       switch$int )
  333.       {
  334.           case HTML_STANDARD_MODE:
  335.           case HTML_QUIRK_MODE;
  336.                $this->mode = $int;
  337.  
  338.           default:
  339.                break;
  340.       }
  341.   }
  342.  
  343.  
  344.  
  345.   /**
  346.    * Sets the body's text-attribute of this document.
  347.    *
  348.    * @access  public
  349.    * @version 1.0
  350.    * @since   0.1.0
  351.    *
  352.    * @param   string $string 
  353.    *
  354.    * @return  void 
  355.    */
  356.   function setText$string )
  357.   $this->text = $string}
  358.  
  359.  
  360.  
  361.   /**
  362.    * Sets the body's bgcolor-attribute of this document.
  363.    *
  364.    * @access  public
  365.    * @version 1.0
  366.    * @since   0.1.0
  367.    *
  368.    * @param   string $string 
  369.    *
  370.    * @return  void 
  371.    */
  372.   function setBGColor$string )
  373.   $this->bgcolor = $string}
  374.  
  375.  
  376.  
  377.   /**
  378.    * Sets the body's leftmargin-attribute of this document.
  379.    *
  380.    * @access  public
  381.    * @version 1.0
  382.    * @since   0.1.0
  383.    *
  384.    * @param   string $string 
  385.    *
  386.    * @return  void 
  387.    */
  388.   function setLeftMargin$string )
  389.   $this->leftmargin = $string}
  390.  
  391.  
  392.  
  393.   /**
  394.    * Sets the body's topmargin-attribute of this document.
  395.    *
  396.    * @access  public
  397.    * @version 1.0
  398.    * @since   0.1.0
  399.    *
  400.    * @param   string $string 
  401.    *
  402.    * @return  void 
  403.    */
  404.   function setTopMargin$string )
  405.   $this->topmargin = $string}
  406.  
  407.  
  408.  
  409.   /**
  410.    * Sets the body's marginwidth-attribute of this document.
  411.    *
  412.    * @access  public
  413.    * @version 1.0
  414.    * @since   0.1.0
  415.    *
  416.    * @param   string $string 
  417.    *
  418.    * @return  void 
  419.    */
  420.   function setMarginWidth$string )
  421.   $this->marginwidth = $string}
  422.  
  423.  
  424.  
  425.   /**
  426.    * Sets the body's marginheight-attribute of this document.
  427.    *
  428.    * @access  public
  429.    * @version 1.0
  430.    * @since   0.1.0
  431.    *
  432.    * @param   string $string 
  433.    *
  434.    * @return  void 
  435.    */
  436.   function setMarginHeight$string )
  437.   $this->marginheight = $string}
  438.  
  439.  
  440.  
  441.   /**
  442.    * Sets the body's onload-attribute of this document.
  443.    *
  444.    * @access  public
  445.    * @version 1.0
  446.    * @since   0.1.0
  447.    *
  448.    * @param   string $string 
  449.    *
  450.    * @return  void 
  451.    */
  452.   function setOnLoad$string )
  453.   $this->onload = $string}
  454.  
  455.  
  456.  
  457.   /**
  458.    * Sets the body's onblur-attribute of this document.
  459.    *
  460.    * @access  public
  461.    * @version 1.0
  462.    * @since   0.1.0
  463.    *
  464.    * @param   string $string 
  465.    *
  466.    * @return  void 
  467.    */
  468.   function setOnBlur$string )
  469.   $this->onblur = $string}
  470.  
  471.  
  472.  
  473.   /**
  474.    * Sets the body's onscroll-attribute of this document.
  475.    *
  476.    * @access  public
  477.    * @version 1.0
  478.    * @since   0.2.23
  479.    *
  480.    * @param   string $string 
  481.    *
  482.    * @return  void 
  483.    */
  484.   function setOnScroll$string )
  485.   $this->onscroll = $string}
  486.  
  487.  
  488.  
  489.   /**
  490.    * Sets the body's onresize-attribute of this document.
  491.    *
  492.    * @access  public
  493.    * @version 1.0
  494.    * @since   0.2.23
  495.    *
  496.    * @param   string $string 
  497.    *
  498.    * @return  void 
  499.    */
  500.   function setOnResize$string )
  501.   $this->onresize = $string}
  502.  
  503.  
  504.  
  505.   /**
  506.    * Sets the body's background-attribute of this document.
  507.    *
  508.    * @access  public
  509.    * @version 1.0
  510.    * @since   0.1.0
  511.    *
  512.    * @param   string $string 
  513.    *
  514.    * @return  void 
  515.    */
  516.   function setBackground$string )
  517.   $this->background = $string}
  518.  
  519.  
  520.  
  521.   /**
  522.    * Sets the behaviour of body's formatting. If noformat is set to true then
  523.    * the body will not be formatted by the plaintextformatter. Look at package
  524.    * CLASSPATH."core" at the class PlainTextFormatter for further information.
  525.    *
  526.    * @access  public
  527.    * @version 1.0
  528.    * @since   0.1.0
  529.    *
  530.    * @param   boolean $boolean 
  531.    *
  532.    * @return  void 
  533.    */
  534.   function setNoFormat$boolean true )
  535.   $this->noformat = $boolean}
  536.  
  537.  
  538.  
  539.   /**
  540.    * Returns the current title of this document.
  541.    *
  542.    * @access  public
  543.    * @version 1.0
  544.    * @since   0.1.0
  545.    *
  546.    * @return  string 
  547.    */
  548.   function getTitle()
  549.   return $this->title}
  550.  
  551.  
  552.  
  553.   /**
  554.    * Returns the current head's content of this document.
  555.    *
  556.    * @access  public
  557.    * @version 1.0
  558.    * @since   0.1.0
  559.    *
  560.    * @return  string 
  561.    */
  562.   function getHead()
  563.   return $this->head}
  564.  
  565.  
  566.  
  567.   /**
  568.    * Returns the current body's content of this document.
  569.    *
  570.    * @access  public
  571.    * @version 1.0
  572.    * @since   0.1.0
  573.    *
  574.    * @return  string 
  575.    */
  576.   function getBody()
  577.   return $this->body}
  578.  
  579.  
  580.  
  581.   /**
  582.    * Returns the current document's mode (standard or quirk).
  583.    *
  584.    * @access  public
  585.    * @version 1.0
  586.    * @since   0.2.21
  587.    *
  588.    * @return  integer 
  589.    */
  590.   function getMode()
  591.   return $this->mode}
  592.  
  593.  
  594.  
  595.   /**
  596.    * Returns the current body's text-attribute of this document.
  597.    *
  598.    * @access  public
  599.    * @version 1.0
  600.    * @since   0.1.0
  601.    *
  602.    * @return  string 
  603.    */
  604.   function getText()
  605.   return $this->text}
  606.  
  607.  
  608.  
  609.   /**
  610.    * Returns the current body's bgcolor-attribute of this document.
  611.    *
  612.    * @access  public
  613.    * @version 1.0
  614.    * @since   0.1.0
  615.    *
  616.    * @return  string 
  617.    */
  618.   function getBGColor()
  619.   return $this->bgcolor}
  620.  
  621.  
  622.  
  623.   /**
  624.    * Returns the current body's leftmargin-attribute of this document.
  625.    *
  626.    * @access  public
  627.    * @version 1.0
  628.    * @since   0.1.0
  629.    *
  630.    * @return  string 
  631.    */
  632.   function getLeftMargin()
  633.   return $this->leftmargin}
  634.  
  635.  
  636.  
  637.   /**
  638.    * Returns the current body's topmargin-attribute of this document.
  639.    *
  640.    * @access  public
  641.    * @version 1.0
  642.    * @since   0.1.0
  643.    *
  644.    * @return  string 
  645.    */
  646.   function getTopMargin()
  647.   return $this->topmargin}
  648.  
  649.  
  650.  
  651.   /**
  652.    * Returns the current body's marginwidth-attribute of this document.
  653.    *
  654.    * @access  public
  655.    * @version 1.0
  656.    * @since   0.1.0
  657.    *
  658.    * @return  string 
  659.    */
  660.   function getMarginWidth()
  661.   return $this->marginwidth}
  662.  
  663.  
  664.  
  665.   /**
  666.    * Returns the current body's marginheight text-attribute of this document.
  667.    *
  668.    * @access  public
  669.    * @version 1.0
  670.    * @since   0.1.0
  671.    *
  672.    * @return  string 
  673.    */
  674.   function getMarginHeight()
  675.   return $this->marginheight}
  676.  
  677.  
  678.  
  679.   /**
  680.    * Returns the current body's onload-attribute of this document.
  681.    *
  682.    * @access  public
  683.    * @version 1.0
  684.    * @since   0.1.0
  685.    *
  686.    * @return  string 
  687.    */
  688.   function getOnLoad()
  689.   return $this->onload}
  690.  
  691.  
  692.  
  693.   /**
  694.    * Returns the body's onblur-attribute of this document.
  695.    *
  696.    * @access  public
  697.    * @version 1.0
  698.    * @since   0.1.0
  699.    *
  700.    * @return  string 
  701.    */
  702.   function getOnBlur()
  703.   return $this->onblur}
  704.  
  705.  
  706.  
  707.   /**
  708.    * Returns the body's onscroll-attribute of this document.
  709.    *
  710.    * @access  public
  711.    * @version 1.0
  712.    * @since   0.1.0
  713.    *
  714.    * @return  string 
  715.    */
  716.   function getOnScroll()
  717.   return $this->onscroll}
  718.  
  719.  
  720.  
  721.   /**
  722.    * Returns the body's onresize-attribute of this document.
  723.    *
  724.    * @access  public
  725.    * @version 1.0
  726.    * @since   0.1.0
  727.    *
  728.    * @return  string 
  729.    */
  730.   function getOnResize()
  731.   return $this->onresize}
  732.  
  733.  
  734.  
  735.   /**
  736.    * Returns the body's background-attribute of this document.
  737.    *
  738.    * @access  public
  739.    * @version 1.0
  740.    * @since   0.1.0
  741.    *
  742.    * @return  string 
  743.    */
  744.   function getBackground()
  745.   return $this->background}
  746.  
  747.  
  748.  
  749.   /*
  750.    * Adds a formitem?????????
  751.    *
  752.    * @todo comment this function it could be somthing todo with php-generator
  753.    *
  754.    * @version 1.0
  755.    * @author  Daniel Plücken <daniel@debakel.net>
  756.    * @access  public??????????
  757.    *
  758.    * @return  string
  759.    */
  760.    /*
  761.   function addItem( &$item_ref )
  762.   {
  763.     if( get_class( $item_ref ) == "htmltable" )
  764.       $this->doctables[] =& $item_ref;
  765.     else
  766.     if(
  767.          get_class( $item_ref ) == "htmlform"
  768.       || get_class( $item_ref ) == "dbtfillingform"
  769.       || get_class( $item_ref ) == "contactform"
  770.       )
  771.       $this->docforms[] =& $item_ref;
  772.     else
  773.       $this->docitems[] =& $item_ref;
  774.   } */
  775.  
  776.  
  777.  
  778.   /**
  779.    * Generates the sourcecode to build this object and returns it.
  780.    *
  781.    * @access  public
  782.    * @version 1.01
  783.    * @since   0.1.0
  784.    *
  785.    * @return  string 
  786.    */
  787.   function getPHPSource()
  788.   {
  789.       $outputstr  "\x24body = \"".$this->body."\";\n";
  790.  
  791.       for$i 0$i count$this->docitems )$i++ )
  792.         $outputstr .= $this->docitems[$i]->getPHPSource()."\n\n";
  793.  
  794.       // newline after items
  795.       $outputstr .= "\n";
  796.  
  797.       for$i 0$i count$this->doctables )$i++ )
  798.         $outputstr .= $this->doctables[$i]->getPHPSource()."\n\n";
  799.  
  800.       // newline after tables
  801.       $outputstr .= "\n";
  802.  
  803.       for$i 0$i count$this->docforms )$i++ )
  804.         $outputstr .= $this->docforms[$i]->getPHPSource()."\n\n";
  805.  
  806.       // newline after Forms
  807.       $outputstr .= "\n";
  808.  
  809.       // DIES MUSS NOCH GEAENDERT WERDERN !!!
  810.       $outputstr .= "\x24body = \x24form->get();\n";
  811.  
  812.       $outputstr .= "\x24doc = new HTMLDocument(\n"
  813.                    ."                          \"".$this->getTitle()."\",\n"
  814.                    ."                          \x24head,\n"
  815.                    ."                          \x24body \n"
  816.                    ."                       );\n\n";
  817.  
  818.       $outputstr .= !empty$this->text )
  819.                     ? "\x24doc->setText( \"".$this->getText()."\" );\n"
  820.                     : "";
  821.       $outputstr .= !empty$this->bgcolor )
  822.                     ? "\x24doc->setBGColor( \"".$this->getBGColor()."\" );\n"
  823.                     : "";
  824.       $outputstr .= isset$this->leftmargin )
  825.                     ? "\x24doc->setLeftMargin( ".$this->getLeftMargin()." );\n"
  826.                     : "";
  827.       $outputstr .= isset$this->topmargin )
  828.                     ? "\x24doc->setTopMargin( ".$this->getTopMargin()." );\n"
  829.                     : "";
  830.       $outputstr .= isset$this->marginwidth )
  831.                     ? "\x24doc->setMarginWidth( ".$this->getMarginWidth()." );\n"
  832.                     : "";
  833.       $outputstr .= isset$this->marginheight )
  834.                     ? "\x24doc->setMarginHeight( ".$this->getMarginHeight()." );\n"
  835.                     : "";
  836.       $outputstr .= !empty$this->onload )
  837.                     ? "\x24doc->setOnLoad( \"".$this->getOnLoad()."\" );\n"
  838.                     : "";
  839.       $outputstr .= !empty$this->onscroll )
  840.                     ? "\x24doc->setOnScroll( \"".$this->getOnScroll()."\" );\n"
  841.                     : "";
  842.       $outputstr .= !empty$this->onresize )
  843.                     ? "\x24doc->setOnScroll( \"".$this->getOnResize()."\" );\n"
  844.                     : "";
  845.       $outputstr .= !empty$this->background )
  846.                     ? "\x24doc->setBackground( \"".$this->getBackground()."\" );\n"
  847.                     : "";
  848.  
  849.       $outputstr .= "echo \x24doc->get();\n";
  850.  
  851.       return $outputstr;
  852.   }
  853.  
  854.  
  855.  
  856.   /**
  857.    * Returns a generated string based on the attributes of this HTML-Object.
  858.    *
  859.    * @access  public
  860.    * @version 1.31
  861.    * @since   0.1.0
  862.    *
  863.    * @return  string 
  864.    */
  865.   function get()
  866.   {
  867.       ////////////////////////
  868.       // DOCTYPE declaration
  869.       if $this->include_doctype )
  870.       {
  871.          $definition_url "";
  872.          $definition_domain "http://www.w3.org/";
  873.          ifstrtolower$this->doctype == "html" )
  874.            if(
  875.                $this->version == 1.1
  876.             && strtoupper$this->contenttype == "XHTML"
  877.              )
  878.              $definition_url $definition_domain."TR/xhtml11/DTD/xhtml11.dtd";
  879.            else
  880.            if $this->mode == HTML_STANDARD_MODE )
  881.            switchstrtoupper$this->behaviour ) )
  882.            {
  883.  
  884.              case "STRICT":
  885.                   ifstrtoupper$this->contenttype == "HTML" )
  886.                     $definition_url $definition_domain."TR/html4/strict.dtd";
  887.                   else
  888.                   ifstrtoupper$this->contenttype == "XHTML" )
  889.                     $definition_url $definition_domain
  890.                                      ."TR/xhtml1/DTD/xhtml1-strict.dtd";
  891.                   break;
  892.              case "TRANSITIONAL":
  893.                   ifstrtoupper$this->contenttype == "HTML" )
  894.                     $definition_url $definition_domain."TR/html4/loose.dtd";
  895.                   else
  896.                   ifstrtoupper$this->contenttype == "XHTML" )
  897.                     $definition_url $definition_domain
  898.                                      ."TR/xhtml1/DTD/xhtml1-transitional.dtd";
  899.                   break;
  900.              case "FRAMESET":
  901.                   ifstrtoupper$this->contenttype == "HTML" )
  902.                     $definition_url $definition_domain
  903.                                      ."TR/html4/frameset.dtd";
  904.                   else
  905.                   ifstrtoupper$this->contenttype == "XHTML" )
  906.                     $definition_url $definition_domain
  907.                                      ."TR/xhtml1/DTD/xhtml1-frameset.dtd";
  908.                   break;
  909.              default:
  910.                   break;
  911.            }
  912.  
  913.          $out  "<!DOCTYPE ".strtolower$this->doctype )." "
  914.                   ."PUBLIC \"-//W3C//DTD ".strtoupper$this->contenttype )." "
  915.                                            .$this->version
  916.                                            .(
  917.                                 strtoupper$this->behaviour != "STRICT" )
  918.                              || $this->version != 4.0
  919.                              || $this->contenttype != "HTML"
  920.                                 ? " ".ucfirststrtolower$this->behaviour ) )
  921.                                 : ""
  922.                                             )."//EN\""
  923.                  .(
  924.                      !empty$definition_url )
  925.                      ? " \"".$definition_url."\""
  926.                      : ""
  927.                   ).">\r\n";
  928.       }
  929.       // DOCTYPE declaration /
  930.       ////////////////////////
  931.  
  932.  
  933.       $out .= "<html>\r\n";
  934.       $out .= "  <head>\r\n";
  935.       $out .= "    <title>".$this->title."</title>\r\n";
  936.       $out .= "    <meta http-equiv=\"content-type\" "
  937.                              ."content=\"text/html; charset="
  938.                              .$this->meta["charset"]."\">\r\n";
  939.  
  940.       $out .= PlainTextFormatter::indentText$this->head);
  941.  
  942.       ifis_array$GLOBALS["javascript_content") )
  943.       {
  944.         $js new JavaScript();
  945.         foreach$GLOBALS["javascript_content"as $str_tmp )
  946.           $js->add$str_tmp );
  947.  
  948.         $out .= $js->get();
  949.       }
  950.  
  951.       $out .= "  </head>\r\n\r\n";
  952.  
  953.       ifstrtoupper$this->behaviour != "FRAMESET" )
  954.         $out .= "  <body"
  955.                   .!empty$this->id )
  956.                      ? " id=\"".$this->id."\""
  957.                      : " id=\"".preg_replace(
  958.                                                "!^.*?([^/.]+)[^/]*$!",
  959.                                                "$1"$_SERVER["SCRIPT_NAME"]
  960.                                             )."\""
  961.                    )
  962.                   .!empty$this->text )
  963.                      ? " text=\"".$this->text."\""
  964.                      : ""
  965.                    )
  966.                   .!empty$this->bgcolor )
  967.                      ? " bgcolor=\"".$this->bgcolor."\""
  968.                      : ""
  969.                    )
  970.                   .!empty$this->onload )
  971.                      ? " onLoad=\"".$this->onload."\""
  972.                      : ""
  973.                    )
  974.                   .!empty$this->onblur )
  975.                      ? " onBlur=\"".$this->onblur."\""
  976.                      : ""
  977.                    )
  978.                   .!empty$this->onscroll )
  979.                      ? " onScroll=\"".$this->onscroll."\""
  980.                      : ""
  981.                    )
  982.                   .!empty$this->onresize )
  983.                      ? " onResize=\"".$this->onresize."\""
  984.                      : ""
  985.                    )
  986.                   .( ( $this->leftmargin != "" )
  987.                      ? " leftmargin=\"".$this->leftmargin."\""
  988.                      : ""
  989.                    )
  990.                   .( ( $this->topmargin != "" )
  991.                      ? " topmargin=\"".$this->topmargin."\""
  992.                      : ""
  993.                    )
  994.                   .( ( $this->marginwidth != "" )
  995.                      ? " marginwidth=\"".$this->marginwidth."\""
  996.                      : ""
  997.                    )
  998.                   .( ( $this->marginheight != "" )
  999.                      ? " marginheight=\"".$this->marginheight."\""
  1000.                      : ""
  1001.                    )
  1002.                   .( ( $this->background != "" )
  1003.                      ? " background=\"".$this->background."\""
  1004.                      : ""
  1005.                    )
  1006.                   .">";
  1007.  
  1008.       if$this->noformat )
  1009.          $out .= $this->body.(
  1010.                                strtoupper$this->behaviour != "FRAMESET"
  1011.                                ? "</body>\r\n" ""
  1012.                              );
  1013.       else
  1014.          $out .= "\r\n".PlainTextFormatter::indentText$this->body)
  1015.                 .(
  1016.                    strtoupper$this->behaviour != "FRAMESET"
  1017.                    ? "  </body>\r\n" ""
  1018.                  );
  1019.  
  1020.       $out .= PlainTextFormatter::indentText$this->behindbody);
  1021.       $out .= "</html>";
  1022.  
  1023.       return $out;
  1024.   }
  1025. // END of class HTMLDocument
  1026. ?>

Documentation generated on Thu, 05 Jun 2008 19:12:06 +0200 by phpDocumentor 1.4.1