HEX
Server: Apache/2
System: Linux vpslll9m.sdns.vn 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
User: thuexe247c (1044)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/thuexe247c/public_html/wp-content/plugins/json-content-importer/uninstall.php
<?php

if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();

UNINSTALL_jci_plugin_options();

function UNINSTALL_jci_plugin_options() {
    global $wpdb;
    if (function_exists('is_multisite') && is_multisite()) {
		$blogIdCurrent = $wpdb->blogid;  // retrieve blogIds
	  	#$query = $wpdb->prepare(
		#	"SELECT blog_id FROM %s",
		#	$wpdb->blogs
		#);	  
		#	$sql = $wpdb->prepare($query, 'publish');
		#$blogIdArr = $wpdb->get_results($sql);
		$sites = get_sites();
        foreach ($sites as $site) {
			switch_to_blog($site->blog_id);
				UNINSTALL_jci_options();
        }
		switch_to_blog($blogIdCurrent);
		return;
    }
    UNINSTALL_jci_options();
	delete_option( "jci_uninstall_deleteall" );
}

function UNINSTALL_jci_options() {
  if (get_option('jci_uninstall_deleteall')==1) {
    delete_option( "jci_json_url" );
	delete_option( "jci_enable_cache" );
    delete_option( "jci_cache_time" );
    delete_option( "jci_cache_time_format" );
    delete_option( "jci_oauth_bearer_access_key" );
    delete_option( "jci_http_header_default_useragent" );
    delete_option( "jci_gutenberg_off" );
    delete_option( "jci_sslverify_off" );
    delete_option( "jci_api_errorhandling" );
  }
}

UNINSTALL_jci_plugin_cacher();

if ( ! function_exists( 'request_filesystem_credentials' ) ) {
    require_once ABSPATH . 'wp-admin/includes/file.php';
}
function UNINSTALL_jci_plugin_cacher() {
	$cacheFolder = WP_CONTENT_DIR.'/cache/jsoncontentimporter/';
	return delete_plugin_cache_directory($cacheFolder);
}

function delete_plugin_cache_directory($dir) {
    $url = wp_nonce_url('index.php', 'my-nonce-del-jci');
    $credentials = request_filesystem_credentials($url);
    if (!WP_Filesystem($credentials)) {
        return false;
    }
    global $wp_filesystem;
    if ($wp_filesystem->rmdir($dir, true)) {
        return true;
    } else {
        return false;
    }
}
?>