name => SVG inner markup. */ private static function shapes(): array { return array( 'bag' => '', 'bag-solid' => '', 'cart' => '', 'basket' => '', ); } /** * An icon's SVG (the chosen one by default). The markup is built here or passed through * kses_svg(), so it can be printed as is. * * @param string $name bag, bag-solid, cart, basket or custom; empty for the setting. * @param int $size Width and height in px (0 leaves them to CSS). */ public static function icon( string $name = '', int $size = 24 ): string { if ( '' === $name ) { $name = (string) Settings::get( 'side_cart_button_icon', 'bag' ); } $dims = $size > 0 ? ' width="' . $size . '" height="' . $size . '"' : ''; if ( 'custom' === $name ) { $custom = self::kses_svg( (string) Settings::get( 'side_cart_button_svg' ) ); if ( '' !== $custom ) { // Our own sizing and hiding replace the file's. if ( preg_match( '/^]*>/i', $custom, $open ) ) { $tag = preg_replace( '/\s(?:width|height|aria-hidden|focusable)=(?:"[^"]*"|\'[^\']*\')/i', '', $open[0] ); $tag = preg_replace( '/^