mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-21 12:16:59 +08:00
* add: reviews module * add: logic for the days * Update modules/reviews/assets/src/layouts/user-feedback-form.js Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com> * fix: button name and action * add: feedback url * fix: endpoint for feedback * remove: unused imports * add: app_name * update: move app name to the request --------- Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>
42 lines
738 B
PHP
42 lines
738 B
PHP
<?php
|
|
|
|
namespace EA11y\Modules\Reviews\Classes;
|
|
|
|
use Exception;
|
|
use EA11y\Classes\Services\Client;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
/**
|
|
* Feedback_Handler
|
|
*
|
|
* Class to post feedback
|
|
*/
|
|
class Feedback_Handler {
|
|
|
|
const SERVICE_ENDPOINT = 'feedback/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;
|
|
}
|
|
}
|