PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 4.2.15
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v4.2.15
4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 All 136 releases
← All changes | inc/admin.php +8 -4 4.2.5 → 4.2.15 View file →
@@ -221,9 +221,9 @@
221 221 * @param string $file Temp file path.
222 222 *
223 223 * @return bool|int
224 224 */
225 - protected function sanitize_svg( $file ) {
225 + public function sanitize_svg( $file ) {
226 226 // We can ignore the phpcs warning here as we're reading and writing to the Temp file.
227 227 $dirty = file_get_contents( $file ); // phpcs:ignore
228 228
229 229 // Is the SVG gzipped? If so we try and decode the string.
@@ -252,12 +252,13 @@
252 252 if ( $is_zipped ) {
253 253 $clean = gzencode( $clean );
254 254 }
255 255
256 - // We can ignore the phpcs warning here as we're reading and writing to the Temp file.
257 - file_put_contents( $file, $clean ); // phpcs:ignore
256 + // We handle the write result below; silence the warning on I/O failure. Reading/writing the temp file is intended.
257 + $written = @file_put_contents( $file, $clean ); // phpcs:ignore WordPress.WP.AlternativeFunctions, WordPress.PHP.NoSilencedErrors
258 258
259 - return true;
259 + // A failed write leaves the dirty upload in place, so report it as unsanitized.
260 + return is_string( $clean ) && strlen( $clean ) === $written;
260 261 }
261 262
262 263 /**
263 264 * Check if the contents are gzipped
@@ -1414,8 +1415,11 @@
1414 1415 $is_offload_media_available = 'yes';
1415 1416 }
1416 1417 $api_key = $this->settings->get( 'api_key' );
1417 1418 $service_data = $this->settings->get( 'service_data' );
1419 + if ( ! is_array( $service_data ) ) {
1420 + $service_data = [];
1421 + }
1418 1422 $user = get_userdata( get_current_user_id() );
1419 1423 $user_status = 'inactive';
1420 1424 $auto_connect = get_option( Optml_Settings::OPTML_USER_EMAIL, 'no' );
1421 1425 $available_apps = isset( $service_data['available_apps'] ) ? $service_data['available_apps'] : null;