← All changes
|
src/component/security-tweaks/class-php-version.php
+19
-9
5.7.1
→
6.3.0
View file →
| @@ -123,9 +123,14 @@ | ||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $position = array_search( $this->stable_php, $supported_php, true ); |
| 126 | 126 | |
| 127 | - if ( false !== $position && ! empty( $supported_php[ $position ] ) ) { | |
| 127 | + if ( | |
| 128 | + false !== $position | |
| 129 | + && isset( $supported_php[ $position ] ) | |
| 130 | + && is_string( $supported_php[ $position ] ) | |
| 131 | + && '' !== $supported_php[ $position ] | |
| 132 | + ) { | |
| 128 | 133 | $this->min_php = $supported_php[ $position ]; |
| 129 | 134 | } else { |
| 130 | 135 | // Fallback to first supported version if search fails. |
| 131 | 136 | $this->min_php = reset( $supported_php ); |
| @@ -137,9 +142,9 @@ | ||
| 137 | 142 | * |
| 138 | 143 | * @return string |
| 139 | 144 | */ |
| 140 | 145 | public function get_label(): string { |
| 141 | - return esc_html__( 'Update PHP to latest version', 'defender-security' ); | |
| 146 | + return esc_html__( 'Update PHP', 'defender-security' ); | |
| 142 | 147 | } |
| 143 | 148 | |
| 144 | 149 | /** |
| 145 | 150 | * Get the error reason. |
| @@ -150,11 +155,11 @@ | ||
| 150 | 155 | $this->set_php_versions(); |
| 151 | 156 | |
| 152 | 157 | return sprintf( |
| 153 | 158 | /* translators: %s: Min PHP version. %s: Min PHP version. */ |
| 154 | - esc_html__( | |
| 159 | + wp_strip_all_tags( | |
| 155 | 160 | 'PHP versions older than %1$s are no longer supported. For security and stability we strongly recommend you upgrade your PHP version to version %2$s or newer as soon as possible.', |
| 156 | - 'defender-security' | |
| 161 | + 'wpdef' | |
| 157 | 162 | ), |
| 158 | 163 | $this->min_php, |
| 159 | 164 | $this->min_php |
| 160 | 165 | ); |
| @@ -168,16 +173,21 @@ | ||
| 168 | 173 | public function to_array(): array { |
| 169 | 174 | $this->set_php_versions(); |
| 170 | 175 | |
| 171 | 176 | return array( |
| 172 | - 'slug' => $this->slug, | |
| 173 | - 'title' => $this->get_label(), | |
| 174 | - 'errorReason' => $this->get_error_reason(), | |
| 175 | - 'successReason' => esc_html__( 'You have the latest version of PHP installed, good stuff!', 'defender-security' ), | |
| 176 | - 'misc' => array( | |
| 177 | + 'slug' => $this->slug, | |
| 178 | + 'title' => $this->get_label(), | |
| 179 | + 'errorReason' => $this->get_error_reason(), | |
| 180 | + 'successReason' => wp_strip_all_tags( __( 'You have the latest version of PHP installed, good stuff!', 'defender-security' ) ), | |
| 181 | + 'misc' => array( | |
| 177 | 182 | 'php_version' => $this->current_php, |
| 178 | 183 | 'min_php_version' => $this->min_php, |
| 179 | 184 | 'stable_php_version' => $this->stable_php, |
| 185 | + 'show_revert_button' => false, | |
| 186 | + 'show_action_button' => false, | |
| 187 | + ), | |
| 188 | + 'bulk_description' => array( | |
| 189 | + wp_strip_all_tags( __( 'PHP powers WordPress by processing code and generating your site’s pages. Update PHP to keep your site fast, reliable, secure, and compatible with supported versions.', 'defender-security' ) ), | |
| 180 | 190 | ), |
| 181 | 191 | ); |
| 182 | 192 | } |
| 183 | 193 | } |