Menus: Remove extra whitespace from URLs in Walker_Nav_Menu_Edit::start_el().

Props alexeyskr, SergeyBiryukov.
Fixes #47666.
Built from https://develop.svn.wordpress.org/trunk@45614


git-svn-id: http://core.svn.wordpress.org/trunk@45425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-07-09 20:45:56 +00:00
parent 29e5155969
commit bb365054b8
2 changed files with 65 additions and 36 deletions

View File

@ -119,9 +119,10 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
<span class="item-controls"> <span class="item-controls">
<span class="item-type"><?php echo esc_html( $item->type_label ); ?></span> <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
<span class="item-order hide-if-js"> <span class="item-order hide-if-js">
<a href="
<?php <?php
echo wp_nonce_url( printf(
'<a href="%s" class="item-move-up" aria-label="%s">&#8593;</a>',
wp_nonce_url(
add_query_arg( add_query_arg(
array( array(
'action' => 'move-up-menu-item', 'action' => 'move-up-menu-item',
@ -130,13 +131,15 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
), ),
'move-menu_item' 'move-menu_item'
); ),
esc_attr__( 'Move up' )
);
?> ?>
" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up' ); ?>">&#8593;</a>
| |
<a href="
<?php <?php
echo wp_nonce_url( printf(
'<a href="%s" class="item-move-down" aria-label="%s">&#8595;</a>',
wp_nonce_url(
add_query_arg( add_query_arg(
array( array(
'action' => 'move-down-menu-item', 'action' => 'move-down-menu-item',
@ -145,15 +148,31 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
), ),
'move-menu_item' 'move-menu_item'
); ),
esc_attr__( 'Move down' )
);
?> ?>
" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down' ); ?>">&#8595;</a>
</span> </span>
<a class="item-edit" id="edit-<?php echo $item_id; ?>" href=" <?php
<?php if ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) {
echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ); $edit_url = admin_url( 'nav-menus.php' );
?> } else {
" aria-label="<?php esc_attr_e( 'Edit menu item' ); ?>"><span class="screen-reader-text"><?php _e( 'Edit' ); ?></span></a> $edit_url = add_query_arg(
array(
'edit-menu-item' => $item_id,
),
remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) )
);
}
printf(
'<a class="item-edit" id="edit-%s" href="%s" aria-label="%s"><span class="screen-reader-text">%s</span></a>',
$item_id,
$edit_url,
esc_attr__( 'Edit menu item' ),
__( 'Edit' )
);
?>
</span> </span>
</div> </div>
</div> </div>
@ -223,32 +242,42 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
?> ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="
<?php
echo wp_nonce_url(
add_query_arg(
array(
'action' => 'delete-menu-item',
'menu-item' => $item_id,
),
admin_url( 'nav-menus.php' )
),
'delete-menu_item_' . $item_id
);
?>
"><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="
<?php <?php
echo esc_url( printf(
add_query_arg( '<a class="item-delete submitdelete deletion" id="delete-%s" href="%s">%s</a>',
array( $item_id,
'edit-menu-item' => $item_id, wp_nonce_url(
'cancel' => time(), add_query_arg(
array(
'action' => 'delete-menu-item',
'menu-item' => $item_id,
),
admin_url( 'nav-menus.php' )
), ),
admin_url( 'nav-menus.php' ) 'delete-menu_item_' . $item_id
) ),
__( 'Remove' )
);
?>
<span class="meta-sep hide-if-no-js"> | </span>
<?php
printf(
'<a class="item-cancel submitcancel hide-if-no-js" id="cancel-%s" href="%s#menu-item-settings-%s">%s</a>',
$item_id,
esc_url(
add_query_arg(
array(
'edit-menu-item' => $item_id,
'cancel' => time(),
),
admin_url( 'nav-menus.php' )
)
),
$item_id,
__( 'Cancel' )
); );
?> ?>
#menu-item-settings-<?php echo $item_id; ?>"><?php _e( 'Cancel' ); ?></a>
</div> </div>
<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45613'; $wp_version = '5.3-alpha-45614';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.