( $response ) ) { return; } $this->maybe_update_settings( $response ); } /** * Maybe update the plugin settings if required. * * @param array $response Response from the web app. * @return void */ public function maybe_update_settings( $response ) { $settings = new Settings(); $data = $settings->get(); $data['consent_logs'] = isset( $response['consent_logs'] ) ? $response['consent_logs'] : array(); $data['languages'] = isset( $response['languages'] ) ? $response['languages'] : array(); update_option( 'cky_settings', $data ); } /** * Load site info from the web app. * * @param array $args Array of arguments. * @return array */ public function get_app_info( $args = array() ) { $data = array(); if ( ! $this->get_website_id() ) { return new WP_Error( 'cky_invalid_website_id', __( 'Invalid Website ID', 'cookie-law-info' ), array( 'status' => 404 ) ); } $response = $this->get( 'websites/' . $this->get_website_id() ); $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 === $response_code ) { $response = json_decode( wp_remote_retrieve_body( $response ), true ); $user = isset( $response['user'] ) ? $response['user'] : array(); $plan = isset( $response['websiteplan'] ) ? $response['websiteplan'] : array(); $features = isset( $plan['features'] ) ? $plan['features'] : array(); $scan_timestamp = isset( $response['last_scan_at'] ) ? strtotime( sanitize_text_field( $response['last_scan_at'] ) ) : false; $scan_success_timestamp = isset( $response['last_successful_scan_at'] ) ? strtotime( sanitize_text_field( $response['last_successful_scan_at'] ) ) : false; $date = isset( $scan_timestamp ) && is_int( $scan_timestamp ) ? gmdate( 'd M Y', $scan_timestamp ) : ''; $time = isset( $scan_timestamp ) && is_int( $scan_timestamp ) ? gmdate( 'H:i:s', $scan_timestamp ) : ''; $success_date = isset( $scan_success_timestamp ) && is_int( $scan_success_timestamp ) ? gmdate( 'd M Y', $scan_success_timestamp ) : ''; $success_time = isset( $scan_success_timestamp ) && is_int( $scan_success_timestamp ) ? gmdate( 'H:i:s', $scan_success_timestamp ) : ''; $applicable_laws = isset( $response['applicableLaws'] ) ? $response['applicableLaws'] : array( 'gdpr' ); $applicable_laws = implode( ' & ', $applicable_laws ); $grace_period = isset( $response['grace_period_ends_at'] ) ? strtotime( sanitize_text_field( $response['grace_period_ends_at'] ) ) : false; $grace_period_ends = isset( $grace_period ) && is_int( $grace_period ) ? gmdate( 'F d, Y', $grace_period ) : ''; $data = array( 'id' => $this->get_website_id(), 'url' => isset( $response['url'] ) ? esc_url_raw( $response['url'] ) : esc_url_raw( get_site_url() ), 'status' => isset( $response['status'] ) ? sanitize_text_field( $response['status'] ) : '', 'banner_disabled_manually' => isset($response['banner_disabled_manually']) && true == $response['banner_disabled_manually'], 'user' => array( 'name' => isset( $user['name'] ) ? sanitize_text_field( $user['name'] ) : '', 'email' => isset( $user['email'] ) ? sanitize_email( $user['email'] ) : '', ), 'plan' => array( 'id' => isset( $plan['id'] ) ? sanitize_text_field( $plan['id'] ) : '', 'slug' => isset( $plan['slug'] ) ? sanitize_text_field( $plan['slug'] ) : '', 'name' => isset( $plan['name'] ) ? sanitize_text_field( $plan['name'] ) : '', 'description' => isset( $plan['description'] ) ? sanitize_text_field( $plan['description'] ) : '', 'scan_limit' => isset( $plan['scan_limit'] ) ? absint( $plan['scan_limit'] ) : 100, 'log_limit' => isset( $plan['log_limit'] ) ? absint( $plan['log_limit'] ) : 5000, 'log_limit' => isset( $plan['log_limit'] ) ? absint( $plan['log_limit'] ) : 5000, 'features' => array( 'multi_law' => isset( $features['multi_law'] ) && true === $features['multi_law'] ? true : false, 'custom_css' => isset( $features['custom_css'] ) && true === $features['custom_css'] ? true : false, 'custom_branding' => isset( $features['custom_branding'] ) && true === $features['custom_branding'] ? true : false, 'config_geo_rules' => isset( $features['config_geo_rules'] ) && true === $features['config_geo_rules'] ? true : false, 'max_free_websites' => isset( $plan['max_free_websites'] ) ? absint( $plan['max_free_websites'] ) : 1, 'remove_powered_by' => isset( $features['remove_powered_by'] ) && true === $features['remove_powered_by'] ? true : false, 'popup_layout' => isset( $features['popup_layout'] ) && true === $features['popup_layout'] ? true : false, ), ), 'banners' => array( 'status' => isset( $response['banner_status'] ) && 1 === $response['banner_status'] ? true : false, 'laws' => $applicable_laws, 'is_iab_enabled' => isset( $response['isIABEnabled'] ) && true === $response['isIABEnabled'], 'targetedLocation' => isset( $response['targetedLocation'] ) ? $response['targetedLocation'] : 'worldwide', ), 'consent_logs' => array( 'status' => isset( $response['visitor_log'] ) && true === $response['visitor_log'] ? true : false, ), 'scans' => array( 'date' => array( 'date' => $date, 'time' => $time, ), 'status' => isset( $response['last_scan_at'] ) && '' !== $response['last_scan_at'] ? true : false, ), 'success_scan' => array( 'date' => array( 'date' => $success_date, 'time' => $success_time, ), 'status' => isset( $response['last_successful_scan_at'] ) && '' !== $response['last_successful_scan_at'], ), 'languages' => array( 'selected' => isset( $response['language']['preferred'] ) ? cky_sanitize_text( $response['language']['preferred'] ) : array(), 'default' => isset( $response['settings_json']['defaultLanguage'] ) ? cky_sanitize_text( $response['settings_json']['defaultLanguage'] ) : 'en', ), 'tables_missing' => false, 'pageviews' => array( 'count' => isset( $response['pageviews']['views'] ) ? absint( $response['pageviews']['views'] ) : 0, 'limit' => isset( $response['pageviews']['views_limit'] ) ? absint( $response['pageviews']['views_limit'] ) : 25000, 'exceeded' => isset( $response['pageviews']['limit_exceeded'] ) && 1 === absint( $response['pageviews']['limit_exceeded'] ), ), 'website' => array( 'status' => isset( $response['website_status'] ) ? sanitize_text_field( $response['website_status'] ) : 'active', 'is_trial' => isset( $response['is_trial'] ) && true === $response['is_trial'], 'is_trial_with_card' => isset( $response['trial_with_card'] ) && true === $response['trial_with_card'], 'grace_period_ends_at' => $grace_period_ends, 'payment_status' => isset( $response['payment_status'] ) && true === $response['payment_status'], ), ); return $data; } return new WP_Error( 'cky_api_fetching_failed', __( 'Failed to fetch data from the API', 'cookie-law-info' ), array( 'status' => 400 ) ); } /** * Force update app settings if any changes from the plugin side. * * @param array $settings Settings array. * @return void */ public function maybe_update_app_settings( $settings = array() ) { if ( ! cky_is_cloud_request() || ! $this->get_website_id() ) { return; } $data = array( 'preferred_languages' => isset( $settings['languages']['selected'] ) ? $settings['languages']['selected'] : array(), 'default_language' => isset( $settings['languages']['default'] ) ? $settings['languages']['default'] : 'en', 'visitor_log' => isset( $settings['consent_logs']['status'] ) && true === $settings['consent_logs']['status'] ? 1 : 0, ); $response = $this->put( 'websites/' . $this->get_website_id(), wp_json_encode( $data ) ); $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $response_code ) { return new WP_Error( 'cky_api_settings_update_failed', __( 'Failed to the update the data to web app', 'cookie-law-info' ), array( 'status' => 200 ) ); } } /** * Delete the cache. * * @return void */ public function delete_cache() { wp_cache_flush(); } }
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Settings\Includes\Controller' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php:30 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\Settings\Settings->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('settings') #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_adm in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/settings/class-settings.php on line 30