diff --git a/wp-admin/about.php b/wp-admin/about.php index 68fa12422f..13269ad58f 100644 --- a/wp-admin/about.php +++ b/wp-admin/about.php @@ -19,15 +19,27 @@
- - -
++ + +
+- Version %1$s addressed %2$s bug.', - 'Version %1$s addressed %2$s bugs.', - 1 - ), - '5.5.3', - number_format_i18n( 1 ) - ); - ?> - the release notes.' ), - sprintf( - /* translators: %s: WordPress version. */ - esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), - sanitize_title( '5.5.3' ) - ) - ); - ?> -
-- Version %1$s addressed some security issues and fixed %2$s bug.', - 'Version %1$s addressed some security issues and fixed %2$s bugs.', - 14 - ), - '5.5.2', - number_format_i18n( 14 ) - ); - ?> - the release notes.' ), - sprintf( - /* translators: %s: WordPress version */ - esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), - sanitize_title( '5.5.2' ) - ) - ); - ?> -
-- Version %1$s addressed %2$s bug.', - 'Version %1$s addressed %2$s bugs.', - 44 - ), - '5.5.1', - number_format_i18n( 44 ) - ); - ?> - the release notes.' ), - sprintf( - /* translators: %s: WordPress version. */ - esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), - sanitize_title( '5.5.1' ) - ) - ); - ?> -
+- - - -
+ +
- - - +
- - -
- +
+ WordPress accessibility-ready guidelines and addresses several more specialized standards from the Web Content Accessibility Guidelines (WCAG) 2.1 at level AAA. It will help you meet the highest level of international accessibility standards when you create accessible content and choose plugins which are accessible too!' ), + 'https://make.wordpress.org/themes/handbook/review/accessibility/', + 'https://www.w3.org/WAI/WCAG2AAA-Conformance' + ); + ?> +
+ feature plugin includes template copy for you to update and publish, and it’s written to support different contexts and jurisdictions.' ), + 'https://github.com/10degrees/accessibility-statement-plugin' + ); + ?> +
++ read the PHP 8 developer note.' ), + 'https://make.wordpress.org/core/2020/11/23/wordpress-and-php-8-0/' + ); + ?> +
wp_get_environment_type()' + /* translators: %s: jQuery update test plugin link. */ + __( 'Updates to jQuery in WordPress take place across three releases: 5.5, 5.6, and 5.7. As we reach the mid-point of this process, run the update test plugin to check your sites for errors ahead of time.' ), + current_user_can( 'install_plugins' ) ? + esc_url( network_admin_url( 'plugin-install.php?tab=search&type=term&s=slug:wp-jquery-update-test' ) ) : + esc_url( __( 'https://wordpress.org/plugins/wp-jquery-update-test/' ) ) ); ?>
-
get_header()',
- 'get_template_part()
',
- '$args
'
+ /* translators: %s: jQuery Migrate plugin link. */
+ __( 'If you find issues with the way your site looks (e.g. a slider doesn’t work, a button is stuck — that sort of thing), install the jQuery Migrate plugin.' ),
+ current_user_can( 'install_plugins' ) ?
+ esc_url( network_admin_url( 'plugin-install.php?tab=search&type=term&s=slug:enable-jquery-migrate-helper' ) ) :
+ esc_url( __( 'https://wordpress.org/plugins/enable-jquery-migrate-helper/' ) )
);
?>
WordPress 5.5 Field Guide.' ), - 'https://make.wordpress.org/core/wordpress-5-5-field-guide/' + /* translators: %s: WordPress 5.6 Field Guide link. */ + __( 'Check out the latest version of the WordPress Field Guide. It highlights developer notes for each change you may want to be aware of. WordPress 5.6 Field Guide.' ), + 'https://make.wordpress.org/core/2020/11/20/wordpress-5-6-field-guide/' ); ?>
@@ -353,7 +253,7 @@get_error_message(); ?>
+ ' . esc_html( $app_name ) . '' + ); + ?> +
+ + + + + ID, true ); + $blogs_count = count( $blogs ); + if ( $blogs_count > 1 ) { + ?> ++ the %2$s blog in this installation that you have permissions on.', + 'This will grant access to all %2$s blogs in this installation that you have permissions on.', + $blogs_count + ), + admin_url( 'my-sites.php' ), + number_format_i18n( $blogs_count ) + ); + ?> +
+ + + ++ + +
+ +- - -
++ + +
+- - -
++ + +
+post_date ) { $time = ''; } else { - /* translators: Date format in table columns, see https://www.php.net/date */ + /* translators: Date format in table columns, see https://www.php.net/manual/datetime.format.php */ $time = mysql2date( __( 'Y/m/d' ), $post->post_date ); } @@ -2370,7 +2370,7 @@ function wp_ajax_save_widget() { } /** - * Ajax handler for saving a widget. + * Ajax handler for updating a widget. * * @since 3.9.0 * @@ -2594,7 +2594,7 @@ function wp_ajax_upload_attachment() { * @since 3.1.0 */ function wp_ajax_image_editor() { - $attachment_id = intval( $_POST['postid'] ); + $attachment_id = (int) $_POST['postid']; if ( empty( $attachment_id ) || ! current_user_can( 'edit_post', $attachment_id ) ) { wp_die( -1 ); @@ -2651,12 +2651,12 @@ function wp_ajax_image_editor() { function wp_ajax_set_post_thumbnail() { $json = ! empty( $_REQUEST['json'] ); // New-style request. - $post_ID = intval( $_POST['post_id'] ); + $post_ID = (int) $_POST['post_id']; if ( ! current_user_can( 'edit_post', $post_ID ) ) { wp_die( -1 ); } - $thumbnail_id = intval( $_POST['thumbnail_id'] ); + $thumbnail_id = (int) $_POST['thumbnail_id']; if ( $json ) { check_ajax_referer( "update-post_$post_ID" ); @@ -2687,7 +2687,7 @@ function wp_ajax_set_post_thumbnail() { * @since 4.6.0 */ function wp_ajax_get_post_thumbnail_html() { - $post_ID = intval( $_POST['post_id'] ); + $post_ID = (int) $_POST['post_id']; check_ajax_referer( "update-post_$post_ID" ); @@ -2695,7 +2695,7 @@ function wp_ajax_get_post_thumbnail_html() { wp_die( -1 ); } - $thumbnail_id = intval( $_POST['thumbnail_id'] ); + $thumbnail_id = (int) $_POST['thumbnail_id']; // For backward compatibility, -1 refers to no featured image. if ( -1 === $thumbnail_id ) { @@ -3208,7 +3208,7 @@ function wp_ajax_send_attachment_to_editor() { $attachment = wp_unslash( $_POST['attachment'] ); - $id = intval( $attachment['id'] ); + $id = (int) $attachment['id']; $post = get_post( $id ); if ( ! $post ) { @@ -3221,7 +3221,7 @@ function wp_ajax_send_attachment_to_editor() { if ( current_user_can( 'edit_post', $id ) ) { // If this attachment is unattached, attach it. Primarily a back compat thing. - $insert_into_post_id = intval( $_POST['post_id'] ); + $insert_into_post_id = (int) $_POST['post_id']; if ( 0 == $post->post_parent && $insert_into_post_id ) { wp_update_post( @@ -3622,7 +3622,7 @@ function wp_ajax_parse_embed() { wp_send_json_error(); } - $post_id = isset( $_POST['post_ID'] ) ? intval( $_POST['post_ID'] ) : 0; + $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); @@ -3674,9 +3674,9 @@ function wp_ajax_parse_embed() { // Set $content_width so any embeds fit in the destination iframe. if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { if ( ! isset( $content_width ) ) { - $content_width = intval( $_POST['maxwidth'] ); + $content_width = (int) $_POST['maxwidth']; } else { - $content_width = min( $content_width, intval( $_POST['maxwidth'] ) ); + $content_width = min( $content_width, (int) $_POST['maxwidth'] ); } } @@ -5142,8 +5142,21 @@ function wp_ajax_wp_privacy_erase_personal_data() { * Ajax handler for site health checks on server communication. * * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_dotorg_communication() + * @see WP_REST_Site_Health_Controller::test_dotorg_communication() */ function wp_ajax_health_check_dotorg_communication() { + _doing_it_wrong( + 'wp_ajax_health_check_dotorg_communication', + sprintf( + // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. + __( 'The Site Health check for %1$s has been replaced with %2$s.' ), + 'wp_ajax_health_check_dotorg_communication', + 'WP_REST_Site_Health_Controller::test_dotorg_communication' + ), + '5.6.0' + ); + check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { @@ -5158,32 +5171,25 @@ function wp_ajax_health_check_dotorg_communication() { wp_send_json_success( $site_health->get_test_dotorg_communication() ); } -/** - * Ajax handler for site health checks on debug mode. - * - * @since 5.2.0 - */ -function wp_ajax_health_check_is_in_debug_mode() { - wp_verify_nonce( 'health-check-site-status' ); - - if ( ! current_user_can( 'view_site_health_checks' ) ) { - wp_send_json_error(); - } - - if ( ! class_exists( 'WP_Site_Health' ) ) { - require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; - } - - $site_health = WP_Site_Health::get_instance(); - wp_send_json_success( $site_health->get_test_is_in_debug_mode() ); -} - /** * Ajax handler for site health checks on background updates. * * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_background_updates() + * @see WP_REST_Site_Health_Controller::test_background_updates() */ function wp_ajax_health_check_background_updates() { + _doing_it_wrong( + 'wp_ajax_health_check_background_updates', + sprintf( + // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. + __( 'The Site Health check for %1$s has been replaced with %2$s.' ), + 'wp_ajax_health_check_background_updates', + 'WP_REST_Site_Health_Controller::test_background_updates' + ), + '5.6.0' + ); + check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { @@ -5202,8 +5208,21 @@ function wp_ajax_health_check_background_updates() { * Ajax handler for site health checks on loopback requests. * * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_loopback_requests() + * @see WP_REST_Site_Health_Controller::test_loopback_requests() */ function wp_ajax_health_check_loopback_requests() { + _doing_it_wrong( + 'wp_ajax_health_check_loopback_requests', + sprintf( + // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. + __( 'The Site Health check for %1$s has been replaced with %2$s.' ), + 'wp_ajax_health_check_loopback_requests', + 'WP_REST_Site_Health_Controller::test_loopback_requests' + ), + '5.6.0' + ); + check_ajax_referer( 'health-check-site-status' ); if ( ! current_user_can( 'view_site_health_checks' ) ) { @@ -5239,8 +5258,21 @@ function wp_ajax_health_check_site_status_result() { * Ajax handler for site health check to get directories and database sizes. * * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::get_directory_sizes() + * @see WP_REST_Site_Health_Controller::get_directory_sizes() */ function wp_ajax_health_check_get_sizes() { + _doing_it_wrong( + 'wp_ajax_health_check_get_sizes', + sprintf( + // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. + __( 'The Site Health check for %1$s has been replaced with %2$s.' ), + 'wp_ajax_health_check_get_sizes', + 'WP_REST_Site_Health_Controller::get_directory_sizes' + ), + '5.6.0' + ); + check_ajax_referer( 'health-check-site-status-result' ); if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) { diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php index 622ea06955..6cc6683f02 100644 --- a/wp-admin/includes/bookmark.php +++ b/wp-admin/includes/bookmark.php @@ -142,13 +142,34 @@ function get_link_to_edit( $link ) { } /** - * Inserts/updates links into/in the database. + * Inserts a link into the database, or updates an existing link. + * + * Runs all the necessary sanitizing, provides default values if arguments are missing, + * and finally saves the link. * * @since 2.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * - * @param array $linkdata Elements that make up the link to insert. + * @param array $linkdata { + * Elements that make up the link to insert. + * + * @type int $link_id Optional. The ID of the existing link if updating. + * @type string $link_url The URL the link points to. + * @type string $link_name The title of the link. + * @type string $link_image Optional. A URL of an image. + * @type string $link_target Optional. The target element for the anchor tag. + * @type string $link_description Optional. A short description of the link. + * @type string $link_visible Optional. 'Y' means visible, anything else means not. + * @type int $link_owner Optional. A user ID. + * @type int $link_rating Optional. A rating for the link. + * @type string $link_updated Optional. When the link was last updated. + * @type string $link_rel Optional. A relationship of the link to you. + * @type string $link_notes Optional. An extended description of or notes on the link. + * @type string $link_rss Optional. A URL of an associated RSS feed. + * @type int $link_category Optional. The term ID of the link category. + * If empty, uses default link category. + * } * @param bool $wp_error Optional. Whether to return a WP_Error object on failure. Default false. * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. */ @@ -274,7 +295,7 @@ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { * * @since 2.0.0 * - * @param array $linkdata Link data to update. + * @param array $linkdata Link data to update. See wp_insert_link() for accepted arguments. * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success. */ function wp_update_link( $linkdata ) { diff --git a/wp-admin/includes/class-automatic-upgrader-skin.php b/wp-admin/includes/class-automatic-upgrader-skin.php index 9875c6dee5..1835b3952c 100644 --- a/wp-admin/includes/class-automatic-upgrader-skin.php +++ b/wp-admin/includes/class-automatic-upgrader-skin.php @@ -8,7 +8,7 @@ */ /** - * Upgrader Skin for Automatic WordPress Upgrades + * Upgrader Skin for Automatic WordPress Upgrades. * * This skin is designed to be used when no output is intended, all output * is captured and stored for the caller to process and log/email/discard. @@ -52,14 +52,22 @@ public function request_filesystem_credentials( $error = false, $context = '', $ } /** - * @return array + * Retrieves the upgrade messages. + * + * @since 3.7.0 + * + * @return array Messages during an upgrade. */ public function get_upgrade_messages() { return $this->messages; } /** - * @param string|array|WP_Error $data + * Stores a message about the upgrade. + * + * @since 3.7.0 + * + * @param string|array|WP_Error $data Message data. * @param mixed ...$args Optional text replacements. */ public function feedback( $data, ...$args ) { @@ -103,12 +111,18 @@ public function feedback( $data, ...$args ) { } /** + * Creates a new output buffer. + * + * @since 3.7.0 */ public function header() { ob_start(); } /** + * Retrieves the buffered content, deletes the buffer, and processes the output. + * + * @since 3.7.0 */ public function footer() { $output = ob_get_clean(); diff --git a/wp-admin/includes/class-bulk-plugin-upgrader-skin.php b/wp-admin/includes/class-bulk-plugin-upgrader-skin.php index 308cacf553..9844e19460 100644 --- a/wp-admin/includes/class-bulk-plugin-upgrader-skin.php +++ b/wp-admin/includes/class-bulk-plugin-upgrader-skin.php @@ -48,12 +48,12 @@ public function bulk_footer() { 'plugins_page' => sprintf( '%s', self_admin_url( 'plugins.php' ), - __( 'Return to Plugins page' ) + __( 'Go to Plugins page' ) ), 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), - __( 'Return to WordPress Updates page' ) + __( 'Go to WordPress Updates page' ) ), ); diff --git a/wp-admin/includes/class-bulk-theme-upgrader-skin.php b/wp-admin/includes/class-bulk-theme-upgrader-skin.php index d3f0c914ea..94daa27131 100644 --- a/wp-admin/includes/class-bulk-theme-upgrader-skin.php +++ b/wp-admin/includes/class-bulk-theme-upgrader-skin.php @@ -48,12 +48,12 @@ public function bulk_footer() { 'themes_page' => sprintf( '%s', self_admin_url( 'themes.php' ), - __( 'Return to Themes page' ) + __( 'Go to Themes page' ) ), 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), - __( 'Return to WordPress Updates page' ) + __( 'Go to WordPress Updates page' ) ), ); diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index d7305589bf..b57a13fd7b 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -279,18 +279,21 @@ public static function should_update_to_version( $offered_ver ) { $current_is_development_version = (bool) strpos( $wp_version, '-' ); // Defaults: - $upgrade_dev = true; - $upgrade_minor = true; - $upgrade_major = false; + $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; + $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; + $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; - // WP_AUTO_UPDATE_CORE = true (all), 'minor', false. + // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it. $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; - } elseif ( true === WP_AUTO_UPDATE_CORE ) { + } elseif ( true === WP_AUTO_UPDATE_CORE + || 'beta' === WP_AUTO_UPDATE_CORE + || 'rc' === WP_AUTO_UPDATE_CORE + ) { // ALL updates for core. $upgrade_dev = true; $upgrade_minor = true; diff --git a/wp-admin/includes/class-language-pack-upgrader-skin.php b/wp-admin/includes/class-language-pack-upgrader-skin.php index cbbc834808..05676269f0 100644 --- a/wp-admin/includes/class-language-pack-upgrader-skin.php +++ b/wp-admin/includes/class-language-pack-upgrader-skin.php @@ -75,7 +75,7 @@ public function bulk_footer() { 'updates_page' => sprintf( '%s', self_admin_url( 'update-core.php' ), - __( 'Return to WordPress Updates page' ) + __( 'Go to WordPress Updates page' ) ), ); diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index e88db55848..2ac6e76329 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/wp-admin/includes/class-language-pack-upgrader.php @@ -309,17 +309,18 @@ public function bulk_upgrade( $language_updates = array(), $args = array() ) { } /** - * Check the package source to make sure there are .mo and .po files. + * Checks that the package source contains .mo and .po files. * * Hooked to the {@see 'upgrader_source_selection'} filter by * Language_Pack_Upgrader::bulk_upgrade(). * * @since 3.7.0 * - * @global WP_Filesystem_Base $wp_filesystem Subclass + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. * - * @param string|WP_Error $source - * @param string $remote_source + * @param string|WP_Error $source The path to the downloaded package source. + * @param string $remote_source Remote file source location. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. */ public function check_package( $source, $remote_source ) { global $wp_filesystem; diff --git a/wp-admin/includes/class-pclzip.php b/wp-admin/includes/class-pclzip.php index 47f2a344a2..8a085f8bd0 100644 --- a/wp-admin/includes/class-pclzip.php +++ b/wp-admin/includes/class-pclzip.php @@ -1171,7 +1171,7 @@ function duplicate($p_archive) $this->privErrorReset(); // ----- Look if the $p_archive is a PclZip object - if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) + if (is_object($p_archive) && $p_archive instanceof pclzip) { // ----- Duplicate the archive @@ -1235,7 +1235,7 @@ function merge($p_archive_to_add) } // ----- Look if the $p_archive_to_add is a PclZip object - if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) + if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip) { // ----- Merge the archive diff --git a/wp-admin/includes/class-plugin-installer-skin.php b/wp-admin/includes/class-plugin-installer-skin.php index 5bb19ebfbc..dad5983d7a 100644 --- a/wp-admin/includes/class-plugin-installer-skin.php +++ b/wp-admin/includes/class-plugin-installer-skin.php @@ -107,7 +107,7 @@ public function after() { $install_actions['activate_plugin'] = sprintf( '%s', wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), - __( 'Activate Plugin & Return to Press This' ) + __( 'Activate Plugin & Go to Press This' ) ); } else { $install_actions['activate_plugin'] = sprintf( @@ -130,25 +130,25 @@ public function after() { $install_actions['importers_page'] = sprintf( '%s', admin_url( 'import.php' ), - __( 'Return to Importers' ) + __( 'Go to Importers' ) ); } elseif ( 'web' === $this->type ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), - __( 'Return to Plugin Installer' ) + __( 'Go to Plugin Installer' ) ); } elseif ( 'upload' === $this->type && 'plugins' === $from ) { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugin-install.php' ), - __( 'Return to Plugin Installer' ) + __( 'Go to Plugin Installer' ) ); } else { $install_actions['plugins_page'] = sprintf( '%s', self_admin_url( 'plugins.php' ), - __( 'Return to Plugins page' ) + __( 'Go to Plugins page' ) ); } diff --git a/wp-admin/includes/class-plugin-upgrader-skin.php b/wp-admin/includes/class-plugin-upgrader-skin.php index 6b911bfea2..1d56b29d21 100644 --- a/wp-admin/includes/class-plugin-upgrader-skin.php +++ b/wp-admin/includes/class-plugin-upgrader-skin.php @@ -22,7 +22,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { * * @since 2.8.0 * - * @var object + * @var string */ public $plugin = ''; @@ -98,7 +98,7 @@ public function after() { 'plugins_page' => sprintf( '%s', self_admin_url( 'plugins.php' ), - __( 'Return to Plugins page' ) + __( 'Go to Plugins page' ) ), ); diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php index 27dc757f19..b171f9228b 100644 --- a/wp-admin/includes/class-plugin-upgrader.php +++ b/wp-admin/includes/class-plugin-upgrader.php @@ -398,21 +398,20 @@ public function bulk_upgrade( $plugins, $args = array() ) { } /** - * Check a source package to be sure it contains a plugin. + * Checks that the source package contains a valid plugin. * - * This function is added to the {@see 'upgrader_source_selection'} filter by - * Plugin_Upgrader::install(). + * Hooked to the {@see 'upgrader_source_selection'} filter by Plugin_Upgrader::install(). * * @since 3.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. * * @param string $source The path to the downloaded package source. - * @return string|WP_Error The source as passed, or a WP_Error object - * if no plugins were found. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. */ public function check_package( $source ) { - global $wp_filesystem; + global $wp_filesystem, $wp_version; $this->new_plugin_data = array(); @@ -459,7 +458,7 @@ public function check_package( $source ) { $error = sprintf( /* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */ __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), - $GLOBALS['wp_version'], + $wp_version, $requires_wp ); diff --git a/wp-admin/includes/class-theme-installer-skin.php b/wp-admin/includes/class-theme-installer-skin.php index c6d0900abe..c22ad86e7a 100644 --- a/wp-admin/includes/class-theme-installer-skin.php +++ b/wp-admin/includes/class-theme-installer-skin.php @@ -155,13 +155,13 @@ public function after() { $install_actions['themes_page'] = sprintf( '%s', self_admin_url( 'theme-install.php' ), - __( 'Return to Theme Installer' ) + __( 'Go to Theme Installer' ) ); } elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) { $install_actions['themes_page'] = sprintf( '%s', self_admin_url( 'themes.php' ), - __( 'Return to Themes page' ) + __( 'Go to Themes page' ) ); } diff --git a/wp-admin/includes/class-theme-upgrader-skin.php b/wp-admin/includes/class-theme-upgrader-skin.php index 7ca0b70db9..e1420b032f 100644 --- a/wp-admin/includes/class-theme-upgrader-skin.php +++ b/wp-admin/includes/class-theme-upgrader-skin.php @@ -22,7 +22,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { * * @since 2.8.0 * - * @var object + * @var string */ public $theme = ''; @@ -124,7 +124,7 @@ public function after() { $update_actions['themes_page'] = sprintf( '%s', self_admin_url( 'themes.php' ), - __( 'Return to Themes page' ) + __( 'Go to Themes page' ) ); /** diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php index c08d3c2d5c..229a8115bd 100644 --- a/wp-admin/includes/class-theme-upgrader.php +++ b/wp-admin/includes/class-theme-upgrader.php @@ -510,21 +510,20 @@ public function bulk_upgrade( $themes, $args = array() ) { } /** - * Check that the package source contains a valid theme. + * Checks that the package source contains a valid theme. * * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install(). - * It will return an error if the theme doesn't have style.css or index.php - * files. * * @since 3.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. * - * @param string $source The full path to the package source. - * @return string|WP_Error The source or a WP_Error. + * @param string $source The path to the downloaded package source. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. */ public function check_package( $source ) { - global $wp_filesystem; + global $wp_filesystem, $wp_version; $this->new_theme_data = array(); @@ -606,7 +605,7 @@ public function check_package( $source ) { $error = sprintf( /* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */ __( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ), - $GLOBALS['wp_version'], + $wp_version, $requires_wp ); diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php index 4c6cc9ef31..171e731987 100644 --- a/wp-admin/includes/class-walker-category-checklist.php +++ b/wp-admin/includes/class-walker-category-checklist.php @@ -62,11 +62,11 @@ public function end_lvl( &$output, $depth = 0, $args = array() ) { * * @since 2.5.1 * - * @param string $output Used to append additional content (passed by reference). - * @param object $category The current term object. - * @param int $depth Depth of the term in reference to parents. Default 0. - * @param array $args An array of arguments. @see wp_terms_checklist() - * @param int $id ID of the current term. + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $category The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. @see wp_terms_checklist() + * @param int $id ID of the current term. */ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { if ( empty( $args['taxonomy'] ) ) { @@ -121,10 +121,10 @@ public function start_el( &$output, $category, $depth = 0, $args = array(), $id * * @since 2.5.1 * - * @param string $output Used to append additional content (passed by reference). - * @param object $category The current term object. - * @param int $depth Depth of the term in reference to parents. Default 0. - * @param array $args An array of arguments. @see wp_terms_checklist() + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $category The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. @see wp_terms_checklist() */ public function end_el( &$output, $category, $depth = 0, $args = array() ) { $output .= "\n"; diff --git a/wp-admin/includes/class-walker-nav-menu-checklist.php b/wp-admin/includes/class-walker-nav-menu-checklist.php index 11e78dd529..3f4d6c1574 100644 --- a/wp-admin/includes/class-walker-nav-menu-checklist.php +++ b/wp-admin/includes/class-walker-nav-menu-checklist.php @@ -74,7 +74,7 @@ public function end_lvl( &$output, $depth = 0, $args = null ) { public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) { global $_nav_menu_placeholder, $nav_menu_selected_id; - $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; + $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? (int) $_nav_menu_placeholder - 1 : -1; $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder; $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; diff --git a/wp-admin/includes/class-wp-ajax-upgrader-skin.php b/wp-admin/includes/class-wp-ajax-upgrader-skin.php index cd4175cd47..27d8beb740 100644 --- a/wp-admin/includes/class-wp-ajax-upgrader-skin.php +++ b/wp-admin/includes/class-wp-ajax-upgrader-skin.php @@ -81,7 +81,7 @@ public function get_error_messages() { } /** - * Stores a log entry for an error. + * Stores an error message about the upgrade. * * @since 4.6.0 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it @@ -116,13 +116,13 @@ public function error( $errors, ...$args ) { } /** - * Stores a log entry. + * Stores a message about the upgrade. * * @since 4.6.0 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it * to the function signature. * - * @param string|array|WP_Error $data Log entry data. + * @param string|array|WP_Error $data Message data. * @param mixed ...$args Optional text replacements. */ public function feedback( $data, ...$args ) { diff --git a/wp-admin/includes/class-wp-application-passwords-list-table.php b/wp-admin/includes/class-wp-application-passwords-list-table.php new file mode 100644 index 0000000000..d1c128b50a --- /dev/null +++ b/wp-admin/includes/class-wp-application-passwords-list-table.php @@ -0,0 +1,267 @@ + __( 'Name' ), + 'created' => __( 'Created' ), + 'last_used' => __( 'Last Used' ), + 'last_ip' => __( 'Last IP' ), + 'revoke' => __( 'Revoke' ), + ); + } + + /** + * Prepares the list of items for displaying. + * + * @since 5.6.0 + * + * @global int $user_id User ID. + */ + public function prepare_items() { + global $user_id; + $this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) ); + } + + /** + * Handles the name column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_name( $item ) { + echo esc_html( $item['name'] ); + } + + /** + * Handles the created column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_created( $item ) { + if ( empty( $item['created'] ) ) { + echo '—'; + } else { + echo date_i18n( __( 'F j, Y' ), $item['created'] ); + } + } + + /** + * Handles the last used column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_last_used( $item ) { + if ( empty( $item['last_used'] ) ) { + echo '—'; + } else { + echo date_i18n( __( 'F j, Y' ), $item['last_used'] ); + } + } + + /** + * Handles the last ip column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_last_ip( $item ) { + if ( empty( $item['last_ip'] ) ) { + echo '—'; + } else { + echo $item['last_ip']; + } + } + + /** + * Handles the revoke column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_revoke( $item ) { + submit_button( + __( 'Revoke' ), + 'delete', + 'revoke-application-password-' . $item['uuid'], + false, + array( + /* translators: %s: the application password's given name. */ + 'aria-label' => sprintf( __( 'Revoke "%s"' ), $item['name'] ), + ) + ); + } + + /** + * Generates content for a single row of the table + * + * @since 5.6.0 + * + * @param array $item The current item. + * @param string $column_name The current column name. + */ + protected function column_default( $item, $column_name ) { + /** + * Fires for each custom column in the Application Passwords list table. + * + * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter. + * + * @since 5.6.0 + * + * @param string $column_name Name of the custom column. + * @param array $item The application password item. + */ + do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); + } + + /** + * Generates custom table navigation to prevent conflicting nonces. + * + * @since 5.6.0 + * + * @param string $which The location of the bulk actions: 'top' or 'bottom'. + */ + protected function display_tablenav( $which ) { + ?> +
' . $dropins[ $plugin_file ][0] . '
'; @@ -764,6 +765,7 @@ public function single_row( $item ) { 'wp-config.php
'
) . '';
}
+
if ( $plugin_data['Description'] ) {
$description .= '' . $plugin_data['Description'] . '
'; } @@ -946,7 +948,8 @@ public function single_row( $item ) { $requires_php = isset( $plugin_data['requires_php'] ) ? $plugin_data['requires_php'] : null; $compatible_php = is_php_version_compatible( $requires_php ); $class = $is_active ? 'active' : 'inactive'; - $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); + $checkbox_id = 'checkbox_' . md5( $plugin_file ); + if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { $checkbox = ''; } else { @@ -959,6 +962,7 @@ public function single_row( $item ) { esc_attr( $plugin_file ) ); } + if ( 'dropins' !== $context ) { $description = '' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '
'; $plugin_name = $plugin_data['Name']; @@ -1124,7 +1128,7 @@ public function single_row( $item ) { $url = add_query_arg( $query_args, 'plugins.php' ); - if ( 'unavailable' == $action ) { + if ( 'unavailable' === $action ) { $html[] = '' . $text . ''; } else { $html[] = sprintf( diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index a7d4748840..22a46d27c9 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -89,19 +89,17 @@ public function __construct( $args = array() ) { 'show_in_admin_all_list' => false, ) ); - $this->user_posts_count = intval( - $wpdb->get_var( - $wpdb->prepare( - " + $this->user_posts_count = (int) $wpdb->get_var( + $wpdb->prepare( + " SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) AND post_author = %d ", - $post_type, - get_current_user_id() - ) + $post_type, + get_current_user_id() ) ); @@ -1081,9 +1079,9 @@ public function column_date( $post ) { $t_time = sprintf( /* translators: 1: Post date, 2: Post time. */ __( '%1$s at %2$s' ), - /* translators: Post date format. See https://www.php.net/date */ + /* translators: Post date format. See https://www.php.net/manual/datetime.format.php */ get_the_time( __( 'Y/m/d' ), $post ), - /* translators: Post time format. See https://www.php.net/date */ + /* translators: Post time format. See https://www.php.net/manual/datetime.format.php */ get_the_time( __( 'g:i a' ), $post ) ); @@ -1221,7 +1219,7 @@ public function column_default( $post, $column_name ) { $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); /* translators: Used between list items, there is a space after the comma. */ - echo join( __( ', ' ), $term_links ); + echo implode( __( ', ' ), $term_links ); } else { echo '' . $taxonomy_object->labels->no_terms . ''; } @@ -1323,9 +1321,9 @@ protected function get_default_primary_column_name() { * * @since 4.3.0 * - * @param object $post Post being acted upon. - * @param string $column_name Current column name. - * @param string $primary Primary column name. + * @param WP_Post $post Post being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. * @return string Row actions output for posts, or an empty string * if the current column is not the primary column. */ @@ -1589,6 +1587,18 @@ public function inline_edit() { $users_opt['show_option_none'] = __( '— No Change —' ); } + /** + * Filters the arguments used to generate the Quick Edit authors drop-down. + * + * @since 5.6.0 + * + * @see wp_dropdown_users() + * + * @param array $users_opt An array of arguments passed to wp_dropdown_users(). + * @param bool $bulk A flag to denote if it's a bulk action. + */ + $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk ); + $authors = wp_dropdown_users( $users_opt ); if ( $authors ) : $authors_dropdown = '" . join( "
\n", array_unique( (array) $field['helps'] ) ) . '
'; + $item .= "" . implode( "
\n", array_unique( (array) $field['helps'] ) ) . '
'; } $item .= "\n\t\t\n"; @@ -2033,7 +2057,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) { * @since 2.5.0 */ function media_upload_header() { - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; echo ''; @@ -2069,7 +2093,7 @@ function media_upload_form( $errors = null ) { } $upload_action_url = admin_url( 'async-upload.php' ); - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $_type = isset( $type ) ? $type : ''; $_tab = isset( $tab ) ? $tab : ''; @@ -2271,15 +2295,15 @@ function media_upload_form( $errors = null ) { * * @since 2.5.0 * - * @param string $type - * @param object $errors - * @param integer $id + * @param string $type + * @param array $errors + * @param int|WP_Error $id */ function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { media_upload_header(); - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); @@ -2347,7 +2371,7 @@ function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { * * @param string $type * @param object $errors - * @param integer $id + * @param int $id */ function media_upload_type_url_form( $type = null, $errors = null, $id = null ) { if ( null === $type ) { @@ -2356,7 +2380,7 @@ function media_upload_type_url_form( $type = null, $errors = null, $id = null ) media_upload_header(); - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); /** This filter is documented in wp-admin/includes/media.php */ @@ -2504,7 +2528,7 @@ function media_upload_gallery_form( $errors ) { $redir_tab = 'gallery'; media_upload_header(); - $post_id = intval( $_REQUEST['post_id'] ); + $post_id = (int) $_REQUEST['post_id']; $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" ); /** This filter is documented in wp-admin/includes/media.php */ $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); @@ -2667,7 +2691,7 @@ function media_upload_library_form( $errors ) { media_upload_header(); - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" ); /** This filter is documented in wp-admin/includes/media.php */ @@ -2680,7 +2704,7 @@ function media_upload_library_form( $errors ) { $q = $_GET; $q['posts_per_page'] = 10; - $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0; + $q['paged'] = isset( $q['paged'] ) ? (int) $q['paged'] : 0; if ( $q['paged'] < 1 ) { $q['paged'] = 1; } @@ -2982,9 +3006,9 @@ function media_upload_flash_bypass() { $post = get_post(); if ( $post ) { - $browser_uploader .= '&post_id=' . intval( $post->ID ); + $browser_uploader .= '&post_id=' . (int) $post->ID; } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { - $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); + $browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID']; } ?> @@ -3076,7 +3100,7 @@ function edit_form_image_editor( $post ) { } $thumb_url = false; - $attachment_id = intval( $post->ID ); + $attachment_id = (int) $post->ID; if ( $attachment_id ) { $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); @@ -3192,7 +3216,7 @@ function edit_form_image_editor( $post ) { /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */ __( 'Describe the purpose of the image%3$s. Leave empty if the image is purely decorative.' ), esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), - 'target="_blank" rel="noopener noreferrer"', + 'target="_blank" rel="noopener"', sprintf( ' %s', /* translators: Accessibility text. */ @@ -3264,12 +3288,47 @@ function attachment_submitbox_metadata() { $att_url = wp_get_attachment_url( $attachment_id ); + $author = get_userdata( $post->post_author ); + + $uploaded_by_name = __( '(no author)' ); + $uploaded_by_link = ''; + if ( $author->exists() ) { + $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname; + $uploaded_by_link = get_edit_user_link( $author->ID ); + } ?> + + + post_parent ) { + $post_parent = get_post( $post->post_parent ); + if ( $post_parent ) { + $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); + $uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' ); + ?> + + + diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index f1cec18c5e..5d003d3210 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -212,11 +212,11 @@ function post_submit_meta_box( $post, $args = array() ) {' . sprintf( + /* translators: %s: URL to Update PHP page. */ __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); @@ -1414,9 +1416,9 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, * parent file someone is trying to link back to the parent manually. In * this case, don't automatically add a link back to avoid duplication. */ - if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug != $parent_slug ) { + if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) { foreach ( (array) $menu as $parent_menu ) { - if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) ) { + if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) { $submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 ); } } @@ -1767,7 +1769,7 @@ function remove_menu_page( $menu_slug ) { global $menu; foreach ( $menu as $i => $item ) { - if ( $menu_slug == $item[2] ) { + if ( $menu_slug === $item[2] ) { unset( $menu[ $i ] ); return $item; } @@ -1795,7 +1797,7 @@ function remove_submenu_page( $menu_slug, $submenu_slug ) { } foreach ( $submenu[ $menu_slug ] as $i => $item ) { - if ( $submenu_slug == $item[2] ) { + if ( $submenu_slug === $item[2] ) { unset( $submenu[ $menu_slug ][ $i ] ); return $item; } @@ -1822,6 +1824,7 @@ function menu_page_url( $menu_slug, $echo = true ) { if ( isset( $_parent_pages[ $menu_slug ] ) ) { $parent_slug = $_parent_pages[ $menu_slug ]; + if ( $parent_slug && ! isset( $_parent_pages[ $parent_slug ] ) ) { $url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) ); } else { @@ -1870,33 +1873,40 @@ function get_admin_page_parent( $parent = '' ) { if ( isset( $_wp_real_parent_file[ $parent ] ) ) { $parent = $_wp_real_parent_file[ $parent ]; } + return $parent; } if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) { foreach ( (array) $menu as $parent_menu ) { - if ( $parent_menu[2] == $plugin_page ) { + if ( $parent_menu[2] === $plugin_page ) { $parent_file = $plugin_page; + if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } + return $parent_file; } } if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { $parent_file = $plugin_page; + if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } + return $parent_file; } } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) { $parent_file = $pagenow; + if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) { $parent_file = $_wp_real_parent_file[ $parent_file ]; } + return $parent_file; } @@ -1905,13 +1915,16 @@ function get_admin_page_parent( $parent = '' ) { if ( isset( $_wp_real_parent_file[ $parent ] ) ) { $parent = $_wp_real_parent_file[ $parent ]; } - if ( ! empty( $typenow ) && ( "$pagenow?post_type=$typenow" === $submenu_array[2] ) ) { + + if ( ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $submenu_array[2] ) { $parent_file = $parent; return $parent; - } elseif ( $submenu_array[2] == $pagenow && empty( $typenow ) && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) ) { + } elseif ( empty( $typenow ) && $pagenow === $submenu_array[2] + && ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) ) + ) { $parent_file = $parent; return $parent; - } elseif ( isset( $plugin_page ) && ( $plugin_page == $submenu_array[2] ) ) { + } elseif ( isset( $plugin_page ) && $plugin_page === $submenu_array[2] ) { $parent_file = $parent; return $parent; } @@ -1953,10 +1966,10 @@ function get_admin_page_title() { if ( empty( $parent ) ) { foreach ( (array) $menu as $menu_array ) { if ( isset( $menu_array[3] ) ) { - if ( $menu_array[2] == $pagenow ) { + if ( $menu_array[2] === $pagenow ) { $title = $menu_array[3]; return $menu_array[3]; - } elseif ( isset( $plugin_page ) && ( $plugin_page == $menu_array[2] ) && ( $hook == $menu_array[5] ) ) { + } elseif ( isset( $plugin_page ) && $plugin_page === $menu_array[2] && $hook === $menu_array[5] ) { $title = $menu_array[3]; return $menu_array[3]; } @@ -1968,21 +1981,19 @@ function get_admin_page_title() { } else { foreach ( array_keys( $submenu ) as $parent ) { foreach ( $submenu[ $parent ] as $submenu_array ) { - if ( isset( $plugin_page ) && - ( $plugin_page == $submenu_array[2] ) && - ( - ( $parent == $pagenow ) || - ( $parent == $plugin_page ) || - ( $plugin_page == $hook ) || - ( 'admin.php' === $pagenow && $parent1 != $submenu_array[2] ) || - ( ! empty( $typenow ) && $parent == $pagenow . '?post_type=' . $typenow ) - ) + if ( isset( $plugin_page ) + && $plugin_page === $submenu_array[2] + && ( $pagenow === $parent + || $plugin_page === $parent + || $plugin_page === $hook + || 'admin.php' === $pagenow && $parent1 !== $submenu_array[2] + || ! empty( $typenow ) && "$pagenow?post_type=$typenow" === $parent ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } - if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) { // Not the current page. + if ( $submenu_array[2] !== $pagenow || isset( $_GET['page'] ) ) { // Not the current page. continue; } @@ -1997,10 +2008,11 @@ function get_admin_page_title() { } if ( empty( $title ) ) { foreach ( $menu as $menu_array ) { - if ( isset( $plugin_page ) && - ( $plugin_page == $menu_array[2] ) && - ( 'admin.php' === $pagenow ) && - ( $parent1 == $menu_array[2] ) ) { + if ( isset( $plugin_page ) + && $plugin_page === $menu_array[2] + && 'admin.php' === $pagenow + && $parent1 === $menu_array[2] + ) { $title = $menu_array[3]; return $menu_array[3]; } @@ -2113,6 +2125,7 @@ function user_can_access_admin_page() { if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } + foreach ( array_keys( $_wp_submenu_nopriv ) as $key ) { if ( isset( $_wp_submenu_nopriv[ $key ][ $pagenow ] ) ) { return false; @@ -2121,38 +2134,27 @@ function user_can_access_admin_page() { return false; } } + return true; } - if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { + if ( isset( $plugin_page ) && $plugin_page === $parent && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { return false; } if ( isset( $submenu[ $parent ] ) ) { foreach ( $submenu[ $parent ] as $submenu_array ) { - if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) { - if ( current_user_can( $submenu_array[1] ) ) { - return true; - } else { - return false; - } - } elseif ( $submenu_array[2] == $pagenow ) { - if ( current_user_can( $submenu_array[1] ) ) { - return true; - } else { - return false; - } + if ( isset( $plugin_page ) && $submenu_array[2] === $plugin_page ) { + return current_user_can( $submenu_array[1] ); + } elseif ( $submenu_array[2] === $pagenow ) { + return current_user_can( $submenu_array[1] ); } } } foreach ( $menu as $menu_array ) { - if ( $menu_array[2] == $parent ) { - if ( current_user_can( $menu_array[1] ) ) { - return true; - } else { - return false; - } + if ( $menu_array[2] === $parent ) { + return current_user_can( $menu_array[1] ); } } @@ -2188,7 +2190,7 @@ function option_update_filter( $options ) { /** * Adds an array of options to the list of allowed options. * - * @since 2.7.0 + * @since 5.5.0 * * @global array $allowed_options * diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 486f6dc1db..fbf11b3ded 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -685,12 +685,15 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft', - ) + ), + false, + false ); $post = get_post( $post_id ); if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) { set_post_format( $post, get_option( 'default_post_format' ) ); } + wp_after_insert_post( $post, false, null ); // Schedule auto-draft cleanup. if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { @@ -1332,9 +1335,9 @@ function postbox_classes( $box_id, $screen_id ) { * * @since 2.5.0 * - * @param int $id Post ID or post object. - * @param string $title Optional. Title to override the post's current title when generating the post name. Default null. - * @param string $name Optional. Name to override the post name. Default null. + * @param int|WP_Post $id Post ID or post object. + * @param string $title Optional. Title to override the post's current title when generating the post name. Default null. + * @param string $name Optional. Name to override the post name. Default null. * @return array { * Array containing the sample permalink with placeholder for the post name, and the post name. * @@ -1536,15 +1539,12 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { * * Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' * image size is registered, which differs from the 'thumbnail' image size - * managed via the Settings > Media screen. See the `$size` parameter description - * for more information on default values. + * managed via the Settings > Media screen. * * @since 4.4.0 * - * @param string|array $size Post thumbnail image size to display in the meta box. Accepts any valid - * image size, or an array of width and height values in pixels (in that order). - * If the 'post-thumbnail' size is set, default is 'post-thumbnail'. Otherwise, - * default is an array with 266 as both the height and width values. + * @param string|int[] $size Requested image size. Can be any registered image size name, or + * an array of width and height values in pixels (in that order). * @param int $thumbnail_id Post thumbnail attachment ID. * @param WP_Post $post The post object associated with the thumbnail. */ @@ -1585,7 +1585,7 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) { * * @since 2.5.0 * - * @param int $post_id ID of the post to check for editing. + * @param int|WP_Post $post_id ID or object of the post to check for editing. * @return int|false ID of the user with lock. False if the post does not exist, post is not locked, * the user with lock does not exist, or the post is locked by current user. */ @@ -1623,7 +1623,7 @@ function wp_check_post_lock( $post_id ) { * * @since 2.5.0 * - * @param int $post_id ID of the post being edited. + * @param int|WP_Post $post_id ID or object of the post being edited. * @return array|false Array of the lock time and user ID. False if the post does not exist, or * there is no current user. */ @@ -1741,10 +1741,10 @@ function _admin_notice_post_locked() { display_name ) ); + printf( __( '%s is currently editing this post. Do you want to take over?' ), esc_html( $user->display_name ) ); } else { /* translators: %s: User's display name. */ - printf( __( '%s is already editing this post.' ), esc_html( $user->display_name ) ); + printf( __( '%s is currently editing this post.' ), esc_html( $user->display_name ) ); } ?>
@@ -1926,7 +1926,7 @@ function post_preview() { } if ( isset( $_POST['_thumbnail_id'] ) ) { - $query_args['_thumbnail_id'] = ( intval( $_POST['_thumbnail_id'] ) <= 0 ) ? '-1' : intval( $_POST['_thumbnail_id'] ); + $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id']; } } @@ -2088,7 +2088,7 @@ function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { ); if ( ! empty( $_term ) ) { - $clean_terms[] = intval( $_term[0] ); + $clean_terms[] = (int) $_term[0]; } else { // No existing term was found, so pass the string. A new term will be created. $clean_terms[] = $term; @@ -2127,7 +2127,7 @@ function use_block_editor_for_post( $post ) { $use_block_editor = use_block_editor_for_post_type( $post->post_type ); /** - * Filter whether a post is able to be edited in the block editor. + * Filters whether a post is able to be edited in the block editor. * * @since 5.0.0 * @@ -2163,7 +2163,7 @@ function use_block_editor_for_post_type( $post_type ) { } /** - * Filter whether a post is able to be edited in the block editor. + * Filters whether a post is able to be edited in the block editor. * * @since 5.0.0 * @@ -2216,7 +2216,7 @@ function get_block_categories( $post ) { ); /** - * Filter the default array of block categories. + * Filters the default array of block categories. * * @since 5.0.0 * diff --git a/wp-admin/includes/privacy-tools.php b/wp-admin/includes/privacy-tools.php index ada0f11410..14914dcb9c 100644 --- a/wp-admin/includes/privacy-tools.php +++ b/wp-admin/includes/privacy-tools.php @@ -13,14 +13,14 @@ * @access private * * @param int $request_id Request ID. - * @return bool|WP_Error Returns true/false based on the success of sending the email, or a WP_Error object. + * @return bool|WP_Error Returns true if sending the email was successful, or a WP_Error object. */ function _wp_privacy_resend_request( $request_id ) { $request_id = absint( $request_id ); $request = get_post( $request_id ); if ( ! $request || 'user_request' !== $request->post_type ) { - return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) ); + return new WP_Error( 'privacy_request_error', __( 'Invalid user privacy request.' ) ); } $result = wp_send_user_request( $request_id ); @@ -28,7 +28,7 @@ function _wp_privacy_resend_request( $request_id ) { if ( is_wp_error( $result ) ) { return $result; } elseif ( ! $result ) { - return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation request.' ) ); + return new WP_Error( 'privacy_request_error', __( 'Unable to initiate user privacy confirmation request.' ) ); } return true; @@ -49,7 +49,7 @@ function _wp_privacy_completed_request( $request_id ) { $request = wp_get_user_request( $request_id ); if ( ! $request ) { - return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) ); + return new WP_Error( 'privacy_request_error', __( 'Invalid user privacy request.' ) ); } update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() ); @@ -104,7 +104,7 @@ function _wp_personal_data_handle_actions() { add_settings_error( 'action_type', 'action_type', - __( 'Invalid action.' ), + __( 'Invalid user privacy action.' ), 'error' ); } @@ -116,7 +116,7 @@ function _wp_personal_data_handle_actions() { add_settings_error( 'action_type', 'action_type', - __( 'Invalid action.' ), + __( 'Invalid user privacy action.' ), 'error' ); } @@ -279,7 +279,7 @@ function wp_privacy_generate_personal_data_export_group_html( $group_data, $grou if ( $groups_count > 1 ) { $group_html .= ''; } @@ -297,20 +297,20 @@ function wp_privacy_generate_personal_data_export_group_html( $group_data, $grou */ function wp_privacy_generate_personal_data_export_file( $request_id ) { if ( ! class_exists( 'ZipArchive' ) ) { - wp_send_json_error( __( 'Unable to generate export file. ZipArchive not available.' ) ); + wp_send_json_error( __( 'Unable to generate user privacy export file. ZipArchive not available.' ) ); } // Get the request. $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { - wp_send_json_error( __( 'Invalid request ID when generating export file.' ) ); + wp_send_json_error( __( 'Invalid request ID when generating user privacy export file.' ) ); } $email_address = $request->email; if ( ! is_email( $email_address ) ) { - wp_send_json_error( __( 'Invalid email address when generating export file.' ) ); + wp_send_json_error( __( 'Invalid email address when generating user privacy export file.' ) ); } // Create the exports folder if needed. @@ -318,7 +318,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $exports_url = wp_privacy_exports_url(); if ( ! wp_mkdir_p( $exports_dir ) ) { - wp_send_json_error( __( 'Unable to create export folder.' ) ); + wp_send_json_error( __( 'Unable to create user privacy export folder.' ) ); } // Protect export folder from browsing. @@ -326,7 +326,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { if ( ! file_exists( $index_pathname ) ) { $file = fopen( $index_pathname, 'w' ); if ( false === $file ) { - wp_send_json_error( __( 'Unable to protect export folder from browsing.' ) ); + wp_send_json_error( __( 'Unable to protect user privacy export folder from browsing.' ) ); } fwrite( $file, '' ); fclose( $file ); @@ -395,7 +395,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $file = fopen( $json_report_pathname, 'w' ); if ( false === $file ) { - wp_send_json_error( __( 'Unable to open export file (JSON report) for writing.' ) ); + wp_send_json_error( __( 'Unable to open user privacy export file (JSON report) for writing.' ) ); } fwrite( $file, '{' ); @@ -410,7 +410,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $file = fopen( $html_report_pathname, 'w' ); if ( false === $file ) { - wp_send_json_error( __( 'Unable to open export file (HTML report) for writing.' ) ); + wp_send_json_error( __( 'Unable to open user privacy export file (HTML report) for writing.' ) ); } fwrite( $file, "\n" ); @@ -504,11 +504,11 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $zip = new ZipArchive; if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) { if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) { - $error = __( 'Unable to add data to JSON file.' ); + $error = __( 'Unable to add data to user privacy export file (JSON format).' ); } if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) { - $error = __( 'Unable to add data to HTML file.' ); + $error = __( 'Unable to add data to user privacy export file (HTML format).' ); } $zip->close(); @@ -529,7 +529,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id, $json_report_pathname ); } } else { - $error = __( 'Unable to open export file (archive) for writing.' ); + $error = __( 'Unable to open user privacy export file (archive) for writing.' ); } // Remove the JSON file. @@ -758,7 +758,7 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde $request = wp_get_user_request( $request_id ); if ( ! $request || 'export_personal_data' !== $request->action_name ) { - wp_send_json_error( __( 'Invalid request ID when merging exporter data.' ) ); + wp_send_json_error( __( 'Invalid request ID when merging user privacy exporter data.' ) ); } $export_data = array(); @@ -767,7 +767,11 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde if ( 1 === $exporter_index && 1 === $page ) { update_post_meta( $request_id, '_export_data_raw', $export_data ); } else { - $export_data = get_post_meta( $request_id, '_export_data_raw', true ); + $accumulated_data = get_post_meta( $request_id, '_export_data_raw', true ); + + if ( $accumulated_data ) { + $export_data = $accumulated_data; + } } // Now, merge the data from the exporter response into the data we have accumulated already. @@ -905,7 +909,7 @@ function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index $request = wp_get_user_request( $request_id ); if ( ! $request || 'remove_personal_data' !== $request->action_name ) { - wp_send_json_error( __( 'Invalid request ID when processing eraser data.' ) ); + wp_send_json_error( __( 'Invalid request ID when processing user privacy eraser data.' ) ); } /** This filter is documented in wp-admin/includes/ajax-actions.php */ diff --git a/wp-admin/includes/revision.php b/wp-admin/includes/revision.php index 52600dce06..7718a831e4 100644 --- a/wp-admin/includes/revision.php +++ b/wp-admin/includes/revision.php @@ -275,7 +275,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null * If we only have one revision, the initial revision is missing; This happens * when we have an autsosave and the user has clicked 'View the Autosave' */ - if ( 1 === sizeof( $revisions ) ) { + if ( 1 === count( $revisions ) ) { $revisions[ $post->ID ] = array( 'id' => $post->ID, 'title' => get_the_title( $post->ID ), diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 54e9171f4b..a59c7c36ce 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -422,11 +422,11 @@ function populate_options( array $options = array() ) { 'default_ping_status' => 'open', 'default_pingback_flag' => 1, 'posts_per_page' => 10, - /* translators: Default date format, see https://www.php.net/date */ + /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */ 'date_format' => __( 'F j, Y' ), - /* translators: Default time format, see https://www.php.net/date */ + /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */ 'time_format' => __( 'g:i a' ), - /* translators: Links last updated date format, see https://www.php.net/date */ + /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */ 'links_updated_date_format' => __( 'F j, Y g:i a' ), 'comment_moderation' => 0, 'moderation_notify' => 1, @@ -535,6 +535,13 @@ function populate_options( array $options = array() ) { 'disallowed_keys' => '', 'comment_previously_approved' => 1, 'auto_plugin_theme_update_emails' => array(), + + // 5.6.0 + 'auto_update_core_dev' => 'enabled', + 'auto_update_core_minor' => 'enabled', + // Default to enabled for new installs. + // See https://core.trac.wordpress.org/ticket/51742. + 'auto_update_core_major' => 'enabled', ); // 3.3.0 diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php index 7f7e60952c..de76917cd0 100644 --- a/wp-admin/includes/taxonomy.php +++ b/wp-admin/includes/taxonomy.php @@ -278,7 +278,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { $term_names[] = $term->name; } - $terms_to_edit = esc_attr( join( ',', $term_names ) ); + $terms_to_edit = esc_attr( implode( ',', $term_names ) ); /** * Filters the comma-separated list of terms available to edit. diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 49725a9ce5..4acbb25afa 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -813,7 +813,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { $cur_hh = current_time( 'H' ); $cur_mn = current_time( 'i' ); - $month = ''+i+"
'+i.data.error+"
'+i.data.msg+"
'+t+"
'+i+"
'+i.data.error+"
'+i.data.msg+"
'+t+"
'+o+"
"+s+"'+a+"
"+s+"' + description + '
', + 'actions': '' + }; + + /** This filter is documented in wp-admin/includes/class-wp-site-health.php */ + appendIssue( wp.hooks.applyFilters( 'site_status_test_result', issue ) ); + } + if ( 'undefined' !== typeof SiteHealth && ! isDebugTab ) { if ( 0 === SiteHealth.site_status.direct.length && 0 === SiteHealth.site_status.async.length ) { recalculateProgression(); @@ -243,32 +364,13 @@ jQuery( document ).ready( function( $ ) { } if ( 0 < SiteHealth.site_status.async.length ) { - data = { - 'action': 'health-check-' + SiteHealth.site_status.async[0].test.replace( '_', '-' ), - '_wpnonce': SiteHealth.nonce.site_status - }; - - SiteHealth.site_status.async[0].completed = true; - - $.post( - ajaxurl, - data, - function( response ) { - appendIssue( response.data ); - maybeRunNextAsyncTest(); - } - ); + maybeRunNextAsyncTest(); } else { recalculateProgression(); } } function getDirectorySizes() { - var data = { - action: 'health-check-get-sizes', - _wpnonce: SiteHealth.nonce.site_status_result - }; - var timestamp = ( new Date().getTime() ); // After 3 seconds announce that we're still waiting for directory sizes. @@ -276,20 +378,17 @@ jQuery( document ).ready( function( $ ) { wp.a11y.speak( __( 'Please wait...' ) ); }, 3000 ); - $.post( { - type: 'POST', - url: ajaxurl, - data: data, - dataType: 'json' + wp.apiRequest( { + path: '/wp-site-health/v1/directory-sizes' } ).done( function( response ) { - updateDirSizes( response.data || {} ); + updateDirSizes( response || {} ); } ).always( function() { var delay = ( new Date().getTime() ) - timestamp; $( '.health-check-wp-paths-sizes.spinner' ).css( 'visibility', 'hidden' ); recalculateProgression(); - if ( delay > 3000 ) { + if ( delay > 3000 ) { /* * We have announced that we're waiting. * Announce that we're ready after giving at least 3 seconds diff --git a/wp-admin/js/site-health.min.js b/wp-admin/js/site-health.min.js index 9056768ddd..cc617fedb5 100644 --- a/wp-admin/js/site-health.min.js +++ b/wp-admin/js/site-health.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -jQuery(document).ready(function(l){var e,a,t,s,i,r=wp.i18n.__,n=wp.i18n._n,c=wp.i18n.sprintf,h=new ClipboardJS(".site-health-copy-buttons .copy-button"),u=l(".health-check-body.health-check-debug-tab").length,o=l("#health-check-accordion-block-wp-paths-sizes");function d(e){var t,s,a=wp.template("health-check-issue"),i=l("#health-check-issues-"+e.status);SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],"critical"===e.status?t=c(n("%s critical issue","%s critical issues",s),''+s+""):"recommended"===e.status?t=c(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=c(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&l(".site-health-issue-count-title",i).html(t),l(".issues","#health-check-issues-"+e.status).append(a(e))}function p(){var e,t,s=l(".site-health-progress"),a=s.closest(".site-health-progress-wrapper"),i=l(".site-health-progress-label",a),n=l(".site-health-progress svg #bar"),c=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),h=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),o=100-Math.ceil(h/c*100);0!==c?(a.removeClass("loading"),e=n.attr("r"),o<0&&(o=0),100"+t+"
",actions:""},l(wp.hooks.applyFilters("site_status_test_result",s))}i.on("success",function(e){var t=c(e.trigger),s=c(".success",t.closest("div"));e.clearSelection(),t.focus(),clearTimeout(a),s.removeClass("hidden"),a=setTimeout(function(){s.addClass("hidden"),i.clipboardAction.fakeElem&&i.clipboardAction.removeFake&&i.clipboardAction.removeFake()},3e3),wp.a11y.speak(h("Site information has been copied to your clipboard."))}),c(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===c(this).attr("aria-expanded")?(c(this).attr("aria-expanded","false"),c("#"+c(this).attr("aria-controls")).attr("hidden",!0)):(c(this).attr("aria-expanded","true"),c("#"+c(this).attr("aria-controls")).attr("hidden",!1))}),c(".site-health-view-passed").on("click",function(){var e=c("#health-check-issues-good");e.toggleClass("hidden"),c(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"==typeof SiteHealth||d||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?u():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0'+t+"
'+e+"
'+t+"
'+e+"
'+s.message+"
'+s.message+"
'+s.message+"
'+s.message+"