9cd67a0a |
1 | <?php |
2 | |
3 | /** |
8008456a |
4 | * html.php |
9cd67a0a |
5 | * |
6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * The idea is to inlcude here some functions to make easier |
10 | * the right to left implementation by "functionize" some |
11 | * html outputs. |
12 | * |
13 | * $Id$ |
14 | */ |
15 | |
8008456a |
16 | function html_tag( $tag, // Tag to output |
13cf639b |
17 | $val = '', // Value between tags (if empty only start tag is issued) |
8008456a |
18 | $align = '', // Alignment |
19 | $bgcolor = '', // Back color |
20 | $xtra = '' ) { // Extra options |
9cd67a0a |
21 | |
13cf639b |
22 | GLOBAL $languages, $squirrelmail_language; |
94ac35c6 |
23 | |
24 | $align = strtolower( $align ); |
25 | $dir = strtolower( $dir ); |
8008456a |
26 | $tag = strtoupper( $tag ); |
94ac35c6 |
27 | |
13cf639b |
28 | if ( isset( $languages[$squirrelmail_language]['DIR']) ) { |
29 | $dir = $languages[$squirrelmail_language]['DIR']; |
94ac35c6 |
30 | } else { |
31 | $dir = 'ltr'; |
32 | } |
33 | |
34 | if ( $dir == 'ltr' ) { |
35 | $rgt = 'right'; |
36 | $lft = 'left'; |
37 | } else { |
38 | $rgt = 'left'; |
39 | $lft = 'right'; |
40 | } |
41 | |
42 | if ( $bgcolor <> '' ) { |
43 | $bgc = " BGCOLOR=\"$bgcolor\""; |
44 | } |
45 | |
46 | switch ( $align ) { |
47 | case '': |
48 | $alg = ''; |
49 | break; |
50 | case 'right': |
51 | $alg = " ALIGN=\"$rgt\""; |
52 | break; |
8008456a |
53 | case 'left': |
54 | $alg = " ALIGN=\"$lft\""; |
94ac35c6 |
55 | default: |
8008456a |
56 | $alg = " ALIGN=\"$align\""; |
94ac35c6 |
57 | } |
9cd67a0a |
58 | |
13cf639b |
59 | $ret = "<$tag"; |
8008456a |
60 | |
13cf639b |
61 | if ( $dir <> 'ltr' ) { |
62 | $ret .= " DIR=\"$dir\""; |
63 | } |
8008456a |
64 | |
13cf639b |
65 | $ret .= "$bgc$alg"; |
8008456a |
66 | |
13cf639b |
67 | if ( $xtra <> '' ) { |
68 | $ret .= " $xtra"; |
69 | } |
70 | $ret .= '>'; |
8008456a |
71 | |
13cf639b |
72 | if ( $val <> '' ) { |
73 | $ret .= "$val</$tag>"; |
74 | } |
8008456a |
75 | |
94ac35c6 |
76 | return( $ret ); |
94ac35c6 |
77 | } |
78 | |
13cf639b |
79 | ?> |