diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
index 0aa75168a4..8c6856bf10 100644
|
|
|
final class WP_Customize_Widgets {
|
| 1179 | 1179 | |
| 1180 | 1180 | // Prepare Customizer settings to pass to JavaScript. |
| 1181 | 1181 | $settings = array( |
| 1182 | | 'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ), |
| 1183 | | 'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ), |
| | 1182 | 'renderedSidebars' => array_fill_keys( array_keys( array_filter( $this->rendered_sidebars ) ), true ), |
| | 1183 | 'renderedWidgets' => array_fill_keys( array_keys( array_filter( $this->rendered_widgets ) ), true ), |
| 1184 | 1184 | 'registeredSidebars' => array_values( $wp_registered_sidebars ), |
| 1185 | 1185 | 'registeredWidgets' => $wp_registered_widgets, |
| 1186 | 1186 | 'l10n' => $l10n, |
| 1187 | 1187 | 'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(), |
| 1188 | 1188 | ); |
| | 1189 | |
| 1189 | 1190 | foreach ( $settings['registeredWidgets'] as &$registered_widget ) { |
| 1190 | 1191 | unset( $registered_widget['callback'] ); // May not be JSON-serializeable. |
| 1191 | 1192 | } |
| … |
… |
final class WP_Customize_Widgets {
|
| 1217 | 1218 | * @return bool Whether the widget is rendered. |
| 1218 | 1219 | */ |
| 1219 | 1220 | public function is_widget_rendered( $widget_id ) { |
| 1220 | | return in_array( $widget_id, $this->rendered_widgets, true ); |
| | 1221 | return ! empty( $this->rendered_widgets[ $widget_id ] ); |
| 1221 | 1222 | } |
| 1222 | 1223 | |
| 1223 | 1224 | /** |
| … |
… |
final class WP_Customize_Widgets {
|
| 1229 | 1230 | * @return bool Whether the sidebar is rendered. |
| 1230 | 1231 | */ |
| 1231 | 1232 | public function is_sidebar_rendered( $sidebar_id ) { |
| 1232 | | return in_array( $sidebar_id, $this->rendered_sidebars, true ); |
| | 1233 | return ! empty( $this->rendered_sidebars[ $sidebar_id ] ); |
| 1233 | 1234 | } |
| 1234 | 1235 | |
| 1235 | 1236 | /** |
| … |
… |
final class WP_Customize_Widgets {
|
| 1247 | 1248 | */ |
| 1248 | 1249 | public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) { |
| 1249 | 1250 | if ( is_registered_sidebar( $sidebar_id ) ) { |
| 1250 | | $this->rendered_sidebars[] = $sidebar_id; |
| | 1251 | $this->rendered_sidebars[ $sidebar_id ] = true; |
| 1251 | 1252 | } |
| | 1253 | |
| 1252 | 1254 | /* |
| 1253 | 1255 | * We may need to force this to true, and also force-true the value |
| 1254 | 1256 | * for 'dynamic_sidebar_has_widgets' if we want to ensure that there |
| … |
… |
final class WP_Customize_Widgets {
|
| 1272 | 1274 | */ |
| 1273 | 1275 | public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) { |
| 1274 | 1276 | if ( is_registered_sidebar( $sidebar_id ) ) { |
| 1275 | | $this->rendered_sidebars[] = $sidebar_id; |
| | 1277 | $this->rendered_sidebars[ $sidebar_id ] = true; |
| 1276 | 1278 | } |
| 1277 | 1279 | |
| 1278 | 1280 | /* |