← All changes
|
src/component/security-tweaks/class-wp-version.php
+16
-13
5.7.2
→
6.3.0
View file →
| @@ -77,15 +77,15 @@ | ||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $data = get_core_updates(); |
| 80 | 80 | |
| 81 | - if ( empty( $data ) ) { | |
| 81 | + if ( ! is_array( $data ) || array() === $data ) { | |
| 82 | 82 | wp_version_check( array(), true ); |
| 83 | 83 | $data = get_core_updates( array( 'dismissed' => true ) ); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // For bool value and empty array. |
| 87 | - if ( empty( $data ) ) { | |
| 87 | + if ( ! is_array( $data ) || array() === $data ) { | |
| 88 | 88 | return false; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return reset( $data )->version; |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | * |
| 97 | 97 | * @return string |
| 98 | 98 | */ |
| 99 | 99 | public function get_label(): string { |
| 100 | - return esc_html__( 'Update WordPress to latest version', 'defender-security' ); | |
| 100 | + return wp_strip_all_tags( 'Update WordPress', 'wpdef' ); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Get the error reason. |
| @@ -106,14 +106,15 @@ | ||
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | 108 | public function get_error_reason(): string { |
| 109 | 109 | return sprintf( |
| 110 | - /* translators: %s: WP Version */ | |
| 110 | + /* translators: 1. Open tag. 2. Close tag. */ | |
| 111 | 111 | esc_html__( |
| 112 | - 'Your current WordPress version is out of date, which means you could be missing out on the latest security patches in v%s', | |
| 112 | + '%1$sWordPress is out of date%2$s and may expose details hackers can use.', | |
| 113 | 113 | 'defender-security' |
| 114 | 114 | ), |
| 115 | - $this->get_latest_version() | |
| 115 | + '<strong>', | |
| 116 | + '</strong>', | |
| 116 | 117 | ); |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | 120 | /** |
| @@ -125,17 +126,19 @@ | ||
| 125 | 126 | return array( |
| 126 | 127 | 'slug' => $this->slug, |
| 127 | 128 | 'title' => $this->get_label(), |
| 128 | 129 | 'errorReason' => $this->get_error_reason(), |
| 129 | - 'successReason' => esc_html__( 'You are using the latest version of WordPress, great job!', 'defender-security' ), | |
| 130 | + 'successReason' => wp_strip_all_tags( 'WordPress is up to date.', 'wpdef' ), | |
| 130 | 131 | 'misc' => array( |
| 131 | - 'latest_wp' => $this->get_latest_version(), | |
| 132 | - 'core_update_url' => network_admin_url( 'update-core.php' ), | |
| 132 | + 'latest_wp' => $this->get_latest_version(), | |
| 133 | + 'core_update_url' => network_admin_url( 'update-core.php' ), | |
| 134 | + 'show_revert_button' => false, | |
| 135 | + 'show_action_button' => false, | |
| 133 | 136 | ), |
| 134 | - 'bulk_description' => esc_html__( | |
| 135 | - 'Your current WordPress version is out of date, which means you could be missing out on the latest update. We will upgrade WordPress version to the latest.', | |
| 136 | - 'defender-security' | |
| 137 | + 'bulk_description' => wp_strip_all_tags( | |
| 138 | + 'Outdated WordPress installs can leave your site vulnerable. Update WordPress to the latest version to help protect your site and keep security up to date.', | |
| 139 | + 'wpdef' | |
| 137 | 140 | ), |
| 138 | - 'bulk_title' => esc_html__( 'WordPress Version', 'defender-security' ), | |
| 141 | + 'bulk_title' => $this->get_label(), | |
| 139 | 142 | ); |
| 140 | 143 | } |
| 141 | 144 | } |