wp/wp-includes/class-wp-customize-nav-menus.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-customize-nav-menus.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-customize-nav-menus.php	Mon Oct 14 18:28:13 2019 +0200
@@ -42,7 +42,7 @@
 	 * @param object $manager An instance of the WP_Customize_Manager class.
 	 */
 	public function __construct( $manager ) {
-		$this->manager = $manager;
+		$this->manager                     = $manager;
 		$this->original_nav_menu_locations = get_nav_menu_locations();
 
 		// See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L469-L499
@@ -75,8 +75,8 @@
 	 *
 	 * @since 4.5.0
 	 *
-	 * @param array $nonces Array of nonces.
-	 * @return array $nonces Modified array of nonces.
+	 * @param string[] $nonces Array of nonces.
+	 * @return string[] $nonces Modified array of nonces.
 	 */
 	public function filter_nonces( $nonces ) {
 		$nonces['customize-menus'] = wp_create_nonce( 'customize-menus' );
@@ -95,15 +95,15 @@
 			wp_die( -1 );
 		}
 
-		$all_items = array();
+		$all_items  = array();
 		$item_types = array();
 		if ( isset( $_POST['item_types'] ) && is_array( $_POST['item_types'] ) ) {
 			$item_types = wp_unslash( $_POST['item_types'] );
 		} elseif ( isset( $_POST['type'] ) && isset( $_POST['object'] ) ) { // Back compat.
 			$item_types[] = array(
-				'type' => wp_unslash( $_POST['type'] ),
+				'type'   => wp_unslash( $_POST['type'] ),
 				'object' => wp_unslash( $_POST['object'] ),
-				'page' => empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] ),
+				'page'   => empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] ),
 			);
 		} else {
 			wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' );
@@ -113,10 +113,10 @@
 			if ( empty( $item_type['type'] ) || empty( $item_type['object'] ) ) {
 				wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' );
 			}
-			$type = sanitize_key( $item_type['type'] );
+			$type   = sanitize_key( $item_type['type'] );
 			$object = sanitize_key( $item_type['object'] );
-			$page = empty( $item_type['page'] ) ? 0 : absint( $item_type['page'] );
-			$items = $this->load_available_items_query( $type, $object, $page );
+			$page   = empty( $item_type['page'] ) ? 0 : absint( $item_type['page'] );
+			$items  = $this->load_available_items_query( $type, $object, $page );
 			if ( is_wp_error( $items ) ) {
 				wp_send_json_error( $items->get_error_code() );
 			}
@@ -179,13 +179,18 @@
 				}
 			}
 
-			$posts = array_merge( $posts, get_posts( array(
-				'numberposts' => 10,
-				'offset'      => 10 * $page,
-				'orderby'     => 'date',
-				'order'       => 'DESC',
-				'post_type'   => $object,
-			) ) );
+			$posts = array_merge(
+				$posts,
+				get_posts(
+					array(
+						'numberposts' => 10,
+						'offset'      => 10 * $page,
+						'orderby'     => 'date',
+						'order'       => 'DESC',
+						'post_type'   => $object,
+					)
+				)
+			);
 
 			foreach ( $posts as $post ) {
 				$post_title = $post->post_title;
@@ -204,18 +209,21 @@
 				);
 			}
 		} elseif ( 'taxonomy' === $type ) {
-			$terms = get_terms( $object, array(
-				'child_of'     => 0,
-				'exclude'      => '',
-				'hide_empty'   => false,
-				'hierarchical' => 1,
-				'include'      => '',
-				'number'       => 10,
-				'offset'       => 10 * $page,
-				'order'        => 'DESC',
-				'orderby'      => 'count',
-				'pad_counts'   => false,
-			) );
+			$terms = get_terms(
+				$object,
+				array(
+					'child_of'     => 0,
+					'exclude'      => '',
+					'hide_empty'   => false,
+					'hierarchical' => 1,
+					'include'      => '',
+					'number'       => 10,
+					'offset'       => 10 * $page,
+					'order'        => 'DESC',
+					'orderby'      => 'count',
+					'pad_counts'   => false,
+				)
+			);
 			if ( is_wp_error( $terms ) ) {
 				return $terms;
 			}
@@ -269,8 +277,13 @@
 			$p = 1;
 		}
 
-		$s = sanitize_text_field( wp_unslash( $_POST['search'] ) );
-		$items = $this->search_available_items_query( array( 'pagenum' => $p, 's' => $s ) );
+		$s     = sanitize_text_field( wp_unslash( $_POST['search'] ) );
+		$items = $this->search_available_items_query(
+			array(
+				'pagenum' => $p,
+				's'       => $s,
+			)
+		);
 
 		if ( empty( $items ) ) {
 			wp_send_json_error( array( 'message' => __( 'No results found.' ) ) );
@@ -293,7 +306,7 @@
 		$items = array();
 
 		$post_type_objects = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
-		$query = array(
+		$query             = array(
 			'post_type'              => array_keys( $post_type_objects ),
 			'suppress_filters'       => true,
 			'update_post_term_cache' => false,
@@ -314,20 +327,22 @@
 		// Prepend list of posts with nav_menus_created_posts search results on first page.
 		$nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' );
 		if ( 1 === $args['pagenum'] && $nav_menus_created_posts_setting && count( $nav_menus_created_posts_setting->value() ) > 0 ) {
-			$stub_post_query = new WP_Query( array_merge(
-				$query,
-				array(
-					'post_status' => 'auto-draft',
-					'post__in' => $nav_menus_created_posts_setting->value(),
-					'posts_per_page' => -1,
+			$stub_post_query = new WP_Query(
+				array_merge(
+					$query,
+					array(
+						'post_status'    => 'auto-draft',
+						'post__in'       => $nav_menus_created_posts_setting->value(),
+						'posts_per_page' => -1,
+					)
 				)
-			) );
-			$posts = array_merge( $posts, $stub_post_query->posts );
+			);
+			$posts           = array_merge( $posts, $stub_post_query->posts );
 		}
 
 		// Query posts.
 		$get_posts = new WP_Query( $query );
-		$posts = array_merge( $posts, $get_posts->posts );
+		$posts     = array_merge( $posts, $get_posts->posts );
 
 		// Create items for posts.
 		foreach ( $posts as $post ) {
@@ -349,11 +364,14 @@
 
 		// Query taxonomy terms.
 		$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
-		$terms = get_terms( $taxonomies, array(
-			'name__like' => $args['s'],
-			'number'     => 20,
-			'offset'     => 20 * ($args['pagenum'] - 1),
-		) );
+		$terms      = get_terms(
+			$taxonomies,
+			array(
+				'name__like' => $args['s'],
+				'number'     => 20,
+				'offset'     => 20 * ( $args['pagenum'] - 1 ),
+			)
+		);
 
 		// Check if any taxonomies were found.
 		if ( ! empty( $terms ) ) {
@@ -372,7 +390,7 @@
 
 		// Add "Home" link if search term matches. Treat as a page, but switch to custom on add.
 		if ( isset( $args['s'] ) ) {
-			$title = _x( 'Home', 'nav menu home label' );
+			$title   = _x( 'Home', 'nav menu home label' );
 			$matches = function_exists( 'mb_stripos' ) ? false !== mb_stripos( $title, $args['s'] ) : false !== stripos( $title, $args['s'] );
 			if ( $matches ) {
 				$items[] = array(
@@ -421,9 +439,9 @@
 
 		// Pass data to JS.
 		$settings = array(
-			'allMenus'             => wp_get_nav_menus(),
-			'itemTypes'            => $this->available_item_types(),
-			'l10n'                 => array(
+			'allMenus'                 => wp_get_nav_menus(),
+			'itemTypes'                => $this->available_item_types(),
+			'l10n'                     => array(
 				'untitled'               => _x( '(no label)', 'missing menu item navigation label' ),
 				'unnamed'                => _x( '(unnamed)', 'Missing menu name.' ),
 				'custom_label'           => __( 'Custom Link' ),
@@ -456,9 +474,9 @@
 				'reorderLabelOn'         => esc_attr__( 'Reorder menu items' ),
 				'reorderLabelOff'        => esc_attr__( 'Close reorder mode' ),
 			),
-			'settingTransport'     => 'postMessage',
-			'phpIntMax'            => PHP_INT_MAX,
-			'defaultSettingValues' => array(
+			'settingTransport'         => 'postMessage',
+			'phpIntMax'                => PHP_INT_MAX,
+			'defaultSettingValues'     => array(
 				'nav_menu'      => $temp_nav_menu_setting->default,
 				'nav_menu_item' => $temp_nav_menu_item_setting->default,
 			),
@@ -471,21 +489,21 @@
 		// This is copied from nav-menus.php, and it has an unfortunate object name of `menus`.
 		$nav_menus_l10n = array(
 			'oneThemeLocationNoMenus' => null,
-			'moveUp'       => __( 'Move up one' ),
-			'moveDown'     => __( 'Move down one' ),
-			'moveToTop'    => __( 'Move to the top' ),
+			'moveUp'                  => __( 'Move up one' ),
+			'moveDown'                => __( 'Move down one' ),
+			'moveToTop'               => __( 'Move to the top' ),
 			/* translators: %s: previous item name */
-			'moveUnder'    => __( 'Move under %s' ),
+			'moveUnder'               => __( 'Move under %s' ),
 			/* translators: %s: previous item name */
-			'moveOutFrom'  => __( 'Move out from under %s' ),
+			'moveOutFrom'             => __( 'Move out from under %s' ),
 			/* translators: %s: previous item name */
-			'under'        => __( 'Under %s' ),
+			'under'                   => __( 'Under %s' ),
 			/* translators: %s: previous item name */
-			'outFrom'      => __( 'Out from under %s' ),
+			'outFrom'                 => __( 'Out from under %s' ),
 			/* translators: 1: item name, 2: item position, 3: total number of items */
-			'menuFocus'    => __( '%1$s. Menu item %2$d of %3$d.' ),
+			'menuFocus'               => __( '%1$s. Menu item %2$d of %3$d.' ),
 			/* translators: 1: item name, 2: item position, 3: parent item name */
-			'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ),
+			'subMenuFocus'            => __( '%1$s. Sub item number %2$d under %3$s.' ),
 		);
 		wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
 	}
@@ -577,12 +595,22 @@
 		} else {
 			$description .= '<p>' . __( 'Menus can be displayed in locations defined by your theme.' ) . '</p>';
 		}
-		$this->manager->add_panel( new WP_Customize_Nav_Menus_Panel( $this->manager, 'nav_menus', array(
-			'title'       => __( 'Menus' ),
-			'description' => $description,
-			'priority'    => 100,
-			// 'theme_supports' => 'menus|widgets', @todo allow multiple theme supports
-		) ) );
+
+		/*
+		 * Once multiple theme supports are allowed in WP_Customize_Panel,
+		 * this panel can be restricted to themes that support menus or widgets.
+		 */
+		$this->manager->add_panel(
+			new WP_Customize_Nav_Menus_Panel(
+				$this->manager,
+				'nav_menus',
+				array(
+					'title'       => __( 'Menus' ),
+					'description' => $description,
+					'priority'    => 100,
+				)
+			)
+		);
 		$menus = wp_get_nav_menus();
 
 		// Menu locations.
@@ -600,12 +628,15 @@
 			$description .= '<p>' . sprintf( __( 'If your theme has widget areas, you can also add menus there. Visit the <a href="%s">Widgets panel</a> and add a &#8220;Navigation Menu widget&#8221; to display a menu in a sidebar or footer.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>';
 		}
 
-		$this->manager->add_section( 'menu_locations', array(
-			'title'       => 1 === $num_locations ? _x( 'View Location', 'menu locations' ) : _x( 'View All Locations', 'menu locations' ),
-			'panel'       => 'nav_menus',
-			'priority'    => 30,
-			'description' => $description,
-		) );
+		$this->manager->add_section(
+			'menu_locations',
+			array(
+				'title'       => 1 === $num_locations ? _x( 'View Location', 'menu locations' ) : _x( 'View All Locations', 'menu locations' ),
+				'panel'       => 'nav_menus',
+				'priority'    => 30,
+				'description' => $description,
+			)
+		);
 
 		$choices = array( '0' => __( '&mdash; Select &mdash;' ) );
 		foreach ( $menus as $menu ) {
@@ -634,13 +665,16 @@
 				remove_filter( "customize_sanitize_{$setting_id}", 'absint' );
 				add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) );
 			} else {
-				$this->manager->add_setting( $setting_id, array(
-					'sanitize_callback' => array( $this, 'intval_base10' ),
-					'theme_supports'    => 'menus',
-					'type'              => 'theme_mod',
-					'transport'         => 'postMessage',
-					'default'           => 0,
-				) );
+				$this->manager->add_setting(
+					$setting_id,
+					array(
+						'sanitize_callback' => array( $this, 'intval_base10' ),
+						'theme_supports'    => 'menus',
+						'type'              => 'theme_mod',
+						'transport'         => 'postMessage',
+						'default'           => 0,
+					)
+				);
 			}
 
 			// Override the assigned nav menu location if mapped during previewed theme switch.
@@ -648,12 +682,18 @@
 				$this->manager->set_post_value( $setting_id, $mapped_nav_menu_locations[ $location ] );
 			}
 
-			$this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array(
-				'label'       => $description,
-				'location_id' => $location,
-				'section'     => 'menu_locations',
-				'choices'     => $choices,
-			) ) );
+			$this->manager->add_control(
+				new WP_Customize_Nav_Menu_Location_Control(
+					$this->manager,
+					$setting_id,
+					array(
+						'label'       => $description,
+						'location_id' => $location,
+						'section'     => 'menu_locations',
+						'choices'     => $choices,
+					)
+				)
+			);
 		}
 
 		// Register each menu as a Customizer section, and add each menu item to each menu.
@@ -662,16 +702,28 @@
 
 			// Create a section for each menu.
 			$section_id = 'nav_menu[' . $menu_id . ']';
-			$this->manager->add_section( new WP_Customize_Nav_Menu_Section( $this->manager, $section_id, array(
-				'title'     => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
-				'priority'  => 10,
-				'panel'     => 'nav_menus',
-			) ) );
+			$this->manager->add_section(
+				new WP_Customize_Nav_Menu_Section(
+					$this->manager,
+					$section_id,
+					array(
+						'title'    => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
+						'priority' => 10,
+						'panel'    => 'nav_menus',
+					)
+				)
+			);
 
 			$nav_menu_setting_id = 'nav_menu[' . $menu_id . ']';
-			$this->manager->add_setting( new WP_Customize_Nav_Menu_Setting( $this->manager, $nav_menu_setting_id, array(
-				'transport' => 'postMessage',
-			) ) );
+			$this->manager->add_setting(
+				new WP_Customize_Nav_Menu_Setting(
+					$this->manager,
+					$nav_menu_setting_id,
+					array(
+						'transport' => 'postMessage',
+					)
+				)
+			);
 
 			// Add the menu contents.
 			$menu_items = (array) wp_get_nav_menu_items( $menu_id );
@@ -687,36 +739,57 @@
 				}
 
 				$value['nav_menu_term_id'] = $menu_id;
-				$this->manager->add_setting( new WP_Customize_Nav_Menu_Item_Setting( $this->manager, $menu_item_setting_id, array(
-					'value'     => $value,
-					'transport' => 'postMessage',
-				) ) );
+				$this->manager->add_setting(
+					new WP_Customize_Nav_Menu_Item_Setting(
+						$this->manager,
+						$menu_item_setting_id,
+						array(
+							'value'     => $value,
+							'transport' => 'postMessage',
+						)
+					)
+				);
 
 				// Create a control for each menu item.
-				$this->manager->add_control( new WP_Customize_Nav_Menu_Item_Control( $this->manager, $menu_item_setting_id, array(
-					'label'    => $item->title,
-					'section'  => $section_id,
-					'priority' => 10 + $i,
-				) ) );
+				$this->manager->add_control(
+					new WP_Customize_Nav_Menu_Item_Control(
+						$this->manager,
+						$menu_item_setting_id,
+						array(
+							'label'    => $item->title,
+							'section'  => $section_id,
+							'priority' => 10 + $i,
+						)
+					)
+				);
 			}
 
 			// Note: other controls inside of this section get added dynamically in JS via the MenuSection.ready() function.
 		}
 
 		// Add the add-new-menu section and controls.
-		$this->manager->add_section( 'add_menu', array(
-			'type'     => 'new_menu',
-			'title'    => __( 'New Menu' ),
-			'panel'    => 'nav_menus',
-			'priority' => 20,
-		) );
+		$this->manager->add_section(
+			'add_menu',
+			array(
+				'type'     => 'new_menu',
+				'title'    => __( 'New Menu' ),
+				'panel'    => 'nav_menus',
+				'priority' => 20,
+			)
+		);
 
-		$this->manager->add_setting( new WP_Customize_Filter_Setting( $this->manager, 'nav_menus_created_posts', array(
-			'transport' => 'postMessage',
-			'type' => 'option', // To prevent theme prefix in changeset.
-			'default' => array(),
-			'sanitize_callback' => array( $this, 'sanitize_nav_menus_created_posts' ),
-		) ) );
+		$this->manager->add_setting(
+			new WP_Customize_Filter_Setting(
+				$this->manager,
+				'nav_menus_created_posts',
+				array(
+					'transport'         => 'postMessage',
+					'type'              => 'option', // To prevent theme prefix in changeset.
+					'default'           => array(),
+					'sanitize_callback' => array( $this, 'sanitize_nav_menus_created_posts' ),
+				)
+			)
+		);
 	}
 
 	/**
@@ -749,10 +822,10 @@
 		if ( $post_types ) {
 			foreach ( $post_types as $slug => $post_type ) {
 				$item_types[] = array(
-					'title'  => $post_type->labels->name,
+					'title'      => $post_type->labels->name,
 					'type_label' => $post_type->labels->singular_name,
-					'type' => 'post_type',
-					'object' => $post_type->name,
+					'type'       => 'post_type',
+					'object'     => $post_type->name,
 				);
 			}
 		}
@@ -764,10 +837,10 @@
 					continue;
 				}
 				$item_types[] = array(
-					'title' => $taxonomy->labels->name,
+					'title'      => $taxonomy->labels->name,
 					'type_label' => $taxonomy->labels->singular_name,
-					'type' => 'taxonomy',
-					'object' => $taxonomy->name,
+					'type'       => 'taxonomy',
+					'object'     => $taxonomy->name,
 				);
 			}
 		}
@@ -793,10 +866,10 @@
 	 * @param array $postarr {
 	 *     Post array. Note that post_status is overridden to be `auto-draft`.
 	 *
-	 *     @var string $post_title   Post title. Required.
-	 *     @var string $post_type    Post type. Required.
-	 *     @var string $post_name    Post name.
-	 *     @var string $post_content Post content.
+	 * @var string $post_title   Post title. Required.
+	 * @var string $post_type    Post type. Required.
+	 * @var string $post_name    Post name.
+	 * @var string $post_content Post content.
 	 * }
 	 * @return WP_Post|WP_Error Inserted auto-draft post object or error.
 	 */
@@ -825,7 +898,7 @@
 			$postarr['meta_input'] = array();
 		}
 		$postarr['meta_input']['_customize_draft_post_name'] = $postarr['post_name'];
-		$postarr['meta_input']['_customize_changeset_uuid'] = $this->manager->changeset_uuid();
+		$postarr['meta_input']['_customize_changeset_uuid']  = $this->manager->changeset_uuid();
 		unset( $postarr['post_name'] );
 
 		add_filter( 'wp_insert_post_empty_content', '__return_false', 1000 );
@@ -857,7 +930,7 @@
 			wp_send_json_error( 'missing_params', 400 );
 		}
 
-		$params = wp_unslash( $_POST['params'] );
+		$params         = wp_unslash( $_POST['params'] );
 		$illegal_params = array_diff( array_keys( $params ), array( 'post_type', 'post_title' ) );
 		if ( ! empty( $illegal_params ) ) {
 			wp_send_json_error( 'illegal_params', 400 );
@@ -865,7 +938,7 @@
 
 		$params = array_merge(
 			array(
-				'post_type' => '',
+				'post_type'  => '',
 				'post_title' => '',
 			),
 			$params
@@ -898,7 +971,7 @@
 			}
 
 			$data = array(
-				/* translators: %1$s is the post type name and %2$s is the error message. */
+				/* translators: 1: post type name, 2: error message */
 				'message' => sprintf( __( '%1$s could not be created: %2$s' ), $singular_name, $error->get_error_message() ),
 			);
 			wp_send_json_error( $data );
@@ -930,10 +1003,12 @@
 							<span class="menu-item-title<# if ( ! data.title ) { #> no-title<# } #>">{{ data.title || wp.customize.Menus.data.l10n.untitled }}</span>
 						</span>
 						<button type="button" class="button-link item-add">
-							<span class="screen-reader-text"><?php
-								/* translators: 1: Title of a menu item, 2: Type of a menu item */
+							<span class="screen-reader-text">
+							<?php
+								/* translators: 1: title of a menu item, 2: type of a menu item */
 								printf( __( 'Add to menu: %1$s (%2$s)' ), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.type_label }}' );
-							?></span>
+							?>
+							</span>
 						</button>
 					</div>
 				</div>
@@ -985,7 +1060,7 @@
 				</button>
 			</h3>
 		</script>
-	<?php
+		<?php
 	}
 
 	/**
@@ -1013,7 +1088,7 @@
 			<div id="available-menu-items-search" class="accordion-section cannot-expand">
 				<div class="accordion-section-title">
 					<label class="screen-reader-text" for="menu-items-search"><?php _e( 'Search Menu Items' ); ?></label>
-					<input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items&hellip;' ) ?>" aria-describedby="menu-items-search-desc" />
+					<input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items&hellip;' ); ?>" aria-describedby="menu-items-search-desc" />
 					<p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p>
 					<span class="spinner"></span>
 				</div>
@@ -1024,7 +1099,7 @@
 			<?php
 
 			// Ensure the page post type comes first in the list.
-			$item_types = $this->available_item_types();
+			$item_types     = $this->available_item_types();
 			$page_item_type = null;
 			foreach ( $item_types as $i => $item_type ) {
 				if ( isset( $item_type['object'] ) && 'page' === $item_type['object'] ) {
@@ -1043,7 +1118,7 @@
 			}
 			?>
 		</div><!-- #available-menu-items -->
-	<?php
+		<?php
 	}
 
 	/**
@@ -1065,9 +1140,12 @@
 				<span class="spinner"></span>
 				<span class="no-items"><?php _e( 'No items' ); ?></span>
 				<button type="button" class="button-link" aria-expanded="false">
-					<span class="screen-reader-text"><?php
+					<span class="screen-reader-text">
+					<?php
 						/* translators: %s: Title of a section with menu items */
-						printf( __( 'Toggle section: %s' ), esc_html( $available_item_type['title'] ) ); ?></span>
+						printf( __( 'Toggle section: %s' ), esc_html( $available_item_type['title'] ) );
+					?>
+						</span>
 					<span class="toggle-indicator" aria-hidden="true"></span>
 				</button>
 			</h4>
@@ -1247,11 +1325,11 @@
 				}
 
 				$target_status = 'attachment' === get_post_type( $post_id ) ? 'inherit' : 'publish';
-				$args = array(
-					'ID' => $post_id,
+				$args          = array(
+					'ID'          => $post_id,
 					'post_status' => $target_status,
 				);
-				$post_name = get_post_meta( $post_id, '_customize_draft_post_name', true );
+				$post_name     = get_post_meta( $post_id, '_customize_draft_post_name', true );
 				if ( $post_name ) {
 					$args['post_name'] = $post_name;
 				}
@@ -1269,7 +1347,7 @@
 	 *
 	 * @since 4.3.0
 	 * @see wp_nav_menu()
-	 * @see WP_Customize_Widgets_Partial_Refresh::filter_dynamic_sidebar_params()
+	 * @see WP_Customize_Widgets::filter_dynamic_sidebar_params()
 	 *
 	 * @param array $args An array containing wp_nav_menu() arguments.
 	 * @return array Arguments.
@@ -1310,7 +1388,7 @@
 		// Empty out args which may not be JSON-serializable.
 		if ( ! $can_partial_refresh ) {
 			$exported_args['fallback_cb'] = '';
-			$exported_args['walker'] = '';
+			$exported_args['walker']      = '';
 		}
 
 		/*
@@ -1324,7 +1402,7 @@
 		ksort( $exported_args );
 		$exported_args['args_hmac'] = $this->hash_nav_menu_args( $exported_args );
 
-		$args['customize_preview_nav_menus_args'] = $exported_args;
+		$args['customize_preview_nav_menus_args']                            = $exported_args;
 		$this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args;
 		return $args;
 	}
@@ -1344,9 +1422,9 @@
 	 */
 	public function filter_wp_nav_menu( $nav_menu_content, $args ) {
 		if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) {
-			$attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) );
-			$attributes .= ' data-customize-partial-type="nav_menu_instance"';
-			$attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) );
+			$attributes       = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) );
+			$attributes      .= ' data-customize-partial-type="nav_menu_instance"';
+			$attributes      .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) );
 			$nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . str_replace( '\\', '\\\\', $attributes ), $nav_menu_content, 1 );
 		}
 		return $nav_menu_content;