Merge branch 'next' into main
This commit is contained in:
@@ -91,8 +91,31 @@ function metrics_dir(): string
|
||||
return base_configuration_dir() . '/metrics';
|
||||
}
|
||||
|
||||
function sanitize_string(?string $input = null): ?string
|
||||
{
|
||||
if (is_null($input)) {
|
||||
return null;
|
||||
}
|
||||
// Remove any HTML/PHP tags
|
||||
$sanitized = strip_tags($input);
|
||||
|
||||
// Convert special characters to HTML entities
|
||||
$sanitized = htmlspecialchars($sanitized, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
|
||||
// Remove any control characters
|
||||
$sanitized = preg_replace('/[\x00-\x1F\x7F]/u', '', $sanitized);
|
||||
|
||||
// Trim whitespace
|
||||
$sanitized = trim($sanitized);
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
function generate_readme_file(string $name, string $updated_at): string
|
||||
{
|
||||
$name = sanitize_string($name);
|
||||
$updated_at = sanitize_string($updated_at);
|
||||
|
||||
return "Resource name: $name\nLatest Deployment Date: $updated_at";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user