mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-21 13:06:02 +08:00
* Initial refactor commit
* ✅ Added build and tests CI/CD
* update: add src for admin settings
* update: incorrect constant names
* update: namespace
* add: accessibility settings
* update: webpack to output files inside a folder
* update: build output folders
* update: removed commented code
* update: npm scripts
* add: webpack config
* add: hooks
* update: move admin setting to the module folder
* update: assets loading logic
* update: add rule to move jsx props to multiline imporving readability
* add: connect modal
* update: hooks import for better readability
* update: replace functions with hooks
* add: connect module
* add: settings and get settings route
* add: hooks and contexts to get settings
* add: hooks
* add: notification component
* add: data api
* add: settings provider and connect settings
* add: husky
* fix: formatting and text-domain
* update: filter names
* fix: hook import
* add: set function for settings
* add: prop-types package
* update: refactor notification component and context
* update: remove filter for authorize url
* update: imports and exports of hooks
* update: plugin settings context filename and relevant imports
---------
Co-authored-by: Ohad <ohad@elementor.com>
50 lines
902 B
PHP
50 lines
902 B
PHP
<?php
|
|
|
|
namespace EA11y\Modules\Settings\Rest;
|
|
|
|
use EA11y\Modules\Settings\Classes\Route_Base;
|
|
use EA11y\Modules\Settings\Module as Settings;
|
|
use Throwable;
|
|
use WP_Error;
|
|
use WP_REST_Response;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
class Get_Settings extends Route_Base {
|
|
public string $path = 'get-settings';
|
|
|
|
public function get_methods(): array {
|
|
return [ 'GET' ];
|
|
}
|
|
|
|
public function get_name(): string {
|
|
return 'get-settings';
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return WP_Error|WP_REST_Response
|
|
*
|
|
*/
|
|
public function GET() {
|
|
try {
|
|
$error = $this->verify_capability();
|
|
|
|
if ( $error ) {
|
|
return $error;
|
|
}
|
|
|
|
$data = Settings::get_plugin_settings();
|
|
|
|
return $this->respond_success_json( $data );
|
|
|
|
} catch ( Throwable $t ) {
|
|
return $this->respond_error_json( [
|
|
'message' => $t->getMessage(),
|
|
'code' => 'internal_server_error',
|
|
] );
|
|
}
|
|
}
|
|
}
|