Make WordPress Core

Ticket #25147: 25147.menu_icon_data_image_v1.patch

File 25147.menu_icon_data_image_v1.patch, 1.6 KB (added by wpsmith, 11 years ago)
  • wp-admin/menu-header.php

     
    7070                $img = '';
    7171                // if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
    7272                // so an icon can be added to div.wp-menu-image as background with CSS.
    73                 if ( ! empty( $item[6] ) )
    74                         $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
     73                if ( ! empty( $item[6] ) ) {
     74            $attr = preg_match( '/^data:image\b/m', $item[6] ) ? ' height="16px" width="16px"' : '';
     75                        $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt=""' . $attr . ' />';
     76        }
    7577                $arrow = '<div class="wp-menu-arrow"><div></div></div>';
    7678
    7779                $title = wptexturize( $item[0] );
  • wp-admin/menu.php

     
    108108        $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
    109109        $ptype_for_id = sanitize_html_class( $ptype );
    110110        if ( is_string( $ptype_obj->menu_icon ) ) {
    111                 $menu_icon   = esc_url( $ptype_obj->menu_icon );
     111                $menu_icon   = preg_match( '/data:image/', $ptype_obj->menu_icon ) ? $ptype_obj->menu_icon : esc_url( $ptype_obj->menu_icon );
    112112                $ptype_class = $ptype_for_id;
    113113        } else {
    114114                $menu_icon   = 'none';