'used-it', 'text' => __( 'Used it successfully. Don\'t need anymore.', 'accessibility-plus' ), 'type' => 'reviewhtml', 'placeholder' => __( 'Have used it successfully and don\'t need it anymore', 'accessibility-plus' ), ), array( 'id' => 'could-not-understand', 'text' => __( 'I couldn\'t understand how to make it work', 'accessibility-plus' ), 'type' => 'textarea', 'placeholder' => __( 'Would you like us to assist you?', 'accessibility-plus' ), ), array( 'id' => 'found-better-plugin', 'text' => __( 'I found a better plugin', 'accessibility-plus' ), 'type' => 'text', 'placeholder' => __( 'Which plugin?', 'accessibility-plus' ), ), array( 'id' => 'not-have-that-feature', 'text' => __( 'The plugin is great, but I need specific feature that you don\'t support', 'accessibility-plus' ), 'type' => 'textarea', 'placeholder' => __( 'Could you tell us more about that feature?', 'accessibility-plus' ), ), array( 'id' => 'is-not-working', 'text' => __( 'The plugin didn\'t work as expected', 'accessibility-plus' ), 'type' => 'textarea', 'placeholder' => __( 'Could you tell us a bit more what\'s not working?', 'accessibility-plus' ), ), array( 'id' => 'other', 'text' => __( 'Other', 'accessibility-plus' ), 'type' => 'textarea', 'placeholder' => __( 'Could you tell us a bit more?', 'accessibility-plus' ), ), ); return $reasons; } /** * Add deactivation scripts (modal + JS) */ public function deactivate_scripts() { global $pagenow; if ( 'plugins.php' !== $pagenow ) { return; } $reasons = $this->get_uninstall_reasons(); $reasons = ( isset( $reasons ) && is_array( $reasons ) ) ? $reasons : array(); // Generate nonce for security $nonce = wp_create_nonce( 'wya11y_uninstall_feedback_nonce' ); ?>

__( 'Invalid request.', 'accessibility-plus' ) ) ); } // Security check: Verify nonce if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wya11y_uninstall_feedback_nonce' ) ) { wp_send_json_error( array( 'message' => __( 'Security check failed.', 'accessibility-plus' ) ) ); wp_die(); } // Security check: Verify user capability (only administrators can deactivate plugins) if ( ! current_user_can( 'activate_plugins' ) ) { wp_send_json_error( array( 'message' => __( 'Permission denied.', 'accessibility-plus' ) ) ); wp_die(); } global $wpdb; if ( ! isset( $_POST['reason_id'] ) ) { wp_send_json_error( array( 'message' => __( 'Missing required data.', 'accessibility-plus' ) ) ); wp_die(); } $data = array( 'reason_id' => sanitize_text_field( wp_unslash( $_POST['reason_id'] ) ), 'plugin' => 'wyaccessibilityplus', 'auth' => 'wyaccessibilityplus_uninstall_1234#', 'date' => gmdate( 'M d, Y h:i:s A' ), 'url' => home_url(), 'user_email' => isset( $_POST['user_email'] ) ? sanitize_email( wp_unslash( $_POST['user_email'] ) ) : '', 'reason_info' => isset( $_POST['reason_info'] ) ? sanitize_textarea_field( wp_unslash( $_POST['reason_info'] ) ) : '', 'software' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '', 'php_version' => phpversion(), 'mysql_version' => $wpdb->db_version(), 'wp_version' => get_bloginfo( 'version' ), 'wc_version' => ( function_exists( 'WC' ) ) ? WC()->version : '', 'locale' => get_locale(), 'languages' => implode( ',', get_available_languages() ), 'theme' => wp_get_theme()->get( 'Name' ), 'wyaccessibilityplus_version' => defined( 'WY_A11Y_VERSION' ) ? WY_A11Y_VERSION : '', 'multisite' => is_multisite() ? 'Yes' : 'No', ); // Send feedback to remote endpoint (non-blocking) wp_remote_post( 'https://feedback.webtoffee.com/wp-json/wyaccessibilityplus/v1/uninstall', array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => false, 'body' => $data, 'cookies' => array(), ) ); wp_send_json_success(); } } new Uninstall_Feedback();