Add JSON-driven partner links section to footer
Reads resources/data/partners.json (url/anchor/title/rel), cached by the file's mtime so edits go live on the next deploy. Skips invalid/non-http entries and renders nothing when the list is empty. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -1542,6 +1542,38 @@ footer{position:relative}
|
||||
<div style="margin-top:8px;font-size:.7rem;opacity:.35">
|
||||
<a href="https://bumin.tr/" title="film izle" style="color:inherit;text-decoration:none">film izle</a>
|
||||
</div>
|
||||
{{-- Partnerler — resources/data/partners.json'dan okunur. Cache anahtarı dosya
|
||||
değişim zamanına bağlı: JSON güncellenip deploy edilince otomatik tazelenir. --}}
|
||||
@php
|
||||
$__pFile = resource_path('data/partners.json');
|
||||
$__partners = \Illuminate\Support\Facades\Cache::remember(
|
||||
'footer_partners_' . (is_file($__pFile) ? @filemtime($__pFile) : '0'),
|
||||
86400,
|
||||
function () use ($__pFile) {
|
||||
if (! is_file($__pFile)) return [];
|
||||
$rows = json_decode((string) @file_get_contents($__pFile), true);
|
||||
if (! is_array($rows)) return [];
|
||||
return array_values(array_filter($rows, fn ($r) =>
|
||||
is_array($r)
|
||||
&& ! empty($r['url']) && ! empty($r['anchor'])
|
||||
&& filter_var($r['url'], FILTER_VALIDATE_URL)
|
||||
&& preg_match('#^https?://#i', $r['url'])
|
||||
));
|
||||
}
|
||||
);
|
||||
@endphp
|
||||
@if(! empty($__partners))
|
||||
<div class="footer-partners" style="margin-top:10px;font-size:.72rem;opacity:.45;line-height:2">
|
||||
<span style="opacity:.7">Partnerler:</span>
|
||||
@foreach($__partners as $__p)
|
||||
<a href="{{ $__p['url'] }}"
|
||||
@isset($__p['title']) title="{{ $__p['title'] }}" @endisset
|
||||
rel="{{ $__p['rel'] ?? 'dofollow' }} noopener"
|
||||
target="_blank"
|
||||
style="color:inherit;text-decoration:none;margin-right:12px">{{ $__p['anchor'] }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user