mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/nav-menu.php
.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit: * Renames the `$echo` parameter to `$display` in `wp_nav_menu_disabled_check()`. * Renames the `$object` parameter to `$item_object` in: * `wp_nav_menu_item_post_type_meta_box()` * `wp_nav_menu_item_taxonomy_meta_box()` * `_wp_nav_menu_meta_box_object()` Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53207 git-svn-id: http://core.svn.wordpress.org/trunk@52796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57fba4946f
commit
c4c4edccc0
@ -262,22 +262,22 @@ function wp_nav_menu_taxonomy_meta_boxes() {
|
||||
* Check whether to disable the Menu Locations meta box submit button and inputs.
|
||||
*
|
||||
* @since 3.6.0
|
||||
* @since 5.3.1 The `$echo` parameter was added.
|
||||
* @since 5.3.1 The `$display` parameter was added.
|
||||
*
|
||||
* @global bool $one_theme_location_no_menus to determine if no menus exist
|
||||
*
|
||||
* @param int|string $nav_menu_selected_id ID, name, or slug of the currently selected menu.
|
||||
* @param bool $echo Whether to echo or just return the string.
|
||||
* @param bool $display Whether to display or just return the string.
|
||||
* @return string|false Disabled attribute if at least one menu exists, false if not.
|
||||
*/
|
||||
function wp_nav_menu_disabled_check( $nav_menu_selected_id, $echo = true ) {
|
||||
function wp_nav_menu_disabled_check( $nav_menu_selected_id, $display = true ) {
|
||||
global $one_theme_location_no_menus;
|
||||
|
||||
if ( $one_theme_location_no_menus ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return disabled( $nav_menu_selected_id, 0, $echo );
|
||||
return disabled( $nav_menu_selected_id, 0, $display );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,7 +325,7 @@ function wp_nav_menu_item_link_meta_box() {
|
||||
* @global int $_nav_menu_placeholder
|
||||
* @global int|string $nav_menu_selected_id
|
||||
*
|
||||
* @param string $object Not used.
|
||||
* @param string $item_object Not used.
|
||||
* @param array $box {
|
||||
* Post type menu item meta box arguments.
|
||||
*
|
||||
@ -335,7 +335,7 @@ function wp_nav_menu_item_link_meta_box() {
|
||||
* @type WP_Post_Type $args Extra meta box arguments (the post type object for this meta box).
|
||||
* }
|
||||
*/
|
||||
function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||
function wp_nav_menu_item_post_type_meta_box( $item_object, $box ) {
|
||||
global $_nav_menu_placeholder, $nav_menu_selected_id;
|
||||
|
||||
$post_type_name = $box['args']->name;
|
||||
@ -689,7 +689,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||
*
|
||||
* @global int|string $nav_menu_selected_id
|
||||
*
|
||||
* @param string $object Not used.
|
||||
* @param string $item_object Not used.
|
||||
* @param array $box {
|
||||
* Taxonomy menu item meta box arguments.
|
||||
*
|
||||
@ -699,7 +699,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||
* @type object $args Extra meta box arguments (the taxonomy object for this meta box).
|
||||
* }
|
||||
*/
|
||||
function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||
function wp_nav_menu_item_taxonomy_meta_box( $item_object, $box ) {
|
||||
global $nav_menu_selected_id;
|
||||
|
||||
$taxonomy_name = $box['args']->name;
|
||||
@ -989,40 +989,40 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param object $object The post type or taxonomy meta-object.
|
||||
* @param object $item_object The post type or taxonomy meta-object.
|
||||
* @return object The post type or taxonomy object.
|
||||
*/
|
||||
function _wp_nav_menu_meta_box_object( $object = null ) {
|
||||
if ( isset( $object->name ) ) {
|
||||
function _wp_nav_menu_meta_box_object( $item_object = null ) {
|
||||
if ( isset( $item_object->name ) ) {
|
||||
|
||||
if ( 'page' === $object->name ) {
|
||||
$object->_default_query = array(
|
||||
if ( 'page' === $item_object->name ) {
|
||||
$item_object->_default_query = array(
|
||||
'orderby' => 'menu_order title',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
// Posts should show only published items.
|
||||
} elseif ( 'post' === $object->name ) {
|
||||
$object->_default_query = array(
|
||||
} elseif ( 'post' === $item_object->name ) {
|
||||
$item_object->_default_query = array(
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
// Categories should be in reverse chronological order.
|
||||
} elseif ( 'category' === $object->name ) {
|
||||
$object->_default_query = array(
|
||||
} elseif ( 'category' === $item_object->name ) {
|
||||
$item_object->_default_query = array(
|
||||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
);
|
||||
|
||||
// Custom post types should show only published items.
|
||||
} else {
|
||||
$object->_default_query = array(
|
||||
$item_object->_default_query = array(
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $object;
|
||||
return $item_object;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta1-53206';
|
||||
$wp_version = '6.0-beta1-53207';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user