Changeset 51739
- Timestamp:
- 09/08/2021 03:35:32 PM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-walker-category-checklist.php
r49197 r51739 62 62 * 63 63 * @since 2.5.1 64 * @since 5.9.0 Renamed `$category` to `$data_object` to match parent class for PHP 8 named parameter support. 64 65 * 65 * @param string $output Used to append additional content (passed by reference).66 * @param WP_Term $ categoryThe current term object.67 * @param int $depth Depth of the term in reference to parents. Default 0.68 * @param array $args An array of arguments. @see wp_terms_checklist()69 * @param int $id ID of the current term.66 * @param string $output Used to append additional content (passed by reference). 67 * @param WP_Term $data_object The current term object. 68 * @param int $depth Depth of the term in reference to parents. Default 0. 69 * @param array $args An array of arguments. @see wp_terms_checklist() 70 * @param int $id ID of the current term. 70 71 */ 71 public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 72 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $id = 0 ) { 73 // Restores the more descriptive, specific name for use within this method. 74 $category = $data_object; 75 72 76 if ( empty( $args['taxonomy'] ) ) { 73 77 $taxonomy = 'category'; -
trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php
r49936 r51739 62 62 * 63 63 * @since 3.0.0 64 * @since 5.9.0 Renamed `$item` to `$data_object` to match parent class for PHP 8 named parameter support. 64 65 * 65 66 * @global int $_nav_menu_placeholder 66 67 * @global int|string $nav_menu_selected_id 67 68 * 68 * @param string $output Used to append additional content (passed by reference).69 * @param WP_Post $ itemMenu item data object.70 * @param int $depth Depth of menu item. Used for padding.71 * @param stdClass $args Not used.72 * @param int $id Not used.69 * @param string $output Used to append additional content (passed by reference). 70 * @param WP_Post $data_object Menu item data object. 71 * @param int $depth Depth of menu item. Used for padding. 72 * @param stdClass $args Not used. 73 * @param int $id Not used. 73 74 */ 74 public function start_el( &$output, $ item, $depth = 0, $args = null, $id = 0 ) {75 public function start_el( &$output, $data_object, $depth = 0, $args = null, $id = 0 ) { 75 76 global $_nav_menu_placeholder, $nav_menu_selected_id; 76 77 78 // Restores the more descriptive, specific name for use within this method. 79 $menu_item = $data_object; 80 77 81 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; 78 $possible_object_id = isset( $ item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder;79 $possible_db_id = ( ! empty( $ item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;82 $possible_object_id = isset( $menu_item->post_type ) && 'nav_menu_item' === $menu_item->post_type ? $menu_item->object_id : $_nav_menu_placeholder; 83 $possible_db_id = ( ! empty( $menu_item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $menu_item->ID : 0; 80 84 81 85 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; … … 85 89 $output .= '<input type="checkbox"' . wp_nav_menu_disabled_check( $nav_menu_selected_id, false ) . ' class="menu-item-checkbox'; 86 90 87 if ( ! empty( $ item->front_or_home ) ) {91 if ( ! empty( $menu_item->front_or_home ) ) { 88 92 $output .= ' add-to-top'; 89 93 } 90 94 91 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="' . esc_attr( $ item->object_id ) . '" /> ';95 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="' . esc_attr( $menu_item->object_id ) . '" /> '; 92 96 93 if ( ! empty( $ item->label ) ) {94 $title = $ item->label;95 } elseif ( isset( $ item->post_type ) ) {97 if ( ! empty( $menu_item->label ) ) { 98 $title = $menu_item->label; 99 } elseif ( isset( $menu_item->post_type ) ) { 96 100 /** This filter is documented in wp-includes/post-template.php */ 97 $title = apply_filters( 'the_title', $ item->post_title, $item->ID );101 $title = apply_filters( 'the_title', $menu_item->post_title, $menu_item->ID ); 98 102 } 99 103 100 $output .= isset( $title ) ? esc_html( $title ) : esc_html( $ item->title );104 $output .= isset( $title ) ? esc_html( $title ) : esc_html( $menu_item->title ); 101 105 102 if ( empty( $ item->label ) && isset( $item->post_type ) && 'page' === $item->post_type ) {106 if ( empty( $menu_item->label ) && isset( $menu_item->post_type ) && 'page' === $menu_item->post_type ) { 103 107 // Append post states. 104 $output .= _post_states( $ item, false );108 $output .= _post_states( $menu_item, false ); 105 109 } 106 110 … … 109 113 // Menu item hidden fields. 110 114 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; 111 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="' . esc_attr( $ item->object ) . '" />';112 $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr( $ item->menu_item_parent ) . '" />';113 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="' . esc_attr( $ item->type ) . '" />';114 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="' . esc_attr( $ item->title ) . '" />';115 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_attr( $ item->url ) . '" />';116 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="' . esc_attr( $ item->target ) . '" />';117 $output .= '<input type="hidden" class="menu-item-attr-title" name="menu-item[' . $possible_object_id . '][menu-item-attr-title]" value="' . esc_attr( $ item->attr_title ) . '" />';118 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="' . esc_attr( implode( ' ', $ item->classes ) ) . '" />';119 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="' . esc_attr( $ item->xfn ) . '" />';115 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="' . esc_attr( $menu_item->object ) . '" />'; 116 $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr( $menu_item->menu_item_parent ) . '" />'; 117 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="' . esc_attr( $menu_item->type ) . '" />'; 118 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="' . esc_attr( $menu_item->title ) . '" />'; 119 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_attr( $menu_item->url ) . '" />'; 120 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="' . esc_attr( $menu_item->target ) . '" />'; 121 $output .= '<input type="hidden" class="menu-item-attr-title" name="menu-item[' . $possible_object_id . '][menu-item-attr-title]" value="' . esc_attr( $menu_item->attr_title ) . '" />'; 122 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="' . esc_attr( implode( ' ', $menu_item->classes ) ) . '" />'; 123 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="' . esc_attr( $menu_item->xfn ) . '" />'; 120 124 } 121 125 -
trunk/src/wp-admin/includes/class-walker-nav-menu-edit.php
r51010 r51739 47 47 * @see Walker_Nav_Menu::start_el() 48 48 * @since 3.0.0 49 * @since 5.9.0 Renamed `$item` to `$data_object` to match parent class for PHP 8 named parameter support. 49 50 * 50 51 * @global int $_wp_nav_menu_max_depth 51 52 * 52 * @param string $output Used to append additional content (passed by reference).53 * @param WP_Post $ itemMenu item data object.54 * @param int $depth Depth of menu item. Used for padding.55 * @param stdClass $args Not used.56 * @param int $id Not used.53 * @param string $output Used to append additional content (passed by reference). 54 * @param WP_Post $data_object Menu item data object. 55 * @param int $depth Depth of menu item. Used for padding. 56 * @param stdClass $args Not used. 57 * @param int $id Not used. 57 58 */ 58 public function start_el( &$output, $ item, $depth = 0, $args = null, $id = 0 ) {59 public function start_el( &$output, $data_object, $depth = 0, $args = null, $id = 0 ) { 59 60 global $_wp_nav_menu_max_depth; 61 62 // Restores the more descriptive, specific name for use within this method. 63 $menu_item = $data_object; 60 64 $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; 61 65 62 66 ob_start(); 63 $item_id = esc_attr( $ item->ID );67 $item_id = esc_attr( $menu_item->ID ); 64 68 $removed_args = array( 65 69 'action', … … 73 77 $original_title = false; 74 78 75 if ( 'taxonomy' === $ item->type ) {76 $original_object = get_term( (int) $ item->object_id, $item->object );79 if ( 'taxonomy' === $menu_item->type ) { 80 $original_object = get_term( (int) $menu_item->object_id, $menu_item->object ); 77 81 if ( $original_object && ! is_wp_error( $original_object ) ) { 78 82 $original_title = $original_object->name; 79 83 } 80 } elseif ( 'post_type' === $ item->type ) {81 $original_object = get_post( $ item->object_id );84 } elseif ( 'post_type' === $menu_item->type ) { 85 $original_object = get_post( $menu_item->object_id ); 82 86 if ( $original_object ) { 83 87 $original_title = get_the_title( $original_object->ID ); 84 88 } 85 } elseif ( 'post_type_archive' === $ item->type ) {86 $original_object = get_post_type_object( $ item->object );89 } elseif ( 'post_type_archive' === $menu_item->type ) { 90 $original_object = get_post_type_object( $menu_item->object ); 87 91 if ( $original_object ) { 88 92 $original_title = $original_object->labels->archives; … … 92 96 $classes = array( 93 97 'menu-item menu-item-depth-' . $depth, 94 'menu-item-' . esc_attr( $ item->object ),98 'menu-item-' . esc_attr( $menu_item->object ), 95 99 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), 96 100 ); 97 101 98 $title = $ item->title;99 100 if ( ! empty( $ item->_invalid ) ) {102 $title = $menu_item->title; 103 104 if ( ! empty( $menu_item->_invalid ) ) { 101 105 $classes[] = 'menu-item-invalid'; 102 106 /* translators: %s: Title of an invalid menu item. */ 103 $title = sprintf( __( '%s (Invalid)' ), $ item->title );104 } elseif ( isset( $ item->post_status ) && 'draft' === $item->post_status ) {107 $title = sprintf( __( '%s (Invalid)' ), $menu_item->title ); 108 } elseif ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { 105 109 $classes[] = 'pending'; 106 110 /* translators: %s: Title of a menu item in draft status. */ 107 $title = sprintf( __( '%s (Pending)' ), $ item->title );111 $title = sprintf( __( '%s (Pending)' ), $menu_item->title ); 108 112 } 109 113 110 $title = ( ! isset( $ item->label ) || '' === $item->label ) ? $title : $item->label;114 $title = ( ! isset( $menu_item->label ) || '' === $menu_item->label ) ? $title : $menu_item->label; 111 115 112 116 $submenu_text = ''; … … 125 129 </label> 126 130 <span class="item-controls"> 127 <span class="item-type"><?php echo esc_html( $ item->type_label ); ?></span>131 <span class="item-type"><?php echo esc_html( $menu_item->type_label ); ?></span> 128 132 <span class="item-order hide-if-js"> 129 133 <?php … … 186 190 187 191 <div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>"> 188 <?php if ( 'custom' === $ item->type ) : ?>192 <?php if ( 'custom' === $menu_item->type ) : ?> 189 193 <p class="field-url description description-wide"> 190 194 <label for="edit-menu-item-url-<?php echo $item_id; ?>"> 191 195 <?php _e( 'URL' ); ?><br /> 192 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->url ); ?>" />196 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->url ); ?>" /> 193 197 </label> 194 198 </p> … … 197 201 <label for="edit-menu-item-title-<?php echo $item_id; ?>"> 198 202 <?php _e( 'Navigation Label' ); ?><br /> 199 <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->title ); ?>" />203 <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->title ); ?>" /> 200 204 </label> 201 205 </p> … … 203 207 <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>"> 204 208 <?php _e( 'Title Attribute' ); ?><br /> 205 <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->post_excerpt ); ?>" />209 <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->post_excerpt ); ?>" /> 206 210 </label> 207 211 </p> 208 212 <p class="field-link-target description"> 209 213 <label for="edit-menu-item-target-<?php echo $item_id; ?>"> 210 <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $ item->target, '_blank' ); ?> />214 <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $menu_item->target, '_blank' ); ?> /> 211 215 <?php _e( 'Open link in a new tab' ); ?> 212 216 </label> … … 215 219 <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> 216 220 <?php _e( 'CSS Classes (optional)' ); ?><br /> 217 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $ item->classes ) ); ?>" />221 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $menu_item->classes ) ); ?>" /> 218 222 </label> 219 223 </p> … … 221 225 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> 222 226 <?php _e( 'Link Relationship (XFN)' ); ?><br /> 223 <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->xfn ); ?>" />227 <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->xfn ); ?>" /> 224 228 </label> 225 229 </p> … … 227 231 <label for="edit-menu-item-description-<?php echo $item_id; ?>"> 228 232 <?php _e( 'Description' ); ?><br /> 229 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $ item->description ); // textarea_escaped ?></textarea>233 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $menu_item->description ); // textarea_escaped ?></textarea> 230 234 <span class="description"><?php _e( 'The description will be displayed in the menu if the current theme supports it.' ); ?></span> 231 235 </label> … … 238 242 * @since 5.4.0 239 243 * 240 * @param int $item_id Menu item ID.241 * @param WP_Post $ itemMenu item data object.242 * @param int $depth Depth of menu item. Used for padding.243 * @param stdClass $args An object of menu item arguments.244 * @param int $id Nav menu ID.244 * @param int $item_id Menu item ID. 245 * @param WP_Post $menu_item Menu item data object. 246 * @param int $depth Depth of menu item. Used for padding. 247 * @param stdClass $args An object of menu item arguments. 248 * @param int $id Nav menu ID. 245 249 */ 246 do_action( 'wp_nav_menu_item_custom_fields', $item_id, $ item, $depth, $args, $id );250 do_action( 'wp_nav_menu_item_custom_fields', $item_id, $menu_item, $depth, $args, $id ); 247 251 ?> 248 252 … … 257 261 258 262 <div class="menu-item-actions description-wide submitbox"> 259 <?php if ( 'custom' !== $ item->type && false !== $original_title ) : ?>263 <?php if ( 'custom' !== $menu_item->type && false !== $original_title ) : ?> 260 264 <p class="link-to-original"> 261 265 <?php 262 266 /* translators: %s: Link to menu item's original object. */ 263 printf( __( 'Original: %s' ), '<a href="' . esc_attr( $ item->url ) . '">' . esc_html( $original_title ) . '</a>' );267 printf( __( 'Original: %s' ), '<a href="' . esc_attr( $menu_item->url ) . '">' . esc_html( $original_title ) . '</a>' ); 264 268 ?> 265 269 </p> … … 304 308 305 309 <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> 306 <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->object_id ); ?>" />307 <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->object ); ?>" />308 <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->menu_item_parent ); ?>" />309 <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->menu_order ); ?>" />310 <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $ item->type ); ?>" />310 <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->object_id ); ?>" /> 311 <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->object ); ?>" /> 312 <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->menu_item_parent ); ?>" /> 313 <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" /> 314 <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->type ); ?>" /> 311 315 </div><!-- .menu-item-settings--> 312 316 <ul class="menu-item-transport"></ul> -
trunk/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-page.php
r51322 r51739 21 21 * 22 22 * @since Twenty Twenty 1.0 23 * @since Twenty Twenty 1.9 Renamed `$page` to `$data_object` to match parent class for PHP 8 named parameter support. 23 24 * 24 25 * @see Walker::start_el() 25 26 * 26 27 * @param string $output Used to append additional content. Passed by reference. 27 * @param WP_Post $ pagePage data object.28 * @param WP_Post $data_object Page data object. 28 29 * @param int $depth Optional. Depth of page. Used for padding. Default 0. 29 30 * @param array $args Optional. Array of arguments. Default empty array. 30 31 * @param int $current_page Optional. Page ID. Default 0. 31 32 */ 32 public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { 33 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_page = 0 ) { 34 // Restores the more descriptive, specific name for use within this method. 35 $page = $data_object; 33 36 34 37 if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { -
trunk/src/wp-includes/class-walker-category-dropdown.php
r49183 r51739 45 45 * 46 46 * @since 2.1.0 47 * @since 5.9.0 Renamed `$category` to `$data_object` to match parent class for PHP 8 named parameter support. 47 48 * 48 49 * @see Walker::start_el() 49 50 * 50 * @param string $output Used to append additional content (passed by reference).51 * @param WP_Term $ categoryCategory data object.52 * @param int $depth Depth of category. Used for padding.53 * @param array $args Uses 'selected', 'show_count', and 'value_field' keys, if they exist.54 * See wp_dropdown_categories().55 * @param int $id Optional. ID of the current category. Default 0 (unused).51 * @param string $output Used to append additional content (passed by reference). 52 * @param WP_Term $data_object Category data object. 53 * @param int $depth Depth of category. Used for padding. 54 * @param array $args Uses 'selected', 'show_count', and 'value_field' keys, if they exist. 55 * See wp_dropdown_categories(). 56 * @param int $id Optional. ID of the current category. Default 0 (unused). 56 57 */ 57 public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 58 $pad = str_repeat( ' ', $depth * 3 ); 58 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $id = 0 ) { 59 // Restores the more descriptive, specific name for use within this method. 60 $category = $data_object; 61 $pad = str_repeat( ' ', $depth * 3 ); 59 62 60 63 /** This filter is documented in wp-includes/category-template.php */ -
trunk/src/wp-includes/class-walker-category.php
r49183 r51739 87 87 * 88 88 * @since 2.1.0 89 * @since 5.9.0 Renamed `$category` to `$data_object` to match parent class for PHP 8 named parameter support. 89 90 * 90 91 * @see Walker::start_el() 91 92 * 92 * @param string $output Used to append additional content (passed by reference). 93 * @param WP_Term $category Category data object. 94 * @param int $depth Optional. Depth of category in reference to parents. Default 0. 95 * @param array $args Optional. An array of arguments. See wp_list_categories(). Default empty array. 96 * @param int $id Optional. ID of the current category. Default 0. 97 */ 98 public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { 93 * @param string $output Used to append additional content (passed by reference). 94 * @param WP_Term $data_object Category data object. 95 * @param int $depth Optional. Depth of category in reference to parents. Default 0. 96 * @param array $args Optional. An array of arguments. See wp_list_categories(). 97 * Default empty array. 98 * @param int $id Optional. ID of the current category. Default 0. 99 */ 100 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $id = 0 ) { 101 // Restores the more descriptive, specific name for use within this method. 102 $category = $data_object; 103 99 104 /** This filter is documented in wp-includes/category-template.php */ 100 105 $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category ); -
trunk/src/wp-includes/class-walker-comment.php
r50816 r51739 158 158 * 159 159 * @since 2.7.0 160 * @since 5.9.0 Renamed `$comment` to `$data_object` to match parent class for PHP 8 named parameter support. 160 161 * 161 162 * @see Walker::start_el() … … 164 165 * @global WP_Comment $comment Global comment object. 165 166 * 166 * @param string $output Used to append additional content. Passed by reference. 167 * @param WP_Comment $comment Comment data object. 168 * @param int $depth Optional. Depth of the current comment in reference to parents. Default 0. 169 * @param array $args Optional. An array of arguments. Default empty array. 170 * @param int $id Optional. ID of the current comment. Default 0 (unused). 171 */ 172 public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { 167 * @param string $output Used to append additional content. Passed by reference. 168 * @param WP_Comment $data_object Comment data object. 169 * @param int $depth Optional. Depth of the current comment in reference to parents. Default 0. 170 * @param array $args Optional. An array of arguments. Default empty array. 171 * @param int $id Optional. ID of the current comment. Default 0 (unused). 172 */ 173 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $id = 0 ) { 174 // Restores the more descriptive, specific name for use within this method. 175 $comment = $data_object; 176 173 177 $depth++; 174 178 $GLOBALS['comment_depth'] = $depth; -
trunk/src/wp-includes/class-walker-nav-menu.php
r50823 r51739 107 107 * @since 3.0.0 108 108 * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added. 109 * @since 5.9.0 Renamed `$item` to `$data_object` to match parent class for PHP 8 named parameter support. 109 110 * 110 111 * @see Walker::start_el() 111 112 * 112 * @param string $output Used to append additional content (passed by reference). 113 * @param WP_Post $item Menu item data object. 114 * @param int $depth Depth of menu item. Used for padding. 115 * @param stdClass $args An object of wp_nav_menu() arguments. 116 * @param int $id Current item ID. 117 */ 118 public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { 113 * @param string $output Used to append additional content (passed by reference). 114 * @param WP_Post $data_object Menu item data object. 115 * @param int $depth Depth of menu item. Used for padding. 116 * @param stdClass $args An object of wp_nav_menu() arguments. 117 * @param int $id Current item ID. 118 */ 119 public function start_el( &$output, $data_object, $depth = 0, $args = null, $id = 0 ) { 120 // Restores the more descriptive, specific name for use within this method. 121 $menu_item = $data_object; 122 119 123 if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { 120 124 $t = ''; … … 126 130 $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; 127 131 128 $classes = empty( $ item->classes ) ? array() : (array) $item->classes;129 $classes[] = 'menu-item-' . $ item->ID;132 $classes = empty( $menu_item->classes ) ? array() : (array) $menu_item->classes; 133 $classes[] = 'menu-item-' . $menu_item->ID; 130 134 131 135 /** … … 134 138 * @since 4.4.0 135 139 * 136 * @param stdClass $args An object of wp_nav_menu() arguments.137 * @param WP_Post $ itemMenu item data object.138 * @param int $depth Depth of menu item. Used for padding.139 */ 140 $args = apply_filters( 'nav_menu_item_args', $args, $ item, $depth );140 * @param stdClass $args An object of wp_nav_menu() arguments. 141 * @param WP_Post $menu_item Menu item data object. 142 * @param int $depth Depth of menu item. Used for padding. 143 */ 144 $args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth ); 141 145 142 146 /** … … 146 150 * @since 4.1.0 The `$depth` parameter was added. 147 151 * 148 * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element.149 * @param WP_Post $ item The current menu item.150 * @param stdClass $args An object of wp_nav_menu() arguments.151 * @param int $depth Depth of menu item. Used for padding.152 */ 153 $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $ item, $args, $depth ) );152 * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element. 153 * @param WP_Post $menu_item The current menu item object. 154 * @param stdClass $args An object of wp_nav_menu() arguments. 155 * @param int $depth Depth of menu item. Used for padding. 156 */ 157 $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) ); 154 158 $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; 155 159 … … 160 164 * @since 4.1.0 The `$depth` parameter was added. 161 165 * 162 * @param string $menu_id The ID that is applied to the menu item's `<li>` element.163 * @param WP_Post $ itemThe current menu item.164 * @param stdClass $args An object of wp_nav_menu() arguments.165 * @param int $depth Depth of menu item. Used for padding.166 */ 167 $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $ item->ID, $item, $args, $depth );166 * @param string $menu_id The ID that is applied to the menu item's `<li>` element. 167 * @param WP_Post $menu_item The current menu item. 168 * @param stdClass $args An object of wp_nav_menu() arguments. 169 * @param int $depth Depth of menu item. Used for padding. 170 */ 171 $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth ); 168 172 $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; 169 173 … … 171 175 172 176 $atts = array(); 173 $atts['title'] = ! empty( $ item->attr_title ) ? $item->attr_title : '';174 $atts['target'] = ! empty( $ item->target ) ? $item->target : '';175 if ( '_blank' === $ item->target && empty( $item->xfn ) ) {177 $atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : ''; 178 $atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : ''; 179 if ( '_blank' === $menu_item->target && empty( $menu_item->xfn ) ) { 176 180 $atts['rel'] = 'noopener'; 177 181 } else { 178 $atts['rel'] = $ item->xfn;179 } 180 $atts['href'] = ! empty( $ item->url ) ? $item->url : '';181 $atts['aria-current'] = $ item->current ? 'page' : '';182 $atts['rel'] = $menu_item->xfn; 183 } 184 $atts['href'] = ! empty( $menu_item->url ) ? $menu_item->url : ''; 185 $atts['aria-current'] = $menu_item->current ? 'page' : ''; 182 186 183 187 /** … … 196 200 * @type string $aria-current The aria-current attribute. 197 201 * } 198 * @param WP_Post $ item The current menu item.199 * @param stdClass $args An object of wp_nav_menu() arguments.200 * @param int $depth Depth of menu item. Used for padding.201 */ 202 $atts = apply_filters( 'nav_menu_link_attributes', $atts, $ item, $args, $depth );202 * @param WP_Post $menu_item The current menu item object. 203 * @param stdClass $args An object of wp_nav_menu() arguments. 204 * @param int $depth Depth of menu item. Used for padding. 205 */ 206 $atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth ); 203 207 204 208 $attributes = ''; … … 211 215 212 216 /** This filter is documented in wp-includes/post-template.php */ 213 $title = apply_filters( 'the_title', $ item->title, $item->ID );217 $title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID ); 214 218 215 219 /** … … 218 222 * @since 4.4.0 219 223 * 220 * @param string $title The menu item's title.221 * @param WP_Post $ item The current menu item.222 * @param stdClass $args An object of wp_nav_menu() arguments.223 * @param int $depth Depth of menu item. Used for padding.224 */ 225 $title = apply_filters( 'nav_menu_item_title', $title, $ item, $args, $depth );224 * @param string $title The menu item's title. 225 * @param WP_Post $menu_item The current menu item object. 226 * @param stdClass $args An object of wp_nav_menu() arguments. 227 * @param int $depth Depth of menu item. Used for padding. 228 */ 229 $title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth ); 226 230 227 231 $item_output = $args->before; … … 241 245 * 242 246 * @param string $item_output The menu item's starting HTML output. 243 * @param WP_Post $ itemMenu item data object.247 * @param WP_Post $menu_item Menu item data object. 244 248 * @param int $depth Depth of menu item. Used for padding. 245 249 * @param stdClass $args An object of wp_nav_menu() arguments. 246 250 */ 247 $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $ item, $depth, $args );251 $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args ); 248 252 } 249 253 -
trunk/src/wp-includes/class-walker-page-dropdown.php
r45932 r51739 45 45 * 46 46 * @since 2.1.0 47 * @since 5.9.0 Renamed `$page` to `$data_object` to match parent class for PHP 8 named parameter support. 47 48 * 48 49 * @see Walker::start_el() 49 50 * 50 * @param string $output Used to append additional content. Passed by reference.51 * @param WP_Post $ pagePage data object.52 * @param int $depth Optional. Depth of page in reference to parent pages. Used for padding.53 * Default 0.54 * @param array $args Optional. Uses 'selected' argument for selected page to set selected HTML55 * attribute for option element. Uses 'value_field' argument to fill "value"56 * attribute. See wp_dropdown_pages(). Default empty array.57 * @param int $id Optional. ID of the current page. Default 0 (unused).51 * @param string $output Used to append additional content. Passed by reference. 52 * @param WP_Post $data_object Page data object. 53 * @param int $depth Optional. Depth of page in reference to parent pages. Used for padding. 54 * Default 0. 55 * @param array $args Optional. Uses 'selected' argument for selected page to set selected HTML 56 * attribute for option element. Uses 'value_field' argument to fill "value" 57 * attribute. See wp_dropdown_pages(). Default empty array. 58 * @param int $id Optional. ID of the current page. Default 0 (unused). 58 59 */ 59 public function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) { 60 $pad = str_repeat( ' ', $depth * 3 ); 60 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $id = 0 ) { 61 // Restores the more descriptive, specific name for use within this method. 62 $page = $data_object; 63 $pad = str_repeat( ' ', $depth * 3 ); 61 64 62 65 if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) { -
trunk/src/wp-includes/class-walker-page.php
r50823 r51739 94 94 * @see Walker::start_el() 95 95 * @since 2.1.0 96 * @since 5.9.0 Renamed `$page` to `$data_object` to match parent class for PHP 8 named parameter support. 96 97 * 97 98 * @param string $output Used to append additional content. Passed by reference. 98 * @param WP_Post $ pagePage data object.99 * @param WP_Post $data_object Page data object. 99 100 * @param int $depth Optional. Depth of page. Used for padding. Default 0. 100 101 * @param array $args Optional. Array of arguments. Default empty array. 101 102 * @param int $current_page Optional. Page ID. Default 0. 102 103 */ 103 public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { 104 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_page = 0 ) { 105 // Restores the more descriptive, specific name for use within this method. 106 $page = $data_object; 107 104 108 if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { 105 109 $t = "\t"; -
trunk/src/wp-includes/class-wp-walker.php
r51204 r51739 84 84 * 85 85 * @since 2.1.0 86 * @since 5.9.0 Renamed `$object` (a PHP reserved keyword) to `$data_object` for PHP 8 named parameter support. 86 87 * @abstract 87 88 * 88 89 * @param string $output Used to append additional content (passed by reference). 89 * @param object $ objectThe data object.90 * @param object $data_object The data object. 90 91 * @param int $depth Depth of the item. 91 92 * @param array $args An array of additional arguments. 92 93 * @param int $current_object_id ID of the current item. 93 94 */ 94 public function start_el( &$output, $ object, $depth = 0, $args = array(), $current_object_id = 0 ) {}95 public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {} 95 96 96 97 /**
Note: See TracChangeset
for help on using the changeset viewer.