10, 'headers' => array( 'Authorization' => 'Bearer ' . $token ), ) ); // النتيجة (نجحت أو فشلت) متتجاهلش قصدًا — التنظيف المحلي لازم يحصل // دايمًا، مش مشروط بنجاح إبلاغ WinnyPlus. } function winnyplus_connect_full_cleanup_for_site() { winnyplus_connect_notify_disconnect_before_uninstall(); delete_option( 'winnyplus_connect_connection' ); delete_option( 'winnyplus_connect_enabled_events' ); delete_option( 'winnyplus_connect_overview_last' ); delete_option( 'winnyplus_connect_last_sent_at' ); delete_option( 'winnyplus_connect_migrated' ); // Left by versions before 3.15 foreach ( array( 'wpc_connection', 'wpc_enabled_events', 'wpc_last_sent_at', 'wpc_db_version', 'wpc_log_removed', 'wpc_overview_last' ) as $legacy ) { delete_option( $legacy ); } wp_clear_scheduled_hook( 'winnyplus_connect_dispatch_event' ); } /** Runs the cleanup for this site, or for every site of a network (in a function so no variable is left in the global scope). */ function winnyplus_connect_uninstall() { if ( ! is_multisite() ) { winnyplus_connect_full_cleanup_for_site(); return; } foreach ( get_sites( array( 'fields' => 'ids' ) ) as $winnyplus_connect_site_id ) { switch_to_blog( $winnyplus_connect_site_id ); winnyplus_connect_full_cleanup_for_site(); restore_current_blog(); } } winnyplus_connect_uninstall();