equal
deleted
inserted
replaced
96 $aria_attributes .= 'aria-current="page"'; |
96 $aria_attributes .= 'aria-current="page"'; |
97 } |
97 } |
98 } else { |
98 } else { |
99 $class[] = 'wp-not-current-submenu'; |
99 $class[] = 'wp-not-current-submenu'; |
100 if ( ! empty( $submenu_items ) ) { |
100 if ( ! empty( $submenu_items ) ) { |
101 $aria_attributes .= 'aria-haspopup="true"'; |
101 $aria_attributes .= 'data-ariahaspopup'; |
102 } |
102 } |
103 } |
103 } |
104 |
104 |
105 if ( ! empty( $item[4] ) ) { |
105 if ( ! empty( $item[4] ) ) { |
106 $class[] = esc_attr( $item[4] ); |
106 $class[] = esc_attr( $item[4] ); |
110 $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
110 $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
111 $img = ''; |
111 $img = ''; |
112 $img_style = ''; |
112 $img_style = ''; |
113 $img_class = ' dashicons-before'; |
113 $img_class = ' dashicons-before'; |
114 |
114 |
115 if ( false !== strpos( $class, 'wp-menu-separator' ) ) { |
115 if ( str_contains( $class, 'wp-menu-separator' ) ) { |
116 $is_separator = true; |
116 $is_separator = true; |
117 } |
117 } |
118 |
118 |
119 /* |
119 /* |
120 * If the string 'none' (previously 'div') is passed instead of a URL, don't output |
120 * If the string 'none' (previously 'div') is passed instead of a URL, don't output |
125 if ( ! empty( $item[6] ) ) { |
125 if ( ! empty( $item[6] ) ) { |
126 $img = '<img src="' . esc_url( $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 ( str_starts_with( $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 // The value is base64-encoded data, so esc_attr() is used here instead of esc_url(). |
133 $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; |
133 $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; |
134 $img_class = ' svg'; |
134 $img_class = ' svg'; |
135 } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) { |
135 } elseif ( str_starts_with( $item[6], 'dashicons-' ) ) { |
136 $img = '<br />'; |
136 $img = '<br />'; |
137 $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); |
137 $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); |
138 } |
138 } |
139 } |
139 } |
140 $arrow = '<div class="wp-menu-arrow"><div></div></div>'; |
140 $arrow = '<div class="wp-menu-arrow"><div></div></div>'; |
224 if ( isset( $submenu_file ) ) { |
224 if ( isset( $submenu_file ) ) { |
225 if ( $submenu_file === $sub_item[2] ) { |
225 if ( $submenu_file === $sub_item[2] ) { |
226 $class[] = 'current'; |
226 $class[] = 'current'; |
227 $aria_attributes .= ' aria-current="page"'; |
227 $aria_attributes .= ' aria-current="page"'; |
228 } |
228 } |
229 // If plugin_page is set the parent must either match the current page or not physically exist. |
229 /* |
230 // This allows plugin pages with the same hook to exist under different parents. |
230 * If plugin_page is set the parent must either match the current page or not physically exist. |
|
231 * This allows plugin pages with the same hook to exist under different parents. |
|
232 */ |
231 } elseif ( |
233 } elseif ( |
232 ( ! isset( $plugin_page ) && $self === $sub_item[2] ) |
234 ( ! isset( $plugin_page ) && $self === $sub_item[2] ) |
233 || ( isset( $plugin_page ) && $plugin_page === $sub_item[2] |
235 || ( isset( $plugin_page ) && $plugin_page === $sub_item[2] |
234 && ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) ) |
236 && ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) ) |
235 ) { |
237 ) { |