$meta) { if (!is_plugin_active($file)) $inactive[] = ($meta['Name'] ?? $file); } $f[] = $this->finding( 'inactive_plugins', count($inactive) > 0 ? 'info' : 'ok', 'Deactivated-but-installed plugins', (string) count($inactive), $inactive ? implode(', ', array_slice($inactive, 0, 10)) . (count($inactive) > 10 ? ' …' : '') : '' ); // Homepage alt-text scan $url = home_url('/'); $resp = wp_remote_get($url, ['timeout' => 6]); if (is_wp_error($resp)) { $f[] = $this->finding('homepage_alt', 'warn', 'Homepage alt text', 'fetch failed', $resp->get_error_message()); } else { $body = (string) wp_remote_retrieve_body($resp); $imgs = 0; $missing = 0; if (preg_match_all('/]*>/i', $body, $matches)) { foreach ($matches[0] as $tag) { $imgs++; if (!preg_match('/\salt\s*=\s*"[^"]+"/i', $tag) && !preg_match('/\salt\s*=\s*\'[^\']+\'/i', $tag)) { $missing++; } } } $level = $missing > 0 ? 'warn' : 'ok'; $f[] = $this->finding( 'homepage_alt', $level, 'Homepage alt text', $missing . ' missing of ' . $imgs . ' image(s)', $missing ? 'Empty/missing alt attributes hurt accessibility and SEO.' : '' ); } return $f; } };