diff options
author | Freya Murphy <freya@freyacat.org> | 2024-12-11 19:57:35 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-12-11 19:57:35 -0500 |
commit | 691003c1eaccb5c762512163ff4d476b34c0e411 (patch) | |
tree | 49966a18cfbcf987f7a99f1bd6d2e1b55b2ca110 /src | |
parent | make ip nullable, refactor get_ip and get_req_route in router (diff) | |
download | website-691003c1eaccb5c762512163ff4d476b34c0e411.tar.gz website-691003c1eaccb5c762512163ff4d476b34c0e411.tar.bz2 website-691003c1eaccb5c762512163ff4d476b34c0e411.zip |
remote ie global, replace with define
Diffstat (limited to 'src')
-rw-r--r-- | src/web/helpers/ie.php | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/web/helpers/ie.php b/src/web/helpers/ie.php index 75e4015..ead6c1a 100644 --- a/src/web/helpers/ie.php +++ b/src/web/helpers/ie.php @@ -3,19 +3,22 @@ /// IE 5 though 8 support IE conditional comments /// 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)) { + define('IE_VERSION', $B['v']); + } else { + define('IE_VERSION', FALSE); + } -if (preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B)) { - $__ie_ver = $B['v']; -} -if ($__ie_ver == FALSE || $__ie_ver > 4) { - // ADD COND COMMENTS - define('IE_START', "<!--[if lt IE 8 ]>"); - define('IE_END', "<![endif]-->"); -} else { - // IE4 DETECTED, DO NOT ADD COMMENTS - define('IE_START', ''); - define('IE_END', ''); + if (IE_VERSION == FALSE || IE_VERSION > 4) { + // ADD COND COMMENTS + define('IE_START', "<!--[if lt IE 8 ]>"); + define('IE_END', "<![endif]-->"); + } else { + // IE4 DETECTED, DO NOT ADD COMMENTS + define('IE_START', ''); + define('IE_END', ''); + } } function ie(string $inner) { @@ -23,7 +26,7 @@ function ie(string $inner) { } function ie_ua(string $inner, int $ver) { - if ($GLOBALS['__ie_ver'] == $ver) + if (IE_VERSION == $ver) return $inner; return ''; } |