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

Annotation of /nfo/php/libs/com.newsblob.phphtmllib/tag_utils/html_utils.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sat Sep 20 00:15:57 2003 UTC (20 years, 10 months ago) by jonen
Branch: MAIN
Changes since 1.2: +0 -0 lines
+ updated whole phphtmllib to v2.3.0

1 jonen 1.1 <?php
2    
3     /**
4     * This file contains some utility functions
5     * to help build some Tag objects that are
6     * commonly used in html.
7     *
8     * $Id: html_utils.inc,v 1.21 2002/11/13 17:54:48 hemna Exp $
9     *
10     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
11     * @package phpHtmlLib
12     *
13     */
14    
15    
16     /**
17     * build an href with content and attributes.
18     *
19     * @author Walt A. Boring
20     * @param string $url - the url to go to.
21     * @param string $content - the visible link text.
22     * @param string $class - the css class to use.
23     * @param string $target - the target browser
24     * window/frame for the url.
25     * @param string $title - the title attribute
26     * @return BRtag object.
27     */
28     function html_a($url, $content, $class=NULL, $target=NULL, $title=NULL) {
29    
30     $attributes = array("href" => $url);
31     if ($class) {
32     $attributes["class"] = $class;
33     }
34     if ($target) {
35     $attributes["target"] = $target;
36     }
37    
38     if ($title) {
39     $attributes["title"] = $title;
40     }
41    
42     $a = new Atag( $attributes, $content);
43     $a->set_collapse();
44    
45     return $a;
46     }
47    
48     /**
49     * build an <ABBR> tag with content.
50     *
51     * This is to build an abbreviation.
52     * normally its just
53     * <abbr title="foo bar">foo</abbr>
54     *
55     * @param string - the title attribute
56     * @param mixed - the content for the tag
57     * @return ABBRtag object.
58     */
59     function html_abbr($title, $content) {
60     $tag = new ABBRtag(array("title"=>$title));
61     $tag->add( $content );
62     return $tag;
63     }
64    
65     /**
66     * build an <ACRONYM> tag with content.
67     *
68     * This is to build an acronym.
69     * normally its just
70     * <acronym title="foo bar">foo</abbr>
71     *
72     * @param string - the title attribute
73     * @param mixed - the content for the tag
74     * @return ACRONYMtag object.
75     */
76     function html_acronym($title, $content) {
77     $tag = new ACRONYMtag( array("title" => $title));
78     $tag->add( $content );
79     return $tag;
80     }
81    
82     /**
83     * build an <ADDRESS> tag with content.
84     *
85     * @return ADDRESStag object.
86     */
87     function html_address() {
88     $tag = new ADDRESStag;
89     $num_args = func_num_args();
90     for ($i=0;$i<$num_args;$i++) {
91     $tag->add(func_get_arg($i));
92     }
93     return $tag;
94     }
95    
96     /**
97     * build an <APPLET> tag with content.
98     *
99     * @return APPLETtag object.
100     */
101     function html_applet() {
102     $tag = new APPLETtag;
103     $args = func_get_args();
104     call_user_func_array( array(&$tag, "add"), $args);
105     return $tag;
106     }
107    
108     /**
109     * build an <AREA> tag with content.
110     *
111     * @param string - the href for the area
112     * @param string - the coords value
113     * circle x,y,radius
114     * poly x1,y1,...xn,yn
115     * left,top,right,bottom
116     * @param string - the shape
117     * DEFAULT: rect
118     * circle, rect, poly, default
119     * @param string - the alt text
120     * @param string - the target
121     * _blank, _parent, _self, _top
122     *
123     * @return AREAtag object.
124     */
125     function html_area($href, $coords, $shape="rect",
126     $alt="", $target="") {
127    
128     $attributes = array("href" => $href,
129     "coords" => $coords,
130     "shape" => $shape);
131     if ($alt != "") {
132     $attributes["alt"] = $alt;
133     }
134    
135     if ($target != "") {
136     $attributes["target"] = $target;
137     }
138    
139     $tag = new AREAtag( $attributes );
140     return $tag;
141     }
142    
143     /**
144     * build a bold <b> tag with content.
145     *
146     * @author Walt A. Boring
147     * @return BRtag object.
148     */
149     function html_b() {
150     $tag = new Btag;
151     $args = func_get_args();
152     call_user_func_array( array(&$tag, "add"), $args);
153     return $tag;
154     }
155    
156     /**
157     * build a <base> tag.
158     * This tag MUST go in the <head>
159     *
160     * @param string - the href
161     * @param string - the target
162     * _blank, _parent, _self, _top
163     * @return BASEtag object.
164     */
165     function html_base($href, $target="") {
166     $attributes = array( "href" => $href);
167    
168     if ($target != "") {
169     $attributes["target"] = $target;
170     }
171    
172     $tag = new BASEtag( $attributes );
173     return $tag;
174     }
175    
176     /**
177     * build a <bdo> tag.
178     * dir attribute is required.
179     *
180     * @param string - the dir attribute
181     * ltr, rtl
182     * @param mixed - any number of text
183     * content params.
184     * @return BDOtag object.
185     */
186     function html_bdo($dir) {
187     $attributes = array( "dir" => $dir);
188    
189     $tag = new BDOtag( $attributes );
190    
191     $num_args = func_num_args();
192     for ($i=1;$i<$num_args;$i++) {
193     $tag->add(func_get_arg($i));
194     }
195    
196     return $tag;
197     }
198    
199    
200     /**
201     * build a <big> tag with content.
202     *
203     * @author Walt A. Boring
204     * @return BIGtag object.
205     */
206     function html_big() {
207     $tag = new BIGtag;
208     $args = func_get_args();
209     call_user_func_array( array(&$tag, "add"), $args);
210     return $tag;
211     }
212    
213     /**
214     * build a <blockquote> tag with content.
215     *
216     * @author Walt A. Boring
217     * @return BLOCKQUOTEtag object.
218     */
219     function html_blockquote() {
220     $tag = new BLOCKQUOTEtag;
221     $args = func_get_args();
222     call_user_func_array( array(&$tag, "add"), $args);
223     return $tag;
224     }
225    
226     /**
227     * build a <body> tag with content.
228     *
229     * @author Walt A. Boring
230     * @return BODYtag object.
231     */
232     function html_body() {
233     $tag = new BODYtag;
234     $args = func_get_args();
235     call_user_func_array( array(&$tag, "add"), $args);
236     return $tag;
237     }
238    
239     /**
240     * builds n # of <br> tags.
241     *
242     * @param int - the number of
243     * br tags you want
244     *
245     * @return mixed - BRtag object.
246     * or Container
247     */
248     function html_br($num=1) {
249     if ($num == 1){
250     return new BRtag;
251     } else if ($num > 1) {
252     $obj = new Container;
253     $obj->set_collapse();
254     for ($i=0; $i<$num;$i++) {
255     $obj->add( new BRtag );
256     }
257     return $obj;
258     } else if ($num <= 0) {
259     return NULL;
260     }
261     }
262    
263     /**
264     * build a <button> tag with content.
265     *
266     * @param string - the button type
267     * button, reset, submit
268     * DEFAULT : button
269     * @param mixed - any number of items as
270     * content.
271     * @return BUTTONtag object.
272     */
273     function html_button($type="button") {
274     $tag = new BUTTONtag( array("type"=> $type));
275     $num_args = func_num_args();
276     for ($i=1;$i<$num_args;$i++) {
277     $tag->add(func_get_arg($i));
278     }
279     return $tag;
280     }
281    
282     /**
283     * build a <caption> tag with content.
284     *
285     * @param mixed - n number of arguments
286     * as content for the tag.
287     * @return CAPTIONtag object.
288     */
289     function html_caption() {
290     $tag = new CAPTIONtag;
291     $args = func_get_args();
292     call_user_func_array( array(&$tag, "add"), $args);
293     return $tag;
294     }
295    
296     /**
297     * build a <center> tag with some content.
298     * DEPRICATED
299     *
300     * @param mixed - n number of arguments
301     * as content for the tag.
302     * @return CENTERtag object.
303     */
304     function html_center( ) {
305     $tag = new CENTERtag;
306     $args = func_get_args();
307     call_user_func_array( array(&$tag, "add"), $args);
308     return $tag;
309     }
310    
311     /**
312     * build a <cite> tag with some content.
313     *
314     * @param mixed - n number of arguments
315     * as content for the tag.
316     * @return CITEtag object.
317     */
318     function html_cite( ) {
319     $tag = new CITEtag;
320     $args = func_get_args();
321     call_user_func_array( array(&$tag, "add"), $args);
322     return $tag;
323     }
324    
325     /**
326     * build a <code> tag with some content.
327     *
328     * @param mixed - n number of arguments
329     * as content for the tag.
330     * @return CODEtag object.
331     */
332     function html_code( ) {
333     $tag = new CODEtag;
334     $args = func_get_args();
335     call_user_func_array( array(&$tag, "add"), $args);
336     return $tag;
337     }
338    
339     /**
340     * build a <col> tag
341     *
342     * @param mixed - n number of arguments
343     * as content for the tag.
344     * @return CODEtag object.
345     */
346     function html_col($width='', $align='', $span='' ) {
347     $attributes = array();
348     if ($width != '') {
349     $attributes["width"] = $width;
350     }
351     if ($align != '') {
352     $attributes["align"] = $align;
353     }
354     if ($span != '') {
355     $attributes["span"] = $span;
356     }
357     $tag = new COLtag( $attributes );
358     return $tag;
359     }
360    
361     /**
362     * build a <colgroup> tag.
363     *
364     * NOTE: The colgroup element is an empty
365     * element that contains attributes
366     * only. To create columns, you must
367     * specify td elements within a tr
368     * element.
369     *
370     * @param array - tag attributes.
371     * @return COLGROUPEtag object.
372     */
373     function html_colgroup( $attributes ) {
374     return new COLGROUPtag( $attributes );
375     }
376    
377     /**
378     * render an html comment string
379     *
380     * @param string - the string to comment.
381     * @return string - the string wrapped in
382     * the html comment block
383     */
384     function html_comment( $string ) {
385     return '<!-- ' . $string . ' //-->';
386     }
387    
388     /**
389     * build a <dd> tag with some content.
390     *
391     * @param mixed - n number of arguments
392     * as content for the tag.
393     * @return DDtag object.
394     */
395     function html_dd( ) {
396     $tag = new DDtag;
397     $args = func_get_args();
398     call_user_func_array( array(&$tag, "add"), $args);
399     return $tag;
400     }
401    
402     /**
403     * build a <del> tag with some content.
404     *
405     * @param mixed - n number of arguments
406     * as content for the tag.
407     * @return DELtag object.
408     */
409     function html_del( ) {
410     $tag = new DELtag;
411     $args = func_get_args();
412     call_user_func_array( array(&$tag, "add"), $args);
413     return $tag;
414     }
415    
416    
417     /**
418     * build a <dfn> tag with some content.
419     *
420     * @param mixed - n number of arguments
421     * as content for the tag.
422     * @return DFNtag object.
423     */
424     function html_dfn( ) {
425     $tag = new DFNtag;
426     $args = func_get_args();
427     call_user_func_array( array(&$tag, "add"), $args);
428     return $tag;
429     }
430    
431     /**
432     * html_div() is defined in
433     * divtag_utils.inc
434     */
435    
436     /**
437     * build a <dl> tag with some content.
438     *
439     * @param mixed - n number of arguments
440     * as content for the tag.
441     * @return DLtag object.
442     */
443     function html_dl( ) {
444     $tag = new DLtag;
445     $args = func_get_args();
446     call_user_func_array( array(&$tag, "add"), $args);
447     return $tag;
448     }
449    
450     /**
451     * build a <dt> tag with some content.
452     *
453     * @param mixed - n number of arguments
454     * as content for the tag.
455     * @return DTtag object.
456     */
457     function html_dt( ) {
458     $tag = new DTtag;
459     $args = func_get_args();
460     call_user_func_array( array(&$tag, "add"), $args);
461     return $tag;
462     }
463    
464     /**
465     * build a <em> tag with some content.
466     *
467     * @param mixed - n number of arguments
468     * as content for the tag.
469     * @return EMtag object.
470     */
471     function html_em( ) {
472     $tag = new EMtag;
473     $args = func_get_args();
474     call_user_func_array( array(&$tag, "add"), $args);
475     return $tag;
476     }
477    
478     /**
479     * build a <fieldset> tag with some content.
480     *
481     * @param mixed - The legend text, or the
482     * LEGENDtag for the fieldset.
483     * @param mixed - n number of arguments
484     * as content for the tag.
485     * @return FIELDSETtag object.
486     */
487     function html_fieldset($legend="") {
488     $tag = new FIELDSETtag;
489    
490     //see if they passed in the legend
491     if ($legend != "") {
492     if (is_object($legend)) {
493     $tag->add( $legend );
494     } else {
495     $tag->add( html_legend( $legend ) );
496     }
497     }
498    
499     $num_args = func_num_args();
500     for ($i=1;$i<$num_args;$i++) {
501     $tag->add(func_get_arg($i));
502     }
503     return $tag;
504     }
505    
506     /**
507     * html_form() is defined
508     * in form_utils.inc
509     */
510    
511    
512     /**
513     * build an H1 tag object with content.
514     *
515     * @author Walt A. Boring
516     * @param mixed - n number of arguments
517     * as content for the tag.
518     * @return H1tag object.
519     */
520     function html_h1( ) {
521     $tag = new H1tag;
522     $tag->set_collapse();
523     $args = func_get_args();
524     call_user_func_array( array(&$tag, "add"), $args);
525     return $tag;
526     }
527    
528     /**
529     * build an H2 tag object with content.
530     *
531     * @author Walt A. Boring
532     * @param mixed - n number of arguments
533     * as content for the tag.
534     * @return H2tag object.
535     */
536     function html_h2( ) {
537     $tag = new H2tag;
538     $tag->set_collapse();
539     $args = func_get_args();
540     call_user_func_array( array(&$tag, "add"), $args);
541     return $tag;
542     }
543    
544    
545     /**
546     * build an H3 tag object with content.
547     *
548     * @author Walt A. Boring
549     * @param mixed - n number of arguments
550     * as content for the tag.
551     * @return H3tag object.
552     */
553     function html_h3( ) {
554     $tag = new H3tag;
555     $tag->set_collapse();
556     $args = func_get_args();
557     call_user_func_array( array(&$tag, "add"), $args);
558     return $tag;
559     }
560    
561     /**
562     * build an H4 tag object with content.
563     *
564     * @author Walt A. Boring
565     * @param mixed - n number of arguments
566     * as content for the tag.
567     * @return H4tag object.
568     */
569     function html_h4( ) {
570     $tag = new H4tag;
571     $tag->set_collapse();
572     $args = func_get_args();
573     call_user_func_array( array(&$tag, "add"), $args);
574     return $tag;
575     }
576    
577     /**
578     * build an H5 tag object with content.
579     *
580     * @author Walt A. Boring
581     * @param mixed - n number of arguments
582     * as content for the tag.
583     * @return H5tag object.
584     */
585     function html_h5( ) {
586     $tag = new H5tag;
587     $tag->set_collapse();
588     $args = func_get_args();
589     call_user_func_array( array(&$tag, "add"), $args);
590     return $tag;
591     }
592    
593    
594     /**
595     * build an H6 tag object with content.
596     *
597     * @author Walt A. Boring
598     * @param mixed - n number of arguments
599     * as content for the tag.
600     * @return H6tag object.
601     */
602     function html_h6( ) {
603     $tag = new H6tag;
604     $tag->set_collapse();
605     $args = func_get_args();
606     call_user_func_array( array(&$tag, "add"), $args);
607     return $tag;
608     }
609    
610     /**
611     * build an <head> tag object with content.
612     *
613     * @author Walt A. Boring
614     * @param mixed - n number of arguments
615     * as content for the tag.
616     * @return HEADtag object.
617     */
618     function html_head( ) {
619     $tag = new HEADtag;
620     $args = func_get_args();
621     call_user_func_array( array(&$tag, "add"), $args);
622     return $tag;
623     }
624    
625     /**
626     * build an <hr> tag object.
627     *
628     * @return HRtag object.
629     */
630     function html_hr( ) {
631     return new HRtag;
632     }
633    
634     /**
635     * build an <html> tag object.
636     *
637     * @author Walt A. Boring
638     * @param mixed - n number of arguments
639     * as content for the tag.
640     * @return HTMLtag object.
641     */
642     function html_html( ) {
643     $tag = new HTMLtag;
644     $args = func_get_args();
645     call_user_func_array( array(&$tag, "add"), $args);
646     return $tag;
647     }
648    
649    
650     /**
651     * build a <i> tag with some content.
652     *
653     * @author Walt A. Boring
654     * @param mixed - n number of arguments
655     * as content for the tag.
656     * @return Itag object.
657     */
658     function html_i( ) {
659     $tag = new Itag;
660     $args = func_get_args();
661     call_user_func_array( array(&$tag, "add"), $args);
662     return $tag;
663     }
664    
665     /**
666     * build a <irame> tag with some content.
667     *
668     * @author Walt A. Boring
669     * @param src - the url for the iframe
670     * @return Itag object.
671     */
672     function html_iframe($src, $width="", $height="", $scrolling="") {
673     $attributes = array("src" => $src);
674     if ($width != "") {
675     $attributes["width"] = $width;
676     }
677     if ($height != "") {
678     $attributes["height"] = $height;
679     }
680     if ($width != "") {
681     $attributes["scrolling"] = $scrolling;
682     }
683     return new IFRAMEtag( $attributes );
684     }
685    
686    
687     /**
688     * Build an <img> tag.
689     * If width and or height are not provided
690     * we do not set them in the tag.
691     *
692     * @author Walter A. Boring IV
693     * @param string - $image - image src
694     * @param int - $width - width of the image.
695     * @param int - $heigth - height of the image
696     * @param int - $border - border flag.
697     * @param string - $alt - alt tag for the image
698     * @param string - $usemap - the image map name
699     * @return IMGtag object.
700     */
701     function html_img( $image, $width='', $height='', $border=0,
702     $alt="", $usemap=NULL, $title=NULL ) {
703     $attributes = array( "src" => $image,
704     "border" => $border,
705     "alt" => $alt);
706    
707     if ($height != '') {
708     $attributes["height"] = $height;
709     }
710     if ($width != '') {
711     $attributes["width"] = $width;
712     }
713    
714     //only add usemap entry if its not NULL
715     if ($usemap) {
716     $attributes["usemap"] = $usemap;
717     }
718    
719     if ($title) {
720     $attributes["title"] = $title;
721     }
722    
723     return new IMGtag( $attributes );
724     }
725    
726    
727     /**
728     * build an hlink for an image.
729     * this automatically turns off indenting
730     * and newlines, so it formats well
731     *
732     * @param string - $url - href for the <a>
733     * @param string - $image - src for the <img>
734     * @param int - $width - width of the image
735     * @param int - $height - height of the image
736     * @param int - $border - for the <img>
737     * @param string - $alt - for the <img ALT="">
738     * @param string - $usemap - the image map name
739     * @param string - $target - the <a target="blah">
740     * @param string - $title - the title attribute
741     * @return Atag object with <img> as content
742     *
743     */
744     function html_img_href( $url, $image, $width='', $height='', $border=0,
745     $alt="", $usemap=NULL, $target=NULL, $title=NULL) {
746     $img = html_img($image, $width, $height, $border, $alt, $usemap, $title);
747     $a = html_a($url, $img, NULL, $target);
748     return $a;
749     }
750    
751    
752     /**
753     * This builds an <input> object
754     * NOTE: This wrapper automatically
755     * calls htmlspecialchars() on
756     * the value attribute's data.
757     *
758     * @param string - the type attribute
759     * @param string - the name attribute
760     * @param string - the value attribute
761     * @param array - any other name=>value attributes
762     * for the tag
763     *
764     * @return INPUTtag object.
765     */
766     function html_input( $type, $name, $value='', $attributes=array() ) {
767     $attrib = array( "type" => $type,
768     "name" => $name,
769     "value" => htmlspecialchars($value, ENT_QUOTES));
770    
771     $attributes = array_merge( $attrib, $attributes );
772     return new INPUTtag( $attributes );
773     }
774    
775     /**
776     * build a <ins> tag with some content.
777     *
778     * @author Walt A. Boring
779     * @param mixed - n number of arguments
780     * as content for the tag.
781     * @return INStag object.
782     */
783     function html_ins( ) {
784     $tag = new INStag;
785     $args = func_get_args();
786     call_user_func_array( array(&$tag, "add"), $args);
787     return $tag;
788     }
789    
790     /**
791     * build a <kbd> tag with some content.
792     *
793     * @param mixed - n number of arguments
794     * as content for the tag.
795     * @return KBDtag object.
796     */
797     function html_kbd( ) {
798     $tag = new KBDtag;
799     $args = func_get_args();
800     call_user_func_array( array(&$tag, "add"), $args);
801     return $tag;
802     }
803    
804     /**
805     * build a <label> tag with some content.
806     *
807     * @param string - the id of the form
808     * element to tie this
809     * label to.
810     * @param mixed - n number of arguments
811     * as content for the tag.
812     * @return LABELtag object.
813     */
814     function html_label($for="") {
815    
816     $attributes = array();
817     if ($for != "") {
818     $attributes["for"] = $for;
819     }
820     $tag = new LABELtag( $attributes );
821     $num_args = func_num_args();
822     for ($i=1;$i<$num_args;$i++) {
823     $tag->add(func_get_arg($i));
824     }
825     return $tag;
826     }
827    
828     /**
829     * build a <legend> tag with some content.
830     *
831     * @param mixed - n number of arguments
832     * as content for the tag.
833     * @return LEGENDtag object.
834     */
835     function html_legend( ) {
836     $tag = new LEGENDtag;
837     $args = func_get_args();
838     call_user_func_array( array(&$tag, "add"), $args);
839     return $tag;
840     }
841    
842    
843     /**
844     * build a <LI> tag with some content..
845     *
846     * @author Walt A. Boring
847     * @param mixed - n number of arguments
848     * as content for the tag.
849     * @return LItag object.
850     */
851     function html_li( ) {
852     $tag = new LItag;
853     $args = func_get_args();
854     call_user_func_array( array(&$tag, "add"), $args); return $tag;
855     }
856    
857     /**
858     * build a <LINK> tag with some content..
859     *
860     *
861     * @param string - the href link
862     * @param string - the rel attribute
863     * @param string - the type of content.
864     * @return LINKtag object.
865     */
866     function html_link($href, $rel, $type ) {
867     return new LINKtag( array("href" => $href,
868     "rel" => $rel,
869     "type" => $type) );
870     }
871    
872     /**
873     * build a <map> tag with some content.
874     *
875     * @param string - the name of the map.
876     * @param mixed - n number of arguments
877     * as content for the tag.
878     * @return MAPtag object.
879     */
880     function html_map( $name ) {
881     $tag = new MAPtag(array("name"=>$name) );
882     $num_args = func_num_args();
883     for ($i=1;$i<$num_args;$i++) {
884     $tag->add(func_get_arg($i));
885     }
886     return $tag;
887     }
888    
889     /**
890     * build a <meta> tag..
891     *
892     * @param string - the content value.
893     * @param string - the http-equiv value
894     * @param string - the name
895     *
896     * @return METAtag object.
897     */
898     function html_meta( $content, $http_equiv="", $name="" ) {
899     $attributes = array("content" => $content);
900    
901     if ($http_equiv != "") {
902     $attributes["http-equiv"] = $http_equiv;
903     }
904     if ($name != "") {
905     $attributes["name"] = $name;
906     }
907    
908     $tag = new METAtag( $attributes );
909     return $tag;
910     }
911    
912    
913     /**
914     * build a <noframes> tag with some content..
915     *
916     * @param mixed - n number of arguments
917     * as content for the tag.
918     * @return NOFRAMEStag object.
919     */
920     function html_noframes( ) {
921     $tag = new NOFRAMEStag;
922     $args = func_get_args();
923     call_user_func_array( array(&$tag, "add"), $args);
924     return $tag;
925     }
926    
927     /**
928     * build a <noscript> tag with some content..
929     *
930     * @param mixed - n number of arguments
931     * as content for the tag.
932     * @return NOSCRIPTtag object.
933     */
934     function html_noscript( ) {
935     $tag = new NOSCRIPTtag;
936     $args = func_get_args();
937     call_user_func_array( array(&$tag, "add"), $args);
938     return $tag;
939     }
940    
941     /**
942     * build a <object> tag with some content..
943     *
944     * @param mixed - n number of arguments
945     * as content for the tag.
946     * @return OBJECTtag object.
947     */
948     function html_object( ) {
949     $tag = new OBJECTtag;
950     $args = func_get_args();
951     call_user_func_array( array(&$tag, "add"), $args);
952     return $tag;
953     }
954    
955     /**
956     * build a <OL> tag with some content..
957     *
958     * @param mixed - n number of arguments
959     * as content for the tag.
960     * @return OLtag object.
961     */
962     function html_ol( ) {
963     $tag = new OLtag;
964     $args = func_get_args();
965     call_user_func_array( array(&$tag, "add"), $args);
966     return $tag;
967     }
968    
969     /**
970     * build a <OPTGROUP> tag with some content..
971     *
972     * @param mixed - n number of arguments
973     * as content for the tag.
974     * @return OPTGROUPtag object.
975     */
976     function html_optgroup( ) {
977     $tag = new OPTGROUPtag;
978     $args = func_get_args();
979     call_user_func_array( array(&$tag, "add"), $args);
980     return $tag;
981     }
982    
983     /**
984     * build a <OPTION> tag with some content..
985     *
986     * @param string - the value attribute
987     * @param string - the content for the tag.
988     *
989     * @return OPTIONtag object.
990     */
991     function html_option($value, $content) {
992     $tag = new OPTIONtag( array("value"=> $value) );
993     $tag->add( $content );
994     return $tag;
995     }
996    
997    
998     /**
999     * build a <p> tag.
1000     *
1001     * @param mixed - n number of arguments
1002     * as content for the tag.
1003     * @return Ptag object.
1004     */
1005     function html_p( ) {
1006     $tag = new Ptag;
1007     $args = func_get_args();
1008     call_user_func_array( array(&$tag, "add"), $args);
1009     return $tag;
1010     }
1011    
1012     /**
1013     * build a <param> tag.
1014     *
1015     * @param string - name of the tag
1016     * @return PARAMtag object.
1017     */
1018     function html_param($name, $value="") {
1019     $attributes = array("name" => $name);
1020     if ($value != "") {
1021     $attributes["value"] = $value;
1022     }
1023     return new PARAMtag( $attributes );
1024     }
1025    
1026     /**
1027     * build a <pre> tag with some content..
1028     *
1029     * @param mixed - n number of arguments
1030     * as content for the tag.
1031     * @return PREtag object.
1032     */
1033     function html_pre( ) {
1034     $tag = new PREtag;
1035     $args = func_get_args();
1036     call_user_func_array( array(&$tag, "add"), $args);
1037     return $tag;
1038     }
1039    
1040     /**
1041     * build a <q> tag with some content..
1042     *
1043     * @param mixed - n number of arguments
1044     * as content for the tag.
1045     * @return Qtag object.
1046     */
1047     function html_q( ) {
1048     $tag = new Qtag;
1049     $args = func_get_args();
1050     call_user_func_array( array(&$tag, "add"), $args);
1051     return $tag;
1052     }
1053    
1054     /**
1055     * build a <samp> tag with some content..
1056     *
1057     * @param mixed - n number of arguments
1058     * as content for the tag.
1059     * @return SAMPtag object.
1060     */
1061     function html_samp( ) {
1062     $tag = new SAMPtag;
1063     $args = func_get_args();
1064     call_user_func_array( array(&$tag, "add"), $args);
1065     return $tag;
1066     }
1067    
1068     /**
1069     * build a <script> tag with some content..
1070     *
1071     * @param src - the src
1072     * @param string - type of script
1073     * @return SCRIPTtag object.
1074     */
1075     function html_script($src="", $type="text/javascript") {
1076     $attributes = array("type" => $type);
1077     if ($src != "") {
1078     $attributes["src"] = $src;
1079     }
1080     return new SCRIPTtag( $attributes );
1081     }
1082    
1083     /**
1084     * <select> tag is defined in
1085     * form_utils.inc as
1086     * form_select()
1087     *
1088     */
1089    
1090     /**
1091     * build a small <small> tag with content.
1092     *
1093     * @author Suren Markossian
1094     * @return SMALLtag object.
1095     */
1096     function html_small() {
1097     $tag = new SMALLtag;
1098     $args = func_get_args();
1099     call_user_func_array( array(&$tag, "add"), $args);
1100     return $tag;
1101     }
1102    
1103    
1104     /**
1105     * build a bold <span> tag with content.
1106     *
1107     * @param string - the class for the
1108     * span.
1109     * @param mixed - n number of arguments
1110     * as content for the tag.
1111     * @return SPANtag object.
1112     */
1113     function html_span($class="") {
1114     $tag = new SPANtag;
1115     if ($class != "") {
1116     $tag->set_class( $class );
1117     }
1118     $num_args = func_num_args();
1119     for ($i=1;$i<$num_args;$i++) {
1120     $tag->add(func_get_arg($i));
1121     }
1122     return $tag;
1123     }
1124    
1125    
1126     /**
1127     * build a <strong> tag with some content..
1128     *
1129     * @param mixed - n number of arguments
1130     * as content for the tag.
1131     * @return STRONGtag object.
1132     */
1133     function html_strong( ) {
1134     $tag = new STRONGtag;
1135     $args = func_get_args();
1136     call_user_func_array( array(&$tag, "add"), $args);
1137     return $tag;
1138     }
1139    
1140     /**
1141     * build a <style> tag with some content.
1142     *
1143     * @param string - the type
1144     * text/css (DEFAULT),
1145     * text/javasript
1146     *
1147     * @param mixed - n number of arguments
1148     * as content for the tag.
1149     * @return STYLEtag object.
1150     */
1151     function html_style($type="text/css") {
1152     $tag = new STYLEtag( array("type" => $type) );
1153     $num_args = func_num_args();
1154     for ($i=1;$i<$num_args;$i++) {
1155     $tag->add(func_get_arg($i));
1156     }
1157     return $tag;
1158     }
1159    
1160     /**
1161     * build a <sub> tag with some content..
1162     *
1163     * @param mixed - n number of arguments
1164     * as content for the tag.
1165     * @return SUBtag object.
1166     */
1167     function html_sub( ) {
1168     $tag = new SUBtag;
1169     $args = func_get_args();
1170     call_user_func_array( array(&$tag, "add"), $args);
1171     return $tag;
1172     }
1173    
1174     /**
1175     * build a <sup> tag with some content..
1176     *
1177     * @param mixed - n number of arguments
1178     * as content for the tag.
1179     * @return SUPtag object.
1180     */
1181     function html_sup( ) {
1182     $tag = new SUPtag;
1183     $args = func_get_args();
1184     call_user_func_array( array(&$tag, "add"), $args);
1185     return $tag;
1186     }
1187    
1188     /**
1189     * Build a TABLEtag object
1190     * with some of the attributes set
1191     *
1192     * @param mixed - width attribute
1193     * default: 100%
1194     * @param mixed - border
1195     * default: 0
1196     * @param mixed - cellspacing
1197     * default: 0
1198     * @param mixed - cellpadding
1199     * default: 0
1200     * @param string - align the align
1201     * attribute
1202     * default: not set.
1203     * @return TABLEtag object.
1204     */
1205     function html_table( $width="100%", $border="0",
1206     $cellspacing="0",
1207     $cellpadding="0",
1208     $align=NULL) {
1209     $attributes = array( "width" => $width,
1210     "border" => $border,
1211     "cellspacing" => $cellspacing,
1212     "cellpadding" => $cellpadding);
1213    
1214     if ($align != NULL) {
1215     $attributes["align"] = $align;
1216     }
1217     return new TABLEtag( $attributes );
1218     }
1219    
1220     /**
1221     * build a <tbody> tag with some content..
1222     *
1223     * @param mixed - n number of arguments
1224     * as content for the tag.
1225     * @return TBODYtag object.
1226     */
1227     function html_tbody( ) {
1228     $tag = new TBODYtag;
1229     $args = func_get_args();
1230     call_user_func_array( array(&$tag, "add"), $args);
1231     return $tag;
1232     }
1233    
1234    
1235    
1236     /**
1237     * build an td tag object with content.
1238     *
1239     * @param string - the class to use
1240     * @param string - the alignment
1241     * left, right
1242     * @param mixed - n number of arguments
1243     * as content for the tag.
1244     * @return TDtag object.
1245     */
1246     function html_td($class="", $align="") {
1247     $attributes = array();
1248     if ($class != "") {
1249     $attributes["class"] = $class;
1250     }
1251     if ($align != "") {
1252     $attributes["align"] = $align;
1253     }
1254    
1255     $tag = new TDtag( $attributes );
1256     $num_args = func_num_args();
1257     for ($i=2;$i<$num_args;$i++) {
1258     $tag->add(func_get_arg($i));
1259     }
1260     return $tag;
1261     }
1262    
1263     /**
1264     * build a <tfoot> tag with content.
1265     *
1266     * @param mixed - n number of arguments
1267     * as content for the tag.
1268     * @return TFOOTtag object.
1269     */
1270     function html_tfoot( ) {
1271     $tag = new TFOOTtag;
1272     $args = func_get_args();
1273     call_user_func_array( array(&$tag, "add"), $args);
1274     return $tag;
1275     }
1276    
1277    
1278     /**
1279     * build a <th>$header</th> tag.
1280     *
1281     * @param mixed - n number of arguments
1282     * as content for the tag.
1283     * @return THtag object.
1284     */
1285     function html_th( ) {
1286     $tag = new THtag;
1287     $args = func_get_args();
1288     call_user_func_array( array(&$tag, "add"), $args);
1289     return $tag;
1290     }
1291    
1292     /**
1293     * build a <thhead> tag.
1294     *
1295     * @param mixed - n number of arguments
1296     * as content for the tag.
1297     * @return THEADtag object.
1298     */
1299     function html_thead( ) {
1300     $tag = new THEADtag;
1301     $args = func_get_args();
1302     call_user_func_array( array(&$tag, "add"), $args);
1303     return $tag;
1304     }
1305    
1306    
1307     /**
1308     * build a <title> tag with some content.
1309     *
1310     * @author Walt A. Boring
1311     * @param mixed - n number of arguments
1312     * as content for the tag.
1313     * @return TITLEtag object.
1314     */
1315     function html_title( ) {
1316     $tag = new TITLEtag;
1317     $args = func_get_args();
1318     call_user_func_array( array(&$tag, "add"), $args);
1319     return $tag;
1320     }
1321    
1322     /**
1323     * build a <tr> tag and contents
1324     *
1325     * @param string - class
1326     * @param mixed - n number of arguments
1327     * as content for the tag.
1328     * @return TRtag object.
1329     */
1330     function html_tr( $class="" ) {
1331     $tag = new TRtag;
1332    
1333     if ($class != "") {
1334     $tag->set_class( $class );
1335     }
1336    
1337     $num_args = func_num_args();
1338     for ($i=1;$i<$num_args;$i++) {
1339     $tag->add(func_get_arg($i));
1340     }
1341     return $tag;
1342     }
1343    
1344     /**
1345     * build a <tt> tag and contents
1346     *
1347     * @param mixed - n number of arguments
1348     * as content for the tag.
1349     * @return TTtag object.
1350     */
1351     function html_tt() {
1352     $tag = new TTtag;
1353     $args = func_get_args();
1354     call_user_func_array( array(&$tag, "add"), $args);
1355     return $tag;
1356     }
1357    
1358     /**
1359     * build a <u> tag and contents
1360     *
1361     * @param mixed - n number of arguments
1362     * as content for the tag.
1363     * @return Utag object.
1364     */
1365     function html_u( ) {
1366     $tag = new Utag;
1367     $args = func_get_args();
1368     call_user_func_array( array(&$tag, "add"), $args);
1369     return $tag;
1370     }
1371    
1372    
1373     /**
1374     * build a <UL> tag with content
1375     * wrapped in an <LI> tag.
1376     *
1377     * @author Walt A. Boring
1378     * @param mixed - n number of arguments
1379     * as content for the tag.
1380     * @return ULtag object.
1381     */
1382     function html_ul( ) {
1383     $tag = new ULtag;
1384     $args = func_get_args();
1385     call_user_func_array( array(&$tag, "add"), $args);
1386     return $tag;
1387     }
1388    
1389     /**
1390     * build a <var> tag and contents
1391     *
1392     * @param mixed - n number of arguments
1393     * as content for the tag.
1394     * @return VARtag object.
1395     */
1396     function html_var( ) {
1397     $tag = new VARtag;
1398     $args = func_get_args();
1399     call_user_func_array( array(&$tag, "add"), $args);
1400     return $tag;
1401     }
1402    
1403    
1404     /**
1405     * build a <xmp> tag with some content..
1406     *
1407     * @author Walt A. Boring
1408     * @param mixed - n number of arguments
1409     * as content for the tag.
1410     * @return XMPtag object.
1411     */
1412     function html_xmp( ) {
1413     $tag = new XMPtag;
1414     $args = func_get_args();
1415     call_user_func_array( array(&$tag, "add"), $args);
1416     return $tag;
1417     }
1418    
1419     /**
1420     * build a mailto url link .
1421     *
1422     * @author Walt A. Boring
1423     * @param string $email - the email address
1424     * for the mailto
1425     * @param string $subject - the subject for
1426     * the email
1427     * @param string $body - the body conent
1428     * for the email
1429     * @param string $cc = the cc email address.
1430     * @return CENTERtag object.
1431     */
1432     function mailto($email, $subject=NULL, $body=NULL, $cc=NULL){
1433    
1434     $mailto = "mailto:".$email."?";
1435     if ($subject) {
1436     $mailto .= "subject=".rawurlencode($subject);
1437     }
1438     if ($body) {
1439     $mailto .= "&body=".rawurlencode($body);
1440     }
1441     if ($cc) {
1442     $mailto .= "&cc=".rawurlencode($cc);
1443     }
1444    
1445     return html_a($mailto, $email);
1446     }
1447    
1448     ?>

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