PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 4.2.13
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v4.2.13
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 3.12.1 All 134 releases
← All changes | inc/rest.php +10 -3 4.2.54.2.13 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 );
@@ -717,9 +717,9 @@
717 717
718 718 foreach ( $final_images as $index => $value ) {
719 719 $final_images[ $index ]['url'] = Optml_Media_Offload::instance()->get_media_optimized_url(
720 720 $value['url'],
721 - $value['key'],
721 + strtolower( $value['key'] ),
722 722 140,
723 723 140,
724 724 [
725 725 'type' => ResizeTypeProperty::FILL,
@@ -843,10 +843,16 @@
843 843 *
844 844 * @return WP_REST_Response
845 845 */
846 846 public function clear_offload_errors( WP_REST_Request $request ) {
847 - $delete_count = Optml_Media_Offload::clear_offload_errors_meta();
847 + $action = $request->get_param( 'action' );
848 848
849 + if ( 'rollback_images' === $action ) {
850 + $delete_count = Optml_Media_Offload::clear_rollback_errors_meta();
851 + } else {
852 + $delete_count = Optml_Media_Offload::clear_offload_errors_meta();
853 + }
854 +
849 855 return $this->response( [ 'success' => $delete_count ] );
850 856 }
851 857
852 858 /**
@@ -958,8 +964,9 @@
958 964 return $this->response( 'Missing required parameters', 'error' );
959 965 }
960 966 // save just the first 6 images, see https://github.com/Codeinwp/optimole-service/issues/1588#issuecomment-3357110865
961 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' ) ) );
962 969 if ( count( $bg_selectors ) > 100 ) {
963 970 return $this->response( 'Background selectors limit exceeded', 'error' );
964 971 }
965 972 if ( $url === Profile::PLACEHOLDER ) {