Make WordPress Core

Ticket #46312: 46312.4.diff

File 46312.4.diff, 3.8 KB (added by aksl95, 6 years ago)

Edit placeholder in javascripts files (nav-menu & customizer). Update the custom link check (http & https).

  • src/js/_enqueues/lib/nav-menu.js

    diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js
    index cd62acc36f..016925b4b5 100644
    a b  
    949949
    950950                        processMethod = processMethod || api.addMenuItemToBottom;
    951951
    952                         if ( '' === url || 'http://' == url ) {
     952                        if ( '' === url || 'https://' == url || 'http://' == url ) {
    953953                                $('#customlinkdiv').addClass('form-invalid');
    954954                                return false;
    955955                        }
     
    961961                                $( '.customlinkdiv .spinner' ).removeClass( 'is-active' );
    962962                                // Set custom link form back to defaults
    963963                                $('#custom-menu-item-name').val('').blur();
    964                                 $('#custom-menu-item-url').val('http://');
     964                                $( '#custom-menu-item-url' ).val( '' ).attr( 'placeholder', 'https://' );
    965965                        });
    966966                },
    967967
  • src/js/_enqueues/wp/customize/nav-menus.js

    diff --git a/src/js/_enqueues/wp/customize/nav-menus.js b/src/js/_enqueues/wp/customize/nav-menus.js
    index b6560366c1..1a836a31e9 100644
    a b  
    583583                        this.currentMenuControl.addItemToMenu( menuItem );
    584584
    585585                        // Reset the custom link form.
    586                         itemUrl.val( 'http://' );
     586                        itemUrl.val( '' ).attr( 'placeholder', 'https://' );
    587587                        itemName.val( '' );
    588588                },
    589589
  • src/wp-admin/includes/nav-menu.php

    diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
    index 0539e7f253..d85bcf561b 100644
    a b function wp_nav_menu_item_link_meta_box() { 
    292292                <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
    293293                <p id="menu-item-url-wrap" class="wp-clearfix">
    294294                        <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
    295                         <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://" />
     295                        <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://" />
    296296                </p>
    297297
    298298                <p id="menu-item-name-wrap" class="wp-clearfix">
    function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) { 
    894894                                        // And item type either isn't set.
    895895                                        ! isset( $_item_object_data['menu-item-type'] ) ||
    896896                                        // Or URL is the default.
    897                                         in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
     897                                        in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||
    898898                                        ! ( '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)
    899899                                        // Or it *is* a custom menu item that already exists.
    900900                                        ! empty( $_item_object_data['menu-item-db-id'] )
  • src/wp-includes/class-wp-customize-nav-menus.php

    diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php
    index a6bae20c87..98f219ee1a 100644
    a b final class WP_Customize_Nav_Menus { 
    11871187                                <input type="hidden" value="custom" id="custom-menu-item-type" name="menu-item[-1][menu-item-type]" />
    11881188                                <p id="menu-item-url-wrap" class="wp-clearfix">
    11891189                                        <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
    1190                                         <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://">
     1190                                        <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://">
    11911191                                </p>
    11921192                                <p id="menu-item-name-wrap" class="wp-clearfix">
    11931193                                        <label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>