@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