Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/leadin/public/modules/api
File: class-base-api-controller.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Leadin\api;
[2] Fix | Delete
[3] Fix | Delete
use Leadin\data\Filters;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Base class to set a rest endpoint
[7] Fix | Delete
*/
[8] Fix | Delete
class Base_Api_Controller {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Register a route with given parameters
[12] Fix | Delete
*
[13] Fix | Delete
* @param string $path The path for the route to register the service on. Route gets namespaced with leadin/v1.
[14] Fix | Delete
* @param string $methods Comma seperated list of methods allowed for this route.
[15] Fix | Delete
* @param array $callback Method to execute when this endpoint is requested.
[16] Fix | Delete
*/
[17] Fix | Delete
public function register_leadin_route( $path, $methods, $callback ) {
[18] Fix | Delete
register_rest_route(
[19] Fix | Delete
'leadin/v1',
[20] Fix | Delete
$path,
[21] Fix | Delete
array(
[22] Fix | Delete
'methods' => $methods,
[23] Fix | Delete
'callback' => $callback,
[24] Fix | Delete
'permission_callback' => array( $this, 'verify_permissions' ),
[25] Fix | Delete
)
[26] Fix | Delete
);
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* Register an admin route with given parameters
[31] Fix | Delete
*
[32] Fix | Delete
* @param string $path The path for the route to register the service on. Route gets namespaced with leadin/v1.
[33] Fix | Delete
* @param string $methods Comma seperated list of methods allowed for this route.
[34] Fix | Delete
* @param array $callback Method to execute when this endpoint is requested.
[35] Fix | Delete
*/
[36] Fix | Delete
public function register_leadin_admin_route( $path, $methods, $callback ) {
[37] Fix | Delete
register_rest_route(
[38] Fix | Delete
'leadin/v1',
[39] Fix | Delete
$path,
[40] Fix | Delete
array(
[41] Fix | Delete
'methods' => $methods,
[42] Fix | Delete
'callback' => $callback,
[43] Fix | Delete
'permission_callback' => array( $this, 'verify_admin_permissions' ),
[44] Fix | Delete
)
[45] Fix | Delete
);
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Permissions required by user to execute the request. User permissions are already
[51] Fix | Delete
* verified by nonce 'wp_rest' automatically.
[52] Fix | Delete
*
[53] Fix | Delete
* @return bool true if the user has adequate permissions for this endpoint.
[54] Fix | Delete
*/
[55] Fix | Delete
public function verify_permissions() {
[56] Fix | Delete
return current_user_can( Filters::apply_view_plugin_menu_capability_filters() );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Permissions required by user to execute the request. User permissions are already
[61] Fix | Delete
* verified by nonce 'wp_rest' automatically.
[62] Fix | Delete
*
[63] Fix | Delete
* @return bool true if the user has adequate admin permissions for this endpoint.
[64] Fix | Delete
*/
[65] Fix | Delete
public function verify_admin_permissions() {
[66] Fix | Delete
return current_user_can( Filters::apply_connect_plugin_capability_filters() );
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function