$cfsp_opt ) {
CFSP_UI::toggle(
$cfsp_key,
$cfsp_opt[0],
array(
'help' => esc_html( $cfsp_opt[1] ),
'warn' => $cfsp_opt[2],
)
);
}
CFSP_UI::card_end();
CFSP_UI::card_start( 'Resource hints', 'Tell browsers to open a connection early to other domains your pages load files from, such as your media CDN. Every domain gets both preconnect and dns-prefetch.' );
CFSP_UI::toggle(
'hints_media',
'Add hints for the media domain',
array( 'help' => 'Uses the public media URL from Media Offload, when media is served from R2.' )
);
CFSP_UI::textarea(
'hints_origins',
'Other domains',
array(
'rows' => 3,
'placeholder' => "https://cdn.example.com\nhttps://fonts.gstatic.com",
'help' => 'One per line. If a page already has a preconnect for a domain (for example one WordPress prints), the matching dns-prefetch is added right below it in the same style. Otherwise both are added at the top of the page head. Nothing is ever added twice.',
)
);
CFSP_UI::card_end();
CFSP_UI::card_start( 'Accessibility', 'Fix common accessibility gaps in the theme\'s markup, on the static pages only.' );
CFSP_UI::toggle(
'a11y_main',
'Add a main landmark when a page has none',
array( 'help' => 'Fixes "Document does not have a main landmark" (Lighthouse). If a page has no <main> and no role="main", role="main" is added to the theme\'s content element. The design doesn\'t change.' )
);
CFSP_UI::input(
'a11y_main_selector',
'Content element',
array(
'show_if' => 'a11y_main',
'placeholder' => CFSP_Cleanup::MAIN_CANDIDATES,
'help' => 'The element that holds the page content, not the sidebar or footer: #id, .class or tag.class. List several separated by commas; the first one found on a page is used. Leave empty to try the common ones shown.',
)
);
CFSP_UI::card_end();
CFSP_UI::card_start( 'Custom removal rules', 'Remove anything else from the HTML of every page.' );
CFSP_UI::textarea(
'cleanup_custom',
'Rules',
array(
'rows' => 6,
'placeholder' => "#some-plugin-inline-css\n/]*>\\s*/i\n",
'help' => 'One per line: #element-id removes the <style>, <script> or <link> with that id · /regex/flags removes every match · anything else is removed as exact text.',
)
);
CFSP_UI::card_end();