remote ie global, replace with define

This commit is contained in:
Murphy 2024-12-11 19:57:35 -05:00
parent d5f1976e62
commit 691003c1ea
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17

View file

@ -3,12 +3,14 @@
/// IE 5 though 8 support IE conditional comments /// IE 5 though 8 support IE conditional comments
/// IE 4 does not (need to fall back to user agent) /// IE 4 does not (need to fall back to user agent)
$__ie_ver = FALSE; {
if (preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B)) { if (preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B)) {
$__ie_ver = $B['v']; define('IE_VERSION', $B['v']);
} else {
define('IE_VERSION', FALSE);
} }
if ($__ie_ver == FALSE || $__ie_ver > 4) {
if (IE_VERSION == FALSE || IE_VERSION > 4) {
// ADD COND COMMENTS // ADD COND COMMENTS
define('IE_START', "<!--[if lt IE 8 ]>"); define('IE_START', "<!--[if lt IE 8 ]>");
define('IE_END', "<![endif]-->"); define('IE_END', "<![endif]-->");
@ -17,13 +19,14 @@ if ($__ie_ver == FALSE || $__ie_ver > 4) {
define('IE_START', ''); define('IE_START', '');
define('IE_END', ''); define('IE_END', '');
} }
}
function ie(string $inner) { function ie(string $inner) {
return IE_START . $inner . IE_END; return IE_START . $inner . IE_END;
} }
function ie_ua(string $inner, int $ver) { function ie_ua(string $inner, int $ver) {
if ($GLOBALS['__ie_ver'] == $ver) if (IE_VERSION == $ver)
return $inner; return $inner;
return ''; return '';
} }