Revert "API ISsues fixes pluigna dn app, plugin v udapte 1.4.0"

This reverts commit a361dea528.
This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 05:26:32 +00:00
parent a361dea528
commit 6f64d359fb
9 changed files with 27 additions and 728 deletions

View File

@@ -756,42 +756,8 @@ class Igny8Admin {
public function sanitize_post_status($value) {
$allowed = array('draft', 'publish');
return in_array($value, $allowed, true) ? $value : 'draft';
}
/**
* Clear update cache via AJAX
*
* Fixes the double-update notification bug by clearing WordPress update transients
* and forcing a fresh update check.
*/
public static function clear_update_cache_ajax() {
// Verify nonce
if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'igny8_clear_cache')) {
wp_send_json_error(array('message' => 'Invalid security token'));
return;
}
// Check user permissions
if (!current_user_can('manage_options')) {
wp_send_json_error(array('message' => 'Insufficient permissions'));
return;
}
// Delete the update_plugins transient to force a fresh check
delete_site_transient('update_plugins');
// Also clear any cached update info
wp_cache_delete('igny8_update_check', 'igny8');
// Clear WordPress object cache
wp_cache_flush();
// Log for debugging
error_log('IGNY8: Update cache cleared manually by admin');
wp_send_json_success(array(
'message' => 'Update cache cleared successfully. WordPress will check for updates on next page load.'
));
}}
}
}
// Register AJAX handlers
add_action('wp_ajax_igny8_test_connection', array('Igny8Admin', 'test_connection'));
@@ -800,4 +766,4 @@ add_action('wp_ajax_igny8_sync_taxonomies', array('Igny8Admin', 'sync_taxonomies
add_action('wp_ajax_igny8_sync_from_igny8', array('Igny8Admin', 'sync_from_igny8'));
add_action('wp_ajax_igny8_collect_site_data', array('Igny8Admin', 'collect_site_data'));
add_action('wp_ajax_igny8_get_stats', array('Igny8Admin', 'get_stats'));
add_action('wp_ajax_igny8_clear_update_cache', array('Igny8Admin', 'clear_update_cache_ajax'));

View File

@@ -236,21 +236,12 @@ foreach ($all_post_types as $pt) {
</div>
</div>
<div style="display: flex; gap: 12px; align-items: center;">
<button type="submit" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
<?php _e('Save Settings', 'igny8-bridge'); ?>
</button>
<button type="button" id="igny8-clear-update-cache" class="igny8-btn" style="background: var(--igny8-surface); border: 1px solid var(--igny8-stroke);">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
<?php _e('Clear Update Cache', 'igny8-bridge'); ?>
</button>
</div>
<button type="submit" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
<?php _e('Save Settings', 'igny8-bridge'); ?>
</button>
</form>
<style>
@@ -292,46 +283,6 @@ jQuery(document).ready(function($) {
card.slideUp(200);
}
});
// Handle clear update cache button
$('#igny8-clear-update-cache').on('click', function(e) {
e.preventDefault();
var $btn = $(this);
var originalText = $btn.html();
$btn.prop('disabled', true).html('<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px; animation: spin 1s linear infinite;"><circle cx="12" cy="12" r="10" stroke-width="4" stroke="currentColor" stroke-opacity="0.25"></circle><path fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Clearing...');
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: 'igny8_clear_update_cache',
nonce: '<?php echo wp_create_nonce('igny8_clear_cache'); ?>'
},
success: function(response) {
if (response.success) {
$btn.html('<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg> Cache Cleared!').css('background', '#10b981').css('color', 'white').css('border-color', '#10b981');
setTimeout(function() {
$btn.prop('disabled', false).html(originalText).css('background', '').css('color', '').css('border-color', '');
}, 2000);
} else {
$btn.html('<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> Failed').css('background', '#ef4444').css('color', 'white');
setTimeout(function() {
$btn.prop('disabled', false).html(originalText).css('background', '').css('color', '');
}, 2000);
}
},
error: function() {
$btn.html('<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> Error').css('background', '#ef4444').css('color', 'white');
setTimeout(function() {
$btn.prop('disabled', false).html(originalText).css('background', '').css('color', '');
}, 2000);
}
});
});
});
</script>