strlen($v) >= 6); foreach ($secrets as $secret) { $text = str_replace($secret, '{secret}', $text); } $account = get_account_id(); if ($account !== '') { $text = str_replace($account, '{account}', $text); } $hosts = array_filter([ (string) wp_parse_url(home_url(), PHP_URL_HOST), (string) wp_parse_url((string) ($s['qdrant_url'] ?? ''), PHP_URL_HOST), (string) ($s['pg_host'] ?? ''), ]); foreach ($hosts as $host) { $text = str_ireplace($host, '{host}', $text); } $text = (string) preg_replace('/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i', '{email}', $text); $text = (string) preg_replace('/\b(?:\d{1,3}\.){3}\d{1,3}\b/', '{ip}', $text); $text = (string) preg_replace('/\b[0-9a-f]{32}\b/i', '{id}', $text); return (string) preg_replace('/\bBearer\s+\S+/i', 'Bearer {secret}', $text); } }