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

Contents of /nfo/php/libs/com.newsblob.phphtmllib/tag_classes/ALLTAGS.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Wed Jul 7 02:24:10 2004 UTC (20 years ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +2 -2 lines
fix for XHTML_STRICT in IMGtag

1 <?php
2
3 /**
4 * This file contains all of the default
5 * support html tags by phpHtmlLib.
6 *
7 * $Id: ALLTAGS.inc,v 1.4 2004/05/06 16:27:30 jonen Exp $
8 *
9 * @author Walter A. Boring IV <waboring@buildabetterweb.com>
10 * @package phpHtmlLib
11 *
12 */
13
14
15 /**
16 * <A> tag class
17 * @tutorial HTMLTagClass.cls#constructor
18 * @package phpHtmlLib
19 */
20 class Atag extends HTMLTagClass {
21 var $_tag = "a";
22 var $_debug_link_attributes = array("href");
23 var $_htmlentities_attributes = array("href");
24
25 function _set_flags() {
26 parent::_set_flags();
27 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
28 }
29 } // Atag
30
31
32 /**
33 * <ABBR> tag class
34 * @package phpHtmlLib
35 */
36 class ABBRtag extends HTMLTagClass {
37 var $_tag = "abbr";
38 } // ABBRtag
39
40
41 /**
42 * <ACRONYM> tag class
43 * @package phpHtmlLib
44 */
45 class ACRONYMtag extends HTMLTagClass {
46 var $_tag = "acronym";
47 } // ACRONYMtag
48
49
50 /**
51 * <ADDRESS> tag class
52 * @package phpHtmlLib
53 */
54 class ADDRESStag extends HTMLTagClass {
55 var $_tag = "address";
56 } // ADDRESStag
57
58 /**
59 * <APPLET> tag class
60 * @package phpHtmlLib
61 *
62 * @deprecated
63 */
64 class APPLETtag extends HTMLTagClass {
65 var $_tag = "applet";
66 function _set_flags() {
67 parent::_set_flags();
68 $this->_flags |= _DEPRICATED;
69 }
70 } // APPLETtag
71
72 /**
73 * <AREA> tag class
74 * @package phpHtmlLib
75 */
76 class AREAtag extends HTMLTagClass {
77 var $_tag = "area";
78 function _set_flags() {
79 parent::_set_flags();
80 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
81 }
82 } // AREAtag
83
84
85 /**
86 * <B> tag class
87 * @package phpHtmlLib
88 */
89 class Btag extends HTMLTagClass {
90 var $_tag = "b";
91 function _set_flags() {
92 parent::_set_flags();
93 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
94 }
95 } // Btag
96
97
98 /**
99 * <BASE> tag class
100 * @package phpHtmlLib
101 */
102 class BASEtag extends HTMLTagClass {
103 var $_tag = "base";
104 function _set_flags() {
105 parent::_set_flags();
106 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
107 }
108 } // BASEtag
109
110
111 /**
112 * <BDO> tag class
113 *
114 * The bdo element overrides the default
115 * text direction.
116 *
117 * REQUIRED ATTRIBUTE
118 * dir : url
119 * @package phpHtmlLib
120 *
121 */
122 class BDOtag extends HTMLTagClass {
123 var $_tag = "bdo";
124 } // BDOtag
125
126
127 /**
128 * <BIG> tag class
129 *
130 * renders as 'bigger' text.
131 * @package phpHtmlLib
132 */
133 class BIGtag extends HTMLTagClass {
134 var $_tag = "big";
135 } // BIGtag
136
137 /**
138 * <BLOCKQUOTE> tag class
139 *
140 * This tag defines a long
141 * quotation block
142 *
143 * @package phpHtmlLib
144 */
145 class BLOCKQUOTEtag extends HTMLTagClass {
146 var $_tag = "blockquote";
147 } // BLOCKQUOTEtag
148
149 /**
150 * <BODY> tag class
151 *
152 * Defines the documents' body.
153 *
154 * OPTIONAL ATTRIBUTES (all depricated)
155 * alink => color : DEPRICATED
156 * background => filename : DEPRICATED
157 * bgcolor => color : DEPRICATED
158 * link => color : DEPRICATED
159 * text => color : DEPRICATED
160 * vlink => color : DEPRICATED
161 *
162 * @package phpHtmlLib
163 */
164 class BODYtag extends HTMLTagClass {
165 var $_tag = "body";
166 } // BODYtag
167
168
169 /**
170 * <BR> tag class
171 *
172 * This tag inserts a single line break;
173 *
174 * @package phpHtmlLib
175 */
176 class BRtag extends HTMLTagClass {
177 var $_tag = "br";
178 function _set_flags() {
179 parent::_set_flags();
180 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
181 }
182 } // BRtag
183
184
185 /**
186 * <BUTTON> tag class
187 *
188 * Defines a push button.
189 *
190 * @package phpHtmlLib
191 */
192 class BUTTONtag extends HTMLTagClass {
193 var $_tag = "button";
194 } // BUTTONtag
195
196
197 /**
198 * <CAPTION> tag class
199 * This element defines a table caption.
200 * The <caption> tag must be inserted immediately
201 * after the <table> tag. You can specify only one
202 * caption per table.
203 *
204 * OPTIONAL ATTRIBUTES
205 * align - top, bottom DEPRICATED
206 *
207 * @package phpHtmlLib
208 */
209 class CAPTIONtag extends HTMLTagClass {
210 var $_tag = "caption";
211 } // CAPTIONtag
212
213
214 /**
215 * <CENTER> tag class.
216 * this is a depricated html tag, but
217 * browsers still support it
218 *
219 * @deprecated
220 * @package phpHtmlLib
221 */
222 class CENTERtag extends HTMLTagClass {
223 var $_tag = "center";
224 function _set_flags() {
225 parent::_set_flags();
226 $this->_flags |= _DEPRICATED;
227 }
228 } // CENTERtag
229
230
231 /**
232 * <CITE> tag class
233 *
234 * Defines a citation
235 *
236 * @package phpHtmlLib
237 */
238 class CITEtag extends HTMLTagClass {
239 var $_tag = "cite";
240 } // CITEtag
241
242
243 /**
244 * <CODE> tag class
245 *
246 * Defines computer code text.
247 *
248 * @package phpHtmlLib
249 */
250 class CODEtag extends HTMLTagClass {
251 var $_tag = "code";
252 } // CODEtag
253
254
255 /**
256 * <COL> tag class
257 *
258 * Defines the attribute values for
259 * one or more columns in a table. You
260 * can only use this element inside a
261 * colgroup.
262 *
263 * @package phpHtmlLib
264 */
265 class COLtag extends HTMLTagClass {
266 var $_tag = "col";
267 } // COLtag
268
269
270 /**
271 * <COLGROUP> tag class
272 *
273 * Defines groups of table columns.
274 * This element is only valid
275 * inside the <table> tag.
276 *
277 * NOTE: The colgroup element is an empty
278 * element that contains attributes
279 * only. To create columns, you must
280 * specify td elements within a tr
281 * element.
282 *
283 * @package phpHtmlLib
284 */
285 class COLGROUPtag extends HTMLTagClass {
286 var $_tag = "colgroup";
287 } // COLGROUPtag
288
289
290
291 /**
292 * <DD> tag class
293 *
294 * The <dd> tag defines the description
295 * of the term in a definition list.
296 *
297 * @package phpHtmlLib
298 */
299 class DDtag extends HTMLTagClass {
300 var $_tag = "dd";
301 } // DDtag
302
303
304 /**
305 * <DEL> tag class
306 *
307 * Defines text that has been deleted in
308 * a document.
309 *
310 * @package phpHtmlLib
311 */
312 class DELtag extends HTMLTagClass {
313 var $_tag = "del";
314 } // DELtag
315
316 /**
317 * <DFN> tag class
318 *
319 * Defines a definition term
320 *
321 * @package phpHtmlLib
322 */
323 class DFNtag extends HTMLTagClass {
324 var $_tag = "dfn";
325 } // DFNtag
326
327
328 /**
329 * <DIV> tag class
330 *
331 * The <div> tag defines the start of a
332 * division/section in a document.
333 *
334 * NOTE: Browsers usually place a line break
335 * before the <div> tag.
336 *
337 * @package phpHtmlLib
338 */
339 class DIVtag extends HTMLTagClass {
340 var $_tag = "div";
341 } // DIVtag
342
343
344 /**
345 * <DL> tag class
346 *
347 * The <dl> tag defines the start of a
348 * definition list.
349 *
350 * @package phpHtmlLib
351 */
352 class DLtag extends HTMLTagClass {
353 var $_tag = "dl";
354 } // DLtag
355
356 /**
357 * <!DOCTYPE> tag class
358 * @package phpHtmlLib
359 */
360 class DOCTYPEtag extends HTMLTagClass {
361 var $_tag = "!DOCTYPE";
362
363 function _set_flags() {
364 parent::_set_flags();
365 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
366 $this->_flags |= _ALWAYS_UPPERCASE | _NOFINISHSLASHXHTML;
367 }
368 } //!DOCTYPEtag
369
370 /**
371 * <DT> tag class
372 *
373 * The <dt> tag defines the start of a
374 * definition list.
375 *
376 * @package phpHtmlLib
377 */
378 class DTtag extends HTMLTagClass {
379 var $_tag = "dt";
380 } // DLtag
381
382
383 /**
384 * <EM> tag class
385 *
386 * Renders as emphasized text
387 *
388 * @package phpHtmlLib
389 */
390 class EMtag extends HTMLTagClass {
391 var $_tag = "em";
392 } // EMtag
393
394
395 /**
396 * <FIELDSET> tag class
397 *
398 * The fieldset element draws a box
399 * around the text and other elements
400 * it contains.
401 *
402 * @package phpHtmlLib
403 */
404 class FIELDSETtag extends HTMLTagClass {
405 var $_tag = "fieldset";
406 } // FIELDSETtag
407
408
409
410 /**
411 * <FONT> tag class
412 *
413 * @deprecated use styles instead
414 *
415 * @package phpHtmlLib
416 */
417 class FONTtag extends HTMLTagClass {
418 var $_tag = "font";
419 function _set_flags() {
420 parent::_set_flags();
421 $this->_flags |= _DEPRICATED;
422 }
423 } // FONTtag
424
425
426
427 /**
428 * FORMtag <FORM> tag
429 *
430 * The form element creates a form
431 * for user input.
432 *
433 * REQUIRED ATTRIBUTES
434 * action : url
435 * Specifies where to send the
436 * data when the user pushes the
437 * submit button in a form.
438 *
439 * @package phpHtmlLib
440 */
441 class FORMtag extends HTMLTagClass {
442 var $_tag = "form";
443 var $_xhtml_strict_attributes = array("name", "target");
444 } // FORMtag
445
446
447
448 /**
449 * <FRAME> tag class
450 *
451 * Defines a sub window (a frame).
452 *
453 * @package phpHtmlLib
454 */
455 class FRAMEtag extends HTMLTagClass {
456 var $_tag = "frame";
457 function _set_flags() {
458 parent::_set_flags();
459 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
460 }
461 } // FRAMEtag
462
463 /**
464 * <FRAMESET> tag class
465 *
466 * The frameset element defines a
467 * frameset.
468 *
469 * @package phpHtmlLib
470 */
471 class FRAMESETtag extends HTMLTagClass {
472 var $_tag = "frameset";
473 } // FRAMESETtag
474
475
476 /**
477 * <H1> tag class
478 *
479 * Defines a header
480 *
481 * @package phpHtmlLib
482 */
483 class H1tag extends HTMLTagClass {
484 var $_tag = "h1";
485 function _set_flags() {
486 parent::_set_flags();
487 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
488 }
489 } // H1tag
490
491
492 /**
493 * <H2> tag class
494 *
495 * Defines a header
496 *
497 * @package phpHtmlLib
498 */
499 class H2tag extends HTMLTagClass {
500 var $_tag = "h2";
501 function _set_flags() {
502 parent::_set_flags();
503 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
504 }
505 } // H2tag
506
507
508 /**
509 * <H3> tag class
510 *
511 * Defines a header
512 *
513 * @package phpHtmlLib
514 */
515 class H3tag extends HTMLTagClass {
516 var $_tag = "h3";
517 function _set_flags() {
518 parent::_set_flags();
519 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
520 }
521 } // H3tag
522
523
524 /**
525 * <H4> tag class
526 *
527 * Defines a header
528 *
529 * @package phpHtmlLib
530 */
531 class H4tag extends HTMLTagClass {
532 var $_tag = "h4";
533 function _set_flags() {
534 parent::_set_flags();
535 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
536 }
537 } // H4tag
538
539
540 /**
541 * <H5> tag class
542 *
543 * Defines a header
544 *
545 * @package phpHtmlLib
546 */
547 class H5tag extends HTMLTagClass {
548 var $_tag = "h5";
549 function _set_flags() {
550 parent::_set_flags();
551 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
552 }
553 } // H5tag
554
555
556 /**
557 * <H6> tag class
558 *
559 * Defines a header
560 *
561 * @package phpHtmlLib
562 */
563 class H6tag extends HTMLTagClass {
564 var $_tag = "h6";
565 function _set_flags() {
566 parent::_set_flags();
567 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
568 }
569 } //H6tag
570
571
572 /**
573 * <HEAD> tag class
574 *
575 * The head element can contain information
576 * about the document.
577 *
578 * @package phpHtmlLib
579 */
580 class HEADtag extends HTMLTagClass {
581 var $_tag = "head";
582 } // HEADtag
583
584
585
586 /**
587 * <HR> tag class
588 *
589 * inserts a horizontal rule.
590 *
591 * NOTE: All the "presentation attributes"
592 * of the hr element have been
593 * deprecated, in favor of style sheets.
594 *
595 * @package phpHtmlLib
596 */
597 class HRtag extends HTMLTagClass {
598 var $_tag = "hr";
599 function _set_flags() {
600 parent::_set_flags();
601 $this->_flags &= ~(_NEWLINEAFTEROPENTAG | _CONTENTREQUIRED | _CLOSETAGREQUIRED);
602 }
603 } // HRtag
604
605
606
607 /**
608 * <HTML> tag class.
609 *
610 * @package phpHtmlLib
611 */
612 class HTMLtag extends HTMLTagClass {
613 var $_tag = "html";
614 } // HTMLtag
615
616
617 /**
618 * <I> tag class
619 *
620 * Renders as italic text
621 *
622 * @package phpHtmlLib
623 */
624 class Itag extends HTMLTagClass {
625 var $_tag = "i";
626 } // Itag
627
628
629 /**
630 * <IFRAME> tag class
631 *
632 * The iframe element creates an inline
633 * frame that contains another document.
634 *
635 * @package phpHtmlLib
636 */
637 class IFRAMEtag extends HTMLTagClass {
638 var $_tag = "iframe";
639 } // IFRAMEtag
640
641
642 /**
643 * <IMG> tag class
644 *
645 * This element inserts an image.
646 *
647 * REQUIRED ATTRIBUTES
648 * src : url
649 * The address of the image you want
650 * to insert
651 * alt : text
652 * A short description of the image.
653 * Use it for text-only browsers
654 *
655 * @package phpHtmlLib
656 */
657 class IMGtag extends HTMLTagClass {
658 var $_tag = "img";
659 var $_debug_link_attributes = array("src");
660 //var $_xhtml_strict_attributes = array("border");
661 var $_htmlentities_attributes = array("src");
662 function _set_flags() {
663 parent::_set_flags();
664 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
665 }
666
667 } // IMGtag
668
669 /**
670 * INPUTtag <INPUT> tag
671 *
672 * The <input> tag defines the start of an input
673 * field where the user can enter data.
674 *
675 * @package phpHtmlLib
676 */
677 class INPUTtag extends HTMLTagClass {
678 var $_tag = "input";
679 function _set_flags() {
680 parent::_set_flags();
681 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
682 }
683 } // INPUTtag
684
685 /**
686 * <INS> tag class
687 *
688 * Defines inserted text.
689 *
690 * @package phpHtmlLib
691 */
692 class INStag extends HTMLTagClass {
693 var $_tag = "ins";
694 } // INStag
695
696 /**
697 * <KBD> tag class
698 *
699 * Defines keyboard text
700 *
701 * @package phpHtmlLib
702 */
703 class KBDtag extends HTMLTagClass {
704 var $_tag = "kbd";
705 } // KBDtag
706
707
708 /**
709 * <LABEL> tag class
710 *
711 * Defines a label to a control. If you
712 * click the text within the label element,
713 * it is supposed to toggle the control.
714 *
715 * NOTE: The "for" attribute binds a label
716 * to another element. Set the value
717 * of the "for" attribute equal to the
718 * value of the "id" attribute of the
719 * related element.
720 *
721 * @package phpHtmlLib
722 */
723 class LABELtag extends HTMLTagClass {
724 var $_tag = "label";
725 } // LABELtag
726
727
728 /**
729 * <LEGEND> tag class
730 *
731 * The legend element defines a caption
732 * for a fieldset.
733 *
734 * @package phpHtmlLib
735 */
736 class LEGENDtag extends HTMLTagClass {
737 var $_tag = "legend";
738 } // LEGENDtag
739
740
741 /**
742 * <LI> tag class
743 *
744 * The <li> tag defines the start of a list
745 * item. The <li> tag is used in both ordered
746 * (<ol>) and unordered lists (<ul>).
747 *
748 * OPTIONAL ATTRIBUTES
749 * type : 1, A, a, I, i DEPRICATED
750 *
751 * @package phpHtmlLib
752 */
753 class LItag extends HTMLTagClass {
754 var $_tag = "li";
755 } // LItag
756
757
758
759 /**
760 * <LINK> tag class
761 *
762 * This element defines the relationship between
763 * two linked documents.
764 *
765 * NOTE: This element goes only in the head section,
766 * but it can appear any number of times.
767 *
768 * @package phpHtmlLib
769 */
770 class LINKtag extends HTMLTagClass {
771 var $_tag = "link";
772 var $_debug_link_attributes = array("href");
773 var $_htmlentities_attributes = array("href");
774 function _set_flags() {
775 parent::_set_flags();
776 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
777 }
778 } // LINKtag
779
780
781
782 /**
783 * <MAP> tag class
784 *
785 * Defines an image map. An image map is an
786 * image with clickable regions.
787 *
788 * @package phpHtmlLib
789 */
790 class MAPtag extends HTMLTagClass {
791 var $_tag = "map";
792 } // MAPtag
793
794 /**
795 * <META> tag class
796 *
797 * The <meta> element provides meta-information
798 * about your page, such as descriptions and
799 * keywords for search engines.
800 *
801 * NOTE: The <meta> tag always goes inside the head element.
802 *
803 * REQUIRED ATTRIBUTES
804 * content : text
805 * Sets meta information to be associated
806 * with http-equiv or name.
807 *
808 * @package phpHtmlLib
809 */
810 class METAtag extends HTMLTagClass {
811 var $_tag = "meta";
812 function _set_flags() {
813 parent::_set_flags();
814 $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
815 }
816 } // METAtag
817
818
819 /**
820 * <NOBR> tag class
821 *
822 * NOTE: This tag doesn't really
823 * exist in the HTML spec
824 * NOT WISE TO USE IT.
825 * @deprecated
826 * @package phpHtmlLib
827 */
828 class NOBRtag extends HTMLTagClass {
829 var $_tag = "nobr";
830 function _set_flags() {
831 parent::_set_flags();
832 $this->_flags |= _DEPRICATED;
833 }
834 } // NOBRtag
835
836
837 /**
838 * <NOFRAMES> tag class
839 *
840 * The noframes element displays text for
841 * browsers that do not handle frames. The
842 * noframes element goes inside the frameset
843 * element.
844 *
845 * @package phpHtmlLib
846 */
847 class NOFRAMEStag extends HTMLTagClass {
848 var $_tag = "noframes";
849 } // NOFRAMEtag
850
851
852
853 /**
854 * <NOSCRIPT> tag class
855 *
856 * The noscript element is used to define
857 * an alternate content (text) if a script
858 * is NOT executed.
859 *
860 * NO ATTRIBUTES
861 *
862 * @package phpHtmlLib
863 */
864 class NOSCRIPTtag extends HTMLTagClass {
865 var $_tag = "noscript";
866 } // NOSCRIPTtag
867
868 /**
869 * <OBJECT> tag class
870 *
871 * Defines an embedded object. Use this element
872 * to insert multimedia into your page.
873 *
874 * @package phpHtmlLib
875 */
876 class OBJECTtag extends HTMLTagClass {
877 var $_tag = "object";
878 } // OBJECTtag
879
880 /**
881 * <OL> tag class
882 *
883 * The <ol> tag defines the start of an ordered list.
884 *
885 * OPTIONAL ATTRIBUTES
886 * type : 1,A,a,I,i DEPRICATED DO NOT USE
887 *
888 * @package phpHtmlLib
889 */
890 class OLtag extends HTMLTagClass {
891 var $_tag = "ol";
892 /**
893 * add content onto content stack
894 * adds content to tag as a FIFO.
895 * You can have n number of parameters.
896 * each one will get added in succession to the content.
897 *
898 * we override this from the parent so we can auto detect if
899 * the user is adding raw strings instead of objects.
900 * If they are trying to add raw strings, then we wrap that in
901 * an LItag object, since you can't add anything other then an <LI>
902 * @param mixed $content - either string, or tag object.
903 * @access public
904 */
905 function add() {
906 $args = func_get_args();
907
908 foreach( $args as $content) {
909
910 if (!is_object($content) || (@$content->_tag != "li") ) {
911 //$content is raw (string)
912 //lets wrap it in a <LI> object
913 $li = new LItag;
914 $li->add( $content );
915 HTMLTagClass::add( $li );
916 } else {
917 //looks like this is some object
918 //let the user do it.
919 //should we only let them push a
920 //<LI> object?
921 HTMLTagClass::add( $content );
922 }
923 }
924 }
925
926 /**
927 * push content onto content stack
928 * adds content to tag as a FIFO
929 * You can only add 1 element at a time, and
930 * it will be added as a reference. So you can't do
931 * push_reference("something");, since "something" is a
932 * static.
933 *
934 * we override this from the parent so we can auto detect if
935 * the user is adding raw strings instead of objects.
936 * If they are trying to add raw strings, then we wrap that in
937 * an LItag object, since you can't add anything other then an <LI>
938 * @param mixed $content - either string, or tag object.
939 * the tag object gets stored as a
940 * reference to the original, so you
941 * can push it, then modify it later.
942 * @access public
943 */
944 function add_reference( &$content ) {
945 if (!is_object($content) || (@$content->_tag != "li") ) {
946 //$content is raw (string)
947 //lets wrap it in a <LI> object
948 $li = new LItag;
949 $li->add_reference( $content );
950 HTMLTagClass::add_reference( $li );
951 } else {
952 //looks like this is some object
953 //let the user do it.
954 //should we only let them push a
955 //<LI> object?
956 HTMLTagClass::add_reference( $content );
957 }
958 }
959 } // OLtag
960
961
962 /**
963 * <OPTGROUP> tag class
964 *
965 * Defines an option group. This element allows
966 * you to group choices. When you have a long list
967 * of options, groups of related choices are easier
968 * to handle.
969 *
970 * @package phpHtmlLib
971 */
972 class OPTGROUPtag extends HTMLTagClass {
973 var $_tag = "optgroup";
974 } // OPTGROUPtag
975
976
977 /**
978 * <OPTION> tag class
979 *
980 * The option element defines an option in the
981 * drop-down box.
982 *
983 * @package phpHtmlLib
984 */
985 class OPTIONtag extends HTMLTagClass {
986 var $_tag = "option";
987 function _set_flags() {
988 parent::_set_flags();
989 $this->_flags &= ~_NEWLINEAFTEROPENTAG;
990 }
991
992 } // OPTIONtag
993
994
995
996 /**
997 * <P> tag class
998 *
999 * The <p> tag defines a paragraph.
1000 *
1001 * OPTIONAL ATTRIBUTES
1002 * align : left, center, right DEPRICATED DO NOT USE
1003 *
1004 * @package phpHtmlLib
1005 */
1006 class Ptag extends HTMLTagClass {
1007 var $_tag = "p";
1008 } // Ptag
1009
1010
1011 /**
1012 * <PARAM> tag class
1013 *
1014 * The param element allows you to specify
1015 * the run-time settings for an object inserted
1016 * into HTML documents.
1017 *
1018 * REQUIRED ATTRIBUTES
1019 * name : the name of the param
1020 *
1021 * @package phpHtmlLib
1022 */
1023 class PARAMtag extends HTMLTagClass {
1024 var $_tag = "param";
1025 } // PARAMtag
1026
1027 /**
1028 * <PRE> tag class
1029 *
1030 * The pre element defines preformatted text.
1031 * The text enclosed in the pre element usually
1032 * preserves spaces and line breaks. The text
1033 * renders in a fixed-pitch font.
1034 *
1035 * @package phpHtmlLib
1036 */
1037 class PREtag extends HTMLTagClass {
1038 var $_tag = "pre";
1039 function _set_flags() {
1040 parent::_set_flags();
1041 $this->_flags &= ~_INDENT;
1042 }
1043 } // PREtag
1044
1045
1046
1047 /**
1048 * <Q> tag class
1049 *
1050 * The <q> tag defines the start of a short quotation.
1051 *
1052 * NOTE: The q element does not render as anything
1053 * special, you have to use styles to format
1054 * the text.
1055 *
1056 * @package phpHtmlLib
1057 */
1058 class Qtag extends HTMLTagClass {
1059 var $_tag = "q";
1060 } // Qtag
1061
1062
1063 /**
1064 * <S> tag class
1065 *
1066 * @deprecated USE <del> instead
1067 *
1068 * @package phpHtmlLib
1069 */
1070 class Stag extends HTMLTagClass {
1071 var $_tag = "s";
1072 function _set_flags() {
1073 parent::_set_flags();
1074 $this->_flags |= _DEPRICATED;
1075 }
1076 } // Stag
1077
1078
1079 /**
1080 * <SAMP> tag class
1081 *
1082 * Defines sample computer code.
1083 *
1084 * @package phpHtmlLib
1085 */
1086 class SAMPtag extends HTMLTagClass {
1087 var $_tag = "samp";
1088 } // SAMPtag
1089
1090
1091 /**
1092 * <SCRIPT> tag class
1093 *
1094 * Defines a script, such as JavaScript.
1095 *
1096 * REQUIRED ATTRIBUTES
1097 * type : text/ecmascript, text/javascript,
1098 * text/jscript, text/vbscript,
1099 * text/vbs, text/xml
1100 * The MIME type of the script.
1101 *
1102 * OPTIONAL ATTRIBUTES
1103 * language : javascript, livescript, vbscript
1104 * other DEPRICATED DO NOT USE
1105 *
1106 * @package phpHtmlLib
1107 */
1108 class SCRIPTtag extends HTMLTagClass {
1109 var $_tag = "script";
1110 var $_debug_link_attributes = array("src");
1111 var $_htmlentities_attributes = array("src");
1112 } // SCRIPTtag
1113
1114
1115 /**
1116 * <SELECT> tag class
1117 *
1118 * The select element creates a drop-down box.
1119 *
1120 * @package phpHtmlLib
1121 */
1122 class SELECTtag extends HTMLTagClass {
1123 var $_tag = "select";
1124 } // SELECTtag
1125
1126
1127
1128 /**
1129 * <SMALL> tag class
1130 *
1131 * Renders as smaller text
1132 *
1133 * @package phpHtmlLib
1134 */
1135 class SMALLtag extends HTMLTagClass {
1136 var $_tag = "small";
1137 } // SMALLtag
1138
1139
1140 /**
1141 * <SPAN> tag class
1142 *
1143 * The <span> tag defines a section in a document.
1144 *
1145 * NOTE: Browsers do not place a line break before
1146 * or after the <span> tag.
1147 *
1148 * @package phpHtmlLib
1149 */
1150 class SPANtag extends HTMLTagClass {
1151 var $_tag = "span";
1152 } // SPANtag
1153
1154
1155 /**
1156 * <STRONG> tag class
1157 *
1158 * Renders as strong emphasized text
1159 * @package phpHtmlLib
1160 *
1161 */
1162 class STRONGtag extends HTMLTagClass {
1163 var $_tag = "strong";
1164 } // STRONGtag
1165
1166
1167 /**
1168 * <STYLE> tag class
1169 *
1170 * Defines a style in a document. The style
1171 * element goes in the head section. If you
1172 * want to include a style sheet in your page,
1173 * you should define the style sheet externally,
1174 * and link to it using <link>.
1175 *
1176 * REQUIRED ATTRIBUTES
1177 * type : text/css, text/javascript
1178 * @package phpHtmlLib
1179 */
1180 class STYLEtag extends HTMLTagClass {
1181 var $_tag = "style";
1182 } // STYLEtag
1183
1184
1185 /**
1186 * <SUB> tag class
1187 *
1188 * defines a subscript text
1189 *
1190 * @package phpHtmlLib
1191 */
1192 class SUBtag extends HTMLTagClass {
1193 var $_tag = "sub";
1194 } // SUBtag
1195
1196
1197 /**
1198 * <SUP> tag class
1199 *
1200 * defines a superscript text
1201 *
1202 * @package phpHtmlLib
1203 */
1204 class SUPtag extends HTMLTagClass {
1205 var $_tag = "sup";
1206 } // SUPtag
1207
1208
1209 /**
1210 * <TABLE> tag class
1211 *
1212 * The <table> tag defines the start of a table.
1213 * Inside a table row you can put table headers,
1214 * table rows, and table cells.
1215 * @package phpHtmlLib
1216 *
1217 */
1218 class TABLEtag extends HTMLTagClass {
1219 var $_tag = "table";
1220
1221
1222 /**
1223 * Holds the default attributes for all <tr>'s
1224 * @var array
1225 * @private
1226 */
1227 var $_default_row_attributes = array();
1228
1229 /**
1230 * Holds the default attributes for all <td>'s
1231 * @var array
1232 * @private
1233 */
1234 var $_default_col_attributes = array();
1235
1236
1237
1238 //****************************************************************
1239 // Table specific routines.
1240 //****************************************************************
1241
1242
1243
1244 /**
1245 * push 1 row (tr) of content.
1246 * Content can be raw strings, or tag objects.
1247 * Can push 1 item, or multiple items in call. Each item
1248 * will be its own td. should call push() to push a
1249 * <TR> object, but we detect it here anyway.
1250 * This function does not save the content by reference.
1251 * It copies the content and pushes it into the table.
1252 * If you want to save a reference use push() instead.
1253 * @param mixed $args The <td>'s to push for next row
1254 * @return string
1255 * @public
1256 */
1257
1258 function add_row() {
1259 $args = func_get_args();
1260 $tr = new TRtag( $this->_default_row_attributes );
1261 $tr->set_default_td_attributes( $this->_default_col_attributes );
1262
1263 for ($x=0; $x <= func_num_args()-1; $x++) {
1264 if (is_object($args[$x])) {
1265 if (isset($args[$x]->_tag) && $args[$x]->_tag == "td") {
1266 $tr->add( $args[$x] );
1267 } else if (isset($args[$x]->_tag) && $args[$x]->_tag == "tr") {
1268 //the user is trying to use this
1269 //to add a TR object.
1270 if ($tr->count_content() >= 1) {
1271 //there is already content in
1272 //the current tr. This is an
1273 //error, since it doesn't make
1274 //sense to add data and a row
1275 //inside a row.
1276 return -1;
1277 } else {
1278 //user is using this to add
1279 //a row. We'll only add it then
1280 //bail.
1281 $tr = $args[$x];
1282 break;
1283 }
1284 } else {
1285 //we need to wrap this in its own td.
1286 $tr->add( $args[$x] );
1287 }
1288 } else {
1289 //user is adding raw string.
1290 //lets wrap it in a <tr><td>content</td></tr>
1291 $tr->add( $args[$x] );
1292 }
1293
1294 }
1295 $this->add( $tr );
1296 }
1297
1298 /**
1299 * Same ass add_row()
1300 *
1301 * NOTE: only exists for compatibility with 1.x
1302 *
1303 * @deprecated - use add()
1304 */
1305 function push_row( ) {
1306 $args = func_get_args();
1307 call_user_func_array( array(&$this, "add_row"), $args);
1308 }
1309
1310 /**
1311 * Sets the default attributes for <tr>'s
1312 * that are added to the table. If there are
1313 * any attributes set for the <tr> it won't use
1314 * the defaults.
1315 *
1316 * {@source }
1317 * @param array $attributes - the default attributes
1318 * @return none
1319 */
1320 function set_default_row_attributes( $attributes ) {
1321
1322 $this->_default_row_attributes = $attributes;
1323 }
1324
1325 /**
1326 * Sets the default attributes for <td>'s
1327 * that are added to the table. If there are
1328 * any attributes set for the <td> it won't use
1329 * the defaults.
1330 *
1331 * {@source }
1332 * @param array $attributes - the default attributes
1333 * @return none
1334 */
1335 function set_default_col_attributes( $attributes ) {
1336
1337 $this->_default_col_attributes = $attributes;
1338 }
1339
1340
1341
1342 /**
1343 * update the attributes of a particular element or td.
1344 *
1345 * {@source }
1346 * @param int $row row # of the table to edit
1347 * @param int $col column # of the table to edit
1348 * @param array $attributes array of name=>value pairs
1349 * @return none
1350 */
1351 function set_cell_attributes( $row, $col, $attributes=array() ) {
1352
1353 if (is_object($this->_content[$row])) {
1354 if (is_object($this->_content[$row]->_content[$col])) {
1355 $this->_content[$row]->_content[$col]->set_tag_attributes( $attributes);
1356 }
1357 }
1358 }
1359
1360 /**
1361 * update the attributes of a particular row or tr.
1362 *
1363 * {@source }
1364 * @param int $row row # of the table to edit
1365 * @param int $col column # of the table to edit
1366 * @param array $attributes array of name=>value pairs
1367 * @return mixed -1 if the row doesn't exist already
1368 */
1369 function set_row_attributes( $row, $attributes ) {
1370 if ($this->_content[$row]) {
1371 $this->_content[$row]->set_tag_attributes( $attributes );
1372 } else {
1373 return -1;
1374 }
1375 }
1376
1377 /**
1378 * This method sets/resets the content for a specific
1379 * cell in the table
1380 *
1381 * {@source }
1382 * @param int the row number
1383 * @param int the column number
1384 * @param mixed the cell content
1385 * @return mixed -1 if the cell doesn't exist already
1386 */
1387 function set_cell_content( $row, $col, $content) {
1388
1389 $item = &$this->_get_element($row);
1390 if ( is_object($item) ) {
1391 $item = &$item->_get_element($col);
1392 if (is_object($item)) {
1393 $item->reset_content( $content );
1394 } else {
1395 return -1;
1396 }
1397 } else {
1398 return -1;
1399 }
1400 }
1401
1402 /**
1403 * This method is used to set a summary
1404 * attribute on the table for speech-synthesizing
1405 * non-visual browsers
1406 *
1407 * {@source }
1408 * @param string the summary
1409 * @return none
1410 */
1411 function set_summary($summary) {
1412 $this->set_tag_attribute("summary", $summary);
1413 }
1414
1415 } // TABLEtag
1416
1417 /**
1418 * <TBODY> class.
1419 *
1420 * Defines a table body.
1421 *
1422 * @package phpHtmlLib
1423 */
1424 class TBODYtag extends TABLEtag {
1425
1426 /**
1427 * Tag definition for class.
1428 * @var string
1429 * @private
1430 */
1431 var $_tag = "tbody";
1432
1433 }// TBODYtag
1434
1435
1436 /**
1437 * Table data <TD> class.
1438 *
1439 * Defines a cell in a table.
1440 *
1441 * OPTIONAL ATTRIBUTES
1442 * bgcolor : color DEPRICATED DO NOT USE
1443 * height : pixels, % DEPRICATED DO NOT USE
1444 * width : pixels, % DEPRICATED
1445 * use styles instead like this <td style="width:100px;">
1446 *
1447 * @package phpHtmlLib
1448 */
1449 class TDtag extends HTMLTagClass {
1450 var $_tag = "td";
1451
1452 /**
1453 * This is a helper for setting the colspan
1454 * attribute
1455 *
1456 * @param int - the colspan value
1457 */
1458 function set_colspan($colspan) {
1459 $this->set_tag_attribute('colspan', (int)$colspan);
1460 }
1461
1462 /**
1463 * This is a helper for setting the rowspan
1464 * attribute
1465 *
1466 * @param int - the rowspan value
1467 */
1468 function set_rowspan($rowspan) {
1469 $this->set_tag_attribute('rowspan', (int)$rowspan);
1470 }
1471
1472
1473 }// TDtag
1474
1475
1476 /**
1477 * <TEXTAREA> tag class
1478 *
1479 * Defines a text-area (a multi-line text
1480 * input control).
1481 * The default font in the text-area is fixed pitch.
1482 *
1483 * REQUIRED ATTRIBUTES
1484 * cols : number
1485 * The width of the textarea, in characters.
1486 *
1487 * rows : number
1488 * The height of the textarea, in rows
1489 *
1490 * OPTIONAL ATTRIBUTES
1491 * wrap : soft, hard, off DEPRICATED DO NOT USE
1492 *
1493 * @package phpHtmlLib
1494 */
1495 class TEXTAREAtag extends HTMLTagClass {
1496 var $_tag = "textarea";
1497 function _set_flags() {
1498 parent::_set_flags();
1499 $this->_flags &= ~(_INDENT | _NEWLINEAFTEROPENTAG);
1500 }
1501 } // TEXTAREAtag
1502
1503
1504
1505 /**
1506 * <TFOOT> tag class
1507 *
1508 * @package phpHtmlLib
1509 */
1510 class TFOOTtag extends TABLEtag {
1511 var $_tag = "tfoot";
1512 } // TFOOTtag
1513
1514
1515
1516 /**
1517 * Table Header <TH> class.
1518 *
1519 * Defines a header cell in a table.
1520 * Very much the same as a data cell,
1521 * but rendered in bold and with a default
1522 * center alignment.
1523 *
1524 * OPTIONAL ATTRIBUTES
1525 * same as TDtag
1526 *
1527 * STANDARD ATTRIBUTES
1528 * same as TDtag
1529 *
1530 * EVENT ATTRIBUTES
1531 * same as TDtag
1532 *
1533 * @package phpHtmlLib
1534 */
1535 class THtag extends HTMLTagClass {
1536 var $_tag = "th";
1537 } // <TH>
1538
1539 /**
1540 * Table Header <THEAD> class.
1541 *
1542 * defines a table header
1543 *
1544 * @package phpHtmlLib
1545 */
1546 class THEADtag extends TABLEtag {
1547 var $_tag = "thead";
1548 } // <TH>
1549
1550
1551 /**
1552 * <TITLE> tag class
1553 *
1554 * @package phpHtmlLib
1555 */
1556 class TITLEtag extends HTMLTagClass {
1557 var $_tag = "title";
1558 } // TITLEtag
1559
1560
1561 /**
1562 * Table Row <TR> class.
1563 * @package phpHtmlLib
1564 */
1565 class TRtag extends HTMLTagClass {
1566 var $_tag = "tr";
1567
1568 /**
1569 * Holds the default attributes for all <td>'s
1570 * @var array
1571 * @private
1572 */
1573 var $_default_td_attributes = array();
1574
1575 //****************************************************************
1576 // TR specific routines.
1577 //****************************************************************
1578
1579 /**
1580 * Sets the default attributes for <td>'s
1581 * that are added to the table. If there are
1582 * any attributes set for the <td> it won't use
1583 * the defaults.
1584 *
1585 * @param array $attributes - the default attributes
1586 */
1587 function set_default_td_attributes( $attributes ) {
1588 $this->_default_td_attributes = $attributes;
1589 }
1590
1591 /**
1592 * add content onto content stack
1593 * adds content to tag as a FIFO.
1594 * You can have n number of parameters.
1595 * each one will get added in succession to the content.
1596 *
1597 * we override this from the parent so we can auto detect if
1598 * the user is adding raw strings instead of objects.
1599 * If they are trying to add raw strings, then we wrap that in
1600 * a TDtag object, since you can't add anything other then a <TD> or
1601 * <TH> to a <TR>.
1602 * @param mixed $content - either string, or tag object.
1603 * @access public
1604 */
1605 function add() {
1606 $args = func_get_args();
1607
1608 foreach( $args as $content) {
1609 if (!is_object($content) || (@$content->_tag != "td" &&
1610 @$content->_tag != "th") ) {
1611 //$content is raw (string)
1612 //lets wrap it in a <td> object
1613 $td = new TDtag( $this->_default_td_attributes );
1614 $td->add( $content );
1615 HTMLTagClass::add( $td );
1616 } else {
1617 //looks like this is some object
1618 //let the user do it.
1619 //should we only let them add a
1620 //<TD> object?
1621 HTMLTagClass::add( $content );
1622 }
1623 }
1624 }
1625
1626 /**
1627 * add content onto content stack
1628 * adds content to tag as a FIFO
1629 * You can only add 1 element at a time, and
1630 * it will be added as a reference. So you can't do
1631 * add_reference("something");, since "something" is a
1632 * static.
1633 *
1634 * we override this from the parent so we can auto detect if
1635 * the user is adding raw strings instead of objects.
1636 * If they are trying to add raw strings, then we wrap that in
1637 * a TDtag object, since you can't add anything other then a <TD> or
1638 * <TH> to a <TR>.
1639 * @param mixed $content - either string, or tag object.
1640 * the tag object gets stored as a
1641 * reference to the original, so you
1642 * can add it, then modify it later.
1643 * @access public
1644 */
1645 function add_reference( &$content ) {
1646 if (!is_object($content) || (@$content->_tag != "td" &&
1647 @$content->_tag != "th") ) {
1648 //$content is raw (string)
1649 //lets wrap it in a <td> object
1650 $td = new TDtag;
1651 $td->add_reference( $content );
1652 HTMLTagClass::add_reference( $td );
1653 } else {
1654 //looks like this is some object
1655 //let the user do it.
1656 //should we only let them add a
1657 //<TD> object?
1658 HTMLTagClass::add_reference( $content );
1659 }
1660 }
1661
1662 /**
1663 * Same ass add()
1664 *
1665 * NOTE: only exists for compatibility with 1.x
1666 *
1667 * @deprecated - use add()
1668 */
1669 function push() {
1670 $args = func_get_args();
1671 call_user_func_array( array(&$this, "add"), $args);
1672 }
1673
1674 /**
1675 * Same ass add_reference()
1676 *
1677 * NOTE: only exists for compatibility with 1.x
1678 *
1679 * @deprecated - use add()
1680 */
1681 function push_reference( &$content ) {
1682 $this->add_reference( $content );
1683
1684 }
1685
1686 } // TRtag
1687
1688 /**
1689 * <TT> tag class
1690 * @package phpHtmlLib
1691 */
1692 class TTtag extends HTMLTagClass {
1693 var $_tag = "tt";
1694 } // TTtag
1695
1696 /**
1697 * <U> tag class
1698 * @package phpHtmlLib
1699 */
1700 class Utag extends HTMLTagClass {
1701 var $_tag = "u";
1702 } // Utag
1703
1704
1705 /**
1706 * <UL> tag class
1707 * @package phpHtmlLib
1708 */
1709 class ULtag extends OLtag {
1710 var $_tag = "ul";
1711 } // ULtag
1712
1713 /**
1714 * <VAR> tag class
1715 * @package phpHtmlLib
1716 */
1717 class VARtag extends HTMLTagClass {
1718 var $_tag = "var";
1719 } // VARtag
1720
1721
1722 /**
1723 * <XMP> tag class
1724 * @package phpHtmlLib
1725 */
1726 class XMPtag extends HTMLTagClass {
1727 var $_tag = "xmp";
1728 } // XMPtag
1729
1730 ?>

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