/[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.1 - (show annotations)
Thu Jan 30 03:29:41 2003 UTC (21 years, 5 months ago) by jonen
Branch: MAIN
Branch point for: no_vendor_tag
Initial revision

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

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