onse( $data );
}
/**
* Get site info including the features allowed for the current plan.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response
*/
public function get_info( $request ) {
$args = array();
$registered = $this->get_collection_params();
if ( isset( $registered['force'], $request['force'] ) ) {
$args['force'] = (bool) $request['force'];
}
$response = Controller::get_instance()->get_info( $args );
if ( empty( $response ) ) {
$data = array();
} else {
$data = $this->prepare_item_for_response( $response, $request );
}
$objects = $this->prepare_response_for_collection( $data );
return rest_ensure_response( $objects );
}
/**
* Send data directly to CookieYes web app.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response
*/
public function send_items( $request ) {
$response = Controller::get_instance()->sync();
if ( empty( $response ) ) {
$data = array();
} else {
$data = $this->prepare_item_for_response( $response, $request );
}
$objects = $this->prepare_response_for_collection( $data );
return rest_ensure_response( $objects );
}
/**
* Clear cache of all the modules
*
* @return WP_Error|WP_REST_Response
*/
public function clear_cache() {
$banner_controller = new \CookieYes\Lite\Admin\Modules\Banners\Includes\Controller();
$category_controller = new \CookieYes\Lite\Admin\Modules\Cookies\Includes\Category_Controller();
$cookie_controller = new \CookieYes\Lite\Admin\Modules\Cookies\Includes\Cookie_Controller();
$banner_controller->delete_cache();
$category_controller->delete_cache();
$cookie_controller->delete_cache();
wp_cache_flush();
$data = array( 'status' => true );
return rest_ensure_response( $data );
}
/**
* Initiate disconnect request.
*
* @return WP_Error|WP_REST_Response
*/
public function disconnect() {
$response = Controller::get_instance()->disconnect();
return rest_ensure_response( $response );
}
/**
* Update the status of admin notices.
*
* @param object $request Request.
* @return WP_Error|WP_REST_Response
*/
public function update_notice( $request ) {
$response = array( 'status' => false );
$notice = isset( $request['notice'] ) ? $request['notice'] : false;
$expiry = isset( $request['expiry'] ) ? intval( $request['expiry'] ) : 0;
if ( $notice ) {
Notice::get_instance()->dismiss( $notice, $expiry );
$response['status'] = true;
}
return rest_ensure_response( $response );
}
/**
* Update the expand status of connect notice.
*
* @param object $request Request.
* @return WP_Error|WP_REST_Response
*/
public function expand_notice( $request ) {
$response = array( 'status' => false );
$expand = isset( $request['expand'] ) ? boolval( $request['expand'] ) : true;
Connect_Notice::get_instance()->save_state( $expand );
$response['status'] = true;
return rest_ensure_response( $response );
}
/**
* Update the status of admin notices.
*
* @param object $request Request.
* @return WP_Error|WP_REST_Response
*/
public function install_missing_tables( $request ) {
$missing_tables = cky_missing_tables();
if ( count( $missing_tables ) > 0 ) {
do_action( 'cky_reinstall_tables' );
do_action( 'cky_clear_cache' );
}
return rest_ensure_response( array( 'success' => true ) );
}
/**
* Format data to provide output to API
*
* @param object $object Object of the corresponding item Cookie or Cookie_Categories.
* @param array $request Request params.
* @return array
*/
public function prepare_item_for_response( $object, $request ) {
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $object, $request );
$data = $this->filter_response_by_context( $data, $context );
return rest_ensure_response( $data );
}
/**
* Prepare a single item for create or update.
*
* @param WP_REST_Request $request Request object.
* @return stdClass
*/
public function prepare_item_for_database( $request ) {
$object = new Settings();
$data = $object->get();
$schema = $this->get_item_schema();
$properties = isset( $schema['properties'] ) && is_array( $schema['properties'] ) ? $schema['properties'] : array();
if ( ! empty( $properties ) ) {
$properties_keys = array_keys(
array_filter(
$properties,
function( $property ) {
return isset( $property['readonly'] ) && true === $property['readonly'] ? false : true;
}
)
);
foreach ( $properties_keys as $key ) {
$value = isset( $request[ $key ] ) ? $request[ $key ] : '';
$data[ $key ] = $value;
}
}
$object->update( $data );
return $object->get();
}
/**
* Get the query params for collections.
*
* @return array
*/
public function get_collection_params() {
return array(
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
'paged' => array(
'description' => __( 'Current page of the collection.', 'cookie-law-info' ),
'type' => 'integer',
'default' => 1,
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
'minimum' => 1,
),
'per_page' => array(
'description' => __( 'Maximum number of items to be returned in result set.', 'cookie-law-info' ),
'type' => 'integer',
'default' => 10,
'minimum' => 1,
'maximum' => 100,
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
),
'search' => array(
'description' => __( 'Limit results to those matching a string.', 'cookie-law-info' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg',
),
'force' => array(
'type' => 'boolean',
'description' => __( 'Force fetch data', 'cookie-law-info' ),
),
);
}
/**
* Get the Consent logs's schema, conforming to JSON Schema.
*
* @return array
*/
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'consentlogs',
'type' => 'object',
'properties' => array(
'id' => array(
'description' => __( 'Unique identifier for the resource.', 'cookie-law-info' ),
'type' => 'integer',
'context' => array( 'view' ),
'readonly' => true,
),
'site' => array(
'description' => __( 'Unique identifier for the resource.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'api' => array(
'description' => __( 'Language.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'account' => array(
'description' => __( 'Language.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'consent_logs' => array(
'description' => __( 'Language.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'languages' => array(
'description' => __( 'Language.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'onboarding' => array(
'description' => __( 'Language.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
),
);
return $this->add_additional_fields_schema( $schema );
}
} // End the class.
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Settings\Api\Api' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php:43
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php(34): CookieYes\Lite\Admin\Modules\Settings\Settings->load_apis()
#1 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-modules.php(54): CookieYes\Lite\Admin\Modules\Settings\Settings->init()
#2 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(179): CookieYes\Lite\Includes\Modules->__construct('settings')
#3 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(81): CookieYes\Lite\Admin\Admin->load_modules()
#4 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(153): CookieYes\Lite\Admin\Admin->__construct( in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php on line 43