PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/component/security-tweaks/class-php-version.php +34 -12 5.3.1 → 6.3.0 View file →
@@ -101,23 +101,40 @@
101 101 $this->stable_php = 'n/a';
102 102
103 103 return;
104 104 }
105 -
105 + // Ref: https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/.
106 106 $supported_php = apply_filters(
107 107 "defender_{$this->slug}_supported_php",
108 108 array(
109 - '7.4',
110 109 '8.0',
111 110 '8.1',
112 111 '8.2',
112 + '8.3',
113 + '8.4',
113 114 )
114 115 );
115 116 $this->stable_php = $info['recommended_version'];
116 - $position = array_search( $this->stable_php, $supported_php, true );
117 117
118 - if ( false !== $position && ! empty( $supported_php[ $position ] ) ) {
118 + // If the recommended version is lower than plugin's minimum requirement.
119 + if ( version_compare( $this->stable_php, WP_DEFENDER_MIN_PHP_VERSION, '<' ) ) {
120 + // WordPress may recommend a PHP version older than what plugin requires.
121 + // In that case, use plugin's minimum requirement instead.
122 + $this->stable_php = WP_DEFENDER_MIN_PHP_VERSION;
123 + }
124 +
125 + $position = array_search( $this->stable_php, $supported_php, true );
126 +
127 + if (
128 + false !== $position
129 + && isset( $supported_php[ $position ] )
130 + && is_string( $supported_php[ $position ] )
131 + && '' !== $supported_php[ $position ]
132 + ) {
119 133 $this->min_php = $supported_php[ $position ];
134 + } else {
135 + // Fallback to first supported version if search fails.
136 + $this->min_php = reset( $supported_php );
120 137 }
121 138 }
122 139
123 140 /**
@@ -125,9 +142,9 @@
125 142 *
126 143 * @return string
127 144 */
128 145 public function get_label(): string {
129 - return esc_html__( 'Update PHP to latest version', 'defender-security' );
146 + return esc_html__( 'Update PHP', 'defender-security' );
130 147 }
131 148
132 149 /**
133 150 * Get the error reason.
@@ -138,11 +155,11 @@
138 155 $this->set_php_versions();
139 156
140 157 return sprintf(
141 158 /* translators: %s: Min PHP version. %s: Min PHP version. */
142 - esc_html__(
159 + wp_strip_all_tags(
143 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.',
144 - 'defender-security'
161 + 'wpdef'
145 162 ),
146 163 $this->min_php,
147 164 $this->min_php
148 165 );
@@ -156,16 +173,21 @@
156 173 public function to_array(): array {
157 174 $this->set_php_versions();
158 175
159 176 return array(
160 - 'slug' => $this->slug,
161 - 'title' => $this->get_label(),
162 - 'errorReason' => $this->get_error_reason(),
163 - 'successReason' => esc_html__( 'You have the latest version of PHP installed, good stuff!', 'defender-security' ),
164 - '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(
165 182 'php_version' => $this->current_php,
166 183 'min_php_version' => $this->min_php,
167 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' ) ),
168 190 ),
169 191 );
170 192 }
171 193 }