From 9fb5112732c62a33d3e56d15fd402f88a97943fa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 4 Apr 2022 18:26:06 +0000 Subject: [PATCH] Docs: Add missing description for `$pagenow` global in various functions. See #54729, #55499. Built from https://develop.svn.wordpress.org/trunk@53060 git-svn-id: http://core.svn.wordpress.org/trunk@52649 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 2 +- wp-admin/admin.php | 10 +++++----- wp-admin/includes/bookmark.php | 2 +- wp-admin/includes/file.php | 2 +- wp-admin/includes/misc.php | 2 +- wp-admin/includes/ms.php | 4 ++-- wp-admin/includes/plugin.php | 12 ++++++------ wp-admin/includes/theme.php | 2 +- wp-admin/includes/update-core.php | 2 +- wp-admin/includes/update.php | 6 +++--- wp-admin/includes/user.php | 3 ++- wp-includes/admin-bar.php | 2 +- wp-includes/class-wp-customize-manager.php | 6 +++--- wp-includes/class-wp-recovery-mode-link-service.php | 2 +- wp-includes/functions.php | 2 +- wp-includes/functions.wp-scripts.php | 2 +- wp-includes/l10n.php | 2 +- wp-includes/load.php | 6 ++++-- wp-includes/post.php | 2 +- wp-includes/script-loader.php | 2 ++ wp-includes/user.php | 2 +- wp-includes/vars.php | 4 ++-- wp-includes/version.php | 2 +- 23 files changed, 43 insertions(+), 38 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 57e036496f..9f09b1c5d2 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -18,7 +18,7 @@ if ( ! defined( 'WP_ADMIN' ) ) { * @global string $hook_suffix * @global WP_Screen $current_screen WordPress current screen object. * @global WP_Locale $wp_locale WordPress date and time locale object. - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global string $update_title * @global int $total_update_count * @global string $parent_file diff --git a/wp-admin/admin.php b/wp-admin/admin.php index d06890259e..e48b6959e7 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -116,11 +116,11 @@ $time_format = __( 'g:i a' ); wp_enqueue_script( 'common' ); /** - * $pagenow is set in vars.php - * $wp_importers is sometimes set in wp-admin/includes/import.php - * The remaining variables are imported as globals elsewhere, declared as globals here + * $pagenow is set in vars.php. + * $wp_importers is sometimes set in wp-admin/includes/import.php. + * The remaining variables are imported as globals elsewhere, declared as globals here. * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global array $wp_importers * @global string $hook_suffix * @global string $plugin_page @@ -376,7 +376,7 @@ if ( isset( $plugin_page ) ) { * The load-* hook fires in a number of contexts. This hook is for core screens. * * The dynamic portion of the hook name, `$pagenow`, is a global variable - * referring to the filename of the current page, such as 'admin.php', + * referring to the filename of the current screen, such as 'admin.php', * 'post-new.php' etc. A complete hook for the latter would be * 'load-post-new.php'. * diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php index abc79d4353..8d26e27a5e 100644 --- a/wp-admin/includes/bookmark.php +++ b/wp-admin/includes/bookmark.php @@ -327,7 +327,7 @@ function wp_update_link( $linkdata ) { * @since 3.5.0 * @access private * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ function wp_link_manager_disabled_message() { global $pagenow; diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 5aac6c29df..a8975356c0 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -2146,7 +2146,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f * @since 2.5.0 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param string $form_post The URL to post the form to. * @param string $type Optional. Chosen type of filesystem. Default empty. diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index f8cf82acf7..aeeccc9b6f 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -1276,7 +1276,7 @@ function wp_refresh_heartbeat_nonces( $response ) { * * @since 3.8.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param array $settings An array of Heartbeat settings. * @return array Filtered Heartbeat settings. diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index ad9dbec3b2..42ff3f21d2 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -692,7 +692,7 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) { * @since 3.0.0 * * @global int $wp_db_version WordPress database version. - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @return void|false Void on success. False if the current user is not a super admin. */ @@ -1029,7 +1029,7 @@ jQuery( function($) { * * @since 4.6.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param array $args { * Optional. Array or string of Query parameters. Default empty array. diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 58718a01d5..4473110a8f 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1858,7 +1858,7 @@ function menu_page_url( $menu_slug, $echo = true ) { * @global string $parent_file * @global array $menu * @global array $submenu - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global string $typenow * @global string $plugin_page * @global array $_wp_real_parent_file @@ -1949,7 +1949,7 @@ function get_admin_page_parent( $parent = '' ) { * @global string $title * @global array $menu * @global array $submenu - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global string $plugin_page * @global string $typenow * @@ -2084,7 +2084,7 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) { * * @since 1.5.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global array $menu * @global array $submenu * @global array $_wp_menu_nopriv @@ -2467,7 +2467,7 @@ function resume_plugin( $plugin, $redirect = '' ) { * * @since 5.2.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ function paused_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { @@ -2500,8 +2500,8 @@ function paused_plugins_notice() { * @since 5.8.0 * @access private * - * @global string $pagenow - * @global string $wp_version + * @global string $pagenow The filename of the current screen. + * @global string $wp_version The WordPress version string. */ function deactivated_plugins_notice() { if ( 'plugins.php' === $GLOBALS['pagenow'] ) { diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 313b344548..3886a8eeff 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -1185,7 +1185,7 @@ function resume_theme( $theme, $redirect = '' ) { * * @since 5.2.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ function paused_themes_notice() { if ( 'themes.php' === $GLOBALS['pagenow'] ) { diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 2326bb6547..3fcd009bcc 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -1554,7 +1554,7 @@ function _copy_dir( $from, $to, $skip_list = array() ) { * @since 3.3.0 * * @global string $wp_version The WordPress version string. - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @global string $action * * @param string $new_version diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 13800a12ae..bc751e1196 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -277,16 +277,16 @@ function core_update_footer( $msg = '' ) { /** * @since 2.3.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * @return void|false */ function update_nag() { + global $pagenow; + if ( is_multisite() && ! current_user_can( 'update_core' ) ) { return false; } - global $pagenow; - if ( 'update-core.php' === $pagenow ) { return; } diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 29a4f3598a..6563859ef7 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -510,10 +510,11 @@ function default_password_nag_edit_user( $user_ID, $old_data ) { /** * @since 2.8.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ function default_password_nag() { global $pagenow; + // Short-circuit it. if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) { return; diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 18ca17b5fa..6f05fb7b26 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -1233,7 +1233,7 @@ function show_admin_bar( $show ) { * @since 3.1.0 * * @global bool $show_admin_bar - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @return bool Whether the admin bar should be showing. */ diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 6d7572c535..67a9b23962 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -500,7 +500,7 @@ final class WP_Customize_Manager { * * @since 3.4.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ public function setup_theme() { global $pagenow; @@ -607,7 +607,7 @@ final class WP_Customize_Manager { * * @since 4.9.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ public function establish_loaded_changeset() { global $pagenow; @@ -3285,7 +3285,7 @@ final class WP_Customize_Manager { * * @since 4.9.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param array $settings Current settings to filter. * @return array Heartbeat settings. diff --git a/wp-includes/class-wp-recovery-mode-link-service.php b/wp-includes/class-wp-recovery-mode-link-service.php index c25b572b76..1b4b96373a 100644 --- a/wp-includes/class-wp-recovery-mode-link-service.php +++ b/wp-includes/class-wp-recovery-mode-link-service.php @@ -65,7 +65,7 @@ class WP_Recovery_Mode_Link_Service { * * @since 5.2.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param int $ttl Number of seconds the link should be valid for. */ diff --git a/wp-includes/functions.php b/wp-includes/functions.php index ce28ff7a9a..589a4256e7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -8399,7 +8399,7 @@ function clean_dirsize_cache( $path ) { * * @since 5.2.0 * - * @global string $wp_version WordPress version. + * @global string $wp_version The WordPress version string. * * @param string $required Minimum required WordPress version. * @return bool True if required version is compatible or empty, false if not. diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index 296aba3891..4dd7122b45 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -258,7 +258,7 @@ function wp_set_script_translations( $handle, $domain = 'default', $path = null * * @since 2.1.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param string $handle Name of the script to be removed. */ diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index d55ef8ff98..98e527281e 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -114,7 +114,7 @@ function get_user_locale( $user_id = 0 ) { * * @since 5.0.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @return string The determined locale. */ diff --git a/wp-includes/load.php b/wp-includes/load.php index 7ef5171b4c..ae5ada388d 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -886,6 +886,8 @@ function wp_skip_paused_plugins( array $plugins ) { * @since 5.1.0 * @access private * + * @global string $pagenow The filename of the current screen. + * * @return string[] Array of absolute paths to theme directories. */ function wp_get_active_and_valid_themes() { @@ -966,7 +968,7 @@ function wp_is_recovery_mode() { * * @since 5.2.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @return bool True if the current endpoint should be protected. */ @@ -1746,7 +1748,7 @@ function wp_is_xml_request() { * * @since 5.6.1 * - * @global string $pagenow The current page. + * @global string $pagenow The filename of the current screen. * * @param string $context The context to check for protection. Accepts 'login', 'admin', and 'front'. * Defaults to the current context. diff --git a/wp-includes/post.php b/wp-includes/post.php index 67704e9fd7..f0d5750494 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -6577,7 +6577,7 @@ function wp_update_attachment_metadata( $attachment_id, $data ) { * * @since 2.1.0 * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. * * @param int $attachment_id Optional. Attachment post ID. Defaults to global $post. * @return string|false Attachment URL, otherwise false. diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 7ac0a3760c..aabd7fc5ed 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -2847,6 +2847,8 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) { * Inject the block editor assets that need to be loaded into the editor's iframe as an inline script. * * @since 5.8.0 + * + * @global string $pagenow The filename of the current screen. */ function wp_add_iframed_editor_assets_html() { global $pagenow; diff --git a/wp-includes/user.php b/wp-includes/user.php index 9e1b81a93a..8d60d06619 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -3712,7 +3712,7 @@ All at ###SITENAME### * @since 3.0.0 * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. * - * @global string $pagenow + * @global string $pagenow The filename of the current screen. */ function new_user_email_admin_notice() { global $pagenow; diff --git a/wp-includes/vars.php b/wp-includes/vars.php index f303a9d835..5f9257e85a 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -2,8 +2,8 @@ /** * Creates common globals for the rest of WordPress * - * Sets $pagenow global which is the current page. Checks - * for the browser to set which one is currently being used. + * Sets $pagenow global which is the filename of the current screen. + * Checks for the browser to set which one is currently being used. * * Detects which user environment WordPress is being used on. * Only attempts to check for Apache, Nginx and IIS -- three web diff --git a/wp-includes/version.php b/wp-includes/version.php index 3e815ae5e4..f6d5de6701 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53059'; +$wp_version = '6.0-alpha-53060'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.