Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
65 lines
2.9 KiB
PHP
65 lines
2.9 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace YakNet\AccessibilityConsole\Core\SelfHealing;
|
||
|
|
|
||
|
|
use YakNet\AccessibilityConsole\Core\Violation;
|
||
|
|
|
||
|
|
class LocalHealer
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Attempt to deterministically fix simple violations locally.
|
||
|
|
*
|
||
|
|
* @param Violation $violation
|
||
|
|
* @return string|null
|
||
|
|
*/
|
||
|
|
public function heal(Violation $violation): ?string
|
||
|
|
{
|
||
|
|
$snippet = $violation->htmlSnippet;
|
||
|
|
$ruleId = $violation->ruleId;
|
||
|
|
|
||
|
|
switch ($ruleId) {
|
||
|
|
case 'WCAG_2_2_2_BLINK':
|
||
|
|
$fixed = str_replace(
|
||
|
|
['<blink>', '</blink>', '<BLINK>', '</BLINK>'],
|
||
|
|
['<span style="text-decoration: blink;">', '</span>', '<span style="text-decoration: blink;">', '</span>'],
|
||
|
|
$snippet
|
||
|
|
);
|
||
|
|
return "EXPLANATION: Banned <blink> tag replaced with a span and text-decoration style.\nFIX: " . $fixed;
|
||
|
|
|
||
|
|
case 'WCAG_2_4_3_AUTOFOCUS':
|
||
|
|
$fixed = preg_replace('/\s+autofocus(=["\'](.*?)["\'])?/i', '', $snippet) ?: $snippet;
|
||
|
|
return "EXPLANATION: Autofocus attribute removed to prevent screen reader interruption on load.\nFIX: " . $fixed;
|
||
|
|
|
||
|
|
case 'WCAG_1_3_1_TABLE_SUMMARY':
|
||
|
|
$fixed = preg_replace('/\s+summary=["\'](.*?)["\']/i', '', $snippet) ?: $snippet;
|
||
|
|
return "EXPLANATION: Deprecated table summary attribute removed. Use caption elements instead.\nFIX: " . $fixed;
|
||
|
|
|
||
|
|
case 'WCAG_2_1_1_SCROLLABLE_FOCUS':
|
||
|
|
if (!str_contains($snippet, 'tabindex')) {
|
||
|
|
$fixed = preg_replace('/(style=["\'](.*?)["\'])/i', '$1 tabindex="0"', $snippet) ?: $snippet;
|
||
|
|
return "EXPLANATION: Added tabindex=\"0\" to scrollable region to allow keyboard scrolling.\nFIX: " . $fixed;
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
|
||
|
|
case 'WCAG_1_3_1_PRESENTATION_TAGS':
|
||
|
|
if (preg_match('/<center>(.*?)<\/center>/is', $snippet, $matches)) {
|
||
|
|
$fixed = '<div style="text-align: center;">' . $matches[1] . '</div>';
|
||
|
|
return "EXPLANATION: Center element replaced with div and text-align CSS.\nFIX: " . $fixed;
|
||
|
|
}
|
||
|
|
if (preg_match('/<strike>(.*?)<\/strike>/is', $snippet, $matches)) {
|
||
|
|
$fixed = '<span style="text-decoration: line-through;">' . $matches[1] . '</span>';
|
||
|
|
return "EXPLANATION: Strike element replaced with span and line-through decoration CSS.\nFIX: " . $fixed;
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
|
||
|
|
case 'WCAG_3_1_1_LANG':
|
||
|
|
if (preg_match('/<html(\s+[^>]*>|>)/i', $snippet)) {
|
||
|
|
$fixed = preg_replace('/<html/i', '<html lang="en"', $snippet) ?: $snippet;
|
||
|
|
return "EXPLANATION: Injected default lang=\"en\" to HTML element.\nFIX: " . $fixed;
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|