get_required_data(); $data['site_type'] = $site ? $site : get_option( '__ultp_site_type', '' ); $data['type'] = $type ? $type : 'deactive'; $form_data = isset($_POST) ? ultimate_post()->ultp_rest_sanitize_params($_POST) : array(); //phpcs:Ignore if ( isset( $form_data['action'] ) ) { unset( $form_data['action'] ); } $response = wp_remote_post( $this->API_ENDPOINT, array( 'method' => 'POST', 'timeout' => 30, 'redirection' => 5, 'headers' => array( 'user-agent' => 'wpxpo/' . md5( esc_url( home_url() ) ) . ';', 'Accept' => 'application/json', ), 'blocking' => true, 'httpversion' => '1.0', 'body' => array_merge( $data, $form_data ), ) ); return $response; } } /** * Get deactivation form settings data. * * @since v.1.0.0 * @return ARRAY Settings parameters. */ public function get_deactive_settings() { $attr = array( array( 'id' => 'no-need', 'input' => false, 'text' => __( 'I no longer need the plugin.', 'ultimate-post' ), ), array( 'id' => 'better-plugin', 'input' => true, 'text' => __( 'I found a better plugin.', 'ultimate-post' ), 'placeholder' => __( 'Please share which plugin.', 'ultimate-post' ), ), array( 'id' => 'stop-working', 'input' => true, 'text' => __( 'The plugin suddenly stopped working.', 'ultimate-post' ), 'placeholder' => __( 'Please share more details.', 'ultimate-post' ), ), array( 'id' => 'not-working', 'input' => false, 'text' => __( 'I could not get the plugin to work.', 'ultimate-post' ), ), array( 'id' => 'temporary-deactivation', 'input' => false, 'text' => __( "It's a temporary deactivation.", 'ultimate-post' ), ), array( 'id' => 'other', 'input' => true, 'text' => __( 'Other.', 'ultimate-post' ), 'placeholder' => __( 'Please share the reason.', 'ultimate-post' ), ), ); return $attr; } /** * Output deactivation HTML view. * * @since v.1.0.0 * @return void No return value. */ public function get_source_data_callback() { $this->deactive_html_container(); $this->deactive_container_css(); $this->deactive_container_js(); } /** * Outputs the HTML container for the deactivation process. * * This method is responsible for rendering the necessary HTML * when the plugin is being deactivated. * * @return void */ public function deactive_html_container() { ?>

    get_deactive_settings() as $key => $setting ) { ?>
$plugin ) { $arr = array(); $arr['name'] = isset( $plugin['Name'] ) ? $plugin['Name'] : ''; $arr['url'] = isset( $plugin['PluginURI'] ) ? $plugin['PluginURI'] : ''; $arr['author'] = isset( $plugin['Author'] ) ? $plugin['Author'] : ''; $arr['version'] = isset( $plugin['Version'] ) ? $plugin['Version'] : ''; if ( in_array( $key, $active_plugins ) ) { $active[ $key ] = $arr; } else { $inactive[ $key ] = $arr; } } return array( 'active' => $active, 'inactive' => $inactive, ); } /** * Get all the installed themes. * * @since v.1.0.0 * @return ARRAY Theme information. */ public function get_installed_themes() { $theme_data = array(); $all_themes = wp_get_themes(); if ( is_array( $all_themes ) ) { foreach ( $all_themes as $key => $theme ) { $attr = array(); $attr['name'] = $theme->Name; $attr['url'] = $theme->ThemeURI; $attr['author'] = $theme->Author; $attr['version'] = $theme->Version; $theme_data[ $key ] = $attr; } } return $theme_data; } /** * Get current user IP address. * * @since v.1.0.0 * @return STRING IP address. */ public function get_user_ip() { $response = wp_remote_get( 'https://icanhazip.com/' ); if ( is_wp_error( $response ) ) { return ''; } else { $user_ip = trim( wp_remote_retrieve_body( $response ) ); return filter_var( $user_ip, FILTER_VALIDATE_IP ) ? $user_ip : ''; } } /** * Get all the collected data for deactivation. * * @since v.1.0.0 * @return ARRAY All send data. */ public function get_required_data() { global $wpdb; $user = wp_get_current_user(); $user_count = count_users(); $plugins_data = $this->get_installed_plugins(); $data = array( 'name' => get_bloginfo( 'name' ), 'home' => esc_url( home_url() ), 'admin_email' => $user->user_email, 'first_name' => isset( $user->user_firstname ) ? $user->user_firstname : '', 'last_name' => isset( $user->user_lastname ) ? $user->user_lastname : '', 'display_name' => $user->display_name, 'wordpress' => get_bloginfo( 'version' ), 'memory_limit' => WP_MEMORY_LIMIT, 'debug_mode' => ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No', 'locale' => get_locale(), 'multisite' => is_multisite() ? 'Yes' : 'No', 'themes' => $this->get_installed_themes(), 'active_theme' => get_stylesheet(), 'users' => isset( $user_count['total_users'] ) ? $user_count['total_users'] : 0, 'active_plugins' => $plugins_data['active'], 'inactive_plugins' => $plugins_data['inactive'], 'server' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_key( $_SERVER['SERVER_SOFTWARE'] ) : '', 'timezone' => date_default_timezone_get(), 'php_curl' => function_exists( 'curl_init' ) ? 'Yes' : 'No', 'php_version' => function_exists( 'phpversion' ) ? phpversion() : '', 'upload_size' => size_format( wp_max_upload_size() ), 'mysql_version' => $wpdb->db_version(), 'php_fsockopen' => function_exists( 'fsockopen' ) ? 'Yes' : 'No', 'ip' => $this->get_user_ip(), 'plugin_name' => $this->PLUGIN_NAME, 'plugin_version' => $this->PLUGIN_VERSION, 'plugin_slug' => $this->PLUGIN_SLUG, ); return $data; } }