PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.7.0
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.7.0
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / helpers / kses-helpers.php
kses-helpers.php
156 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get the allowed SVG for safe output.
4 *
5 * @return array
6 */
7 function sc_allowed_svg_html(): array {
8 $kses_defaults = wp_kses_allowed_html( 'post' );
9
10 /**
11 * Filters the allowed SVG attributes.
12 *
13 * @param array $svg_args An array of allowed SVG attributes.
14 */
15 $svg_args = apply_filters(
16 'sc_allowed_svg_html',
17 array(
18 'svg' => array(
19 'class' => true,
20 'aria-hidden' => true,
21 'aria-labelledby' => true,
22 'role' => true,
23 'xmlns' => true,
24 'width' => true,
25 'height' => true,
26 'viewbox' => true,
27 'fill' => true,
28 'color' => true,
29 'fill-rule' => true,
30 'fill-opacity' => true,
31 'stroke' => true,
32 'stroke-width' => true,
33 'stroke-linecap' => true,
34 'stroke-linejoin' => true,
35 'stroke-miterlimit' => true,
36 ),
37 'defs' => array( 'id' => true ),
38 'clipPath' => array( 'id' => true ),
39 'clippath' => array( 'id' => true ),
40 'linearGradient' => array( 'id' => true ),
41 'lineargradient' => array( 'id' => true ),
42 'stop' => array(
43 'offset' => true,
44 'stop-color' => true,
45 'stopOpacity' => true,
46 'stop-opacity' => true,
47 ),
48 'g' => array(
49 'fill' => true,
50 'transform' => true,
51 'clip-path' => true,
52 ),
53 'title' => array( 'title' => true ),
54 'path' => array(
55 'd' => true,
56 'fill' => true,
57 'stroke' => true,
58 'stroke-linecap' => true,
59 'stroke-linejoin' => true,
60 'stroke-miterlimit' => true,
61 'transform' => true,
62 'clip-path' => true,
63 'fill-rule' => true,
64 'clip-rule' => true,
65 ),
66 'circle' => array(
67 'stroke' => true,
68 'stroke-linecap' => true,
69 'stroke-linejoin' => true,
70 'stroke-miterlimit' => true,
71 'cx' => true,
72 'cy' => true,
73 'r' => true,
74 'fill' => true,
75 ),
76 'ellipse' => array(
77 'stroke' => true,
78 'stroke-linecap' => true,
79 'stroke-linejoin' => true,
80 'stroke-miterlimit' => true,
81 'cx' => true,
82 'cy' => true,
83 'rx' => true,
84 'ry' => true,
85 'fill' => true,
86 ),
87 'line' => array(
88 'x1' => true,
89 'y1' => true,
90 'x2' => true,
91 'y2' => true,
92 'stroke' => true,
93 'stroke-linecap' => true,
94 'stroke-linejoin' => true,
95 'stroke-miterlimit' => true,
96 ),
97 'polygon' => array(
98 'points' => true,
99 'fill' => true,
100 'stroke' => true,
101 'stroke-linecap' => true,
102 'stroke-linejoin' => true,
103 'stroke-miterlimit' => true,
104 'clip-path' => true,
105 ),
106 'polyline' => array(
107 'points' => true,
108 'fill' => true,
109 'stroke' => true,
110 'stroke-linecap' => true,
111 'stroke-linejoin' => true,
112 'stroke-miterlimit' => true,
113 ),
114 'rect' => array(
115 'x' => true,
116 'y' => true,
117 'width' => true,
118 'height' => true,
119 'fill' => true,
120 'stroke' => true,
121 'stroke-linecap' => true,
122 'stroke-linejoin' => true,
123 'stroke-miterlimit' => true,
124 ),
125 'text' => array(
126 'x' => true,
127 'y' => true,
128 'dx' => true,
129 'dy' => true,
130 'font-size' => true,
131 'fill' => true,
132 'stroke' => true,
133 'stroke-linecap' => true,
134 'stroke-linejoin' => true,
135 'stroke-miterlimit' => true,
136 ),
137 )
138 );
139
140 return array_merge( $kses_defaults, $svg_args );
141 }
142
143 /**
144 * Add sizes and srcset to allowed image HTML.
145 *
146 * @return array
147 */
148 function sc_allowed_image_html(): array {
149 $kses = wp_kses_allowed_html( 'post' );
150
151 $kses['img']['srcset'] = true;
152 $kses['img']['sizes'] = true;
153
154 return $kses;
155 }
156