0, 'skipped' => 0, 'errors' => [] ]; foreach ($credentials_to_migrate as $option_name) { $plaintext = get_option($option_name, ''); if (empty($plaintext)) { $results['skipped']++; continue; } // Check if it's already encrypted (basic heuristic) $decrypted = self::decrypt($plaintext); if ($decrypted !== false && $decrypted !== $plaintext) { $results['skipped']++; continue; } // Migrate to encrypted storage if (self::store_credential($option_name, $plaintext)) { $results['migrated']++; } else { $results['errors'][] = "Failed to migrate: $option_name"; } } return $results; } /** * Check if OpenSSL is available * * @return bool */ public static function is_encryption_available() { return function_exists('openssl_encrypt') && function_exists('openssl_decrypt'); } }