}
if ( ! empty( $item[4] ) )
- $class[] = $item[4];
+ $class[] = esc_attr( $item[4] );
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
$img = $img_style = '';
$img_class = ' dashicons-before';
- // 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.
- // Dashicons and base64-encoded data:image/svg_xml URIs are also handled as special cases.
+ /*
+ * 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. 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="" />';
echo "<li class='wp-submenu-head'>{$item[0]}</li>";
$first = true;
+
+ // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes
foreach ( $submenu_items as $sub_key => $sub_item ) {
if ( ! current_user_can( $sub_item[1] ) )
continue;
$class[] = 'current';
}
+ if ( ! empty( $sub_item[4] ) ) {
+ $class[] = esc_attr( $sub_item[4] );
+ }
+
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);