logo_svg());
add_menu_page('SiteBirds', 'SiteBirds', 'manage_options', 'sitefix', [$this, 'dashboard_page'], $icon, 30);
add_submenu_page('sitefix', 'Overview', 'Overview', 'manage_options', 'sitefix', [$this, 'dashboard_page']);
add_submenu_page('sitefix', 'Setup wizard', 'Setup wizard', 'manage_options', 'sitebirds-wizard', [$this, 'render_wizard']);
add_submenu_page('sitefix', 'SiteBirds dashboard', 'SiteBirds dashboard', 'manage_options', 'sitebirds-cloud', [$this, 'render_cloud_dashboard']);
}
public function enqueue_assets($hook) {
if (strpos((string) $hook, 'sitefix') === false && strpos((string) $hook, 'sitebirds') === false) return;
wp_enqueue_script('jquery');
wp_register_script('sitebirds-admin-inline', '', array('jquery'), SITEFIX_VERSION, true);
wp_enqueue_script('sitebirds-admin-inline');
wp_register_style('sitebirds-admin-inline', false, array(), SITEFIX_VERSION);
wp_enqueue_style('sitebirds-admin-inline');
wp_add_inline_style('sitebirds-admin-inline', $this->get_css());
wp_add_inline_script('sitebirds-admin-inline', $this->get_js());
}
public function handle_connect() {
if (!current_user_can('manage_options')) wp_die('Unauthorized');
check_admin_referer('sitebirds_connect_action');
$token = isset($_POST['sitebirds_connect_code']) ? sanitize_text_field(wp_unslash($_POST['sitebirds_connect_code'])) : '';
$result = sitebirds_connect()->connect($token);
if (!empty($result['success'])) {
wp_safe_redirect(add_query_arg(['page' => 'sitefix', 'sitebirds_notice' => 'connected'], admin_url('admin.php'))); exit;
}
wp_safe_redirect(add_query_arg(['page' => 'sitefix', 'sitebirds_error' => rawurlencode(sitebirds_connect()->get_error_message($result))], admin_url('admin.php'))); exit;
}
public function handle_disconnect() {
if (!current_user_can('manage_options')) wp_die('Unauthorized');
check_admin_referer('sitebirds_disconnect_action');
sitebirds_connect()->disconnect();
wp_safe_redirect(add_query_arg(['page' => 'sitefix', 'sitebirds_notice' => 'disconnected'], admin_url('admin.php'))); exit;
}
public function dashboard_page() {
$snapshot = sitebirds_wizard()->get_snapshot();
if (empty($snapshot)) $snapshot = sitebirds_wizard()->build_snapshot();
$plugin_scan = sitebirds_plugin_scanner()->get_cache();
$config = sitebirds_bridge()->get_config();
$connected = sitebirds_bridge()->is_connected();
$score = (int) ($snapshot['sitebirds_scan']['score'] ?? 0);
$score_class = $score >= 80 ? 'good' : ($score >= 55 ? 'mid' : 'low');
$active_fix_count = (int) ($snapshot['fixes']['active_count'] ?? 0);
$wizard_url = sitebirds_wizard()->get_wizard_url();
?>
render_notices(); ?>
logo_svg(); ?>
SiteBirds
More leads from your existing website.
Start with the scan. Keep the built-in accessibility improvements on in WordPress. Connect only when you are ready for questions, leads, bookings and follow-up.
Accessibility score
Active fixes /8
Plugins replaceable
How it works
Start with the scan
WordPress already knows a lot about this site. SiteBirds uses that to make setup obvious and fast.
1 Scan Review this WordPress site
2 Activate Keep built-in improvements on
3 Connect Create your SiteBirds dashboard
Prefilled from WordPress
profile_item('Website', home_url('/')); ?>
profile_item('Site name', get_bloginfo('name')); ?>
profile_item('Email', get_option('admin_email')); ?>
profile_item('Language', get_bloginfo('language')); ?>
profile_item('Theme', ($snapshot['site']['theme_name'] ?? 'Unknown') . ' ' . ($snapshot['site']['theme_version'] ?? '')); ?>
profile_item('Active plugins', (string) ($plugin_scan['active_plugins_count'] ?? count((array) get_option('active_plugins', [])))); ?>
profile_item('Published pages', (string) ($snapshot['content']['published_pages'] ?? 0)); ?>
profile_item('Published posts', (string) ($snapshot['content']['published_posts'] ?? 0)); ?>
What SiteBirds checks
Accessibility issues and what the built-in fixes already cover
Plugins SiteBirds may replace or simplify
Signals for leads, quote requests and bookings
A fast path into your SiteBirds setup wizard
Run SiteBirds scan now
Open public SiteBirds wizard
The scan runs inside WordPress first, then you can continue in SiteBirds with your site already filled in.
Results
SiteBirds scan results
render_scan_results($snapshot, $plugin_scan); ?>
Step 2
Keep the built-in improvements on
These WordPress accessibility improvements stay local and active while you prepare the SiteBirds connection.
render_fixes_list(); ?>
Step 3
Connect this site to SiteBirds
This is the important step. Keep the fixes on in WordPress, then connect your SiteBirds dashboard when you are ready.
Connected
Business ID:
Plan:
build_prefill();
$wizard_url = sitebirds_wizard()->get_wizard_url();
?>
Setup wizard
Start with your WordPress site already filled in.
Open the SiteBirds wizard from this WordPress site. Your current website URL, site name, email, language, theme and plugin count are already added to the wizard link.
$prefill['site_url'] ?? '',
'Site name' => $prefill['site_name'] ?? '',
'Email' => $prefill['email'] ?? '',
'Language' => $prefill['language'] ?? '',
'Theme' => trim((string) (($prefill['theme_name'] ?? '') . ' ' . ($prefill['theme_version'] ?? ''))),
'Active plugins' => (string) ($prefill['active_plugins_count'] ?? '0'),
]; ?>
$value): ?>
get_config();
?>
' . esc_html($text) . '
';
}
if (!empty($_GET['sitebirds_error'])) {
echo '' . esc_html(rawurldecode((string) wp_unslash($_GET['sitebirds_error']))) . '
';
}
}
private function render_fixes_list(): void {
$settings = get_option('sitefix_settings', []);
$fixes = [
'enable_images' => ['Image alt text', 'Automatically improve missing alt attributes'],
'enable_headings' => ['Heading hierarchy', 'Fix skipped or broken heading structure'],
'enable_links' => ['Link accessibility', 'Improve labels and safer link behavior'],
'enable_forms' => ['Form labels', 'Add labels and improve basic form clarity'],
'enable_tables' => ['Table headers', 'Improve table semantics'],
'enable_aria' => ['ARIA landmarks', 'Add common semantic roles'],
'enable_lang' => ['Language attribute', 'Ensure the page language is present'],
'enable_focus' => ['Focus and skip links', 'Improve keyboard visibility and skip navigation'],
];
foreach ($fixes as $key => $meta) {
echo '';
echo '' . esc_html($meta[0]) . ' ' . esc_html($meta[1]) . '
';
echo ' ';
echo ' ';
}
}
private function profile_item(string $label, string $value): void {
echo '' . esc_html($label) . ' ' . esc_html($value) . '
';
}
private function render_scan_results(array $snapshot, array $plugin_scan): void {
$priorities = (array) ($snapshot['sitebirds_scan']['priority_issues'] ?? []);
?>
Scan score /100
Plugins replaceable
Estimated size reduction KB
No supported replaceable plugins detected yet
This check currently recognizes common SEO, form, booking, chat, consent and accessibility plugins. When one is active, SiteBirds will show it here.
Top issues
No major issues found in the last scan.
Plugins SiteBirds may replace
Plugin Replaces Estimated size Typical cost
KB
';
}
private function get_css(): string {
return '
:root{--sb-purple:#6466F1;--sb-purple-dark:#4F46E5;--sb-black:#111111;--sb-white:#FFFFFF;--sb-bg:#f5f5ff;--sb-panel:#ffffff;--sb-border:#e7e7f3;--sb-text:#1f2340;--sb-muted:#626789;--sb-soft:#eef0ff;--sb-shadow:0 20px 50px rgba(17,17,17,.08)}
.sb-wrap{margin:0 0 0 -20px;background:linear-gradient(180deg,#f8f8ff 0%,#f4f5ff 100%);min-height:100vh;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;color:var(--sb-text)}
.sb-shell{max-width:1280px;margin:0 auto;padding:28px 32px 40px}
.sb-hero{display:flex;justify-content:space-between;gap:24px;background:linear-gradient(135deg,var(--sb-black) 0%,#181827 48%,var(--sb-purple-dark) 100%);color:#fff;border-radius:28px;padding:28px 30px;box-shadow:0 24px 60px rgba(79,70,229,.18)}
.sb-brand-lockup{display:flex;gap:18px;align-items:flex-start;max-width:760px}.sb-brand-mark{width:64px;height:64px;flex:0 0 64px}.sb-brand-mark svg{width:64px;height:64px;display:block;border-radius:16px;box-shadow:0 14px 30px rgba(99,102,241,.28)}.sb-wordmark,.sb-kicker{font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:#c7d2fe;font-weight:800}.sb-hero h1{font-size:40px;line-height:1.02;margin:8px 0 12px;color:#fff}.sb-hero p{font-size:16px;line-height:1.6;max-width:720px;margin:0;color:#e9e9ff}.sb-hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:18px}
.sb-hero-stats{display:grid;grid-template-columns:repeat(3,minmax(140px,1fr));gap:14px;align-self:flex-end}.sb-stat-card{background:rgba(255,255,255,.08);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.14);border-radius:18px;padding:18px 16px}.sb-stat-card span{display:block;font-size:12px;color:#d7d9ff;margin-bottom:10px}.sb-stat-card strong{font-size:28px;line-height:1;font-weight:800;color:#fff}.sb-stat-card strong.good{color:#c7d2fe}.sb-stat-card strong.mid{color:#fde68a}.sb-stat-card strong.low{color:#fca5a5}
.sb-wizard-card,.sb-panel{background:var(--sb-panel);border:1px solid var(--sb-border);border-radius:24px;box-shadow:var(--sb-shadow)}
.sb-wizard-card{padding:24px;margin-top:22px}.sb-panel{padding:22px;display:flex;flex-direction:column}.sb-panel.accent{background:linear-gradient(180deg,#f7f7ff 0%,#ffffff 100%);border-color:#dfe2ff}
.sb-section-head{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:20px}.sb-section-head h2,.sb-panel h2{margin:6px 0 6px;font-size:28px;color:var(--sb-black)}.sb-section-head p,.sb-panel p{margin:0;color:var(--sb-muted);line-height:1.6}.sb-section-head.compact h2{font-size:24px}
.sb-primary-btn,.sb-secondary-btn,.sb-link-btn,.sb-ghost-btn{appearance:none;border:0;border-radius:14px;padding:14px 18px;font-weight:700;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:.18s ease;min-height:50px;box-sizing:border-box;text-align:center}.sb-primary-btn{background:var(--sb-purple);color:#fff;box-shadow:0 12px 30px rgba(99,102,241,.24)}.sb-primary-btn:hover{transform:translateY(-1px);background:var(--sb-purple-dark);box-shadow:0 16px 34px rgba(99,102,241,.28)}.sb-secondary-btn{background:#fff;color:var(--sb-black);border:1px solid var(--sb-border)}.sb-link-btn{background:var(--sb-soft);color:var(--sb-purple-dark)}.sb-ghost-btn{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.18)}.sb-ghost-btn:hover{background:rgba(255,255,255,.08)}.sb-ghost-btn.full,.sb-primary-btn.full,.sb-link-btn.full,.sb-secondary-btn.full{width:100%}.sb-panel .sb-ghost-btn{color:var(--sb-purple-dark);border:1px solid #d5d8ff;background:#fff}.sb-panel .sb-ghost-btn:hover{background:#f8f8ff}
.sb-steps{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:20px}.sb-step{display:flex;align-items:center;gap:12px;padding:14px;border:1px solid var(--sb-border);border-radius:18px;background:#fff}.sb-step span{width:32px;height:32px;border-radius:999px;background:var(--sb-soft);color:var(--sb-purple-dark);font-weight:800;display:flex;align-items:center;justify-content:center}.sb-step strong{display:block;color:var(--sb-black)}.sb-step small{display:block;color:var(--sb-muted)}.sb-step.done,.sb-step.current{background:#f7f7ff;border-color:#d8dcff}.sb-step.done span,.sb-step.current span{background:var(--sb-purple);color:#fff}.sb-step.emphasis{border-color:var(--sb-purple);box-shadow:inset 0 0 0 1px var(--sb-purple)}
.sb-grid{display:grid;gap:20px}.sb-grid.two{grid-template-columns:1.15fr .85fr;align-items:stretch}.sb-grid.two.tight{grid-template-columns:1fr 1fr}.main-grid{grid-template-columns:minmax(0,1.45fr) 420px;margin-top:22px;align-items:start}.sb-side-stack{display:grid;gap:20px}.sb-side-stack > .sb-panel{height:100%}.sb-profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.sb-profile-item{padding:14px;border:1px solid var(--sb-border);border-radius:16px;background:#fafaff}.sb-profile-item span{display:block;font-size:12px;color:var(--sb-muted);margin-bottom:6px}.sb-profile-item strong{display:block;color:var(--sb-black);font-size:14px;word-break:break-word}
.sb-check-list,.sb-priority-list{margin:0;padding-left:18px;color:var(--sb-black)}.sb-check-list li,.sb-priority-list li{margin:0 0 10px;line-height:1.5}.sb-check-list.compact li{margin-bottom:8px}.sb-scan-cta{margin-top:auto;display:grid;gap:10px;align-content:end}.sb-scan-cta small,.sb-mini{color:var(--sb-muted)}.sb-stack{display:grid;gap:10px;align-content:start}.sb-connect-intro{margin-bottom:12px}.sb-actions-bottom{margin-top:auto}.sb-panel .sb-stack:last-child,.sb-panel form:last-child,.sb-panel .sb-scan-cta:last-child{margin-top:auto}
.sb-results-top{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:16px}.sb-result-highlight{background:#fafaff;border:1px solid var(--sb-border);border-radius:18px;padding:16px}.sb-result-highlight span{display:block;font-size:12px;color:var(--sb-muted);margin-bottom:8px}.sb-result-highlight strong{font-size:24px;color:var(--sb-black)}.sb-subpanel{background:#fafaff;border:1px solid var(--sb-border);border-radius:18px;padding:18px}.sb-subpanel h3{margin-top:0;color:var(--sb-black)}.sb-muted-panel{margin-bottom:16px}.sb-empty{color:var(--sb-muted)}.sb-priority-list{list-style:none;padding-left:0}.sb-priority-list li{display:flex;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid var(--sb-border)}.sb-priority-list li:last-child{border-bottom:0}.sb-priority-list strong{color:var(--sb-purple-dark)}
.connect-panel{background:linear-gradient(135deg,var(--sb-black) 0%,#181827 42%,var(--sb-purple-dark) 100%);color:#fff;border-color:#2b2f54}.connect-panel h2,.connect-panel h1,.connect-panel p,.connect-panel .sb-kicker,.connect-panel label{color:#fff}.sb-connect-form{display:grid;gap:10px;margin-top:14px}.sb-connect-form input{width:100%;padding:14px 16px;border-radius:14px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);color:#fff}.sb-connect-form input::placeholder{color:#d7d9ff}.sb-connection-state{display:grid;gap:6px;padding:16px;border-radius:16px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);margin:14px 0}.sb-connection-state.success strong{color:#c7d2fe}
.sb-fixes-list{display:grid;gap:10px}.sb-fix-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;padding:14px 0;border-bottom:1px solid var(--sb-border)}.sb-fix-row:last-child{border-bottom:0}.sb-fix-copy{flex:1;min-width:0}.sb-fix-row strong{display:block;color:var(--sb-black)}.sb-fix-row small{display:block;color:var(--sb-muted);margin-top:3px}
.sb-toggle{position:relative;width:48px;height:28px;flex:0 0 auto}.sb-toggle input{opacity:0;width:0;height:0;position:absolute}.sb-toggle span{position:absolute;inset:0;border-radius:999px;background:#d1d5db;transition:.18s}.sb-toggle span:before{content:"";position:absolute;width:22px;height:22px;left:3px;top:3px;border-radius:50%;background:#fff;transition:.18s;box-shadow:0 2px 8px rgba(0,0,0,.12)}.sb-toggle input:checked+span{background:var(--sb-purple)}.sb-toggle input:checked+span:before{transform:translateX(20px)}
.sb-loading{display:grid;place-items:center;padding:26px;color:var(--sb-black)}.sb-spinner{width:34px;height:34px;border-radius:999px;border:3px solid #d1d5db;border-top-color:var(--sb-purple);animation:sbspin .8s linear infinite;margin-bottom:10px}@keyframes sbspin{to{transform:rotate(360deg)}}.mt16{margin-top:16px}
.widefat thead th{color:var(--sb-purple-dark)}
@media (max-width: 1120px){.sb-hero{flex-direction:column}.sb-hero-stats{grid-template-columns:repeat(3,minmax(0,1fr));width:100%}.main-grid{grid-template-columns:1fr}.sb-grid.two{grid-template-columns:1fr}.sb-steps{grid-template-columns:1fr}}
@media (max-width: 720px){.sb-shell{padding:18px}.sb-hero h1{font-size:30px}.sb-profile-grid,.sb-results-top,.sb-hero-stats,.sb-grid.two.tight,.sb-steps{grid-template-columns:1fr}.sb-section-head{flex-direction:column;align-items:flex-start}.sb-brand-lockup{flex-direction:column}.sb-brand-mark{width:56px;height:56px;flex-basis:56px}.sb-brand-mark svg{width:56px;height:56px}}
';
}
private function get_js(): string {
$ajax = admin_url('admin-ajax.php');
$nonce = wp_create_nonce('sitefix_nonce');
return "
jQuery(function($){
function esc(s){ return $('').text(s || '').html(); }
function renderResults(data){
var html = '';
html += '
';
html += '
Scan score '+esc(data.score)+'/100
';
html += '
Plugins replaceable '+esc(data.replaceable_count)+'
';
html += '
Estimated size reduction '+esc(data.estimated_size_kb)+' KB
';
html += '
';
if (!data.matches.length) {
html += '
No supported replaceable plugins detected yet This check currently recognizes common SEO, form, booking, chat, consent and accessibility plugins. When one is active, SiteBirds will show it here.
';
}
html += '
';
html += '
Top issues ';
if (!data.priority_issues.length) html += '
No major issues found in the last scan.
';
else { html += '
'; data.priority_issues.forEach(function(item){ html += ''+esc(item.label)+' '+esc(item.count)+' '; }); html += ' '; }
html += '
';
html += '
SiteBirds opportunities ';
data.opportunities.forEach(function(item){ html += ''+esc(item)+' ';});
html += ' ';
if (data.matches.length) {
html += '
Plugins SiteBirds may replace Plugin Replaces Estimated size ';
data.matches.forEach(function(match){ html += ''+esc(match.name)+' '+esc(match.replaces.join(', '))+' '+esc(match.est_size_kb)+' KB '; });
html += '
';
}
$('#sb-scan-results').html(html);
$('#sb-score').text(data.score).removeClass('good mid low').addClass(data.score_class);
$('#sb-replaceable-count').text(data.replaceable_count);
$('#sb-active-fixes').text(data.active_fixes+'/8');
}
function runSiteBirdsScan(){
$('#sb-scan-results').html('
Scanning your WordPress site…
');
$.ajax({
url:'{$ajax}',
method:'POST',
data:{action:'sitebirds_run_wizard_scan', nonce:'{$nonce}'},
success:function(resp){
if(resp && resp.success){ renderResults(resp.data); }
else { $('#sb-scan-results').html('
'+(resp && resp.data ? esc(resp.data) : 'The SiteBirds scan did not complete.')+'
'); }
},
error:function(xhr){
var msg = 'The SiteBirds scan could not reach WordPress AJAX.';
if (xhr && xhr.responseJSON && xhr.responseJSON.data) msg = xhr.responseJSON.data;
$('#sb-scan-results').html('
');
}
});
}
$(document).on('click', '#sb-run-sitebirds-scan, #sb-run-sitebirds-scan-2', function(e){
e.preventDefault();
runSiteBirdsScan();
var target = document.getElementById('sb-scan-results');
if (target) { target.scrollIntoView({behavior:'smooth', block:'start'}); }
});
$('.sb-fixes-list').on('change', 'input[data-fix]', function(){
var input = $(this), fix = input.data('fix');
$.post('{$ajax}', {action:'sitefix_toggle_fix', nonce:'{$nonce}', fix:fix}, function(resp){
if(resp && resp.success){ var active = $('.sb-fixes-list input[data-fix]:checked').length; $('#sb-active-fixes').text(active + '/8'); }
else { input.prop('checked', !input.prop('checked')); alert(resp && resp.data ? resp.data : 'Could not save this fix.'); }
}).fail(function(){ input.prop('checked', !input.prop('checked')); alert('Could not save this fix.'); });
});
});";
}
}