first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace WPML\Rest;
use \WP_REST_Request;
class Adaptor extends \WPML_REST_Base {
/** @var ITarget $target */
private $target;
public function set_target( ITarget $target ) {
$this->target = $target;
$this->namespace = $target->get_namespace();
}
public function add_hooks() {
$routes = $this->target->get_routes();
foreach ( $routes as $route ) {
$this->register_route( $route['route'], $route['args'] );
}
}
/**
* @param WP_REST_Request $request
*
* @return array
*/
public function get_allowed_capabilities( WP_REST_Request $request ) {
return $this->target->get_allowed_capabilities( $request );
}
}