Docs: Add a comment about the `$title` global usage in various admin files.

This should make it clear that the variable is used as part of the HTML `<title>` tag on admin screens.

Props ravipatel, hellofromTonya, sabernhardt, audrasjb, SergeyBiryukov.
Fixes #53729.
Built from https://develop.svn.wordpress.org/trunk@51475


git-svn-id: http://core.svn.wordpress.org/trunk@51086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-07-22 13:53:00 +00:00
parent 8a975839f1
commit 8a90b8691f
55 changed files with 93 additions and 4 deletions

View File

@ -9,6 +9,7 @@
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
// Used in the HTML title tag.
/* translators: Page title of the About WordPress page in the admin. */
$title = _x( 'About', 'page title' );

View File

@ -334,9 +334,10 @@ if ( isset( $plugin_page ) ) {
*/
do_action( "load-importer-{$importer}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
// Used in the HTML title tag.
$title = __( 'Import' );
$parent_file = 'tools.php';
$submenu_file = 'import.php';
$title = __( 'Import' );
if ( ! isset( $_GET['noheader'] ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';

View File

@ -62,6 +62,7 @@ if ( isset( $_POST['action'] ) && 'authorize_application_password' === $_POST['a
}
}
// Used in the HTML title tag.
$title = __( 'Authorize Application' );
$app_name = ! empty( $_REQUEST['app_name'] ) ? $_REQUEST['app_name'] : '';

View File

@ -53,6 +53,7 @@ if ( isset( $_REQUEST['c'] ) ) {
switch ( $action ) {
case 'editcomment':
// Used in the HTML title tag.
$title = __( 'Edit Comment' );
get_current_screen()->add_help_tab(
@ -96,6 +97,7 @@ switch ( $action ) {
case 'approve':
case 'trash':
case 'spam':
// Used in the HTML title tag.
$title = __( 'Moderate Comment' );
if ( ! $comment ) {

View File

@ -10,6 +10,7 @@
require_once __DIR__ . '/admin.php';
require_once __DIR__ . '/includes/credits.php';
// Used in the HTML title tag.
$title = __( 'Credits' );
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );

View File

@ -138,7 +138,9 @@ enqueue_comment_hotkeys_js();
if ( $post_id ) {
$comments_count = wp_count_comments( $post_id );
$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );
if ( $comments_count->moderated > 0 ) {
// Used in the HTML title tag.
$title = sprintf(
/* translators: 1: Comments count, 2: Post title. */
__( 'Comments (%1$s) on &#8220;%2$s&#8221;' ),
@ -146,6 +148,7 @@ if ( $post_id ) {
$draft_or_post_title
);
} else {
// Used in the HTML title tag.
$title = sprintf(
/* translators: %s: Post title. */
__( 'Comments on &#8220;%s&#8221;' ),
@ -154,13 +157,16 @@ if ( $post_id ) {
}
} else {
$comments_count = wp_count_comments();
if ( $comments_count->moderated > 0 ) {
// Used in the HTML title tag.
$title = sprintf(
/* translators: %s: Comments count. */
__( 'Comments (%s)' ),
number_format_i18n( $comments_count->moderated )
);
} else {
// Used in the HTML title tag.
$title = __( 'Comments' );
}
}

View File

@ -232,6 +232,7 @@ if ( 'wp_block' === $post_type ) {
wp_enqueue_style( 'wp-list-reusable-blocks' );
}
// Used in the HTML title tag.
$title = $post_type_object->labels->name;
if ( 'post' === $post_type ) {

View File

@ -15,6 +15,8 @@ if ( ! current_user_can( 'export' ) ) {
/** Load WordPress export API */
require_once ABSPATH . 'wp-admin/includes/export.php';
// Used in the HTML title tag.
$title = __( 'Export' );
/**

View File

@ -15,6 +15,7 @@ if ( isset( $_GET['privacy-notice'] ) ) {
exit;
}
// Used in the HTML title tag.
$title = __( 'Freedoms' );
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );

View File

@ -15,6 +15,7 @@ if ( ! current_user_can( 'import' ) ) {
wp_die( __( 'Sorry, you are not allowed to import content into this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Import' );
get_current_screen()->add_help_tab(

View File

@ -29,6 +29,7 @@ if ( wp_is_mobile() ) {
wp_enqueue_script( 'jquery-touch-punch' );
}
// Used in the HTML title tag.
$title = __( 'Dashboard' );
$parent_file = 'index.php';

View File

@ -13,6 +13,7 @@ if ( ! current_user_can( 'manage_links' ) ) {
wp_die( __( 'Sorry, you are not allowed to add links to this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Add New Link' );
$parent_file = 'link-manager.php';

View File

@ -46,6 +46,7 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
$wp_list_table->prepare_items();
// Used in the HTML title tag.
$title = __( 'Links' );
$this_file = 'link-manager.php';
$parent_file = $this_file;

View File

@ -108,6 +108,7 @@ switch ( $action ) {
$parent_file = 'link-manager.php';
$submenu_file = 'link-manager.php';
// Used in the HTML title tag.
$title = __( 'Edit Link' );
$link_id = (int) $_GET['link_id'];

View File

@ -39,6 +39,7 @@ if ( $_POST ) {
exit;
}
// Used in the HTML title tag.
$title = __( 'Upload New Media' );
$parent_file = 'upload.php';

View File

@ -45,6 +45,7 @@ switch ( $action ) {
// No break.
case 'edit':
// Used in the HTML title tag.
$title = __( 'Edit Media' );
if ( empty( $errors ) ) {

View File

@ -35,8 +35,10 @@ if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_b
$blog = get_site();
$user = wp_get_current_user();
// Used in the HTML title tag.
$title = __( 'Delete Site' );
$parent_file = 'tools.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
echo '<div class="wrap">';

View File

@ -34,6 +34,7 @@ if ( 'updateblogsettings' === $action && isset( $_POST['primary_blog'] ) ) {
}
}
// Used in the HTML title tag.
$title = __( 'My Sites' );
$parent_file = 'index.php';

View File

@ -49,9 +49,11 @@ if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALL
}
if ( is_network_admin() ) {
// Used in the HTML title tag.
$title = __( 'Network Setup' );
$parent_file = 'settings.php';
} else {
// Used in the HTML title tag.
$title = __( 'Create a Network of WordPress Sites' );
$parent_file = 'tools.php';
}

View File

@ -17,6 +17,7 @@ if ( ! current_user_can( 'manage_network' ) ) {
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
}
// Used in the HTML title tag.
$title = __( 'Dashboard' );
$parent_file = 'index.php';

View File

@ -17,6 +17,7 @@ if ( ! current_user_can( 'manage_network_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
}
// Used in the HTML title tag.
$title = __( 'Network Settings' );
$parent_file = 'settings.php';

View File

@ -122,6 +122,7 @@ if ( isset( $_GET['update'] ) ) {
}
}
// Used in the HTML title tag.
/* translators: %s: Site title. */
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );

View File

@ -174,6 +174,7 @@ if ( isset( $_GET['update'] ) ) {
}
}
// Used in the HTML title tag.
$title = __( 'Add New Site' );
$parent_file = 'sites.php';

View File

@ -79,6 +79,7 @@ if ( isset( $_GET['update'] ) ) {
}
}
// Used in the HTML title tag.
/* translators: %s: Site title. */
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );

View File

@ -166,6 +166,7 @@ if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) {
add_thickbox();
add_screen_option( 'per_page' );
// Used in the HTML title tag.
/* translators: %s: Site title. */
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );

View File

@ -195,6 +195,7 @@ if ( isset( $_GET['action'] ) && 'update-site' === $_GET['action'] ) {
add_screen_option( 'per_page' );
// Used in the HTML title tag.
/* translators: %s: Site title. */
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );

View File

@ -17,6 +17,7 @@ if ( ! current_user_can( 'manage_sites' ) ) {
$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
$pagenum = $wp_list_table->get_pagenum();
// Used in the HTML title tag.
$title = __( 'Sites' );
$parent_file = 'sites.php';

View File

@ -81,6 +81,7 @@ if ( $action ) {
$themes = array();
}
// Used in the HTML title tag.
$title = __( 'Update Themes' );
$parent_file = 'themes.php';
@ -333,6 +334,7 @@ get_current_screen()->set_screen_reader_content(
)
);
// Used in the HTML title tag.
$title = __( 'Themes' );
$parent_file = 'themes.php';

View File

@ -12,6 +12,7 @@ require_once __DIR__ . '/admin.php';
require_once ABSPATH . WPINC . '/http.php';
// Used in the HTML title tag.
$title = __( 'Upgrade Network' );
$parent_file = 'upgrade.php';

View File

@ -98,6 +98,7 @@ if ( isset( $_GET['update'] ) ) {
}
}
// Used in the HTML title tag.
$title = __( 'Add New User' );
$parent_file = 'users.php';

View File

@ -29,12 +29,17 @@ if ( isset( $_GET['action'] ) ) {
$id = (int) $_GET['id'];
if ( $id > 1 ) {
$_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle arrays.
// Used in the HTML title tag.
$title = __( 'Users' );
$parent_file = 'users.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
echo '<div class="wrap">';
confirm_delete_users( $_POST['allusers'] );
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
} else {
wp_redirect( network_admin_url( 'users.php' ) );
@ -59,12 +64,17 @@ if ( isset( $_GET['action'] ) ) {
if ( ! current_user_can( 'delete_users' ) ) {
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
}
// Used in the HTML title tag.
$title = __( 'Users' );
$parent_file = 'users.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
echo '<div class="wrap">';
confirm_delete_users( $_POST['allusers'] );
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
@ -206,6 +216,8 @@ if ( $pagenum > $total_pages && $total_pages > 0 ) {
wp_redirect( add_query_arg( 'paged', $total_pages ) );
exit;
}
// Used in the HTML title tag.
$title = __( 'Users' );
$parent_file = 'users.php';

View File

@ -12,6 +12,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Discussion Settings' );
$parent_file = 'options-general.php';

View File

@ -16,6 +16,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'General Settings' );
$parent_file = 'options-general.php';
/* translators: Date and time format for exact current time, mainly about timezones, see https://www.php.net/manual/datetime.format.php */

View File

@ -13,6 +13,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Media Settings' );
$parent_file = 'options-general.php';

View File

@ -13,6 +13,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Permalink Settings' );
$parent_file = 'options-general.php';

View File

@ -13,6 +13,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Reading Settings' );
$parent_file = 'options-general.php';

View File

@ -13,6 +13,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Writing Settings' );
$parent_file = 'options-general.php';

View File

@ -18,6 +18,7 @@
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
// Used in the HTML title tag.
$title = __( 'Settings' );
$this_file = 'options.php';
$parent_file = 'options-general.php';

View File

@ -18,6 +18,7 @@ if ( ! current_user_can( 'edit_plugins' ) ) {
wp_die( __( 'Sorry, you are not allowed to edit plugins for this site.' ) );
}
// Used in the HTML title tag.
$title = __( 'Edit Plugins' );
$parent_file = 'plugins.php';

View File

@ -47,6 +47,7 @@ if ( $pagenum > $total_pages && $total_pages > 0 ) {
exit;
}
// Used in the HTML title tag.
$title = __( 'Add Plugins' );
$parent_file = 'plugins.php';

View File

@ -153,6 +153,7 @@ if ( $action ) {
$plugins = array();
}
// Used in the HTML title tag.
$title = __( 'Update Plugins' );
$parent_file = 'plugins.php';
@ -597,6 +598,7 @@ get_current_screen()->set_screen_reader_content(
)
);
// Used in the HTML title tag.
$title = __( 'Plugins' );
$parent_file = 'plugins.php';

View File

@ -9,6 +9,7 @@
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
// Used in the HTML title tag.
$title = __( 'Privacy' );
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );

View File

@ -108,6 +108,7 @@ switch ( $action ) {
/* translators: %s: Post title. */
$h1 = sprintf( __( 'Compare Revisions of &#8220;%s&#8221;' ), $post_title );
$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Go to editor' ) . '</a>';
// Used in the HTML title tag.
$title = __( 'Revisions' );
$redirect = false;

View File

@ -18,6 +18,7 @@ if ( ! current_user_can( 'edit_themes' ) ) {
wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
}
// Used in the HTML title tag.
$title = __( 'Edit Themes' );
$parent_file = 'themes.php';

View File

@ -21,6 +21,7 @@ if ( is_multisite() && ! is_network_admin() ) {
exit;
}
// Used in the HTML title tag.
$title = __( 'Add Themes' );
$parent_file = 'themes.php';

View File

@ -123,6 +123,7 @@ if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
}
}
// Used in the HTML title tag.
$title = __( 'Manage Themes' );
$parent_file = 'themes.php';

View File

@ -39,6 +39,7 @@ if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
// Used in the HTML title tag.
$title = __( 'Tools' );
get_current_screen()->add_help_tab(

View File

@ -1136,6 +1136,7 @@ if ( 'upgrade-core' === $action ) {
$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
$url = wp_nonce_url( $url, 'bulk-update-plugins' );
// Used in the HTML title tag.
$title = __( 'Update Plugins' );
require_once ABSPATH . 'wp-admin/admin-header.php';
@ -1176,6 +1177,7 @@ if ( 'upgrade-core' === $action ) {
$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
$url = wp_nonce_url( $url, 'bulk-update-themes' );
// Used in the HTML title tag.
$title = __( 'Update Themes' );
require_once ABSPATH . 'wp-admin/admin-header.php';

View File

@ -59,6 +59,7 @@ if ( isset( $_GET['action'] ) ) {
check_admin_referer( 'upgrade-plugin_' . $plugin );
// Used in the HTML title tag.
$title = __( 'Update Plugin' );
$parent_file = 'plugins.php';
$submenu_file = 'plugins.php';
@ -123,9 +124,11 @@ if ( isset( $_GET['action'] ) ) {
wp_die( $api );
}
// Used in the HTML title tag.
$title = __( 'Plugin Installation' );
$parent_file = 'plugins.php';
$submenu_file = 'plugin-install.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
/* translators: %s: Plugin name and version. */
@ -153,9 +156,11 @@ if ( isset( $_GET['action'] ) ) {
$file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' );
// Used in the HTML title tag.
$title = __( 'Upload Plugin' );
$parent_file = 'plugins.php';
$submenu_file = 'plugin-install.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
/* translators: %s: File name. */
@ -206,9 +211,11 @@ if ( isset( $_GET['action'] ) ) {
wp_enqueue_script( 'updates' );
// Used in the HTML title tag.
$title = __( 'Update Theme' );
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
$nonce = 'upgrade-theme_' . $theme;
@ -269,9 +276,11 @@ if ( isset( $_GET['action'] ) ) {
wp_die( $api );
}
// Used in the HTML title tag.
$title = __( 'Install Themes' );
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
/* translators: %s: Theme name and version. */
@ -295,6 +304,7 @@ if ( isset( $_GET['action'] ) ) {
$file_upload = new File_Upload_Upgrader( 'themezip', 'package' );
// Used in the HTML title tag.
$title = __( 'Upload Theme' );
$parent_file = 'themes.php';
$submenu_file = 'theme-install.php';

View File

@ -76,6 +76,7 @@ if ( 'grid' === $mode ) {
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
);
// Used in the HTML title tag.
$title = __( 'Media Library' );
$parent_file = 'upload.php';
@ -215,6 +216,7 @@ if ( $doaction ) {
$wp_list_table->prepare_items();
// Used in the HTML title tag.
$title = __( 'Media Library' );
$parent_file = 'upload.php';

View File

@ -32,8 +32,10 @@ if ( wp_is_application_passwords_available_for_user( $user_id ) ) {
}
if ( IS_PROFILE_PAGE ) {
// Used in the HTML title tag.
$title = __( 'Profile' );
} else {
// Used in the HTML title tag.
/* translators: %s: User's display name. */
$title = __( 'Edit User %s' );
}

View File

@ -245,6 +245,7 @@ Please click the following link to confirm the invite:
}
}
// Used in the HTML title tag.
$title = __( 'Add New User' );
$parent_file = 'users.php';

View File

@ -20,8 +20,10 @@ if ( ! current_user_can( 'list_users' ) ) {
$wp_list_table = _get_list_table( 'WP_Users_List_Table' );
$pagenum = $wp_list_table->get_pagenum();
$title = __( 'Users' );
$parent_file = 'users.php';
// Used in the HTML title tag.
$title = __( 'Users' );
$parent_file = 'users.php';
add_screen_option( 'per_page' );

View File

@ -24,6 +24,7 @@ if ( ! current_theme_supports( 'widgets' ) ) {
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
}
// Used in the HTML title tag.
$title = __( 'Widgets' );
$parent_file = 'themes.php';

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51474';
$wp_version = '5.9-alpha-51475';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.