summaryrefslogtreecommitdiff
path: root/skins/larry/svggradient.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-01-21 16:07:52 +0000
committerthomascube <thomas@roundcube.net>2012-01-21 16:07:52 +0000
commitd5fedc34ab68c809d06165e8852910962c52b989 (patch)
treefec81652cc3fccf3dfec888546543f25126df134 /skins/larry/svggradient.php
parent071c78c3a4f344f1005c8be8ba895a91452de6b9 (diff)
CSS optimizations for IE8/9
Diffstat (limited to 'skins/larry/svggradient.php')
-rw-r--r--skins/larry/svggradient.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/skins/larry/svggradient.php b/skins/larry/svggradient.php
new file mode 100644
index 000000000..25b2e9082
--- /dev/null
+++ b/skins/larry/svggradient.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Render SVG gradients for IE 9
+ *
+ * Copyright (c) 2012, The Roundcube Dev Team
+ *
+ * The contents are subject to the Creative Commons Attribution-ShareAlike
+ * License. It is allowed to copy, distribute, transmit and to adapt the work
+ * by keeping credits to the original autors in the README file.
+ * See http://creativecommons.org/licenses/by-sa/3.0/ for details.
+ *
+ * $Id$
+ */
+
+header('Content-Type: image/svg+xml');
+header("Expires: ".gmdate("D, d M Y H:i:s", time()+864000)." GMT");
+header("Cache-Control: max-age=864000");
+header("Pragma: ");
+
+$svg_stops = '';
+$color_stops = explode(';', preg_replace('/[^a-f0-9,;%]/i', '', $_GET['c']));
+$last = count($color_stops) - 1;
+foreach ($color_stops as $i => $stop) {
+ list($color, $offset) = explode(',', $stop);
+ if ($offset)
+ $offset = intval($offset);
+ else
+ $offset = $i == $last ? 100 : 0;
+
+ $svg_stops .= '<stop offset="' . $offset . '%" stop-color="#' . $color . '" stop-opacity="1"/>';
+}
+
+?>
+<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" version="1.0" width="100%" height="100%">
+<defs>
+ <linearGradient id="LG1" x1="0%" y1="0%" x2="0%" y2="100%" spreadMethod="pad">
+ <?php echo $svg_stops; ?>
+ </linearGradient>
+</defs>
+<rect width="100%" height="100%" style="fill:url(#LG1);"/>
+</svg>