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

Diff of /nfo/php/libs/com.newsblob.phphtmllib/HTMLTagClass.inc

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

revision 1.2 by jonen, Sat Feb 22 20:55:24 2003 UTC revision 1.3 by jonen, Thu May 6 12:58:02 2004 UTC
# Line 46  class HTMLTagClass extends XMLTagClass { Line 46  class HTMLTagClass extends XMLTagClass {
46    
47          /**          /**
48           * The list of attributes not to render           * The list of attributes not to render
49           * if HTML_RENDER_TYPE is "XHTML STRICT"           * if $GLOBALS["HTML_RENDER_TYPE"] is "XHTML STRICT"
50           *           *
51       * We comment this declaration out       * We comment this declaration out
52       * to save memory, since only a small       * to save memory, since only a small
# Line 105  class HTMLTagClass extends XMLTagClass { Line 105  class HTMLTagClass extends XMLTagClass {
105                  //this is a magic test.  It assumes that                  //this is a magic test.  It assumes that
106                  //someone has created the define for                  //someone has created the define for
107                  //HTML_RENDER_TYPE                  //HTML_RENDER_TYPE
108                  if ( HTML_RENDER_TYPE == XHTML ||                  if ( $GLOBALS["HTML_RENDER_TYPE"] == XHTML ||
109                           HTML_RENDER_TYPE == XHTML_STRICT ) {                           $GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT ) {
110                          $this->_flags |= _XHTMLCOMPLIANT;                          $this->_flags |= _XHTMLCOMPLIANT;
111    
112                  }                  }
# Line 245  class HTMLTagClass extends XMLTagClass { Line 245  class HTMLTagClass extends XMLTagClass {
245    
246                  $indent = $this->_render_indent($indent_level, TRUE);                  $indent = $this->_render_indent($indent_level, TRUE);
247    
248                  $tag_prefix = htmlspecialchars( ($this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX));                  $tag_prefix = htmlspecialchars( (@$this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX));
249                  $tab_postfix = htmlspecialchars( ($this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX));                  $tab_postfix = htmlspecialchars( (@$this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX));
250                  $str = $indent . $tag_prefix. "<span class=\"purple\" style=\"white-space:nowrap;\">";                  $str = $indent . $tag_prefix. "<span class=\"purple\" style=\"white-space:nowrap;\">";
251                  $str .= $this->_tag . "</span>";                  $str .= $this->_tag . "</span>";
252    
# Line 396  class HTMLTagClass extends XMLTagClass { Line 396  class HTMLTagClass extends XMLTagClass {
396                                  }                                  }
397                          }                          }
398    
399                          if ( HTML_RENDER_TYPE == XHTML_STRICT &&                          if ( $GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT &&
400                                   @in_array($name, $this->_xhtml_strict_attributes) ) {                                   @in_array($name, $this->_xhtml_strict_attributes) ) {
401                                  $returnval = NULL;                                  $returnval = NULL;
402                          }                          }
403                  } else {                  } else {
404                          //hack to make non name-value pair work.                          //hack to make non name-value pair work.
405                          //ie <option name=foo value=bar CHECKED>                          //ie <option name=foo value=bar CHECKED>
406                          if ( HTML_RENDER_TYPE == XHTML_STRICT && !is_int($name) ) {                          if ( $GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT && !is_int($name) ) {
407                                  //We do this because XHTML STRICT complains about                                  //We do this because XHTML STRICT complains about
408                                  //html characters such as &.  So we mask them.                                  //html characters such as &.  So we mask them.
409                                  $value = htmlentities($value);                                  $value = htmlspecialchars($value);
410                          }                          }
411    
412                          if ( HTML_RENDER_TYPE == XHTML_STRICT &&                          if ( $GLOBALS["HTML_RENDER_TYPE"] == XHTML_STRICT &&
413                                   @in_array($name, $this->_xhtml_strict_attributes) ) {                                   @in_array($name, $this->_xhtml_strict_attributes) ) {
414                                  $returnval = NULL;                                  $returnval = NULL;
415                          } else {                          } else {
416                                  $returnval = XMLTagClass::_build_attribute_string($name, $value);                  if ( ((int)$name - 0) === $name) {
417                        $returnval = " ".$value;
418                    } else if ( $value === NULL ) {
419                        $returnval = " ".$name;
420                    } else {
421                        $returnval= " ".$name."=\"".$value."\"";
422                    }
423                          }                          }
424                  }                  }
425                  return $returnval;                  return $returnval;
# Line 423  class HTMLTagClass extends XMLTagClass { Line 429  class HTMLTagClass extends XMLTagClass {
429          // Misc functions          // Misc functions
430          //****************************************************************          //****************************************************************
431    
432    
433        /**
434         * This function checks to see if
435         * there is only 1 content data, and
436         * its not an object, then it auto
437         * sets some of the indentation flags
438         *
439         */
440        function _prepare_flags() {
441                    if ($this->_flags & _CONTENTREQUIRED) {
442                            if ($this->count_content() == 1) {
443                                    if (!is_object($this->_content[0])) {
444                                            //ok looks like this object has only
445                                            //1 data for content and its a string.          
446                                            if ( !strstr($this->_content[0], "\n") ) {
447                                                    $this->_flags &= ~_NEWLINEAFTEROPENTAG;
448                                            }
449                                    }
450                            } else if ($this->count_content() == 0) {
451                    $this->_flags &= ~_NEWLINEAFTEROPENTAG;
452                }
453                    }
454        }
455    
456  }  }
457  ?>  ?>

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

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