Clean up `@global` doc blocks/imports for `class-wp-customizer-*.php` and friends.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32542


git-svn-id: http://core.svn.wordpress.org/trunk@32512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-05-22 05:06:25 +00:00
parent 1b52916239
commit 082bfab426
6 changed files with 70 additions and 24 deletions

View File

@ -153,6 +153,8 @@ function get_the_category_by_ID( $cat_ID ) {
*
* @since 1.5.1
*
* @global WP_Rewrite $wp_rewrite
*
* @param string $separator Optional, default is empty string. Separator for between the categories.
* @param string $parents Optional. How to display the parents.
* @param int $post_id Optional. Post ID to retrieve categories.

View File

@ -36,6 +36,8 @@ class WP_Http {
* @access public
* @since 2.7.0
*
* @global string $wp_version
*
* @param string $url The request URL.
* @param string|array $args {
* Optional. Array or string of HTTP request arguments.

View File

@ -1048,6 +1048,10 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
parent::enqueue();
}
/**
*
* @global Custom_Image_Header $custom_image_header
*/
public function prepare_control() {
global $custom_image_header;
if ( empty( $custom_image_header ) ) {
@ -1064,14 +1068,14 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
?>
<script type="text/template" id="tmpl-header-choice">
<# if (data.random) { #>
<button type="button" class="button display-options random">
<span class="dashicons dashicons-randomize dice"></span>
<# if ( data.type === 'uploaded' ) { #>
<?php _e( 'Randomize uploaded headers' ); ?>
<# } else if ( data.type === 'default' ) { #>
<?php _e( 'Randomize suggested headers' ); ?>
<# } #>
</button>
<button type="button" class="button display-options random">
<span class="dashicons dashicons-randomize dice"></span>
<# if ( data.type === 'uploaded' ) { #>
<?php _e( 'Randomize uploaded headers' ); ?>
<# } else if ( data.type === 'default' ) { #>
<?php _e( 'Randomize suggested headers' ); ?>
<# } #>
</button>
<# } else { #>
@ -1350,6 +1354,10 @@ class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
}
}
/**
*
* @global array $wp_registered_widgets
*/
public function render_content() {
global $wp_registered_widgets;
require_once ABSPATH . '/wp-admin/includes/widgets.php';

View File

@ -592,6 +592,8 @@ final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {
/**
* @since 3.4.0
*
* @global Custom_Image_Header $custom_image_header
*
* @param $value
*/
public function update( $value ) {

View File

@ -203,6 +203,9 @@ final class WP_Customize_Widgets {
*
* @since 3.9.0
* @access public
*
* @global array $sidebars_widgets
* @global array $_wp_sidebars_widgets
*/
public function override_sidebars_widgets_for_theme_switch() {
global $sidebars_widgets;
@ -218,7 +221,8 @@ final class WP_Customize_Widgets {
$sidebars_widgets = $this->old_sidebars_widgets;
$sidebars_widgets = retrieve_widgets( 'customize' );
add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
unset( $GLOBALS['_wp_sidebars_widgets'] ); // reset global cache var used by wp_get_sidebars_widgets()
// reset global cache var used by wp_get_sidebars_widgets()
unset( $GLOBALS['_wp_sidebars_widgets'] );
}
/**
@ -252,6 +256,8 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $sidebars_widgets
*
* @param array $sidebars_widgets
* @return array
*/
@ -303,13 +309,17 @@ final class WP_Customize_Widgets {
*
* @since 3.9.0
* @access public
*
* @global array $wp_registered_widgets
* @global array $wp_registered_widget_controls
* @global array $wp_registered_sidebars
*/
public function customize_register() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
$sidebars_widgets = array_merge(
array( 'wp_inactive_widgets' => array() ),
array_fill_keys( array_keys( $GLOBALS['wp_registered_sidebars'] ), array() ),
array_fill_keys( array_keys( $wp_registered_sidebars ), array() ),
wp_get_sidebars_widgets()
);
@ -353,7 +363,7 @@ final class WP_Customize_Widgets {
$sidebar_widget_ids = array();
}
$is_registered_sidebar = isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] );
$is_registered_sidebar = isset( $wp_registered_sidebars[ $sidebar_id ] );
$is_inactive_widgets = ( 'wp_inactive_widgets' === $sidebar_id );
$is_active_sidebar = ( $is_registered_sidebar && ! $is_inactive_widgets );
@ -374,8 +384,8 @@ final class WP_Customize_Widgets {
if ( $is_active_sidebar ) {
$section_args = array(
'title' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],
'description' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],
'title' => $wp_registered_sidebars[ $sidebar_id ]['name'],
'description' => $wp_registered_sidebars[ $sidebar_id ]['description'],
'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
'panel' => 'widgets',
'sidebar_id' => $sidebar_id,
@ -410,13 +420,13 @@ final class WP_Customize_Widgets {
foreach ( $sidebar_widget_ids as $i => $widget_id ) {
// Skip widgets that may have gone away due to a plugin being deactivated.
if ( ! $is_active_sidebar || ! isset( $GLOBALS['wp_registered_widgets'][$widget_id] ) ) {
if ( ! $is_active_sidebar || ! isset( $wp_registered_widgets[$widget_id] ) ) {
continue;
}
$registered_widget = $GLOBALS['wp_registered_widgets'][$widget_id];
$registered_widget = $wp_registered_widgets[$widget_id];
$setting_id = $this->get_setting_id( $widget_id );
$id_base = $GLOBALS['wp_registered_widget_controls'][$widget_id]['id_base'];
$id_base = $wp_registered_widget_controls[$widget_id]['id_base'];
$control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array(
'label' => $registered_widget['name'],
@ -474,6 +484,8 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global $wp_registered_widget_controls
*
* @param string $widget_id Widget ID.
* @return bool Whether or not the widget is a "wide" widget.
*/
@ -577,8 +589,14 @@ final class WP_Customize_Widgets {
*
* @since 3.9.0
* @access public
*
* @global WP_Scripts $wp_scripts
* @global array $wp_registered_sidebars
* @global array $wp_registered_widgets
*/
public function enqueue_scripts() {
global $wp_scripts, $wp_registered_sidebars, $wp_registered_widgets;
wp_enqueue_style( 'customize-widgets' );
wp_enqueue_script( 'customize-widgets' );
@ -622,12 +640,10 @@ final class WP_Customize_Widgets {
</div>'
);
global $wp_scripts;
$settings = array(
'nonce' => wp_create_nonce( 'update-widget' ),
'registeredSidebars' => array_values( $GLOBALS['wp_registered_sidebars'] ),
'registeredWidgets' => $GLOBALS['wp_registered_widgets'],
'registeredSidebars' => array_values( $wp_registered_sidebars ),
'registeredWidgets' => $wp_registered_widgets,
'availableWidgets' => $available_widgets, // @todo Merge this with registered_widgets
'l10n' => array(
'saveBtnLabel' => __( 'Apply' ),
@ -763,6 +779,10 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $wp_registered_widgets
* @global array $wp_registered_widget_controls
* @staticvar array $available_widgets
*
* @see wp_list_widgets()
*
* @return array List of available widgets.
@ -967,15 +987,18 @@ final class WP_Customize_Widgets {
*
* @since 3.9.0
* @access public
*
* @global array $wp_registered_sidebars
* @global array $wp_registered_widgets
*/
public function export_preview_data() {
global $wp_registered_sidebars, $wp_registered_widgets;
// Prepare Customizer settings to pass to JavaScript.
$settings = array(
'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
'registeredSidebars' => array_values( $GLOBALS['wp_registered_sidebars'] ),
'registeredWidgets' => $GLOBALS['wp_registered_widgets'],
'registeredSidebars' => array_values( $wp_registered_sidebars ),
'registeredWidgets' => $wp_registered_widgets,
'l10n' => array(
'widgetTooltip' => __( 'Shift-click to edit this widget.' ),
),
@ -1040,6 +1063,8 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $wp_registered_sidebars
*
* @param bool $is_active Whether the sidebar is active.
* @param string $sidebar_id Sidebar ID.
* @return bool
@ -1066,6 +1091,8 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $wp_registered_sidebars
*
* @param bool $has_widgets Whether the current sidebar has widgets.
* @param string $sidebar_id Sidebar ID.
* @return bool
@ -1172,6 +1199,8 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $wp_registered_widgets
*
* @param array $widget_ids List of widget IDs.
* @return array Parsed list of widget IDs.
*/
@ -1189,6 +1218,9 @@ final class WP_Customize_Widgets {
* @since 3.9.0
* @access public
*
* @global array $wp_registered_widget_updates
* @global array $wp_registered_widget_controls
*
* @param string $widget_id Widget ID.
* @return WP_Error|array Array containing the updated widget information.
* A WP_Error object, otherwise.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32541';
$wp_version = '4.3-alpha-32542';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.