Changeset 48299
- Timestamp:
- 07/04/2020 07:33:06 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-widgets.php
r48121 r48299 1171 1171 1172 1172 $switched_locale = switch_to_locale( get_user_locale() ); 1173 $l10n = array( 1173 1174 $l10n = array( 1174 1175 'widgetTooltip' => __( 'Shift-click to edit this widget.' ), 1175 1176 ); 1177 1176 1178 if ( $switched_locale ) { 1177 1179 restore_previous_locale(); 1178 1180 } 1179 1181 1182 $rendered_sidebars = array_filter( $this->rendered_sidebars ); 1183 $rendered_widgets = array_filter( $this->rendered_widgets ); 1184 1180 1185 // Prepare Customizer settings to pass to JavaScript. 1181 1186 $settings = array( 1182 'renderedSidebars' => array_fill_keys( array_ unique( $this->rendered_sidebars ), true ),1183 'renderedWidgets' => array_fill_keys( array_keys( $ this->rendered_widgets ), true ),1187 'renderedSidebars' => array_fill_keys( array_keys( $rendered_sidebars ), true ), 1188 'renderedWidgets' => array_fill_keys( array_keys( $rendered_widgets ), true ), 1184 1189 'registeredSidebars' => array_values( $wp_registered_sidebars ), 1185 1190 'registeredWidgets' => $wp_registered_widgets, … … 1187 1192 'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets(), 1188 1193 ); 1194 1189 1195 foreach ( $settings['registeredWidgets'] as &$registered_widget ) { 1190 1196 unset( $registered_widget['callback'] ); // May not be JSON-serializeable. … … 1218 1224 */ 1219 1225 public function is_widget_rendered( $widget_id ) { 1220 return in_array( $widget_id, $this->rendered_widgets, true);1226 return ! empty( $this->rendered_widgets[ $widget_id ] ); 1221 1227 } 1222 1228 … … 1230 1236 */ 1231 1237 public function is_sidebar_rendered( $sidebar_id ) { 1232 return in_array( $sidebar_id, $this->rendered_sidebars, true);1238 return ! empty( $this->rendered_sidebars[ $sidebar_id ] ); 1233 1239 } 1234 1240 … … 1248 1254 public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) { 1249 1255 if ( is_registered_sidebar( $sidebar_id ) ) { 1250 $this->rendered_sidebars[] = $sidebar_id; 1251 } 1256 $this->rendered_sidebars[ $sidebar_id ] = true; 1257 } 1258 1252 1259 /* 1253 1260 * We may need to force this to true, and also force-true the value … … 1273 1280 public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) { 1274 1281 if ( is_registered_sidebar( $sidebar_id ) ) { 1275 $this->rendered_sidebars[ ] = $sidebar_id;1282 $this->rendered_sidebars[ $sidebar_id ] = true; 1276 1283 } 1277 1284
Note: See TracChangeset
for help on using the changeset viewer.