pluign updates

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-10 01:42:20 +00:00
parent a86524a6b1
commit 346d3f0531
8 changed files with 97 additions and 42 deletions

View File

@@ -57,6 +57,9 @@ class Igny8_Updater {
// Hook into WordPress update system
add_filter('pre_set_site_transient_update_plugins', array($this, 'check_for_updates'));
add_filter('plugins_api', array($this, 'plugin_info'), 10, 3);
// Add custom styling for plugin details popup
add_action('admin_enqueue_scripts', array($this, 'enqueue_plugin_details_styles'));
}
/**
@@ -73,21 +76,26 @@ class Igny8_Updater {
// Get update info from IGNY8 API
$update_info = $this->get_update_info();
if (!$update_info || !isset($update_info['update_available'])) {
if (!$update_info || !isset($update_info['latest_version'])) {
return $transient;
}
if ($update_info['update_available'] === true) {
$plugin_basename = plugin_basename($this->plugin_file);
$plugin_basename = plugin_basename($this->plugin_file);
$latest_version = $update_info['latest_version'];
// Only show update if latest version is actually newer than current
if (version_compare($this->version, $latest_version, '<')) {
$transient->response[$plugin_basename] = (object) array(
'slug' => $this->plugin_slug,
'new_version' => $update_info['latest_version'],
'package' => $update_info['download_url'],
'new_version' => $latest_version,
'package' => $update_info['download_url'] ?? '',
'url' => $update_info['info_url'] ?? '',
'tested' => $update_info['tested'] ?? '',
'requires_php' => $update_info['requires_php'] ?? '',
);
} else {
// Remove from response if version is current or newer
unset($transient->response[$plugin_basename]);
}
return $transient;
@@ -121,7 +129,7 @@ class Igny8_Updater {
'name' => $info['name'] ?? 'IGNY8 WordPress Bridge',
'slug' => $this->plugin_slug,
'version' => $info['version'] ?? $this->version,
'author' => 'IGNY8',
'author' => '<a href="https://igny8.com">IGNY8</a>',
'author_profile' => 'https://igny8.com',
'homepage' => 'https://igny8.com',
'sections' => array(
@@ -134,6 +142,13 @@ class Igny8_Updater {
);
}
/**
* Enqueue custom styles for plugin details popup
*/
public function enqueue_plugin_details_styles() {
// No custom styles needed
}
/**
* Get update information from IGNY8 API
*