Changeset 45832 for branches/5.2
- Timestamp:
- 08/19/2019 04:06:15 AM (5 years ago)
- Location:
- branches/5.2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.2
- Property svn:mergeinfo changed
/trunk merged: 45655-45656
- Property svn:mergeinfo changed
-
branches/5.2/src/wp-includes/nav-menu.php
r44167 r45832 457 457 $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0; 458 458 459 if ( 'custom' != $args['menu-item-type'] ) { 460 /* if non-custom menu item, then: 461 * use original object's URL 462 * blank default title to sync with original object's 463 */ 459 if ( 'custom' === $args['menu-item-type'] ) { 460 // If custom menu item, trim the URL. 461 $args['menu-item-url'] = trim( $args['menu-item-url'] ); 462 } else { 463 /* 464 * If non-custom menu item, then: 465 * - use the original object's URL. 466 * - blank default title to sync with the original object's title. 467 */ 464 468 465 469 $args['menu-item-url'] = ''; -
branches/5.2/tests/phpunit/tests/post/nav-menu.php
r44966 r45832 150 150 'menu-item-type' => 'custom', 151 151 'menu-item-title' => 'Wordpress.org', 152 'menu-item- link'=> 'http://wordpress.org',152 'menu-item-url' => 'http://wordpress.org', 153 153 'menu-item-status' => 'publish', 154 154 ) … … 927 927 } 928 928 929 /** 930 * @ticket 47723 931 * @dataProvider data_trim_url_for_custom_item 932 */ 933 function test_trim_url_for_custom_item( $custom_url, $correct_url ) { 934 $custom_item_id = wp_update_nav_menu_item( 935 $this->menu_id, 936 0, 937 array( 938 'menu-item-type' => 'custom', 939 'menu-item-title' => 'WordPress.org', 940 'menu-item-url' => $custom_url, 941 'menu-item-status' => 'publish', 942 ) 943 ); 944 945 $custom_item = wp_setup_nav_menu_item( get_post( $custom_item_id ) ); 946 $this->assertEquals( $correct_url, $custom_item->url ); 947 } 948 949 /** 950 * Provides data for test_trim_url_for_custom_item(). 951 */ 952 function data_trim_url_for_custom_item() { 953 return array( 954 array( 'https://wordpress.org ', 'https://wordpress.org' ), 955 array( ' https://wordpress.org', 'https://wordpress.org' ), 956 ); 957 } 958 929 959 }
Note: See TracChangeset
for help on using the changeset viewer.