Skip to content
Permalink
Browse files

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
  • Loading branch information...
whyisjake committed Sep 26, 2019
1 parent d9e6a5d commit 2ff8e68e15720c1253665a9f3100638e2eddb165
@@ -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://' );
});
},

@@ -584,7 +584,7 @@
this.currentMenuControl.addItemToMenu( menuItem );

// Reset the custom link form.
itemUrl.val( 'http://' );
itemUrl.val( '' ).attr( 'placeholder', 'https://' );
itemName.val( '' );
},

@@ -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'] )
@@ -1192,7 +1192,7 @@ protected function print_custom_links_available_menu_item() {
<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>

0 comments on commit 2ff8e68

Please sign in to comment.
You can’t perform that action at this time.