' . __('Contact Support', 'duplicator') . ''; $reasons = array( array( 'id' => 'NOT_WORKING', 'text' => __("It's not working on my server.", 'duplicator'), 'input_type' => 'textarea', 'input_placeholder' => __("Kindly share what didn't work so we can fix it in future updates...", 'duplicator'), 'internal_message' => $contact_support_template ), array( 'id' => 'CONFUSING_TO_UNDERSTAND', 'text' => __("It's too confusing to understand.", 'duplicator'), 'input_type' => 'textarea', 'input_placeholder' => __('Please tell us what is not clear so that we can improve it.', 'duplicator'), 'internal_message' => $contact_support_template ), array( 'id' => 'FOUND_A_DIFFERENT_PLUGIN', 'text' => __('I found a different plugin that I like better.', 'duplicator'), 'input_type' => 'textfield', 'input_placeholder' => __("What's the plugin name?", 'duplicator') ), array( 'id' => 'NOT_DO_WHAT_I_NEED', 'text' => __("It does not do what I need.", 'duplicator'), 'input_type' => 'textarea', 'input_placeholder' => __('What does it need to do?', 'duplicator') ), array( 'id' => 'TEMPORARY_DEACTIVATION', 'text' => __("It's a temporary deactivation, I use the plugin all the time.", 'duplicator'), 'input_type' => '', 'input_placeholder' => '' ), array( 'id' => 'SWITCHING_PRO_VERSION', 'text' => sprintf(__("I'm switching over to the %s", 'duplicator'), '' . __('Pro version', 'duplicator') . ''), 'input_type' => '', 'input_placeholder' => '' ), /* array( 'id' => 'OTHER', 'text' => __('Other', 'duplicator'), 'input_type' => 'textarea', 'input_placeholder' => __('Please tell us the reason so we can improve it.', 'duplicator') ) */ ); $reasons_list_items_html = ''; foreach ($reasons as $reason) { $list_item_classes = 'duplicator-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 . '
  • '; } ?> array( 'filter' => FILTER_UNSAFE_RAW, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'default' => false ) ), 'plugin' => array( 'filter' => FILTER_UNSAFE_RAW, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'default' => false ) ), 'reason_info' => array( 'filter' => FILTER_UNSAFE_RAW, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'default' => '' ) ) )); $reason_id = $inputData['reason_id']; $basename = $inputData['plugin']; if (!$reason_id || !$basename) { $isValid = false; } try { if (!wp_verify_nonce($_POST['duplicator_ajax_nonce'], 'duplicator_ajax_nonce')) { throw new Exception(__('Security issue', 'duplicator')); } DUP_Util::hasCapability('export', DUP_Util::SECURE_ISSUE_THROW); if (!$isValid) { throw new Exception(__('Invalid Request.', 'duplicator')); } $reason_info = isset($_REQUEST['reason_info']) ? stripcslashes(esc_html($_REQUEST['reason_info'])) : ''; if (!empty($reason_info)) { $reason_info = substr($reason_info, 0, 255); } $options = array( 'product' => $basename, 'reason_id' => $reason_id, 'reason_info' => $reason_info, ); /* send data */ $raw_response = wp_remote_post( 'https://snapcreekanalytics.com/wp-content/plugins/duplicator-statistics-plugin/deactivation-feedback/', array( 'method' => 'POST', 'body' => $options, 'timeout' => 15, // 'sslverify' => FALSE ) ); if (!is_wp_error($raw_response) && 200 == wp_remote_retrieve_response_code($raw_response)) { echo 'done'; } else { $error_msg = $raw_response->get_error_code() . ': ' . $raw_response->get_error_message(); error_log($error_msg); throw new Exception($error_msg); } } catch (Exception $ex) { echo $ex->getMessage(); } exit; } } add_action('wp_ajax_duplicator_submit_uninstall_reason_action', 'duplicator_submit_uninstall_reason_action');