3 * Theme based generator for SVG gradient.
5 * @package PhpMyAdmin-theme
7 header('Content-Type: image/svg+xml');
8 header('Expires: ' . gmdate('D, d M Y H:i:s', time() +
3600) . ' GMT');
11 * Gets single color from GET parameters validating it.
13 * @param string $get_name Name of parameter in request
14 * @param string $default Default value
16 * @return string Color name or code.
18 function PMA_gradientGetColor($get_name, $default)
20 // get color from GET args, only alphanumeric characters
21 $opts = array('options' => array('regexp' => '/^[a-z0-9]+$/i'));
22 $color = filter_input(INPUT_GET
, $get_name, FILTER_VALIDATE_REGEXP
, $opts);
23 if (preg_match('/^[a-f0-9]{6}$/', $color)) {
26 return $color ?
$color : $default;
29 $from = PMA_gradientGetColor('from', 'white');
30 $to = PMA_gradientGetColor('to', 'blank');
32 echo '<?xml version="1.0" ?>';
35 xmlns
="http://www.w3.org/2000/svg"
36 preserveAspectRatio
="none"
37 version
="1.0" width
="100%" height
="100%">
39 <linearGradient id
="linear-gradient" x1
="0%" y1
="0%" x2
="0%" y2
="100%">
42 stop
-color
="<?php echo $from; ?>"
47 stop
-color
="<?php echo $to; ?>"
52 <rect width
="100%" height
="100%" style
="fill:url(#linear-gradient);" />