- $img = '';
- // if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
- // so an icon can be added to div.wp-menu-image as background with CSS.
- if ( ! empty( $item[6] ) )
- $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
+ $img = $img_style = '';
+ $img_class = ' dashicons-before';
+
+ if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
+ $is_separator = true;
+ }
+
+ /*
+ * If the string 'none' (previously 'div') is passed instead of a URL, don't output
+ * the default menu image so an icon can be added to div.wp-menu-image as background
+ * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
+ * as special cases.
+ */
+ if ( ! empty( $item[6] ) ) {
+ $img = '<img src="' . $item[6] . '" alt="" />';
+
+ if ( 'none' === $item[6] || 'div' === $item[6] ) {
+ $img = '<br />';
+ } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
+ $img = '<br />';
+ $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
+ $img_class = ' svg';
+ } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
+ $img = '<br />';
+ $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] );
+ }
+ }