| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/cwd/wp-content/plugins/persian-woocommerce/src/API/ |
Upload File : |
<?php
namespace PersianWooCommerce\API;
use WP_REST_Request;
abstract class RestAPI {
public function __construct() {
add_action( 'rest_api_init', [ $this, 'register_routes' ] );
}
abstract public function register_routes();
public function permission_callback( WP_REST_Request $request ): bool {
return current_user_can( 'view_woocommerce_reports' );
}
/**
* @param bool $success
* @param string|null $message
* @param array $data
*
* @return no-return
*/
public static function response( bool $success, string $message = null, array $data = [] ) {
echo json_encode( [
'success' => $success,
'message' => $message,
'data' => $data,
] );
die();
}
}