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

Diff of /nfo/php/libs/com.newsblob.phphtmllib/XMLTagClass.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 221  class XMLTagClass extends Container { Line 221  class XMLTagClass extends Container {
221          }          }
222      }      }
223    
224        /**
225         * This method turns on the automatic wrapping
226         * of the tag's content inside the CDATA wrapper
227         * for XML
228         *
229         * @param   boolean     $flag   TRUE or FALSE
230         */
231        function set_cdata_flag($flag) {
232            if ($flag) {
233                $this->_flags |= _CDATACONTENTWRAP;
234                $this->set_collapse(TRUE);
235            } else{
236                $this->_flags &= ~_CDATACONTENTWRAP;
237            }
238        }
239    
240          /**          /**
241           * This function turns on the collapse flag           * This function turns on the collapse flag
242           *           *
# Line 261  class XMLTagClass extends Container { Line 277  class XMLTagClass extends Container {
277                                                  $this->_flags &= ~_NEWLINEAFTEROPENTAG;                                                  $this->_flags &= ~_NEWLINEAFTEROPENTAG;
278                                          }                                          }
279                                  }                                  }
280                          }                          } else if ($this->count_content() == 0) {
281                    $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
282                }
283                  }                  }
284      }      }
285    
# Line 290  class XMLTagClass extends Container { Line 308  class XMLTagClass extends Container {
308                          $this->_tag = strtoupper($this->_tag);                          $this->_tag = strtoupper($this->_tag);
309                  }                  }
310          //save on mem          //save on mem
311                  $xml = $indent . ($this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX) . $this->_tag;                  $xml = $indent . (@$this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX) . $this->_tag;
312                                    
313                  foreach( $this->_attributes as $name => $value) {                  foreach( $this->_attributes as $name => $value) {
314                          $xml .= $this->_build_attribute_string($name, $value);                          $xml .= $this->_build_attribute_string($name, $value);
# Line 298  class XMLTagClass extends Container { Line 316  class XMLTagClass extends Container {
316    
317                  if ( !($this->_flags & _CLOSETAGREQUIRED) && !($this->_flags & _NOFINISHSLASHXHTML)                  if ( !($this->_flags & _CLOSETAGREQUIRED) && !($this->_flags & _NOFINISHSLASHXHTML)
318                           && $finish_slash ) {                           && $finish_slash ) {
319                          $xml .= " /".($this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);                          $xml .= " /".(@$this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
320                  } else {                  } else {
321                          $xml .= ($this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);                          $xml .= (@$this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
322                  }                  }
323                                    
324                  if ($this->_flags & _NEWLINEAFTEROPENTAG) {                  if ($this->_flags & _NEWLINEAFTEROPENTAG) {
# Line 343  class XMLTagClass extends Container { Line 361  class XMLTagClass extends Container {
361                                          } else {                                          } else {
362                                                  $indent = $indent_level + 1;                                                  $indent = $indent_level + 1;
363                                          }                                          }
364                                          $indent = $this->_render_indent($indent + 1);                                          $indent = $this->_render_indent($indent);
365                                          if ($this->_flags & _NEWLINEAFTEROPENTAG) {                                                                  if ($this->_flags & _NEWLINEAFTEROPENTAG) {                        
366                                                  $item = str_replace("\n", "\n" . $indent, $item);                                                  $item = str_replace("\n", "\n" . $indent, $item);
367                                                  $xml .= $indent . $item . "\n";                                                  $xml .= $indent . $item . "\n";
# Line 404  class XMLTagClass extends Container { Line 422  class XMLTagClass extends Container {
422       *          to be added to the tag.       *          to be added to the tag.
423       */       */
424      function _build_attribute_string($name, $value) {      function _build_attribute_string($name, $value) {
425                  if ( ((int)$name - 0) === $name) {          return " ".$name."=\"".$value."\"";
                         $returnval = " ".$value;  
                 } else if ( $value === NULL ) {  
                         $returnval = " ".$name;  
                 } else {  
                         $returnval= " ".$name."=\"".$value."\"";  
                 }  
         return $returnval;  
426      }      }
427  }  }
428  ?>  ?>

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