summaryrefslogtreecommitdiff
path: root/src/web/helpers
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-27 15:05:35 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-27 15:05:35 -0400
commitcc2c4de595bc3c4f7424d30342d74a5974fdefe0 (patch)
tree38a1daec46b11484c12eb6f08128dd05619b1e10 /src/web/helpers
parentie5 (diff)
downloadwebsite-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.tar.gz
website-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.tar.bz2
website-cc2c4de595bc3c4f7424d30342d74a5974fdefe0.zip
ie4
Diffstat (limited to 'src/web/helpers')
-rw-r--r--src/web/helpers/ie.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/web/helpers/ie.php b/src/web/helpers/ie.php
new file mode 100644
index 0000000..75e4015
--- /dev/null
+++ b/src/web/helpers/ie.php
@@ -0,0 +1,29 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+
+/// 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)) {
+ $__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', '');
+}
+
+function ie(string $inner) {
+ return IE_START . $inner . IE_END;
+}
+
+function ie_ua(string $inner, int $ver) {
+ if ($GLOBALS['__ie_ver'] == $ver)
+ return $inner;
+ return '';
+}