$tabs [slug => label]
* @param string $current Currently active tab slug
* @param int $server_id Row ID; appended to the tab href
*/
public function render_tab_nav( array $tabs, string $current, int $server_id ): void {
echo '
';
foreach ( $tabs as $slug => $label ) {
$url = esc_url(
add_query_arg(
array(
'page' => AdminPageSlugs::PARENT,
'action' => 'edit',
'server' => $server_id,
'tab' => $slug,
),
admin_url( 'admin.php' )
)
);
$active = ( $slug === $current ) ? ' nav-tab-active' : '';
printf(
'%s',
esc_url( $url ), // SEC-S2: defense in depth — esc_url is idempotent.
esc_attr( $active ),
esc_html( $label )
);
}
echo '
';
}
}