=> $object->get_id(),
'name' => $object->get_name(),
'slug' => $object->get_slug(),
'description' => $object->get_description(),
'prior_consent' => $object->get_prior_consent(),
'visibility' => $object->get_visibility(),
'language' => $object->get_language(),
'priority' => $object->get_priority(),
'sell_personal_data' => $object->get_sell_personal_data(),
'cookie_list' => $object->get_cookies(),
'date_created' => $object->get_date_created(),
'date_modified' => $object->get_date_modified(),
);
}
/**
* Bulk update of categories.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response
*/
public function bulk( $request ) {
try {
if ( ! isset( $request['categories'] ) ) {
return new WP_Error( 'cookieyes_rest_invalid_data', __( 'No data specified to create/edit categories', 'cookie-law-info' ), array( 'status' => 404 ) );
}
if ( ! defined( 'CKY_BULK_REQUEST' ) ) {
define( 'CKY_BULK_REQUEST', true );
}
$item_objects = array();
$objects = array();
$data = $request['categories'];
$categories = array();
foreach ( $data as $_category ) {
$id = 0;
// Try to get the category ID.
if ( isset( $_category['id'] ) ) {
$id = intval( $_category['id'] );
}
if ( $id ) {
$object = new Cookie_Categories( $id );
$prior_consent = isset( $_category['prior_consent'] ) ? (bool) $_category['prior_consent'] : false;
$visibility = isset( $_category['visibility'] ) ? (bool) $_category['visibility'] : true;
$object->set_prior_consent( $prior_consent );
$object->set_visibility( $visibility );
$object->save();
$item_objects[] = $object;
}
}
foreach ( $item_objects as $data ) {
$data = $this->prepare_item_for_response( $data, $request );
$objects[] = $this->prepare_response_for_collection( $data );
}
do_action( 'cky_after_update_cookie_category' );
return rest_ensure_response( $objects );
} catch ( Exception $e ) {
return new WP_Error( $e->getCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
}
/**
* Get the Cookies's schema, conforming to JSON Schema.
*
* @return array
*/
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'cookie_categories',
'type' => 'object',
'properties' => array(
'id' => array(
'description' => __( 'Unique identifier for the resource.', 'cookie-law-info' ),
'type' => 'integer',
'context' => array( 'view' ),
'readonly' => true,
),
'date_created' => array(
'description' => __( 'The date the cookie was created, as GMT.', 'cookie-law-info' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_modified' => array(
'description' => __( 'The date the cookie was last modified, as GMT.', 'cookie-law-info' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'name' => array(
'description' => __( 'Cookie category name.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'slug' => array(
'description' => __( 'Cookie category unique name', 'cookie-law-info' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'language' => array(
'description' => __( 'Cookie category language', 'cookie-law-info' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'description' => array(
'description' => __( 'Cookie category description.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
),
'prior_consent' => array(
'description' => __( 'Cookie type.', 'cookie-law-info' ),
'type' => 'boolean',
'context' => array( 'view', 'edit' ),
),
'priority' => array(
'description' => __( 'Cookie type.', 'cookie-law-info' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
),
'visibility' => array(
'description' => __( 'Show cookies on audit table or not', 'cookie-law-info' ),
'type' => 'boolean',
'context' => array( 'view', 'edit' ),
),
'sell_personal_data' => array(
'description' => __( 'Show cookies on audit table or not', 'cookie-law-info' ),
'type' => 'boolean',
'context' => array( 'view', 'edit' ),
),
'cookies' => array(
'description' => __( 'Cookie category description.', 'cookie-law-info' ),
'type' => 'object',
'context' => array( 'view' ),
),
),
);
return $this->add_additional_fields_schema( $schema );
}
} // End the class.
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Cookies\Api\Categories_API' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php:52
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php(33): CookieYes\Lite\Admin\Modules\Cookies\Cookies->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\Cookies\Cookies->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('cookies')
#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/cookies/class-cookies.php on line 52