wp/wp-includes/customize/class-wp-customize-selective-refresh.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    10 /**
    10 /**
    11  * Core Customizer class for implementing selective refresh.
    11  * Core Customizer class for implementing selective refresh.
    12  *
    12  *
    13  * @since 4.5.0
    13  * @since 4.5.0
    14  */
    14  */
       
    15 #[AllowDynamicProperties]
    15 final class WP_Customize_Selective_Refresh {
    16 final class WP_Customize_Selective_Refresh {
    16 
    17 
    17 	/**
    18 	/**
    18 	 * Query var used in requests to render partials.
    19 	 * Query var used in requests to render partials.
    19 	 *
    20 	 *
   169 			if ( $partial->check_capabilities() ) {
   170 			if ( $partial->check_capabilities() ) {
   170 				$partials[ $partial->id ] = $partial->json();
   171 				$partials[ $partial->id ] = $partial->json();
   171 			}
   172 			}
   172 		}
   173 		}
   173 
   174 
   174 		$switched_locale = switch_to_locale( get_user_locale() );
   175 		$switched_locale = switch_to_user_locale( get_current_user_id() );
   175 		$l10n            = array(
   176 		$l10n            = array(
   176 			'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
   177 			'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
   177 			'clickEditMenu'    => __( 'Click to edit this menu.' ),
   178 			'clickEditMenu'    => __( 'Click to edit this menu.' ),
   178 			'clickEditWidget'  => __( 'Click to edit this widget.' ),
   179 			'clickEditWidget'  => __( 'Click to edit this widget.' ),
   179 			'clickEditTitle'   => __( 'Click to edit the site title.' ),
   180 			'clickEditTitle'   => __( 'Click to edit the site title.' ),
   190 			'renderQueryVar' => self::RENDER_QUERY_VAR,
   191 			'renderQueryVar' => self::RENDER_QUERY_VAR,
   191 			'l10n'           => $l10n,
   192 			'l10n'           => $l10n,
   192 		);
   193 		);
   193 
   194 
   194 		// Export data to JS.
   195 		// Export data to JS.
   195 		printf( '<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode( $exports ) );
   196 		wp_print_inline_script_tag( sprintf( 'var _customizePartialRefreshExports = %s;', wp_json_encode( $exports ) ) );
   196 	}
   197 	}
   197 
   198 
   198 	/**
   199 	/**
   199 	 * Registers dynamically-created partials.
   200 	 * Registers dynamically-created partials.
   200 	 *
   201 	 *