api_url='https://feedback.webtoffee.com/wp-json/'.$this->plugin_id.'/v1/uninstall'; add_action('admin_footer', array($this,'deactivate_scripts')); add_action('wp_ajax_'.$this->plugin_id.'_submit_uninstall_reason', array($this,"send_uninstall_reason")); add_filter('plugin_action_links_'.plugin_basename($this->plugin_file),array($this,'plugin_action_links')); } public function plugin_action_links($links) { if(array_key_exists('deactivate',$links)) { $links['deactivate']=str_replace(' 'complex-setup', 'text' => __('The plugin is more complex to set up', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('Please describe which area you are facing difficulties', 'cookie-law-info') ), array( 'id' => 'conflict-theme-plugin', 'text' => __('A conflict with another plugin or theme', 'cookie-law-info'), 'type' => 'text', 'placeholder' => __('Which plugin or theme?', 'cookie-law-info') ), array( 'id' => 'translation-issues', 'text' => __('Language translation issues', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('Which plugin are you using for language translation? Could you tell us a bit more?', 'cookie-law-info') ), array( 'id' => 'caching-issues', 'text' => __('Caching issues', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('Which caching plugin are you using? Could you tell us a bit more?', 'cookie-law-info') ), array( 'id' => 'found-better-plugin', 'text' => __('I found a better plugin', 'cookie-law-info'), 'type' => 'text', 'placeholder' => __('Which plugin?', 'cookie-law-info') ), array( 'id' => 'not-have-that-feature', 'text' => __('The plugin is great, but I need specific feature that you don\'t support', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('Could you tell us more about that feature?', 'cookie-law-info') ), array( 'id' => 'did-not-work-as-expected', 'text' => __('The plugin didn\'t work as expected', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('What did you expect?', 'cookie-law-info') ), array( 'id' => 'other', 'text' => __('Other', 'cookie-law-info'), 'type' => 'textarea', 'placeholder' => __('Could you tell us a bit more?', 'cookie-law-info') ), ); return $reasons; } public function deactivate_scripts() { global $pagenow; if('plugins.php' != $pagenow) { return; } $reasons = $this->get_uninstall_reasons(); ?>
sanitize_text_field($_POST['reason_id']), 'plugin' =>$this->plugin_id, 'auth' =>$this->auth_key, 'date' => gmdate("M d, Y h:i:s A"), 'url' => '', 'user_email' => '', 'reason_info' => isset($_REQUEST['reason_info']) ? trim(stripslashes($_REQUEST['reason_info'])) : '', 'software' => $_SERVER['SERVER_SOFTWARE'], 'php_version' => phpversion(), 'mysql_version' => $wpdb->db_version(), 'wp_version' => get_bloginfo('version'), 'wc_version' => (!defined('WC_VERSION')) ? '' : WC_VERSION, 'locale' => get_locale(), 'multisite' => is_multisite() ? 'Yes' : 'No', $this->plugin_id.'_version' =>$this->current_version, ); // Write an action/hook here in webtoffe to recieve the data $resp = wp_remote_post($this->api_url, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => false, 'body' => $data, 'cookies' => array() ) ); wp_send_json_success(); } } new Cookie_Law_Info_Uninstall_Feedback();