admin_url( 'admin-ajax.php' ), 'survey_nonce' => wp_create_nonce( 'cookiebot_survey_nonce' ), ) ); $args = array( 'cookiebot_logo' => asset_url( 'img/icon.svg' ), ); include_view( 'admin/templates/extra/review-form.php', $args ); } /** * Send uninstall reason to server * * @return void */ public function send_uninstall_survey() { global $wpdb; if ( ! check_ajax_referer( 'cookiebot_survey_nonce', 'survey_nonce', false ) ) { wp_send_json_error( esc_html__( 'Sorry you are not allowed to do this.', 'cookiebot' ), 401 ); } if ( ! isset( $_POST['reason_id'] ) ) { wp_send_json_error( esc_html__( 'Please select one option', 'cookiebot' ), 400 ); } $data = array( 'survey_check' => sanitize_text_field( wp_unslash( $_POST['survey_check'] ) ), 'reason_slug' => sanitize_text_field( wp_unslash( $_POST['reason_id'] ) ), 'reason_detail' => ! empty( $_POST['reason_text'] ) ? sanitize_text_field( wp_unslash( $_POST['reason_text'] ) ) : null, 'comments' => ! empty( $_POST['reason_info'] ) ? sanitize_text_field( wp_unslash( $_POST['reason_info'] ) ) : null, 'date' => gmdate( 'M d, Y h:i:s A' ), 'server' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : null, 'php_version' => phpversion(), 'mysql_version' => $wpdb->db_version(), 'wp_version' => get_bloginfo( 'version' ), 'locale' => get_locale(), 'plugin_version' => Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION, 'is_multisite' => is_multisite(), ); if ( ! empty( $_POST['reason_debug'] ) && rest_sanitize_boolean( $_POST['reason_debug'] ) === true ) { $debug_info = new Debug_Page(); $data['debug_info'] = wp_json_encode( $debug_info->prepare_debug_data() ); } wp_remote_post( $this->api_url, array( 'headers' => array( 'Content-Type' => 'application/json; charset=utf-8', ), 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => false, 'body' => wp_json_encode( $data ), 'cookies' => array(), ) ); wp_send_json_success( null, 200 ); } }