$plugin_data ) { $slug = dirname( $basename ); $plugin_id = sanitize_title( $plugin_data['Name'] ); $contact_support_template = __( 'Need help? We are ready to answer your questions.', 'bestwebsoft' ) . ' ' . __( 'Contact Support', 'bestwebsoft' ) . ''; $reasons = array( array( 'id' => 'NOT_WORKING', 'text' => __( 'The plugin is not working', 'bestwebsoft' ), 'input_type' => 'textarea', 'input_placeholder' => __( "Kindly share what didn't work so we can fix it in future updates...", 'bestwebsoft' ) ), array( 'id' => 'DIDNT_WORK_AS_EXPECTED', 'text' => __( "The plugin didn't work as expected", 'bestwebsoft' ), 'input_type' => 'textarea', 'input_placeholder' => __( 'What did you expect?', 'bestwebsoft' ) ), array( 'id' => 'SUDDENLY_STOPPED_WORKING', 'text' => __( 'The plugin suddenly stopped working', 'bestwebsoft' ), 'input_type' => '', 'input_placeholder' => '', 'internal_message' => $contact_support_template ), array( 'id' => 'BROKE_MY_SITE', 'text' => __( 'The plugin broke my site', 'bestwebsoft' ), 'input_type' => '', 'input_placeholder' => '', 'internal_message' => $contact_support_template ), array( 'id' => 'COULDNT_MAKE_IT_WORK', 'text' => __( "I couldn't understand how to get it work", 'bestwebsoft' ), 'input_type' => '', 'input_placeholder' => '', 'internal_message' => $contact_support_template ), array( 'id' => 'FOUND_A_BETTER_PLUGIN', 'text' => __( 'I found a better plugin', 'bestwebsoft' ), 'input_type' => 'textfield', 'input_placeholder' => __( "What's the plugin name?", 'bestwebsoft' ) ), array( 'id' => 'GREAT_BUT_NEED_SPECIFIC_FEATURE', 'text' => __( "The plugin is great, but I need specific feature that you don't support", 'bestwebsoft' ), 'input_type' => 'textarea', 'input_placeholder' => __( 'What feature?', 'bestwebsoft' ) ), array( 'id' => 'NO_LONGER_NEEDED', 'text' => __( 'I no longer need the plugin', 'bestwebsoft' ), 'input_type' => '', 'input_placeholder' => '' ), array( 'id' => 'TEMPORARY_DEACTIVATION', 'text' => __( "It's a temporary deactivation, I'm just debugging an issue", 'bestwebsoft' ), 'input_type' => '', 'input_placeholder' => '' ), array( 'id' => 'OTHER', 'text' => __( 'Other', 'bestwebsoft' ), 'input_type' => 'textfield', 'input_placeholder' => '' ) ); $reasons_list_items_html = ''; foreach ( $reasons as $reason ) { $list_item_classes = 'bws-modal-reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' ); if ( ! empty( $reason['internal_message'] ) ) { $list_item_classes .= ' has-internal-message'; $reason_internal_message = $reason['internal_message']; } else { $reason_internal_message = ''; } $reasons_list_items_html .= '
  • ' . $reason_internal_message . '
  • '; } ?> $basename, 'reason_id' => $reason_id, 'reason_info' => $reason_info, ); if ( ! $is_anonymous ) { if ( ! isset( $bstwbsftwppdtplgns_options ) ) $bstwbsftwppdtplgns_options = ( is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['usage_id'] ) ) { $options['usage_id'] = $bstwbsftwppdtplgns_options['track_usage']['usage_id']; } else { $options['usage_id'] = false; $options['url'] = get_bloginfo( 'url' ); $options['wp_version'] = $wp_version; $options['is_active'] = false; $options['version'] = $bstwbsftwppdtplgns_active_plugins[ $basename ]['Version']; } $options['email'] = $current_user->data->user_email; } /* send data */ $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/products-statistics/deactivation-feedback/', array( 'method' => 'POST', 'body' => $options, 'timeout' => 15, ) ); if ( ! is_wp_error( $raw_response ) && 200 == wp_remote_retrieve_response_code( $raw_response ) ) { if ( ! $is_anonymous ) { $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) ); if ( is_array( $response ) && ! empty( $response['usage_id'] ) && $response['usage_id'] != $options['usage_id'] ) { $bstwbsftwppdtplgns_options['track_usage']['usage_id'] = $response['usage_id']; if ( is_multisite() ) update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); else update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } } echo 'done'; } else { echo $response->get_error_code() . ': ' . $response->get_error_message(); } exit; } } add_action( 'wp_ajax_bws_submit_uninstall_reason_action', 'bws_submit_uninstall_reason_action' );