Changeset 45099 for trunk/src/wp-admin/includes/class-wp-site-health.php
- Timestamp:
- 04/02/2019 09:31:43 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-site-health.php
r45095 r45099 1 1 <?php 2 2 /** 3 * Class for looking up a site s health based on a users WordPress environment.3 * Class for looking up a site's health based on a user's WordPress environment. 4 4 * 5 5 * @package WordPress … … 299 299 $plugins_active = 0; 300 300 $plugins_total = 0; 301 $plugins_need s_update= 0;301 $plugins_need_update = 0; 302 302 303 303 // Loop over the available plugins and check their versions and active state. … … 312 312 313 313 if ( array_key_exists( $plugin_path, $plugin_updates ) ) { 314 $plugins_need s_update++;314 $plugins_need_update++; 315 315 $plugins_have_updates = true; 316 316 } … … 318 318 319 319 // Add a notice if there are outdated plugins. 320 if ( $plugins_need s_update > 0 ) {320 if ( $plugins_need_update > 0 ) { 321 321 $result['status'] = 'critical'; 322 322 … … 326 326 '<p>%s</p>', 327 327 sprintf( 328 esc_html( 329 /* translators: %d: The number of outdated plugins. */ 330 _n( 331 'Your site has %d plugin waiting to be updated.', 332 'Your site has %d plugins waiting for updates.', 333 $plugins_needs_update 334 ) 328 /* translators: %d: The number of outdated plugins. */ 329 _n( 330 'Your site has %d plugin waiting to be updated.', 331 'Your site has %d plugins waiting to be updated.', 332 $plugins_need_update 335 333 ), 336 $plugins_need s_update334 $plugins_need_update 337 335 ) 338 336 ); 339 337 } else { 340 $result['description'] .= sprintf( 341 '<p>%s</p>', 342 sprintf( 343 esc_html( 338 if ( 1 === $plugins_active ) { 339 $result['description'] .= sprintf( 340 '<p>%s</p>', 341 __( 'Your site has 1 active plugin, and it is up to date.' ) 342 ); 343 } else { 344 $result['description'] .= sprintf( 345 '<p>%s</p>', 346 sprintf( 344 347 /* translators: %d: The number of active plugins. */ 345 348 _n( 346 'Your site has %d active plugin, and it isup to date.',349 'Your site has %d active plugin, and they are all up to date.', 347 350 'Your site has %d active plugins, and they are all up to date.', 348 351 $plugins_active 349 ) 350 ),351 $plugins_active352 ) 353 );352 ), 353 $plugins_active 354 ) 355 ); 356 } 354 357 } 355 358 … … 363 366 364 367 $result['description'] .= sprintf( 365 '<p>%s </p>',368 '<p>%s %s</p>', 366 369 sprintf( 367 esc_html( 368 /* translators: %d: The number of inactive plugins. */ 369 _n( 370 'Your site has %d inactive plugin. Inactive plugins are tempting targets for attackers. if you’re not going to use a plugin, we recommend you remove it.', 371 'Your site has %d inactive plugins. Inactive plugins are tempting targets for attackers. if you’re not going to use a plugin, we recommend you remove it.', 372 $unused_plugins 373 ) 370 /* translators: %d: The number of inactive plugins. */ 371 _n( 372 'Your site has %d inactive plugin.', 373 'Your site has %d inactive plugins.', 374 $unused_plugins 374 375 ), 375 376 $unused_plugins 376 ) 377 ), 378 __( 'Inactive plugins are tempting targets for attackers. If you’re not going to use a plugin, we recommend you remove it.' ) 377 379 ); 378 380 } … … 465 467 '<p>%s</p>', 466 468 sprintf( 467 esc_html( 468 /* translators: %d: The number of outdated themes. */ 469 _n( 470 'Your site has %d theme waiting to be updated.', 471 'Your site has %d themes waiting to be updated.', 472 $themes_need_updates 473 ) 469 /* translators: %d: The number of outdated themes. */ 470 _n( 471 'Your site has %d theme waiting to be updated.', 472 'Your site has %d themes waiting to be updated.', 473 $themes_need_updates 474 474 ), 475 475 $themes_need_updates … … 478 478 } else { 479 479 // Give positive feedback about the site being good about keeping things up to date. 480 $result['description'] .= sprintf( 481 '<p>%s</p>', 482 sprintf( 483 esc_html( 480 if ( 1 === $themes_total ) { 481 $result['description'] .= sprintf( 482 '<p>%s</p>', 483 __( 'Your site has 1 installed theme, and it is up to date.' ) 484 ); 485 } else { 486 $result['description'] .= sprintf( 487 '<p>%s</p>', 488 sprintf( 484 489 /* translators: %d: The number of themes. */ 485 490 _n( 486 'Your site has %d installed theme, and it isup to date.',491 'Your site has %d installed theme, and they are all up to date.', 487 492 'Your site has %d installed themes, and they are all up to date.', 488 493 $themes_total 489 ) 490 ),491 $themes_total492 ) 493 );494 ), 495 $themes_total 496 ) 497 ); 498 } 494 499 } 495 500 … … 505 510 if ( $using_default_theme ) { 506 511 $result['description'] .= sprintf( 507 '<p>%s </p>',512 '<p>%s %s</p>', 508 513 sprintf( 509 esc_html( 510 /* translators: %d: The number of inactive themes. */ 511 _n( 512 'Your site has %1$d inactive theme. To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep your current theme, %2$s, and %3$s, its parent theme.', 513 'Your site has %1$d inactive themes. To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep your current theme, %2$s, and %3$s, its parent theme.', 514 $themes_inactive 515 ) 514 /* translators: %d: The number of inactive themes. */ 515 _n( 516 'Your site has %d inactive theme.', 517 'Your site has %d inactive themes.', 518 $themes_inactive 516 519 ), 517 $themes_inactive, 520 $themes_inactive 521 ), 522 sprintf( 523 /* translators: 1: The currently active theme. 2: The active theme's parent theme. */ 524 __( 'To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep your current theme, %1$s, and %2$s, its parent theme.' ), 518 525 $active_theme->name, 519 526 $active_theme->parent()->name … … 522 529 } else { 523 530 $result['description'] .= sprintf( 524 '<p>%s </p>',531 '<p>%s %s</p>', 525 532 sprintf( 526 esc_html( 527 /* translators: %1$d: The number of inactive themes. %2$s: The default theme for WordPress. %3$s: The currently active theme. %4$s: The active themes parent theme. */ 528 _n( 529 'Your site has %1$d inactive theme. To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep %2$s, the default WordPress theme, %3$s, your current theme and %4$s, its parent theme.', 530 'Your site has %1$d inactive themes. To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep %2$s, the default WordPress theme, %3$s, your current theme and %4$s, its parent theme.', 531 $themes_inactive 532 ) 533 /* translators: %d: The number of inactive themes. */ 534 _n( 535 'Your site has %d inactive theme.', 536 'Your site has %d inactive themes.', 537 $themes_inactive 533 538 ), 534 $themes_inactive, 539 $themes_inactive 540 ), 541 sprintf( 542 /* translators: 1: The default theme for WordPress. 2: The currently active theme. 3: The active theme's parent theme. */ 543 __( 'To enhance your site’s security, we recommend you remove any themes you’re not using. You should keep %1$s, the default WordPress theme, %2$s, your current theme, and %3$s, its parent theme.' ), 535 544 WP_DEFAULT_THEME, 536 545 $active_theme->name, … … 547 556 if ( $using_default_theme ) { 548 557 $result['description'] .= sprintf( 549 '<p>%s </p>',558 '<p>%s %s</p>', 550 559 sprintf( 551 esc_html( 552 /* translators: %1$d: The amount of inactive themes. %2$s: The currently active theme. */ 553 _n( 554 'Your site has %1$d inactive theme, other than %2$s, your active theme. We recommend removing any unused themes to enhance your sites security.', 555 'Your site has %1$d inactive themes, other than %2$s, your active theme. We recommend removing any unused themes to enhance your sites security.', 556 $themes_inactive 557 ) 560 /* translators: 1: The amount of inactive themes. 2: The currently active theme. */ 561 _n( 562 'Your site has %1$d inactive theme, other than %2$s, your active theme.', 563 'Your site has %1$d inactive themes, other than %2$s, your active theme.', 564 $themes_inactive 558 565 ), 559 566 $themes_inactive, 560 567 $active_theme->name 561 ) 568 ), 569 __( 'We recommend removing any unused themes to enhance your site’s security.' ) 562 570 ); 563 571 } else { 564 572 $result['description'] .= sprintf( 565 '<p>%s </p>',573 '<p>%s %s</p>', 566 574 sprintf( 567 esc_html( 568 /* translators: %1$d: The amount of inactive themes. %2$s: The default theme for WordPress. %3$s: The currently active theme. */ 569 _n( 570 'Your site has %1$d inactive theme, other than %2$s, the default WordPress theme, and %3$s, your active theme. We recommend removing any unused themes to enhance your sites security.', 571 'Your site has %1$d inactive themes, other than %2$s, the default WordPress theme, and %3$s, your active theme. We recommend removing any unused themes to enhance your sites security.', 572 $themes_inactive 573 ) 575 /* translators: 1: The amount of inactive themes. 2: The default theme for WordPress. 3: The currently active theme. */ 576 _n( 577 'Your site has %1$d inactive theme, other than %2$s, the default WordPress theme, and %3$s, your active theme.', 578 'Your site has %1$d inactive themes, other than %2$s, the default WordPress theme, and %3$s, your active theme.', 579 $themes_inactive 574 580 ), 575 581 $themes_inactive, 576 582 WP_DEFAULT_THEME, 577 583 $active_theme->name 578 ) 584 ), 585 __( 'We recommend removing any unused themes to enhance your site’s security.' ) 579 586 ); 580 587 } … … 711 718 sprintf( 712 719 /* translators: %s: Link to the hosting group page about recommended PHP modules. */ 713 __( 'The Hosting team maintains a list of those modules, both recommended and required, in %s.' ), 714 sprintf( 715 '<a href="%s">%s</a>', 716 esc_url( _x( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions', 'The address to describe PHP modules and their use.' ) ), 717 __( 'the team handbook' ) 718 ) 720 __( 'The Hosting team maintains a list of those modules, both recommended and required, in <a href="%s">the team handbook</a>.' ), 721 /* translators: The address to describe PHP modules and their use. */ 722 esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ) 719 723 ) 720 724 ), … … 923 927 '<p>%s</p>', 924 928 sprintf( 925 /* translators: %1$s: The database engine in use (MySQL or MariaDB). %2$s: Database server recommended version number. */929 /* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server recommended version number. */ 926 930 __( 'For optimal performance and security reasons, we recommend running %1$s version %2$s or higher. Contact your web hosting company to correct this.' ), 927 931 ( $this->mariadb ? 'MariaDB' : 'MySQL' ), … … 939 943 '<p>%s</p>', 940 944 sprintf( 941 /* translators: %1$s: The database engine in use (MySQL or MariaDB). %2$s: Database server minimum version number. */945 /* translators: 1: The database engine in use (MySQL or MariaDB). 2: Database server minimum version number. */ 942 946 __( 'WordPress requires %1$s version %2$s or higher. Contact your web hosting company to correct this.' ), 943 947 ( $this->mariadb ? 'MariaDB' : 'MySQL' ), … … 952 956 wp_kses( 953 957 sprintf( 954 /* translators: %s: The name of the database engine being used. */ 955 __( 'You are using a <code>wp-content/db.php</code> drop-in which might mean that a %s database is not being used.' ), 958 /* translators: 1: The name of the drop-in. 2: The name of the database engine. */ 959 __( 'You are using a %1$s drop-in which might mean that a %2$s database is not being used.' ), 960 '<code>wp-content/db.php</code>', 956 961 ( $this->is_mariadb ? 'MariaDB' : 'MySQL' ) 957 962 ), … … 1055 1060 '<p>%s</p>', 1056 1061 sprintf( 1057 /* translators: %1$s: Name of the library, %2$s: Number of version. */1062 /* translators: 1: Name of the library, 2: Number of version. */ 1058 1063 __( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer.' ), 1059 1064 'mysqlnd', … … 1071 1076 '<p>%s</p>', 1072 1077 sprintf( 1073 /* translators: %1$s: Name of the library, %2$s: Number of version. */1078 /* translators: 1: Name of the library, 2: Number of version. */ 1074 1079 __( 'WordPress’ utf8mb4 support requires MySQL client library (%1$s) version %2$s or newer.' ), 1075 1080 'libmysql', … … 1125 1130 __( 'Error' ), 1126 1131 sprintf( 1127 /* translators: %1$s: The IP address WordPress.org resolves to. %2$s: The error returned by the lookup. */1132 /* translators: 1: The IP address WordPress.org resolves to. 2: The error returned by the lookup. */ 1128 1133 __( 'Your site is unable to reach WordPress.org at %1$s, and returned the error: %2$s' ), 1129 1134 gethostbyname( 'wordpress.org' ), … … 1174 1179 $result['description'] .= sprintf( 1175 1180 '<p>%s</p>', 1176 __( 'The value, WP_DEBUG_LOG, has been added to this websites configuration file. This means any errors on the site will be written to a file which is potentially available to normal users.' ) 1181 sprintf( 1182 /* translators: %s: Name of the constant used. */ 1183 __( 'The value, %s, has been added to this website’s configuration file. This means any errors on the site will be written to a file which is potentially available to normal users.' ), 1184 '<code>WP_DEBUG_LOG</code>' 1185 ) 1177 1186 ); 1178 1187 } … … 1185 1194 $result['description'] .= sprintf( 1186 1195 '<p>%s</p>', 1187 __( 'The value, WP_DEBUG_DISPLAY, has either been added to your configuration file, or left with its default value. This will make errors display on the front end of your site.' ) 1196 sprintf( 1197 /* translators: %s: Name of the constant used. */ 1198 __( 'The value, %s, has either been added to your configuration file, or left with its default value. This will make errors display on the front end of your site.' ), 1199 '<code>WP_DEBUG_DISPLAY</code>' 1200 ) 1188 1201 ); 1189 1202 } … … 1218 1231 '<p><a href="%s">%s</a></p>', 1219 1232 esc_url( 1220 /* translators: Website forexplaining HTTPS and why it should be used. */1233 /* translators: Documentation explaining HTTPS and why it should be used. */ 1221 1234 __( 'https://wordpress.org/support/article/why-should-i-use-https/' ) 1222 1235 ), … … 1339 1352 sprintf( 1340 1353 /* translators: %s: The error message returned while from the cron scheduler. */ 1341 __( 'While trying to test your site s scheduled events, the following error was returned: %s' ),1354 __( 'While trying to test your site’s scheduled events, the following error was returned: %s' ), 1342 1355 $this->has_missed_cron()->get_error_message() 1343 1356 ) … … 1525 1538 $result['description'] .= sprintf( 1526 1539 '<p>%s</p>', 1527 __( 'HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with no allowed hosts.' ) 1540 sprintf( 1541 /* translators: %s: Name of the constant used. */ 1542 __( 'HTTP requests have been blocked by the %s constant, with no allowed hosts.' ), 1543 '<code>WP_HTTP_BLOCK_EXTERNAL</code>' 1544 ) 1528 1545 ); 1529 1546 } … … 1537 1554 '<p>%s</p>', 1538 1555 sprintf( 1539 /* translators: %s: List of hostnames whitelisted. */ 1540 __( 'HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with some hosts whitelisted: %s.' ), 1556 /* translators: 1: Name of the constant used. 2: List of hostnames whitelisted. */ 1557 __( 'HTTP requests have been blocked by the %1$s constant, with some hosts whitelisted: %2$s.' ), 1558 '<code>WP_HTTP_BLOCK_EXTERNAL</code>', 1541 1559 implode( ',', $hosts ) 1542 1560 ) … … 1608 1626 __( 'The REST API request failed due to an error.' ), 1609 1627 sprintf( 1610 /* translators: %1$d: The HTTP response code. %2$s: The error message returned. */1628 /* translators: 1: The HTTP response code. 2: The error message returned. */ 1611 1629 __( 'Error encountered: (%1$d) %2$s' ), 1612 1630 wp_remote_retrieve_response_code( $r ), … … 1623 1641 '<p>%s</p>', 1624 1642 sprintf( 1625 /* translators: %1$d: The HTTP response code returned. %2$s: The error message returned. */1643 /* translators: 1: The HTTP response code returned. 2: The error message returned. */ 1626 1644 __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ), 1627 1645 wp_remote_retrieve_response_code( $r ), … … 1889 1907 __( 'The loopback request to your site failed, this means features relying on them are not currently working as expected.' ), 1890 1908 sprintf( 1891 // translators: %1$d: The HTTP response code. %2$s: The error message returned.1909 // translators: 1: The HTTP response code. 2: The error message returned. 1892 1910 __( 'Error encountered: (%1$d) %2$s' ), 1893 1911 wp_remote_retrieve_response_code( $r ),
Note: See TracChangeset
for help on using the changeset viewer.