dao->getStatsDashboardSnapshot(true); $statsData = $statsSnapshot['data']; $statsHash = $statsSnapshot['hash']; // Main container echo "
' . $avgLabel . '
'; $content .= ''; $content .= '' . esc_html__('Loading chart data…', '404-solution') . '
'; $trendsContent .= ''; $trendsContent .= ''; $trendsContent .= '' . esc_html__('No broken internal links found.', '404-solution') . '
'; } else { $postCount = count(array_unique(array_column($results, 'post_id'))); $content = '' . esc_html(sprintf( /* translators: 1: number of broken links, 2: number of posts/pages */ __('Found %1$d broken internal link(s) across %2$d post(s)/page(s).', '404-solution'), count($results), $postCount )) . '
'; $content .= '| ' . esc_html__('Post/Page', '404-solution') . ' | ' . '' . esc_html__('Broken URL', '404-solution') . ' | ' . '' . esc_html__('404 Hits', '404-solution') . ' | ' . '|
|---|---|---|---|
| ' . esc_html($postTitle) . ' | '; } else { $content .= '' . esc_html($postTitle) . ' | '; } $content .= '' . esc_html($brokenUrl) . ' | ';
$content .= '' . esc_html((string)$hitCount) . ' | '; $content .= '
'; if (empty($availableSources)) { $html .= esc_html__('No supported redirect plugins detected on this site.', '404-solution'); $html .= '
'; $html .= '' . esc_html__('Supported plugins: Rank Math, Yoast SEO Premium, AIOSEO, Safe Redirect Manager, Redirection.', '404-solution') . '
'; return $html; } $detectedNames = array_values($availableSources); $html .= esc_html__('Detected redirect plugins:', '404-solution') . ' '; $html .= '' . esc_html(implode(', ', $detectedNames)) . ''; $html .= ''; $previewNonce = wp_create_nonce('abj404_crossPluginPreview'); $ajaxUrl = admin_url('admin-ajax.php'); // Step 1: source selector + Preview button (visible by default) $html .= ''; $html .= ' '; $html .= ''; $html .= '
'; $html .= ''; $html .= ''; $html .= ' '; $html .= '
'; $html .= '' . esc_html__('This will import all active redirects from the selected plugin into 404 Solution. Regex and redirect codes are preserved.', '404-solution') . '
'; // Inline JS for the two-step flow $html .= ''; return $html; } /** * Build compact diagnostics markup for the Tools page. * This is intentionally read-only and lightweight. * * @return string */ private function getToolsDiagnosticsMarkup() { $rows = $this->getToolsDiagnosticsRows(); $html = '' . esc_html__('Quick environment checks for troubleshooting and support.', '404-solution') . '
'; $html .= '| ' . esc_html($label) . ' | '; if ($valueHtml !== '') { $html .= '' . wp_kses_post($valueHtml) . ' | '; } else { $html .= '' . esc_html($value) . ' | '; } $html .= '' . esc_html($statusLabel) . ' | '; $html .= '