mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-30 17:19:31 +08:00
45 lines
837 B
PHP
45 lines
837 B
PHP
<?php
|
|
|
|
namespace EA11y\Modules\Reviews\Classes;
|
|
|
|
use Exception;
|
|
use EA11y\Classes\Services\Client;
|
|
use EA11y\Modules\Logs\Database\Log_Entry;
|
|
use EA11y\Modules\Statuses\Database\Status_Entry;
|
|
use Throwable;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
/**
|
|
* Feedback_Handler
|
|
*
|
|
* Class to post feedback
|
|
*/
|
|
class Feedback_Handler {
|
|
|
|
const SERVICE_ENDPOINT = 'reviews';
|
|
|
|
/**
|
|
* Send request to the service to submit the feedback.
|
|
*
|
|
* @param $params
|
|
*
|
|
* @return string
|
|
* @throws Exception
|
|
*/
|
|
public static function post_feedback( $params ) {
|
|
$response = Client::get_instance()->make_request(
|
|
'POST',
|
|
self::SERVICE_ENDPOINT,
|
|
$params
|
|
);
|
|
|
|
if ( empty( $response ) || is_wp_error( $response ) ) {
|
|
throw new Exception( 'Failed to add the feedback.' );
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|