';
return $html;
}
// Format tabs and content together (interleaved for collapsible functionality)
function format_tabs_and_content($contents) {
global $all_views;
// Ensure all_views is loaded
if (!isset($all_views) || !is_array($all_views)) {
include dirname(__FILE__).'/settings/settingsviews.php';
}
$rows = explode("\n", $contents);
$output = '';
$profile_count = 0;
// Count profiles for performance warning
foreach ($rows as $row) {
if (preg_match('/\/\*(.*?)\*\//', $row)) {
$profile_count++;
}
}
// Add performance notice for large numbers of profiles
if ($profile_count > 10) {
$output .= '
';
$output .= '';
$output .= '
Managing ' . $profile_count . ' profiles.
';
$output .= '';
$output .= '
';
}
// Start with General tab and its content
$output .= '
Each tab represents a profile. Each element in a profile represents a view and or API access. Total views available: ' . (isset($all_views) && is_array($all_views) ? count($all_views) : 0) . '
';
// Add scan views functionality
$output .= '
';
$output .= '';
$output .= '
';
$current_content = '';
$current_profile = 'general';
for ($i = 0; $i < count($rows); $i++) {
// Check for tab comment
preg_match('/\/\*(.*?)\*\//', $rows[$i], $tab_match);
if ($tab_match) {
// Close previous content section and start new tab
$output .= $current_content . '