X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fhtml.php;h=62bcafcf13899962058621378416d1afee2ed26d;hb=e86403df82b8cd0ba6829e723fafe16df7aa1c21;hp=75429eb2840bf2f2230162d6eaf448be2ae7524c;hpb=94ac35c67eff63dedaa4a7013f13d3d7a5f04e86;p=squirrelmail.git diff --git a/functions/html.php b/functions/html.php index 75429eb2..62bcafcf 100644 --- a/functions/html.php +++ b/functions/html.php @@ -1,7 +1,7 @@ '' ) { - $bgc = " BGCOLOR=\"$bgcolor\""; - } - - switch ( $align ) { - case '': - $alg = ''; - break; - case 'right': - $alg = " ALIGN=\"$rgt\""; - break; - default: - $alg = " ALIGN=\"$lft\""; - } - - return( "<$tag DIR=\"$dir\"$bgc$alg $xtra>" ); - } - -/* - * Zookeeper - * Copyright (c) 2001 Partridge - * Licensed under the GNU GPL. For full terms see the file COPYING. - * - * $Id$ - */ - -/** - * ZkSvc_html - * - * The ZkSvc_html class manages html output. - */ -class ZkSvc_html { - - /* Constants */ - var $name = 'html'; // Module name - var $ver = '$Id$'; - - /* Properties */ - var $buffer; // Buffered output - var $htmlmod; // Module handler - var $title; // Page title - var $head_extras; // Extra header tags - var $bgcolor; // Background color - var $text; // Text color - var $link; // Link color - var $vlink; // Visited link color - var $alink; // Active link color - var $onload; // Onload event - var $onunload; // OnUnload event - var $dir; // Text direction - - var $tag_options; // Array of tag options array - - /** CONSTRUCTOR - */ - - function ZkSvc_html() { - - GLOBAL $languages, $language; - - $this->spool = FALSE; - $this->buffer = ''; - $this->title = 'Default zkHTML Title'; - $this->head_extras = ''; - $this->bgcolor = '#FFFFFF'; - $this->text = '#000000'; - $this->link = '#3300CC'; - $this->vlink = '#993333'; - $this->alink = '#993333'; - $this->onload = ''; - $this->onunload = ''; - - /* To know if a tag exists we check that it has got a place in the following array */ - $this->tag_options = array( 'table' => array( 'tag_name' => 'table', - 'tag_closed' => TRUE ), - 'tr' => array( 'tag_name' => 'tr', - 'tag_closed' => TRUE ), - 'th' => array( 'tag_name' => 'th', - 'tag_closed' => TRUE ), - 'td' => array( 'tag_name' => 'td', - 'tag_closed' => TRUE ), - 'li' => array( 'tag_name' => 'li', - 'tag_closed' => TRUE ), - 'ol' => array( 'tag_name' => 'ol', - 'tag_closed' => TRUE ), - 'form' => array( 'tag_name' => 'form', - 'tag_closed' => TRUE ), - 'input' => array( 'tag_name' => 'input', - 'tag_closed' => FALSE ), - 'br' => array( 'tag_name' => 'br', - 'tag_closed' => FALSE ), - 'textarea' => array( 'tag_name' => 'textarea', - 'tag_closed' => TRUE ), - 'p' => array( 'tag_name' => 'p', - 'tag_closed' => TRUE ), - 'a' => array( 'tag_name' => 'a', - 'tag_closed' => TRUE ), - 'center' => array( 'name' => 'center', - 'tag_closed' => TRUE ), - 'img' => array( 'name' => 'img', - 'tag_closed' => FALSE ), - 'font' => array( 'tag_closed' => TRUE ), - 'blockquote' => array( 'tag_name' => 'blockquote', - 'tag_closed' => TRUE ) - ); - - if ( isset( $languages[$language]['DIR']) ) { - $this->dir = strtolower( $languages[$language]['DIR'] ); - } else { - $this->dir = 'ltr'; - } - - } - - /** - * Return the name of this service. - * - * @return string the name of this service - */ - function getServiceName() { - return( $this->name ); - } + function html_tag( $tag, // Tag to output + $val = '', // Value between tags (if empty only start tag is issued) + $align = '', // Alignment + $bgcolor = '', // Back color + $xtra = '' ) { // Extra options - /** - * Replace the Zookeeper html module loaded for this service. (no modules yet) - * - */ - function loadModule(&$module) { - $this->htmlmod = &$module; - } + GLOBAL $languages, $squirrelmail_language; - /** - * Outputs the buffer and re-initialize it. - * - */ - function flush( $string = '' ) { - echo $this->buffer . $string; - flush(); - $this->buffer = ''; - } + $align = strtolower( $align ); + $bgc = ''; + $tag = strtoupper( $tag ); - /** - * Builds a header string - * - */ - function header( $string = '' ) { + if ( isset( $languages[$squirrelmail_language]['DIR']) ) { + $dir = $languages[$squirrelmail_language]['DIR']; + } else { + $dir = 'ltr'; + } - // It initializes the buffer. - $this->buffer = '' . - "\n\n"; + if ( $dir == 'ltr' ) { + $rgt = 'right'; + $lft = 'left'; + } else { + $rgt = 'left'; + $lft = 'right'; + } - if( $this->head_extras <> '' || $this->title <> '' ) { + if ( $bgcolor <> '' ) { + $bgc = " BGCOLOR=\"$bgcolor\""; + } - $this->buffer .= "
\n"; + switch ( $align ) { + case '': + $alg = ''; + break; + case 'right': + $alg = " ALIGN=\"$rgt\""; + break; + case 'left': + $alg = " ALIGN=\"$lft\""; + break; + default: + $alg = " ALIGN=\"$align\""; + break; + } - if( $this->title <> '' ) - $this->buffer .= "