diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-walker-nav-menu-edit.php --- a/wp/wp-admin/includes/class-walker-nav-menu-edit.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/class-walker-nav-menu-edit.php Tue Dec 15 13:49:49 2020 +0100 @@ -22,11 +22,11 @@ * * @since 3.0.0 * - * @param string $output Passed by reference. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args Not used. + * @param string $output Passed by reference. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. */ - public function start_lvl( &$output, $depth = 0, $args = array() ) {} + public function start_lvl( &$output, $depth = 0, $args = null ) {} /** * Ends the list of after the elements are added. @@ -35,11 +35,11 @@ * * @since 3.0.0 * - * @param string $output Passed by reference. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args Not used. + * @param string $output Passed by reference. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. */ - public function end_lvl( &$output, $depth = 0, $args = array() ) {} + public function end_lvl( &$output, $depth = 0, $args = null ) {} /** * Start the element output. @@ -49,13 +49,13 @@ * * @global int $_wp_nav_menu_max_depth * - * @param string $output Used to append additional content (passed by reference). - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args Not used. - * @param int $id Not used. + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + * @param int $id Not used. */ - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { + public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; @@ -71,15 +71,18 @@ ); $original_title = false; - if ( 'taxonomy' == $item->type ) { - $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); - if ( is_wp_error( $original_title ) ) { - $original_title = false; + + if ( 'taxonomy' === $item->type ) { + $original_object = get_term( (int) $item->object_id, $item->object ); + if ( $original_object && ! is_wp_error( $original_object ) ) { + $original_title = $original_object->name; } - } elseif ( 'post_type' == $item->type ) { + } elseif ( 'post_type' === $item->type ) { $original_object = get_post( $item->object_id ); - $original_title = get_the_title( $original_object->ID ); - } elseif ( 'post_type_archive' == $item->type ) { + if ( $original_object ) { + $original_title = get_the_title( $original_object->ID ); + } + } elseif ( 'post_type_archive' === $item->type ) { $original_object = get_post_type_object( $item->object ); if ( $original_object ) { $original_title = $original_object->labels->archives; @@ -96,15 +99,15 @@ if ( ! empty( $item->_invalid ) ) { $classes[] = 'menu-item-invalid'; - /* translators: %s: title of menu item which is invalid */ + /* translators: %s: Title of an invalid menu item. */ $title = sprintf( __( '%s (Invalid)' ), $item->title ); - } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { + } elseif ( isset( $item->post_status ) && 'draft' === $item->post_status ) { $classes[] = 'pending'; - /* translators: %s: title of menu item in draft status */ + /* translators: %s: Title of a menu item in draft status. */ $title = sprintf( __( '%s (Pending)' ), $item->title ); } - $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; + $title = ( ! isset( $item->label ) || '' === $item->label ) ? $title : $item->label; $submenu_text = ''; if ( 0 == $depth ) { @@ -119,9 +122,10 @@ type_label ); ?> - ', + wp_nonce_url( add_query_arg( array( 'action' => 'move-up-menu-item', @@ -130,13 +134,15 @@ remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ), 'move-menu_item' - ); + ), + esc_attr__( 'Move up' ) + ); ?> - " class="item-move-up" aria-label="">↑ | - ', + wp_nonce_url( add_query_arg( array( 'action' => 'move-down-menu-item', @@ -145,21 +151,37 @@ remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ), 'move-menu_item' - ); + ), + esc_attr__( 'Move down' ) + ); ?> - " class="item-move-down" aria-label="">↓ - + $item_id, + ), + remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) + ); + } + + printf( + '%s', + $item_id, + $edit_url, + esc_attr__( 'Edit menu item' ), + __( 'Edit' ) + ); + ?>