Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

svggradient.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Render SVG gradients for IE 9
  4. *
  5. * Copyright (c) 2012, The Roundcube Dev Team
  6. *
  7. * The contents are subject to the Creative Commons Attribution-ShareAlike
  8. * License. It is allowed to copy, distribute, transmit and to adapt the work
  9. * by keeping credits to the original autors in the README file.
  10. * See http://creativecommons.org/licenses/by-sa/3.0/ for details.
  11. */
  12. ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
  13. header('Content-Type: image/svg+xml');
  14. header("Expires: ".gmdate("D, d M Y H:i:s", time()+864000)." GMT");
  15. header("Cache-Control: max-age=864000");
  16. header("Pragma: ");
  17. $svg_stops = '';
  18. $color_stops = explode(';', preg_replace('/[^a-f0-9,;%]/i', '', $_GET['c']));
  19. $gradient_coords = !empty($_GET['h']) ? 'x1="0%" y1="0%" x2="100%" y2="0%"' : 'x1="0%" y1="0%" x2="0%" y2="100%"';
  20. $last = count($color_stops) - 1;
  21. foreach ($color_stops as $i => $stop) {
  22. list($color, $offset) = explode(',', $stop);
  23. if ($offset)
  24. $offset = intval($offset);
  25. else
  26. $offset = $i == $last ? 100 : 0;
  27. $svg_stops .= '<stop offset="' . $offset . '%" stop-color="#' . $color . '" stop-opacity="1"/>';
  28. }
  29. ?>
  30. <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" version="1.0" width="100%" height="100%">
  31. <defs>
  32. <linearGradient id="LG1" <?php echo $gradient_coords; ?> spreadMethod="pad">
  33. <?php echo $svg_stops; ?>
  34. </linearGradient>
  35. </defs>
  36. <rect width="100%" height="100%" style="fill:url(#LG1);"/>
  37. </svg>