1 |
jonen |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
/** |
4 |
|
|
* This file contains miscellaneous functions |
5 |
|
|
* used by the phpHtmllibs that don't seem to |
6 |
|
|
* fit in the other files. |
7 |
|
|
* |
8 |
|
|
* $Id: misc_utils.inc,v 1.6 2002/11/04 22:47:46 hemna Exp $ |
9 |
|
|
* |
10 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
11 |
|
|
* @package phpHtmlLib |
12 |
|
|
* |
13 |
|
|
*/ |
14 |
|
|
|
15 |
|
|
/** |
16 |
|
|
* This builds an IMG tag object that is used |
17 |
|
|
* to show a spacer image. |
18 |
|
|
* <img src="spacer.gif" width="$width" height="$height"> |
19 |
|
|
* |
20 |
|
|
* @param int $width - the width of the img |
21 |
|
|
* ( DEFAULT : 1) |
22 |
|
|
* @param int $height - the height of the img |
23 |
|
|
* ( DEFAULT : 1) |
24 |
|
|
* @param string $img_path - The dir that holds the spacer.gif file. |
25 |
|
|
* ( DEFAULT = "/images" ) |
26 |
|
|
* @return IMGtag object. |
27 |
|
|
*/ |
28 |
|
|
function build_spacergif_imgtag( $width=1, $height=1, $img_path="/images" ) { |
29 |
|
|
$attributes = array( "src" => $img_path."/spacer.gif", |
30 |
|
|
"width" => $width, |
31 |
|
|
"height" => $height); |
32 |
|
|
return html_img( $img_path."/spacer.gif", $width, $height ); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
/** |
36 |
|
|
* This function pushes an array of keys |
37 |
|
|
* into an HTMLTagObject |
38 |
|
|
* |
39 |
|
|
* @param object - the HTMLTagClass object. |
40 |
|
|
* @param array - the array of data to push |
41 |
|
|
* array("blah", "foo", "bar"); |
42 |
|
|
* @return HTMLTagClass object. |
43 |
|
|
*/ |
44 |
|
|
function push_args( $tag_object, $args ) { |
45 |
|
|
foreach ($args as $content) { |
46 |
|
|
$tag_object->push( $content ); |
47 |
|
|
} |
48 |
|
|
return $tag_object; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
/** |
54 |
|
|
* This function creates a new container widget |
55 |
|
|
* and stuffs all the args into it. |
56 |
|
|
* |
57 |
|
|
* @param mixed - variable # of args |
58 |
|
|
* @return ContainerWidget object |
59 |
|
|
*/ |
60 |
|
|
function container() { |
61 |
|
|
$container = new ContainerWidget; |
62 |
|
|
|
63 |
|
|
$num_args = func_num_args(); |
64 |
|
|
for ($i=0;$i<$num_args;$i++) { |
65 |
|
|
$container->push(func_get_arg($i)); |
66 |
|
|
} |
67 |
|
|
return $container; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
|
71 |
|
|
/** |
72 |
|
|
* This function is used to wrap |
73 |
|
|
* a string in the standard |
74 |
|
|
* CDATA section wrapper for a |
75 |
|
|
* tag content |
76 |
|
|
* |
77 |
|
|
* <![CDATA[ CONTENT ]]> |
78 |
|
|
* |
79 |
|
|
* @param string the content to wrap |
80 |
|
|
*/ |
81 |
|
|
function cdata_wrapper( $content ) { |
82 |
|
|
$tag = new CDATAtag; |
83 |
|
|
|
84 |
|
|
$num_args = func_num_args(); |
85 |
|
|
for ($i=0;$i<$num_args;$i++) { |
86 |
|
|
$tag->push(func_get_arg($i)); |
87 |
|
|
} |
88 |
|
|
return $tag; |
89 |
|
|
} |
90 |
|
|
?> |