/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/widgets/HTMLPageClass.inc
ViewVC logotype

Diff of /nfo/php/libs/com.newsblob.phphtmllib/widgets/HTMLPageClass.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jonen, Fri Nov 14 21:31:40 2003 UTC revision 1.4 by jonen, Thu May 6 16:27:41 2004 UTC
# Line 174  class HTMLPageClass { Line 174  class HTMLPageClass {
174           */           */
175          var $_indent_style = 0;          var $_indent_style = 0;
176    
177        /**
178         * keeps track of the html
179         * render type.
180         *
181         * @var string
182         */
183        var $_html_render_type = HTML;
184    
185        /**
186         * The favicon params
187         * @var array
188         */
189        var $_favicon = array("href" => "/favicon.ico",
190                              "type" => "images/x-ico",
191                              "enabled" => FALSE);
192    
193    
194    
195      /**      /**
# Line 205  class HTMLPageClass { Line 221  class HTMLPageClass {
221          switch ($html_type) {          switch ($html_type) {
222                  case HTML:                  case HTML:
223                  default:                  default:
224              $this->build_doctype("-//W3C//DTD HTML 4.01 Transitional//EN");              $this->build_doctype("-//W3C//DTD HTML 4.01 Transitional//EN",
225              $GLOBALS["HTML_RENDER_TYPE"] = HTML;                                   "http://www.w3.org/TR/html4/loose.dtd");
226                $this->_html_render_type = $GLOBALS["HTML_RENDER_TYPE"] = HTML;
227              break;              break;
228    
229          case XHTML_STRICT:          case XHTML_STRICT:
230              $this->build_doctype("-//W3C//DTD XHTML 1.0 Strict//EN",              $this->build_doctype("-//W3C//DTD XHTML 1.0 Strict//EN",
231                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
232              $GLOBALS["HTML_RENDER_TYPE"] = XHTML_STRICT;              $this->_html_render_type = $GLOBALS["HTML_RENDER_TYPE"] = XHTML_STRICT;
233              $this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",              $this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",
234                                                 "xml:lang" => "en",                                                 "xml:lang" => "en",
235                                                 "lang" => "en") );                                                 "lang" => "en") );
# Line 222  class HTMLPageClass { Line 239  class HTMLPageClass {
239          case XHTML_TRANSITIONAL:          case XHTML_TRANSITIONAL:
240              $this->build_doctype("-//W3C//DTD XHTML 1.0 Transitional//EN",              $this->build_doctype("-//W3C//DTD XHTML 1.0 Transitional//EN",
241                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
242              $GLOBALS["HTML_RENDER_TYPE"] = XHTML;              $this->_html_render_type = $GLOBALS["HTML_RENDER_TYPE"] = XHTML;
243              $this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",              $this->set_html_attributes( array( "xmlns" => "http://www.w3.org/1999/xhtml",
244                                                 "xml:lang" => "en",                                                 "xml:lang" => "en",
245                                                 "lang" => "en") );                                                 "lang" => "en") );
# Line 233  class HTMLPageClass { Line 250  class HTMLPageClass {
250          case XHTML_FRAMESET:          case XHTML_FRAMESET:
251                          $this->build_doctype("-//W3C//DTD XHTML 1.0 Frameset//EN",                          $this->build_doctype("-//W3C//DTD XHTML 1.0 Frameset//EN",
252                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd");                                                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd");
253              $GLOBALS["HTML_RENDER_TYPE"] = XHTML_FRAMESET;              $this->_html_render_type = $GLOBALS["HTML_RENDER_TYPE"] = XHTML_FRAMESET;
254              break;              break;
255          }          }
256    
# Line 465  class HTMLPageClass { Line 482  class HTMLPageClass {
482          return html_meta($content_type, "Content-Type");          return html_meta($content_type, "Content-Type");
483      }      }
484    
485        /**
486         * This is used to enable the ability to add the
487         * favicon link in the head of the document.
488         * By default it is off.  
489         *
490         * @param boolean TRUE = enable
491         */
492        function set_favicon_flag($flag=TRUE) {
493            $this->_favicon["enabled"] = $flag;
494        }
495    
496        /**
497         * This allows you to change the default url/path
498         * for where the favicon.ico lives.
499         * NOTE: calling this method automatically enables the
500         *       link in the head to be created.
501         *
502         * @param string the url to the favicon.ico file
503         * @param string the type of the image.
504         *               NOTE: Default is image/x-ico
505         */
506        function set_favicon($path, $type="image/x-ico") {
507            $this->_favicon["href"] = $path;
508            $this->_favicon["type"] = $type;
509            $this->set_favicon_flag( TRUE );
510        }
511    
512      //**************************************************      //**************************************************
513      //* BODY tag related functions      //* BODY tag related functions
514      //**************************************************      //**************************************************
# Line 487  class HTMLPageClass { Line 531  class HTMLPageClass {
531                                  $js = "";                                  $js = "";
532                                  $js = $arg->get_javascript();                                  $js = $arg->get_javascript();
533                                  $class_name = get_class($arg);                                  $class_name = get_class($arg);
534                                  if ($js != "" && !$this->_widget_js_auto[$class_name]) {                                  if ($js != "" && !isset($this->_widget_js_auto[$class_name])) {
535                                          $this->add_head_js( str_replace(chr(9),'', $js) );                                          $this->add_head_js( str_replace(chr(9),'', $js) );
536                                          $this->_widget_js_auto[$class_name] = TRUE;                                          $this->_widget_js_auto[$class_name] = TRUE;
537                                  }                                  }
# Line 594  class HTMLPageClass { Line 638  class HTMLPageClass {
638          if ($this->_title) {          if ($this->_title) {
639              $this->_head->add( $this->_title );              $this->_head->add( $this->_title );
640          }          }
641    
642            if ($this->_favicon["enabled"]) {
643                $this->_head->add( html_link($this->_favicon["href"],
644                                             "shortcut icon",
645                                             $this->_favicon["type"]));
646            }
647                    
648          if ( $this->_head_style->count_content() ) {          if ( $this->_head_style->count_content() ) {
649              $this->_head->add( $this->_head_style );              $this->_head->add( $this->_head_style );
# Line 637  class HTMLPageClass { Line 687  class HTMLPageClass {
687       */       */
688      function render() {      function render() {
689    
690            //make sure the render type is correctly
691            //set
692            $GLOBALS["HTML_RENDER_TYPE"] = $this->_html_render_type;
693    
694          //lets use ourself to render the debug page!          //lets use ourself to render the debug page!
695          if ($this->_text_debug) {          if ($this->_text_debug) {
696              $page = new HTMLPageClass;              $page = new HTMLPageClass;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed