in its allow-list, so the logo the sidebar * has always built was being stripped down to its coloured square. Anything * that echoes logo markup — including the White-Label addon's replacement — * goes through `easy_invoice_kses_logo()` instead. * * @package EasyInvoice */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'easy_invoice_logo_allowed_html' ) ) { /** * post allow-list + the SVG subset the brand mark needs. * * @return array> */ function easy_invoice_logo_allowed_html() { $shared = [ 'class' => true, 'style' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true, 'opacity' => true, 'transform' => true, ]; return array_merge( wp_kses_allowed_html( 'post' ), [ 'svg' => array_merge( $shared, [ 'xmlns' => true, 'viewbox' => true, 'width' => true, 'height' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ] ), 'g' => $shared, 'defs' => [], 'title' => [], 'lineargradient' => [ 'id' => true, 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, 'gradientunits' => true ], 'stop' => [ 'offset' => true, 'stop-color' => true, 'stop-opacity' => true ], 'path' => array_merge( $shared, [ 'd' => true ] ), 'rect' => array_merge( $shared, [ 'x' => true, 'y' => true, 'width' => true, 'height' => true, 'rx' => true, 'ry' => true ] ), 'circle' => array_merge( $shared, [ 'cx' => true, 'cy' => true, 'r' => true ] ), 'line' => array_merge( $shared, [ 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true ] ), 'polyline' => array_merge( $shared, [ 'points' => true ] ), 'polygon' => array_merge( $shared, [ 'points' => true ] ), 'use' => array_merge( $shared, [ 'href' => true, 'xlink:href' => true ] ), ] ); } } if ( ! function_exists( 'easy_invoice_kses_logo' ) ) { /** * Sanitise logo markup without losing the SVG. * * @param string $html Logo markup. * @return string */ function easy_invoice_kses_logo( $html ) { return wp_kses( $html, easy_invoice_logo_allowed_html() ); } } if ( ! function_exists( 'easy_invoice_logo_mark_svg' ) ) { /** * The brand mark: the same document-and-tick used for the WordPress.org * icon and the admin menu, in colour. * * @param int $size Square size in pixels. * @return string */ function easy_invoice_logo_mark_svg( $size = 32 ) { $size = (int) $size; $id = 'ei-logo-g'; return ''; } }