html.php 1.7 KB

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