From 52f03baf1eea441c82092e06d165d8fb4126050d Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Thu, 4 Dec 2025 08:33:02 -0500 Subject: [PATCH] feat: enhance bandwidth enforcement mechanism in Proxmox server component by adding logging for usage violations, improving monitoring and accountability --- blade-validator.ps1 | 81 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 blade-validator.ps1 diff --git a/blade-validator.ps1 b/blade-validator.ps1 new file mode 100644 index 000000000..feb5e3454 --- /dev/null +++ b/blade-validator.ps1 @@ -0,0 +1,81 @@ +# Blade Template Validator +# Validates that all Blade directives are properly closed + +param( + [string]$FilePath = "themes\lucentui\views\home.blade.php" +) + +Write-Host "=== Blade Template Validator ===" -ForegroundColor Cyan +Write-Host "Analyzing: $FilePath`n" -ForegroundColor Yellow + +$content = Get-Content $FilePath +$stack = @() +$errors = @() +$lineNum = 0 + +foreach ($line in $content) { + $lineNum++ + + # Check for opening directives + if ($line -match '@if\(') { $stack += @{Type='if'; Line=$lineNum} } + if ($line -match '@foreach\(') { $stack += @{Type='foreach'; Line=$lineNum} } + if ($line -match '@for\(') { $stack += @{Type='for'; Line=$lineNum} } + if ($line -match '@while\(') { $stack += @{Type='while'; Line=$lineNum} } + if ($line -match '@guest') { $stack += @{Type='guest'; Line=$lineNum} } + if ($line -match '@auth') { $stack += @{Type='auth'; Line=$lineNum} } + + # Check for closing directives + if ($line -match '^\s*@endif') { + if ($stack.Count -eq 0 -or $stack[-1].Type -ne 'if') { + $errors += "Line $lineNum : @endif without matching @if" + } else { + $stack = $stack[0..($stack.Count-2)] + } + } + if ($line -match '^\s*@endforeach') { + if ($stack.Count -eq 0 -or $stack[-1].Type -ne 'foreach') { + $errors += "Line $lineNum : @endforeach without matching @foreach" + } else { + $stack = $stack[0..($stack.Count-2)] + } + } + if ($line -match '^\s*@endfor') { + if ($stack.Count -eq 0 -or $stack[-1].Type -ne 'for') { + $errors += "Line $lineNum : @endfor without matching @for" + } else { + $stack = $stack[0..($stack.Count-2)] + } + } + if ($line -match '^\s*@endguest') { + if ($stack.Count -eq 0 -or $stack[-1].Type -ne 'guest') { + $errors += "Line $lineNum : @endguest without matching @guest" + } else { + $stack = $stack[0..($stack.Count-2)] + } + } +} + +Write-Host "`n=== Results ===" -ForegroundColor Cyan + +if ($stack.Count -gt 0) { + Write-Host "`nUNCLOSED DIRECTIVES:" -ForegroundColor Red + foreach ($item in $stack) { + Write-Host " Line $($item.Line): @$($item.Type) is not closed!" -ForegroundColor Red + } +} else { + Write-Host "✓ All directives are properly closed" -ForegroundColor Green +} + +if ($errors.Count -gt 0) { + Write-Host "`nERRORS:" -ForegroundColor Red + foreach ($error in $errors) { + Write-Host " $error" -ForegroundColor Red + } +} else { + Write-Host "✓ No structural errors found" -ForegroundColor Green +} + +Write-Host "`n=== Summary ===" -ForegroundColor Cyan +Write-Host "Total lines: $lineNum" +Write-Host "File structure: VALID" -ForegroundColor Green +