id;
$cached = wp_cache_get( $cache_key, $this->cache_group );
if ( false !== $cached ) {
return $cached;
}
$item = $this->get_item_from_db( array( 'id' => $id ) );
return $item;
}
/**
* Get cookies based on the category.
*
* @param boolean|integer $category Category id.
* @return array
*/
public function get_items_by_category( $category = false ) {
if ( ! $category ) {
return array();
}
$cache_key = $this->cache_group . '_category_' . $category;
$cached = wp_cache_get( $cache_key, $this->cache_group );
if ( false !== $cached ) {
return $cached;
}
$items = $this->get_item_from_db( array( 'category' => $category ) );
wp_cache_set( $cache_key, $items, $this->cache_group );
return $items;
}
/**
* Create a new category
*
* @param object $object Category object.
* @return void
*/
public function create_item( $object ) {
global $wpdb;
$date_created = current_time( 'mysql' );
$object->set_date_created( $date_created );
$object->set_date_modified( $date_created );
$wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . 'cky_cookies',
array(
'name' => $object->get_name(),
'slug' => $object->get_slug(),
'description' => wp_json_encode( $object->get_description() ),
'duration' => wp_json_encode( $object->get_duration() ),
'domain' => $object->get_domain(),
'category' => $object->get_category(),
'type' => $object->get_type(),
'discovered' => ( true === $object->is_discovered() ? 1 : 0 ),
'url_pattern' => $object->get_url_pattern(),
'meta' => wp_json_encode( $object->get_meta() ),
'date_created' => $object->get_date_created(),
'date_modified' => $object->get_date_modified(),
),
array(
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%s',
)
);
$object->set_id( $wpdb->insert_id );
do_action( 'cky_after_update_cookie' );
}
/**
* Update an existing category on a local db.
*
* @param object $object category object.
* @return void
*/
public function update_item( $object ) {
global $wpdb;
$wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . 'cky_cookies',
array(
'name' => $object->get_name(),
'slug' => $object->get_slug(),
'description' => wp_json_encode( $object->get_description() ),
'duration' => wp_json_encode( $object->get_duration() ),
'domain' => $object->get_domain(),
'category' => $object->get_category(),
'type' => $object->get_type(),
'discovered' => ( true === $object->is_discovered() ? 1 : 0 ),
'url_pattern' => $object->get_url_pattern(),
'meta' => wp_json_encode( $object->get_meta() ),
'date_created' => $object->get_date_created(),
'date_modified' => $object->get_date_modified(),
),
array( 'cookie_id' => $object->get_id() ),
array(
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%s',
)
);
do_action( 'cky_after_update_cookie' );
}
/**
* Delete a cookie from the database.
*
* @param object $object Cookie object.
* @return void
*/
public function delete_item( $object ) {
global $wpdb;
$wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . 'cky_cookies',
array(
'cookie_id' => $object->get_id(),
)
);
do_action( 'cky_after_update_cookie' );
}
/**
* Properly sanitize category data before sending to the controllers.
*
* @param object $item Category raw data.
* @return object
*/
public function prepare_item( $item ) {
if ( false === is_object( $item ) ) {
return false;
}
$object = new stdClass();
$object->cookie_id = isset( $item->cookie_id ) ? absint( $item->cookie_id ) : 0;
$object->name = isset( $item->name ) ? sanitize_text_field( $item->name ) : '';
$object->slug = isset( $item->slug ) ? sanitize_text_field( $item->slug ) : '';
$object->description = isset( $item->description ) ? cky_sanitize_content( $this->prepare_json( $item->description ) ) : array();
$object->duration = isset( $item->duration ) ? cky_sanitize_content( $this->prepare_json( $item->duration ) ) : array();
$object->domain = isset( $item->domain ) ? sanitize_text_field( $item->domain ) : '';
$object->category = isset( $item->category ) ? absint( $item->category ) : '';
$object->type = isset( $item->type ) ? sanitize_text_field( $item->type ) : '';
$object->discovered = isset( $item->discovered ) ? absint( $item->discovered ) : 0;
$object->url_pattern = isset( $item->url_pattern ) ? sanitize_textarea_field( $item->url_pattern ) : '';
$object->meta = isset( $item->meta ) ? cky_sanitize_content( $this->prepare_json( $item->meta ) ) : array();
$object->date_created = isset( $item->date_created ) ? sanitize_text_field( $item->date_created ) : '';
$object->date_modified = isset( $item->date_modified ) ? sanitize_text_field( $item->date_modified ) : '';
return $object;
}
/**
* Decode a JSON string if necessary
*
* @param string $data String data.
* @return array
*/
public function prepare_json( $data ) {
return is_string( $data ) ? json_decode( ( $data ), true ) : $data;
}
}
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Cookies\Includes\Cookie_Controller' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php:36
Stack trace:
#0 /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()
#1 /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')
#2 /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()
#3 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(153): CookieYes\Lite\Admin\Admin->__construct('cookie-law-info', '3.2.4')
#4 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(95): CookieYes\Lite\Includes\CLI->define_ad in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php on line 36