wp/wp-admin/menu-header.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    57  *
    57  *
    58  * @global string $self
    58  * @global string $self
    59  * @global string $parent_file
    59  * @global string $parent_file
    60  * @global string $submenu_file
    60  * @global string $submenu_file
    61  * @global string $plugin_page
    61  * @global string $plugin_page
    62  * @global string $typenow
    62  * @global string $typenow      The post type of the current screen.
    63  *
    63  *
    64  * @param array $menu
    64  * @param array $menu
    65  * @param array $submenu
    65  * @param array $submenu
    66  * @param bool  $submenu_as_parent
    66  * @param bool  $submenu_as_parent
    67  */
    67  */
   121 		 * the default menu image so an icon can be added to div.wp-menu-image as background
   121 		 * the default menu image so an icon can be added to div.wp-menu-image as background
   122 		 * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
   122 		 * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
   123 		 * as special cases.
   123 		 * as special cases.
   124 		 */
   124 		 */
   125 		if ( ! empty( $item[6] ) ) {
   125 		if ( ! empty( $item[6] ) ) {
   126 			$img = '<img src="' . $item[6] . '" alt="" />';
   126 			$img = '<img src="' . esc_url( $item[6] ) . '" alt="" />';
   127 
   127 
   128 			if ( 'none' === $item[6] || 'div' === $item[6] ) {
   128 			if ( 'none' === $item[6] || 'div' === $item[6] ) {
   129 				$img = '<br />';
   129 				$img = '<br />';
   130 			} elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
   130 			} elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
   131 				$img       = '<br />';
   131 				$img = '<br />';
       
   132 				// The value is base64-encoded data, so esc_attr() is used here instead of esc_url().
   132 				$img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
   133 				$img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
   133 				$img_class = ' svg';
   134 				$img_class = ' svg';
   134 			} elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
   135 			} elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
   135 				$img       = '<br />';
   136 				$img       = '<br />';
   136 				$img_class = ' dashicons-before ' . sanitize_html_class( $item[6] );
   137 				$img_class = ' dashicons-before ' . sanitize_html_class( $item[6] );