From f1f47a13c1a9f7006b09f99d671c314d73dfb39b Mon Sep 17 00:00:00 2001 From: LebCit Date: Wed, 12 Dec 2018 08:35:34 +0200 Subject: [PATCH] Added full_screen_morphing_search_add_svg_tags( $svg_tags ) --- functions-full-screen-morphing-search.php | 41 ++++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/functions-full-screen-morphing-search.php b/functions-full-screen-morphing-search.php index 3ca2667..e710d87 100644 --- a/functions-full-screen-morphing-search.php +++ b/functions-full-screen-morphing-search.php @@ -41,6 +41,40 @@ function fsmsp_customize_preview_js() { } add_action( 'customize_preview_init', 'fsmsp_customize_preview_js' ); +if ( ! function_exists( 'full_screen_morphing_search_add_svg_tags' ) ) { + /** + * Function to add svg tags to wp_kses_allowed_html + * + * @see http://themelovin.com/add-allowed-html-tags-wordpress/ + * + * To secure the output, to correctly escape it ! + * @see https://wordpress.stackexchange.com/a/316943 + * + * @param array $svg_tags The SVG Tags. + * + * @since 2.4 + */ + function full_screen_morphing_search_add_svg_tags( $svg_tags ) { + $svg_tags['svg'] = array( + 'version' => true, + 'id' => true, + 'xmlns' => true, + 'xmlns:xlink' => true, + 'x' => true, + 'y' => true, + 'viewbox' => true, // <= Must be lower case ! + 'style' => true, + 'xml:space' => true, + ); + $svg_tags['path'] = array( + 'fill' => true, + 'd' => true, + ); + return $svg_tags; + } + add_filter( 'wp_kses_allowed_html', 'full_screen_morphing_search_add_svg_tags' ); +} + /** * Require Kirki. */ @@ -173,11 +207,8 @@ if ( class_exists( 'Kirki' ) ) { 'transport' => 'auto', 'output' => array( array( - 'element' => array( - '#Layer_1 circle', - '#Layer_1 line', - ), - 'property' => 'stroke', + 'element' => '#Capa_1 path', + 'property' => 'fill', ), ), )