From a2dcfae7b4973b494226e832f49c06bdbf67c283 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 29 Sep 2002 16:33:47 +0000 Subject: [PATCH] some more browser detection and using title instead of alt for images for all browsers but netscape 4.x --- etemplate/inc/class.html.inc.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/etemplate/inc/class.html.inc.php b/etemplate/inc/class.html.inc.php index ae97f07508..d2a0da0d87 100644 --- a/etemplate/inc/class.html.inc.php +++ b/etemplate/inc/class.html.inc.php @@ -14,18 +14,22 @@ class html { + var $user_agent,$ua_version; var $prefered_img_title; function html() - { - global $HTTP_USER_AGENT; - // should be Ok for all HTML 4 compatible browsers - $this->prefered_img_title = stristr($HTTP_USER_AGENT,'konqueror') ? 'title' : 'alt'; + { // should be Ok for all HTML 4 compatible browsers + if (!eregi('compatible; ([a-z_]+)[/ ]+([0-9.]+)',$GLOBALS['HTTP_USER_AGENT'],$parts)) + eregi('^([a-z_]+)/([0-9.]+)',$GLOBALS['HTTP_USER_AGENT'],$parts); + list(,$this->user_agent,$this->ua_version) = $parts; + $this->user_agent = strtolower($this->user_agent); + $this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'ALT' : 'TITLE'; + //echo "

HTTP_USER_AGENT='$GLOBALS[HTTP_USER_AGENT]', UserAgent: '$this->user_agent', Version: '$this->ua_version', img_title: '$this->prefered_img_title'

\n"; } function div($content,$options='') { - return "
\n$content
\n"; + return "
\n$content
\n"; } function input_hidden($vars,$value='',$ignore_empty=True) @@ -37,10 +41,9 @@ class html while (list($name,$value) = each($vars)) { if (is_array($value)) $value = serialize($value); - $del = strchr($value,'"') ? "'" : '"'; if (!$ignore_empty || $value && !($name == 'filter' && $value == 'none')) // dont need to send all the empty vars { - $html .= "\n"; + $html .= "\n"; } } return $html;