Skip to content

Commit 23ce2ef

Browse files
committed
Add @global annotations for wp-admin/*.
See #32444. git-svn-id: https://develop.svn.wordpress.org/trunk@32642 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5f8df22 commit 23ce2ef

61 files changed

Lines changed: 703 additions & 37 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/wp-admin/admin-footer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
*
8282
* @since 2.8.0
8383
*
84+
* @global string $hook_suffix
8485
* @param string $hook_suffix The current admin page.
8586
*/
8687
do_action( "admin_footer-" . $GLOBALS['hook_suffix'] );

src/wp-admin/admin-header.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@
1010
if ( ! defined( 'WP_ADMIN' ) )
1111
require_once( dirname( __FILE__ ) . '/admin.php' );
1212

13-
// In case admin-header.php is included in a function.
13+
/**
14+
* In case admin-header.php is included in a function.
15+
*
16+
* @global string $title
17+
* @global string $hook_suffix
18+
* @global WP_Screen $current_screen
19+
* @global WP_Locale $wp_locale
20+
* @global string $pagenow
21+
* @global string $wp_version
22+
* @global string $update_title
23+
* @global int $total_update_count
24+
* @global string $parent_file
25+
*/
1426
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
1527
$update_title, $total_update_count, $parent_file;
1628

src/wp-admin/admin.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,21 @@
9494

9595
wp_enqueue_script( 'common' );
9696

97-
// $pagenow is set in vars.php
98-
// $wp_importers is sometimes set in wp-admin/includes/import.php
99-
//
100-
// The remaining variables are imported as globals elsewhere,
101-
// declared as globals here
97+
98+
99+
100+
/**
101+
* $pagenow is set in vars.php
102+
* $wp_importers is sometimes set in wp-admin/includes/import.php
103+
* The remaining variables are imported as globals elsewhere, declared as globals here
104+
*
105+
* @global string $pagenow
106+
* @global array $wp_importers
107+
* @global string $hook_suffix
108+
* @global string $plugin_page
109+
* @global string $typenow
110+
* @global string $taxnow
111+
*/
102112
global $pagenow, $wp_importers, $hook_suffix, $plugin_page, $typenow, $taxnow;
103113

104114
$page_hook = null;

src/wp-admin/comment.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
$parent_file = 'edit-comments.php';
1313
$submenu_file = 'edit-comments.php';
1414

15+
/**
16+
* @global string $action
17+
*/
1518
global $action;
1619
wp_reset_vars( array('action') );
1720

src/wp-admin/custom-header.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ public function take_action() {
228228
* Process the default headers
229229
*
230230
* @since 3.0.0
231+
*
232+
* @global array $_wp_default_headers
231233
*/
232234
public function process_default_headers() {
233235
global $_wp_default_headers;

src/wp-admin/customize.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
}
3434
}
3535

36+
/**
37+
* @global WP_Scripts $wp_scripts
38+
* @global WP_Customize_Manager $wp_customize
39+
*/
3640
global $wp_scripts, $wp_customize;
3741

3842
$registered = $wp_scripts->registered;

src/wp-admin/edit-form-advanced.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
if ( !defined('ABSPATH') )
1111
die('-1');
1212

13+
/**
14+
* @global string $post_type
15+
* @global object $post_type_object
16+
* @global WP_Post $post
17+
*/
1318
global $post_type, $post_type_object, $post;
1419

1520
wp_enqueue_script('post');

src/wp-admin/edit-tags.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
if ( ! current_user_can( $tax->cap->manage_terms ) )
2121
wp_die( __( 'Cheatin’ uh?' ), 403 );
2222

23-
// $post_type is set when the WP_Terms_List_Table instance is created
23+
/**
24+
* $post_type is set when the WP_Terms_List_Table instance is created
25+
*
26+
* @global string $post_type
27+
*/
2428
global $post_type;
2529

2630
$wp_list_table = _get_list_table('WP_Terms_List_Table');

src/wp-admin/edit.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
}
1919
}
2020

21+
/**
22+
* @global string $post_type
23+
* @global object $post_type_object
24+
*/
2125
global $post_type, $post_type_object;
2226

2327
$post_type = $typenow;

src/wp-admin/includes/ajax-actions.php

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ function wp_ajax_nopriv_heartbeat() {
7878
* Ajax handler for fetching a list table.
7979
*
8080
* @since 3.1.0
81+
*
82+
* @global WP_List_Table $wp_list_table
8183
*/
8284
function wp_ajax_fetch_list() {
8385
global $wp_list_table;
@@ -226,6 +228,8 @@ function wp_ajax_imgedit_preview() {
226228
* Ajax handler for oEmbed caching.
227229
*
228230
* @since 3.1.0
231+
*
232+
* @global WP_Embed $wp_embed
229233
*/
230234
function wp_ajax_oembed_cache() {
231235
$GLOBALS['wp_embed']->cache_oembed( $_GET['post'] );
@@ -762,6 +766,8 @@ function wp_ajax_add_link_category( $action ) {
762766
* Ajax handler to add a tag.
763767
*
764768
* @since 3.1.0
769+
*
770+
* @global WP_List_Table $wp_list_table
765771
*/
766772
function wp_ajax_add_tag() {
767773
global $wp_list_table;
@@ -864,6 +870,9 @@ function wp_ajax_get_tagcloud() {
864870
*
865871
* @since 3.1.0
866872
*
873+
* @global WP_List_Table $wp_list_table
874+
* @global int $post_id
875+
*
867876
* @param string $action Action to perform.
868877
*/
869878
function wp_ajax_get_comments( $action ) {
@@ -915,6 +924,8 @@ function wp_ajax_get_comments( $action ) {
915924
*
916925
* @since 3.1.0
917926
*
927+
* @global WP_List_Table $wp_list_table
928+
*
918929
* @param string $action Action to perform.
919930
*/
920931
function wp_ajax_replyto_comment( $action ) {
@@ -1016,6 +1027,8 @@ function wp_ajax_replyto_comment( $action ) {
10161027
* Ajax handler for editing a comment.
10171028
*
10181029
* @since 3.1.0
1030+
*
1031+
* @global WP_List_Table $wp_list_table
10191032
*/
10201033
function wp_ajax_edit_comment() {
10211034
global $wp_list_table;
@@ -1229,6 +1242,8 @@ function wp_ajax_add_meta() {
12291242
*
12301243
* @since 3.1.0
12311244
*
1245+
* @global WP_List_Table $wp_list_table
1246+
*
12321247
* @param string $action Action to perform.
12331248
*/
12341249
function wp_ajax_add_user( $action ) {
@@ -1499,6 +1514,8 @@ function wp_ajax_sample_permalink() {
14991514
* Ajax handler for Quick Edit saving a post from a list table.
15001515
*
15011516
* @since 3.1.0
1517+
*
1518+
* @global WP_List_Table $wp_list_table
15021519
*/
15031520
function wp_ajax_inline_save() {
15041521
global $wp_list_table;
@@ -1591,6 +1608,8 @@ function wp_ajax_inline_save() {
15911608
* Ajax handler for quick edit saving for a term.
15921609
*
15931610
* @since 3.1.0
1611+
*
1612+
* @global WP_List_Table $wp_list_table
15941613
*/
15951614
function wp_ajax_inline_save_tax() {
15961615
global $wp_list_table;
@@ -1743,6 +1762,10 @@ function wp_ajax_widgets_order() {
17431762
* Ajax handler for saving a widget.
17441763
*
17451764
* @since 3.1.0
1765+
*
1766+
* @global array $wp_registered_widgets
1767+
* @global array $wp_registered_widget_controls
1768+
* @global array $wp_registered_widget_updates
17461769
*/
17471770
function wp_ajax_save_widget() {
17481771
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
@@ -1832,6 +1855,8 @@ function wp_ajax_save_widget() {
18321855
* Ajax handler for saving a widget.
18331856
*
18341857
* @since 3.9.0
1858+
*
1859+
* @global WP_Customize_Manager $wp_customize
18351860
*/
18361861
function wp_ajax_update_widget() {
18371862
global $wp_customize;
@@ -2475,6 +2500,9 @@ function wp_ajax_send_attachment_to_editor() {
24752500
* - video_send_to_editor_url
24762501
*
24772502
* @since 3.5.0
2503+
*
2504+
* @global WP_Post $post
2505+
* @global WP_Embed $wp_embed
24782506
*/
24792507
function wp_ajax_send_link_to_editor() {
24802508
global $post, $wp_embed;
@@ -2627,6 +2655,8 @@ function wp_ajax_get_revision_diffs() {
26272655
* a user's own profile.
26282656
*
26292657
* @since 3.8.0
2658+
*
2659+
* @global array $_wp_admin_css_colors
26302660
*/
26312661
function wp_ajax_save_user_color_scheme() {
26322662
global $_wp_admin_css_colors;
@@ -2652,6 +2682,9 @@ function wp_ajax_save_user_color_scheme() {
26522682
* Ajax handler for getting themes from themes_api().
26532683
*
26542684
* @since 3.9.0
2685+
*
2686+
* @global array $themes_allowedtags
2687+
* @global array $theme_field_defaults
26552688
*/
26562689
function wp_ajax_query_themes() {
26572690
global $themes_allowedtags, $theme_field_defaults;
@@ -2699,8 +2732,9 @@ function wp_ajax_query_themes() {
26992732
*
27002733
* @since 4.0.0
27012734
*
2702-
* @global WP_Post $post Global $post.
2703-
* @global WP_Embed $wp_embed Embed API instance.
2735+
* @global WP_Post $post Global $post.
2736+
* @global WP_Embed $wp_embed Embed API instance.
2737+
* @global WP_Scripts $wp_scripts
27042738
*/
27052739
function wp_ajax_parse_embed() {
27062740
global $post, $wp_embed;
@@ -2788,6 +2822,11 @@ function wp_ajax_parse_embed() {
27882822
) );
27892823
}
27902824

2825+
/**
2826+
*
2827+
* @global WP_Post $post
2828+
* @global WP_Scripts $wp_scripts
2829+
*/
27912830
function wp_ajax_parse_media_shortcode() {
27922831
global $post, $wp_scripts;
27932832

@@ -2967,6 +3006,8 @@ function wp_ajax_update_plugin() {
29673006
* AJAX handler for saving a post from Press This.
29683007
*
29693008
* @since 4.2.0
3009+
*
3010+
* @global WP_Press_This $wp_press_this
29703011
*/
29713012
function wp_ajax_press_this_save_post() {
29723013
if ( empty( $GLOBALS['wp_press_this'] ) ) {
@@ -2980,6 +3021,8 @@ function wp_ajax_press_this_save_post() {
29803021
* AJAX handler for creating new category from Press This.
29813022
*
29823023
* @since 4.2.0
3024+
*
3025+
* @global WP_Press_This $wp_press_this
29833026
*/
29843027
function wp_ajax_press_this_add_category() {
29853028
if ( empty( $GLOBALS['wp_press_this'] ) ) {

0 commit comments

Comments
 (0)