Files
breadcrumb-the-shire/templates/partials/app-tile.phtml
fs 576a0c51cd feat(guards): add GR-SEC-010 — output escaping enforcement in views
Add architecture test ViewLayerOutputEscapingContractTest that flags
raw <?php echo in .phtml files. Legitimate uses (pre-built ARIA attrs
from navActive(), hardcoded role values, pre-rendered HTML fragments)
must carry an inline // raw-html-ok: reason marker.

Annotated all 11 existing raw echo sites with justification markers.
Added guard to catalog, enforcement map (automated), CLAUDE.md security
section, and never-do-this list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 12:08:25 +02:00

54 lines
1.5 KiB
PHTML

<?php
/**
* @var string $href
* @var string $label
* @var string|null $count
* @var string|null $icon
* @var string|null $iconBg
* @var string|null $iconColor
* @var string|null $class
* @var string|null $tooltip
* @var string|null $tooltipPos
*/
$href = $href ?? '#';
$label = $label ?? '';
$count = $count ?? null;
$icon = $icon ?? 'bi bi-grid-1x2';
$iconBg = $iconBg ?? null;
$iconColor = $iconColor ?? null;
$class = $class ?? '';
$tooltip = $tooltip ?? '';
$tooltipPos = $tooltipPos ?? 'top';
$styleParts = [];
if ($iconBg) {
$styleParts[] = '--tile-icon-bg:' . $iconBg;
}
if ($iconColor) {
$styleParts[] = '--tile-icon-color:' . $iconColor;
}
$style = $styleParts ? implode(';', $styleParts) . ';' : '';
?>
<a
class="app-tile<?php echo $class ? ' ' . $class : ''; // raw-html-ok: internal CSS class from tile config ?>"
href="<?php e($href); ?>"
<?php if ($style) : ?>style="<?php e($style); ?>"<?php endif; ?>
<?php if ($tooltip !== '') : ?>data-tooltip="<?php e($tooltip); ?>" data-tooltip-pos="<?php e($tooltipPos); ?>"<?php endif; ?>
>
<span class="app-tile-icon">
<i class="<?php e($icon); ?>" aria-hidden="true"></i>
</span>
<?php if ($count !== null && $count !== '') : ?>
<span class="app-tile-count"><?php e($count); ?></span>
<?php endif; ?>
<?php if ($label !== '') : ?>
<span class="app-tile-label"><?php e($label); ?></span>
<?php endif; ?>
<span class="app-tile-link" aria-hidden="true">
<i class="bi bi-box-arrow-up-right"></i>
</span>
</a>