['match' => 'wordpress-seo/', 'name' => 'Yoast SEO', 'replaces' => ['meta_management', 'schema', 'sitemap'], 'est_size_kb' => 2800], 'rankmath' => ['match' => 'seo-by-rank-math/', 'name' => 'Rank Math', 'replaces' => ['meta_management', 'schema', 'sitemap'], 'est_size_kb' => 3200], 'aioseo' => ['match' => 'all-in-one-seo-pack/', 'name' => 'All in One SEO', 'replaces' => ['meta_management', 'schema', 'sitemap'], 'est_size_kb' => 2400], 'schema_pro' => ['match' => 'wp-schema-pro/', 'name' => 'Schema Pro', 'replaces' => ['schema'], 'est_size_kb' => 800], 'accessibility_helper' => ['match' => 'wp-accessibility/', 'name' => 'WP Accessibility', 'replaces' => ['accessibility'], 'est_size_kb' => 400], 'tidio' => ['match' => 'tidio-live-chat/', 'name' => 'Tidio', 'replaces' => ['chat_widget'], 'est_size_kb' => 1200, 'est_cost' => 'EUR 29/mo'], 'intercom' => ['match' => 'intercom/', 'name' => 'Intercom', 'replaces' => ['chat_widget'], 'est_size_kb' => 0, 'est_cost' => 'EUR 74/mo'], 'crisp' => ['match' => 'crisp/', 'name' => 'Crisp', 'replaces' => ['chat_widget'], 'est_size_kb' => 600, 'est_cost' => 'EUR 25/mo'], 'redirection' => ['match' => 'redirection/', 'name' => 'Redirection', 'replaces' => ['redirects'], 'est_size_kb' => 500], 'broken_link_checker' => ['match' => 'broken-link-checker/', 'name' => 'Broken Link Checker', 'replaces' => ['monitoring'], 'est_size_kb' => 900], 'cookieyes' => ['match' => 'cookie-law-info/', 'name' => 'CookieYes', 'replaces' => ['consent'], 'est_size_kb' => 600], 'complianz' => ['match' => 'complianz-gdpr/', 'name' => 'Complianz', 'replaces' => ['consent'], 'est_size_kb' => 1100], 'wpforms' => ['match' => 'wpforms-lite/', 'name' => 'WPForms Lite', 'replaces' => ['forms', 'lead_capture'], 'est_size_kb' => 1700], 'contact_form_7' => ['match' => 'contact-form-7/', 'name' => 'Contact Form 7', 'replaces' => ['forms', 'lead_capture'], 'est_size_kb' => 900], 'fluent_forms' => ['match' => 'fluentform/', 'name' => 'Fluent Forms', 'replaces' => ['forms', 'lead_capture'], 'est_size_kb' => 1400], 'gravity_forms' => ['match' => 'gravityforms/', 'name' => 'Gravity Forms', 'replaces' => ['forms', 'lead_capture'], 'est_size_kb' => 2200], 'ninja_forms' => ['match' => 'ninja-forms/', 'name' => 'Ninja Forms', 'replaces' => ['forms', 'lead_capture'], 'est_size_kb' => 1500], 'amelia' => ['match' => 'amelia/', 'name' => 'Amelia', 'replaces' => ['bookings'], 'est_size_kb' => 2100], 'bookly' => ['match' => 'bookly-responsive-appointment-booking-tool/', 'name' => 'Bookly', 'replaces' => ['bookings'], 'est_size_kb' => 2000], 'simply_schedule' => ['match' => 'simply-schedule-appointments/', 'name' => 'Simply Schedule Appointments', 'replaces' => ['bookings'], 'est_size_kb' => 1800], 'tawkto' => ['match' => 'tawkto-live-chat/', 'name' => 'tawk.to Live Chat', 'replaces' => ['chat_widget'], 'est_size_kb' => 700], 'hubspot' => ['match' => 'leadin/', 'name' => 'HubSpot', 'replaces' => ['chat_widget', 'forms'], 'est_size_kb' => 2400], ]; public function __construct() { add_action('sitebirds_scan_plugins', [$this, 'run_scan']); } public function run_scan(): array { $active_plugins = (array) get_option('active_plugins', []); $matches = []; $saved_kb = 0; $saved_cost = []; foreach ($this->signatures as $key => $signature) { foreach ($active_plugins as $plugin_file) { if (strpos((string) $plugin_file, (string) $signature['match']) !== false) { $matches[$key] = [ 'slug' => $key, 'plugin_file' => $plugin_file, 'name' => $signature['name'], 'replaces' => $signature['replaces'], 'est_size_kb' => $signature['est_size_kb'], 'est_cost' => $signature['est_cost'] ?? '', ]; $saved_kb += (int) ($signature['est_size_kb'] ?? 0); if (!empty($signature['est_cost'])) { $saved_cost[] = $signature['est_cost']; } } } } $payload = [ 'last_run' => gmdate('c'), 'active_plugins_count' => count($active_plugins), 'replaceable_count' => count($matches), 'estimated_size_kb' => $saved_kb, 'estimated_cost' => $saved_cost, 'matches' => array_values($matches), ]; update_option('sitebirds_scanner_cache', $payload, false); return $payload; } public function get_cache(): array { $payload = get_option('sitebirds_scanner_cache', []); return is_array($payload) ? $payload : []; } public function seo_conflict_active(): bool { $active_plugins = (array) get_option('active_plugins', []); foreach (['wordpress-seo/', 'seo-by-rank-math/', 'all-in-one-seo-pack/'] as $match) { foreach ($active_plugins as $plugin_file) { if (strpos((string) $plugin_file, $match) !== false) { return true; } } } return false; } }