| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/pia/wp-content/plugins/cookie-law-info/lite/includes/ |
Upload File : |
<?php
/**
* WordPress Rest controller class.
*
* @link https://www.cookieyes.com/
* @since 3.0.0
*
* @package CookieYes\Lite\Includes
*/
namespace CookieYes\Lite\Includes;
use WP_REST_Controller;
use WP_Error;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Abstract Rest Controller Class
*
* @package CookieYes
* @extends WP_REST_Controller
* @version 3.0.0
*/
abstract class Rest_Controller extends WP_REST_Controller {
/**
* Endpoint namespace.
*
* @var string
*/
protected $namespace = 'cky/v1';
/**
* Route base.
*
* @var string
*/
protected $rest_base = '';
/**
* Check if a given request has access to read items.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error( 'cookieyes_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
/**
* Check if a given request has access to create an item.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function create_item_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error( 'cookieyes_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
/**
* Check if a given request has access to read an item.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_item_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error( 'cookieyes_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
/**
* Check if a given request has access to update an item.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function update_item_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error( 'cookieyes_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
/**
* Check if a given request has access to delete an item.
*
* @param WP_REST_Request $request Full details about the request.
* @return bool|WP_Error
*/
public function delete_item_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error( 'cookieyes_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
}
}