Changeset 32542 for trunk/src/wp-includes/class-wp-customize-widgets.php
- Timestamp:
- 05/22/2015 05:05:19 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-widgets.php
r32535 r32542 204 204 * @since 3.9.0 205 205 * @access public 206 * 207 * @global array $sidebars_widgets 208 * @global array $_wp_sidebars_widgets 206 209 */ 207 210 public function override_sidebars_widgets_for_theme_switch() { … … 219 222 $sidebars_widgets = retrieve_widgets( 'customize' ); 220 223 add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 ); 221 unset( $GLOBALS['_wp_sidebars_widgets'] ); // reset global cache var used by wp_get_sidebars_widgets() 224 // reset global cache var used by wp_get_sidebars_widgets() 225 unset( $GLOBALS['_wp_sidebars_widgets'] ); 222 226 } 223 227 … … 253 257 * @access public 254 258 * 259 * @global array $sidebars_widgets 260 * 255 261 * @param array $sidebars_widgets 256 262 * @return array … … 304 310 * @since 3.9.0 305 311 * @access public 312 * 313 * @global array $wp_registered_widgets 314 * @global array $wp_registered_widget_controls 315 * @global array $wp_registered_sidebars 306 316 */ 307 317 public function customize_register() { … … 310 320 $sidebars_widgets = array_merge( 311 321 array( 'wp_inactive_widgets' => array() ), 312 array_fill_keys( array_keys( $ GLOBALS['wp_registered_sidebars']), array() ),322 array_fill_keys( array_keys( $wp_registered_sidebars ), array() ), 313 323 wp_get_sidebars_widgets() 314 324 ); … … 354 364 } 355 365 356 $is_registered_sidebar = isset( $ GLOBALS['wp_registered_sidebars'][$sidebar_id] );366 $is_registered_sidebar = isset( $wp_registered_sidebars[ $sidebar_id ] ); 357 367 $is_inactive_widgets = ( 'wp_inactive_widgets' === $sidebar_id ); 358 368 $is_active_sidebar = ( $is_registered_sidebar && ! $is_inactive_widgets ); … … 375 385 376 386 $section_args = array( 377 'title' => $ GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],378 'description' => $ GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],387 'title' => $wp_registered_sidebars[ $sidebar_id ]['name'], 388 'description' => $wp_registered_sidebars[ $sidebar_id ]['description'], 379 389 'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ), 380 390 'panel' => 'widgets', … … 411 421 412 422 // Skip widgets that may have gone away due to a plugin being deactivated. 413 if ( ! $is_active_sidebar || ! isset( $ GLOBALS['wp_registered_widgets'][$widget_id] ) ) {423 if ( ! $is_active_sidebar || ! isset( $wp_registered_widgets[$widget_id] ) ) { 414 424 continue; 415 425 } 416 426 417 $registered_widget = $ GLOBALS['wp_registered_widgets'][$widget_id];427 $registered_widget = $wp_registered_widgets[$widget_id]; 418 428 $setting_id = $this->get_setting_id( $widget_id ); 419 $id_base = $ GLOBALS['wp_registered_widget_controls'][$widget_id]['id_base'];429 $id_base = $wp_registered_widget_controls[$widget_id]['id_base']; 420 430 421 431 $control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array( … … 475 485 * @access public 476 486 * 487 * @global $wp_registered_widget_controls 488 * 477 489 * @param string $widget_id Widget ID. 478 490 * @return bool Whether or not the widget is a "wide" widget. … … 578 590 * @since 3.9.0 579 591 * @access public 592 * 593 * @global WP_Scripts $wp_scripts 594 * @global array $wp_registered_sidebars 595 * @global array $wp_registered_widgets 580 596 */ 581 597 public function enqueue_scripts() { 598 global $wp_scripts, $wp_registered_sidebars, $wp_registered_widgets; 599 582 600 wp_enqueue_style( 'customize-widgets' ); 583 601 wp_enqueue_script( 'customize-widgets' ); … … 623 641 ); 624 642 625 global $wp_scripts;626 627 643 $settings = array( 628 644 'nonce' => wp_create_nonce( 'update-widget' ), 629 'registeredSidebars' => array_values( $ GLOBALS['wp_registered_sidebars']),630 'registeredWidgets' => $ GLOBALS['wp_registered_widgets'],645 'registeredSidebars' => array_values( $wp_registered_sidebars ), 646 'registeredWidgets' => $wp_registered_widgets, 631 647 'availableWidgets' => $available_widgets, // @todo Merge this with registered_widgets 632 648 'l10n' => array( … … 764 780 * @access public 765 781 * 782 * @global array $wp_registered_widgets 783 * @global array $wp_registered_widget_controls 784 * @staticvar array $available_widgets 785 * 766 786 * @see wp_list_widgets() 767 787 * … … 968 988 * @since 3.9.0 969 989 * @access public 990 * 991 * @global array $wp_registered_sidebars 992 * @global array $wp_registered_widgets 970 993 */ 971 994 public function export_preview_data() { 972 995 global $wp_registered_sidebars, $wp_registered_widgets; 973 996 // Prepare Customizer settings to pass to JavaScript. 974 997 $settings = array( 975 998 'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ), 976 999 'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ), 977 'registeredSidebars' => array_values( $ GLOBALS['wp_registered_sidebars']),978 'registeredWidgets' => $ GLOBALS['wp_registered_widgets'],1000 'registeredSidebars' => array_values( $wp_registered_sidebars ), 1001 'registeredWidgets' => $wp_registered_widgets, 979 1002 'l10n' => array( 980 1003 'widgetTooltip' => __( 'Shift-click to edit this widget.' ), … … 1041 1064 * @access public 1042 1065 * 1066 * @global array $wp_registered_sidebars 1067 * 1043 1068 * @param bool $is_active Whether the sidebar is active. 1044 1069 * @param string $sidebar_id Sidebar ID. … … 1067 1092 * @access public 1068 1093 * 1094 * @global array $wp_registered_sidebars 1095 * 1069 1096 * @param bool $has_widgets Whether the current sidebar has widgets. 1070 1097 * @param string $sidebar_id Sidebar ID. … … 1173 1200 * @access public 1174 1201 * 1202 * @global array $wp_registered_widgets 1203 * 1175 1204 * @param array $widget_ids List of widget IDs. 1176 1205 * @return array Parsed list of widget IDs. … … 1189 1218 * @since 3.9.0 1190 1219 * @access public 1220 * 1221 * @global array $wp_registered_widget_updates 1222 * @global array $wp_registered_widget_controls 1191 1223 * 1192 1224 * @param string $widget_id Widget ID.
Note: See TracChangeset
for help on using the changeset viewer.