one-click-accessibility/modules/connect/classes/route-base.php
Nirbhay Singh 9056e59ea8
[APP 705] add connect module, settings and notification component (#112)
* 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>
2024-11-13 14:30:35 +02:00

43 lines
909 B
PHP

<?php
namespace EA11y\Modules\Connect\Classes;
use EA11y\Classes\Rest\Route;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Class Route_Base
*/
class Route_Base extends Route {
protected bool $override = false;
protected $auth = true;
protected string $path = '';
public function get_methods(): array {
return [];
}
public function get_endpoint(): string {
return 'connect/' . $this->get_path();
}
public function get_path(): string {
return $this->path;
}
public function get_name(): string {
return '';
}
public function post_permission_callback( \WP_REST_Request $request ): bool {
return $this->get_permission_callback( $request );
}
public function get_permission_callback( \WP_REST_Request $request ): bool {
$valid = $this->permission_callback( $request );
return $valid && user_can( $this->current_user_id, 'manage_options' );
}
}