PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.7.7
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.7.7
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
image-optimization / modules / reviews / classes / feedback-handler.php

feedback-handler.php in Image Optimizer – Compress Images and Convert to WebP or AVIF 1.7.7, at modules/reviews/classes/feedback-handler.php

43 lines 753 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImageOptimization\Modules\Reviews\Classes;
4
5 use Exception;
6 use ImageOptimization\Classes\Utils;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12 /**
13 * Feedback_Handler
14 *
15 * Class to post feedback
16 */
17 class Feedback_Handler {
18
19 const SERVICE_ENDPOINT = 'feedback/reviews';
20
21 /**
22 * Send request to the service to submit the feedback.
23 *
24 * @param $params
25 *
26 * @return string
27 * @throws Exception
28 */
29 public static function post_feedback( $params ) {
30 $response = Utils::get_api_client()->make_request(
31 'POST',
32 self::SERVICE_ENDPOINT,
33 $params
34 );
35
36 if ( empty( $response ) || is_wp_error( $response ) ) {
37 throw new Exception( 'Failed to add the feedback.' );
38 }
39
40 return $response;
41 }
42 }
43