PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / trunk
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization vtrunk
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 3.12.0 All 135 releases
← All changes | inc/rest.php +2 -1 4.2.10 → trunk View file →
@@ -708,9 +708,9 @@
708 708 public function poll_optimized_images( WP_REST_Request $request ) {
709 709 $api_key = $request->get_param( 'api_key' );
710 710 $request = new Optml_Api();
711 711 $images = $request->get_optimized_images( $api_key );
712 - if ( ! isset( $images['list'] ) || empty( $images['list'] ) ) {
712 + if ( is_wp_error( $images ) || ! is_array( $images ) || empty( $images['list'] ) ) {
713 713 return $this->response( [] );
714 714 }
715 715
716 716 $final_images = array_splice( $images['list'], 0, 10 );
@@ -964,8 +964,9 @@
964 964 return $this->response( 'Missing required parameters', 'error' );
965 965 }
966 966 // save just the first 6 images, see https://github.com/Codeinwp/optimole-service/issues/1588#issuecomment-3357110865
967 967 $above_fold_images = array_slice( $above_fold_images, 0, 6 );
968 + $above_fold_images = array_values( array_map( 'intval', array_filter( $above_fold_images, 'is_numeric' ) ) );
968 969 if ( count( $bg_selectors ) > 100 ) {
969 970 return $this->response( 'Background selectors limit exceeded', 'error' );
970 971 }
971 972 if ( $url === Profile::PLACEHOLDER ) {