return_optimized_images() ->set_paging_size( 1 ) ->execute(); if ( ! $optimized_image_query->post_count ) { return false; } return true; } /** * Checks if the notice should be rendered after the one third of images were optimized. * * @param bool $check_location * * @return bool */ public function should_render_third_optimized_notice( bool $check_location = true ): bool { if ( Pointers::is_dismissed( self::THIRD_OF_IMAGES_OPTIMIZED_FEEDBACK_SLUG ) ) { return false; } if ( $check_location && ! Utils::is_plugin_settings_page() ) { return false; } $images_query = ( new Image_Query_Builder() ) ->execute(); $optimized_images_query = ( new Image_Query_Builder() ) ->return_optimized_images() ->execute(); if ( ! $optimized_images_query->post_count ) { return false; } $optimized_percentage = round( $optimized_images_query->post_count / $images_query->post_count * 100 ); if ( $optimized_percentage < 33.33 ) { return false; } return true; } /** * Renders the notice after the first optimization. * * @return void */ public function render_first_optimized_notice() { ?>
★★★★★ review to spread the word.', 'image-optimization' ), esc_url( self::NOTICE_FEEDBACK_LINK ), esc_attr__( 'Five stars', 'image-optimization' ) ) ); ?>
★★★★★ review to spread the word.', 'image-optimization' ), esc_url( self::NOTICE_FEEDBACK_LINK ), esc_attr__( 'Five stars', 'image-optimization' ) ) ); ?>