File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ function get_the_link( array $attributes, array $settings = [] ): string {
172172 // Implode all attributes for display purposes
173173 $ attributes_escaped = implode ( ' ' , $ attributes_escaped );
174174 // Escape content for display purposes
175- $ label = $ settings ['content ' ] ? escape_content_value ( $ settings ['content ' ], $ settings ['escape ' ]['content ' ] ?? 'esc_html ' ) : '' ;
175+ $ label = $ settings ['content ' ] ? escape_content_value ( $ settings ['content ' ], $ settings ['escape ' ]['content ' ] ?? 'wp_kses_post ' ) : '' ;
176176
177177 $ link_markup = sprintf ( '<a %s>%s%s</a> ' , $ attributes_escaped , $ settings ['new_window ' ], $ label );
178178
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ class Svg implements Service {
1616 * @param Service_Container $container
1717 */
1818 public function register ( Service_Container $ container ): void {
19+ add_filter ( 'wp_kses_allowed_html ' , [ $ this , 'allow_svg_tag ' ] );
1920 }
2021
2122 /**
@@ -52,9 +53,41 @@ public function get_the_icon( string $icon_class, array $additionnal_classes = [
5253
5354 /**
5455 * @param string $icon_class
55- * @param array $additionnal_classes
56+ * @param array $additionnal_classes
5657 */
5758 public function the_icon ( string $ icon_class , array $ additionnal_classes = [] ): void {
5859 echo $ this ->get_the_icon ( $ icon_class , $ additionnal_classes ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
5960 }
61+
62+ /**
63+ * Allow svg tag
64+ *
65+ * @param $tags
66+ *
67+ * @return mixed
68+ * @author Egidio CORICA
69+ */
70+ public function allow_svg_tag ( $ tags ) {
71+ $ tags ['svg ' ] = [
72+ 'xmlns ' => [],
73+ 'fill ' => [],
74+ 'viewbox ' => [],
75+ 'role ' => [],
76+ 'aria-hidden ' => [],
77+ 'focusable ' => [],
78+ 'class ' => [],
79+ ];
80+
81+ $ tags ['path ' ] = [
82+ 'd ' => [],
83+ 'fill ' => [],
84+ ];
85+
86+ $ tags ['use ' ] = [
87+ 'xmlns:xlink ' => [],
88+ 'xlink:href ' => [],
89+ ];
90+
91+ return $ tags ;
92+ }
6093}
You can’t perform that action at this time.
0 commit comments