X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/42aebe6945a3a60c8f73853bea2c8b202d64a20b..refs/tags/wordpress-3.8:/wp-admin/menu-header.php
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index 10ad1395..6b775f4c 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -67,11 +67,25 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
- $img = '';
+ $img = $img_style = $img_class = '';
+
// 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] ) ? '
' : '';
+ // Dashicons and base64-encoded data:image/svg_xml URIs are also handled as special cases.
+ if ( ! empty( $item[6] ) ) {
+ $img = '';
+
+ if ( 'none' === $item[6] || 'div' === $item[6] ) {
+ $img = '
';
+ } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
+ $img = '
';
+ $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
+ $img_class = ' svg';
+ } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
+ $img = '
';
+ $img_class = ' dashicons ' . sanitize_html_class( $item[6] );
+ }
+ }
$arrow = '