Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
37 | PointedEar | 1 | <?php |
2 | |||
3 | namespace de\pointedears\css\least; |
||
4 | |||
5 | /** |
||
6 | * Mix-ins for the LEAST extended CSS parser |
||
7 | * |
||
8 | * @author Thomas 'PointedEars' Lahn <php@PointedEars.de> |
||
9 | */ |
||
10 | abstract class Mixins |
||
11 | { |
||
12 | /** |
||
13 | * Generates a CSS property declaration whose value is a |
||
14 | * <code>linear-gradient()</code> function call for |
||
15 | * supported function name prefixes. |
||
16 | * |
||
17 | * @param string $property |
||
18 | * Property to be declared |
||
19 | * @param string $params |
||
20 | * Parameters to the <code>linear-gradient()</code> function |
||
21 | * @param array $prefixes |
||
22 | * Pass to override supported function name prefixes |
||
23 | */ |
||
24 | public static function linear_gradient ($property, $params, |
||
25 | array $prefixes = array('-moz-', '-o-', '-webkit-', '')) |
||
26 | { |
||
27 | ob_start(); |
||
28 | foreach ($prefixes as $prefix) |
||
29 | { |
||
30 | echo "{$property}: {$prefix}linear-gradient({$params});\n"; |
||
31 | } |
||
32 | ob_end_flush(); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Generates a CSS property declaration whose value is a |
||
37 | * <code>radial-gradient()</code> function call for |
||
38 | * supported function name prefixes. |
||
39 | * |
||
40 | * @param string $property |
||
41 | * Property to be declared |
||
42 | * @param string $params |
||
43 | * Parameters to the <code>radial-gradient()</code> function |
||
44 | * @param array $prefixes |
||
45 | * Pass to override supported function name prefixes |
||
46 | */ |
||
47 | public static function radial_gradient ($property, $params, |
||
48 | array $prefixes = array('-moz-', '-webkit-')) |
||
49 | { |
||
50 | ob_start(); |
||
51 | foreach ($prefixes as $prefix) |
||
52 | { |
||
53 | echo "{$property}: {$prefix}radial-gradient({$params});\n"; |
||
54 | } |
||
55 | ob_end_flush(); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Generates a CSS <code>transition</code> property declaration |
||
60 | * for supported property name prefixes. |
||
61 | * |
||
62 | * @param string $suffix |
||
63 | * Property name suffix |
||
64 | * @param string $value |
||
65 | * Property value |
||
66 | * @param array $prefixes |
||
67 | * Pass to override supported property name prefixes |
||
68 | */ |
||
69 | public static function transition ($suffix, $value, |
||
70 | array $prefixes = array('-moz-', '-webkit-', '')) |
||
71 | { |
||
72 | ob_start(); |
||
73 | foreach ($prefixes as $prefix) |
||
74 | { |
||
75 | echo "{$prefix}transition{$suffix}: {$value};\n"; |
||
76 | } |
||
77 | ob_end_flush(); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Generates a CSS <code>@keyframes</code> section for |
||
82 | * supported keyword prefixes. |
||
83 | * |
||
84 | * @param string $name |
||
85 | * Animation name as referred by the <code>animation-name</code> |
||
86 | * property declaration. |
||
87 | * @param string $data |
||
88 | * Keyframes data |
||
89 | * @param array $prefixes |
||
90 | * Pass to override supported keyword prefixes |
||
91 | */ |
||
92 | public static function keyframes ($name, $data, |
||
93 | array $prefixes = array('-moz-', '-webkit-', '')) |
||
94 | { |
||
95 | ob_start(); |
||
96 | foreach ($prefixes as $prefix) |
||
97 | { |
||
98 | echo "@{$prefix}keyframes {$name} {\n {$data}\n}\n"; |
||
99 | } |
||
100 | ob_end_flush(); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Generates a CSS <code>animation</code> property declaration |
||
105 | * for supported property name prefixes. |
||
106 | * |
||
107 | * @param string $suffix |
||
108 | * Property name suffix |
||
109 | * @param string $value |
||
110 | * Property value |
||
111 | * @param array $prefixes |
||
112 | * Pass to override supported property name prefixes |
||
113 | */ |
||
114 | public static function animation ($suffix, $value, |
||
115 | array $prefixes = array('-moz-', '-webkit-', '')) |
||
116 | { |
||
117 | ob_start(); |
||
118 | foreach ($prefixes as $prefix) |
||
119 | { |
||
120 | echo "{$prefix}animation{$suffix}: {$value};\n"; |
||
121 | } |
||
122 | ob_end_flush(); |
||
123 | } |
||
124 | } |