Menus: Replace http with https in placeholders.

Encourage the use of https with the placeholder text in menus.

Fixes #46312
Props aksl95, audrasjb, celloexpressions, SergeyBiryukov, jorbin.


git-svn-id: https://develop.svn.wordpress.org/trunk@46330 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2019-09-26 20:30:59 +00:00
parent d9e6a5dd68
commit 2ff8e68e15
4 changed files with 6 additions and 6 deletions

View File

@ -950,7 +950,7 @@
processMethod = processMethod || api.addMenuItemToBottom;
if ( '' === url || 'http://' == url ) {
if ( '' === url || 'https://' == url || 'http://' == url ) {
$('#customlinkdiv').addClass('form-invalid');
return false;
}
@ -962,7 +962,7 @@
$( '.customlinkdiv .spinner' ).removeClass( 'is-active' );
// Set custom link form back to defaults
$('#custom-menu-item-name').val('').blur();
$('#custom-menu-item-url').val('http://');
$( '#custom-menu-item-url' ).val( '' ).attr( 'placeholder', 'https://' );
});
},

View File

@ -584,7 +584,7 @@
this.currentMenuControl.addItemToMenu( menuItem );
// Reset the custom link form.
itemUrl.val( 'http://' );
itemUrl.val( '' ).attr( 'placeholder', 'https://' );
itemName.val( '' );
},

View File

@ -292,7 +292,7 @@ function wp_nav_menu_item_link_meta_box() {
<input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
<p id="menu-item-url-wrap" class="wp-clearfix">
<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://" />
</p>
<p id="menu-item-name-wrap" class="wp-clearfix">
@ -918,7 +918,7 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
// And item type either isn't set.
! isset( $_item_object_data['menu-item-type'] ) ||
// Or URL is the default.
in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||
! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
// Or it *is* a custom menu item that already exists.
! empty( $_item_object_data['menu-item-db-id'] )

View File

@ -1192,7 +1192,7 @@ final class WP_Customize_Nav_Menus {
<input type="hidden" value="custom" id="custom-menu-item-type" name="menu-item[-1][menu-item-type]" />
<p id="menu-item-url-wrap" class="wp-clearfix">
<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
<input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://">
<input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://">
</p>
<p id="menu-item-name-wrap" class="wp-clearfix">
<label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>