Update views and templates to use render helper object

This commit is contained in:
Timothy Warren 2023-12-21 13:46:15 -05:00
parent fe1caffc0f
commit ff8c837fd9
33 changed files with 218 additions and 229 deletions

View File

@ -4,13 +4,13 @@
data-anilist-id="<?= $item['anilist_id'] ?>"
data-mal-id="<?= $item['mal_id'] ?>"
>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<button title="Increment episode count" class="plus-one" hidden>+1 Episode</button>
<?php endif ?>
<?= $helper->img($item['anime']['cover_image'], ['width' => 220, 'loading' => 'lazy']) ?>
<?= $_->h->img($item['anime']['cover_image'], ['width' => 220, 'loading' => 'lazy']) ?>
<div class="name">
<a href="<?= $url->generate('anime.details', ['id' => $item['anime']['slug']]) ?>">
<a href="<?= $_->urlFromRoute('anime.details', ['id' => $item['anime']['slug']]) ?>">
<span class="canonical"><?= $item['anime']['title'] ?></span>
<?php foreach ($item['anime']['titles'] as $title): ?>
<br/>
@ -50,7 +50,7 @@
<?php if ($link['meta']['link']): ?>
<a href="<?= $link['link'] ?>"
title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'streaming-logo',
'width' => 20,
'height' => 20,
@ -58,7 +58,7 @@
]); ?>
</a>
<?php else: ?>
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'streaming-logo',
'width' => 20,
'height' => 20,
@ -70,11 +70,11 @@
</div>
<?php endif ?>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<div class="row">
<span class="edit">
<a class="bracketed" title="Edit information about this anime" href="<?=
$url->generate('edit', [
$_->urlFromRoute('edit', [
'controller' => 'anime',
'id' => $item['id'],
'status' => $item['watching_status']
@ -92,9 +92,9 @@
</div>
</div>
<div class="row">
<div class="media_type"><?= $escape->html($item['anime']['show_type']) ?></div>
<div class="airing-status"><?= $escape->html($item['airing']['status']) ?></div>
<div class="age-rating"><?= $escape->html($item['anime']['age_rating']) ?></div>
<div class="media_type"><?= $_->escape->html($item['anime']['show_type']) ?></div>
<div class="airing-status"><?= $_->escape->html($item['airing']['status']) ?></div>
<div class="age-rating"><?= $_->escape->html($item['anime']['age_rating']) ?></div>
</div>
</div>
</article>

View File

@ -1,25 +1,25 @@
<article class="media" data-kitsu-id="<?= $item['id'] ?>" data-mal-id="<?= $item['mal_id'] ?>">
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<div class="edit-buttons" hidden>
<button class="plus-one-chapter">+1 Chapter</button>
</div>
<?php endif ?>
<?= $helper->img($item['manga']['image'], ['width' => 220, 'loading' => 'lazy']) ?>
<?= $_->h->img($item['manga']['image'], ['width' => 220, 'loading' => 'lazy']) ?>
<div class="name">
<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $escape->html($item['manga']['title']) ?>
<a href="<?= $_->urlFromRoute('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $_->escape->html($item['manga']['title']) ?>
<?php foreach($item['manga']['titles'] as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
<div class="table">
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<div class="row">
<span class="edit">
<a class="bracketed"
title="Edit information about this manga"
href="<?= $url->generate('edit', [
href="<?= $_->urlFromRoute('edit', [
'controller' => 'manga',
'id' => $item['id'],
'status' => $name

View File

@ -1,4 +1,4 @@
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>Add Anime to your List</h2>
<form action="<?= $action_url ?>" method="post">

View File

@ -1,6 +1,6 @@
<main class="media-list">
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute('anime.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -11,16 +11,16 @@
<?php foreach ($sections as $name => $items): ?>
<?php if (empty($items)): ?>
<section class="status">
<h2><?= $escape->html($name) ?></h2>
<h2><?= $_->escape->html($name) ?></h2>
<h3>There's nothing here!</h3>
</section>
<?php else: ?>
<section class="status">
<h2><?= $escape->html($name) ?></h2>
<h2><?= $_->escape->html($name) ?></h2>
<section class="media-wrap">
<?php foreach($items as $item): ?>
<?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?>
<?= $component->animeCover($item) ?>
<?php if ($item['private'] && ! $_->isAuthenticated()) continue; ?>
<?= $_->component->animeCover($item) ?>
<?php endforeach ?>
</section>
</section>

View File

@ -4,9 +4,9 @@ use function Aviat\AnimeClient\friendlyTime;
?>
<main class="details fixed">
<section class="flex" unselectable>
<section class="flex">
<aside class="info">
<?= $helper->img($data['cover_image'], ['width' => '390']) ?>
<?= $_->h->img($data['cover_image'], ['width' => '390']) ?>
<br />
@ -110,7 +110,7 @@ use function Aviat\AnimeClient\friendlyTime;
href="<?= $link['link'] ?>"
title="Stream '<?= $data['title'] ?>' on <?= $link['meta']['name'] ?>"
>
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'streaming-logo',
'width' => 50,
'height' => 50,
@ -119,7 +119,7 @@ use function Aviat\AnimeClient\friendlyTime;
&nbsp;&nbsp;<?= $link['meta']['name'] ?>
</a>
<?php else: ?>
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'streaming-logo',
'width' => 50,
'height' => 50,
@ -157,18 +157,18 @@ use function Aviat\AnimeClient\friendlyTime;
<section>
<h2>Characters</h2>
<?= $component->tabs('character-types', $data['characters'], static function ($characterList, $role)
use ($component, $url, $helper) {
<?= $_->component->tabs('character-types', $data['characters'], static function ($characterList, $role)
use ($_) {
$rendered = [];
foreach ($characterList as $id => $character):
if (empty($character['image']))
{
continue;
}
$rendered[] = $component->character(
$rendered[] = $_->component->character(
$character['name'],
$url->generate('character', ['slug' => $character['slug']]),
$helper->img($character['image']),
$_->urlFromRoute('character', ['slug' => $character['slug']]),
$_->h->img($character['image']),
(strtolower($role) !== 'main') ? 'small-character' : 'character'
);
endforeach;
@ -182,18 +182,18 @@ use function Aviat\AnimeClient\friendlyTime;
<section>
<h2>Staff</h2>
<?= $component->verticalTabs('staff-role', $data['staff'], static function ($staffList)
use ($component, $url, $helper) {
<?= $_->component->verticalTabs('staff-role', $data['staff'], static function ($staffList)
use ($_) {
$rendered = [];
foreach ($staffList as $id => $person):
if (empty($person['image']))
{
continue;
}
$rendered[] = $component->character(
$rendered[] = $_ ->component->character(
$person['name'],
$url->generate('person', ['slug' => $person['slug']]),
$helper->img($person['image']),
$_->urlFromRoute('person', ['slug' => $person['slug']]),
$_->h->img($person['image']),
'character small-person',
);
endforeach;

View File

@ -1,4 +1,4 @@
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>Edit Anime List Item</h2>
<form action="<?= $action ?>" method="post">
@ -6,9 +6,9 @@
<thead>
<tr>
<th>
<h3><?= $escape->html($item['anime']['title']) ?></h3>
<h3><?= $_->escape->html($item['anime']['title']) ?></h3>
<?php foreach($item['anime']['titles'] as $title): ?>
<h4><?= $escape->html($title) ?></h4>
<h4><?= $_->escape->html($title) ?></h4>
<?php endforeach ?>
</th>
</tr>
@ -16,7 +16,7 @@
<tbody>
<tr>
<td rowspan="9">
<?= $helper->img($item['anime']['cover_image']) ?>
<?= $_->h->img($item['anime']['cover_image']) ?>
</td>
</tr>
<tr>
@ -70,7 +70,7 @@
<tr>
<td><label for="notes">Notes</label></td>
<td>
<textarea name="notes" id="notes"><?= $escape->html($item['notes']) ?></textarea>
<textarea name="notes" id="notes"><?= $_->escape->html($item['notes']) ?></textarea>
</td>
</tr>
<tr>
@ -87,7 +87,7 @@
</tbody>
</table>
</form>
<form class="js-delete" action="<?= $url->generate('anime.delete') ?>" method="post">
<form class="js-delete" action="<?= $_->urlFromRoute('anime.delete') ?>" method="post">
<fieldset>
<legend>Danger Zone</legend>
<table class="form invisible">

View File

@ -1,7 +1,7 @@
<?php use function Aviat\AnimeClient\colNotEmpty; ?>
<main class="media-list">
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute('anime.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -20,7 +20,7 @@
<table class='media-wrap'>
<thead>
<tr>
<?php if($auth->isAuthenticated()): ?>
<?php if($_->isAuthenticated()): ?>
<td class="no-border">&nbsp;</td>
<?php endif ?>
<th>Title</th>
@ -35,11 +35,11 @@
</thead>
<tbody>
<?php foreach($items as $item): ?>
<?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?>
<?php if ($item['private'] && ! $_->isAuthenticated()) continue; ?>
<tr id="a-<?= $item['id'] ?>">
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<td>
<a class="bracketed" href="<?= $url->generate('edit', [
<a class="bracketed" href="<?= $_->urlFromRoute('edit', [
'controller' => 'anime',
'id' => $item['id'],
'status' => $item['watching_status']
@ -47,7 +47,7 @@
</td>
<?php endif ?>
<td class="align-left justify">
<a href="<?= $url->generate('anime.details', ['id' => $item['anime']['slug']]) ?>">
<a href="<?= $_->urlFromRoute('anime.details', ['id' => $item['anime']['slug']]) ?>">
<?= $item['anime']['title'] ?>
</a>
<br />
@ -65,7 +65,7 @@
<?php foreach($item['anime']['streaming_links'] as $link): ?>
<?php if ($link['meta']['link'] !== FALSE): ?>
<a href="<?= $link['link'] ?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'small-streaming-logo',
'width' => 25,
'height' => 25,
@ -73,7 +73,7 @@
]) ?>
</a>
<?php else: ?>
<?= $helper->img("/public/images/{$link['meta']['image']}", [
<?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'small-streaming-logo',
'width' => 25,
'height' => 25,
@ -101,7 +101,7 @@
<?php endforeach ?>
</ul>
</td>
<?php if ($hasNotes): ?><td><p><?= $escape->html($item['notes']) ?></p></td><?php endif ?>
<?php if ($hasNotes): ?><td><p><?= $_->escape->html($item['notes']) ?></p></td><?php endif ?>
</tr>
<?php endforeach ?>
</tbody>
@ -110,4 +110,4 @@
<?php endforeach ?>
<?php endif ?>
</main>
<script defer="defer" src="<?= $urlGenerator->assetUrl('js/tables.min.js') ?>"></script>
<script defer="defer" src="<?= $_->assetUrl('js/tables.min.js') ?>"></script>

View File

@ -7,7 +7,7 @@ use Aviat\AnimeClient\Kitsu;
<main class="character-page details fixed">
<section class="flex flex-no-wrap">
<aside>
<?= $helper->img($data['image']) ?>
<?= $_->h->img($data['image']) ?>
</aside>
<div>
<h2 class="toph"><?= $data['name'] ?></h2>
@ -34,14 +34,14 @@ use Aviat\AnimeClient\Kitsu;
<?php if ( ! (empty($data['media']['anime']) || empty($data['media']['manga']))): ?>
<h3>Media</h3>
<?= $component->tabs('character-media', $data['media'], static function ($media, $mediaType) use ($url, $component, $helper) {
<?= $_->component->tabs('character-media', $data['media'], static function ($media, $mediaType) use ($_) {
$rendered = [];
foreach ($media as $id => $item)
{
$rendered[] = $component->media(
$rendered[] = $_->component->media(
array_merge([$item['title']], $item['titles']),
$url->generate("{$mediaType}.details", ['id' => $item['slug']]),
$helper->img(Kitsu::getPosterImage($item), ['width' => 220, 'loading' => 'lazy']),
$_->urlFromRoute("{$mediaType}.details", ['id' => $item['slug']]),
$_->h->img(Kitsu::getPosterImage($item), ['width' => 220, 'loading' => 'lazy']),
);
}
@ -72,10 +72,10 @@ use Aviat\AnimeClient\Kitsu;
<td>
<article class="character">
<?php
$link = $url->generate('person', ['id' => $c['person']['id']]);
$link = $_->urlFromRoute('person', ['id' => $c['person']['id']]);
?>
<a href="<?= $link ?>">
<?= $helper->img($c['person']['image']) ?>
<?= $_->h->img($c['person']['image']) ?>
<div class="name">
<?= $c['person']['name'] ?>
</div>
@ -87,11 +87,11 @@ use Aviat\AnimeClient\Kitsu;
<?php foreach ($c['series'] as $series): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]);
$link = $_->urlFromRoute('anime.details', ['id' => $series['attributes']['slug']]);
$titles = Kitsu::filterTitles($series['attributes']);
?>
<a href="<?= $link ?>">
<?= $helper->img(Kitsu::getPosterImage($series['attributes'])) ?>
<?= $_->h->img(Kitsu::getPosterImage($series['attributes'])) ?>
</a>
<div class="name">
<a href="<?= $link ?>">
@ -115,18 +115,18 @@ use Aviat\AnimeClient\Kitsu;
<?php if ( ! empty($vas)): ?>
<h4>Voice Actors</h4>
<?= $component->tabs('character-vas', $vas, static function ($casting) use ($url, $component, $helper) {
<?= $_->component->tabs('character-vas', $vas, static function ($casting) use ($_) {
$castings = [];
foreach ($casting as $id => $c):
$person = $component->character(
$person = $_->component->character(
$c['person']['name'],
$url->generate('person', ['slug' => $c['person']['slug']]),
$helper->img($c['person']['image']['original']['url']),
$_->urlFromRoute('person', ['slug' => $c['person']['slug']]),
$_->h->img($c['person']['image']['original']['url']),
);
$medias = array_map(fn ($series) => $component->media(
$medias = array_map(fn ($series) => $_->component->media(
array_merge([$series['title']], $series['titles']),
$url->generate('anime.details', ['id' => $series['slug']]),
$helper->img(Kitsu::getPosterImage($series)),
$_->urlFromRoute('anime.details', ['id' => $series['slug']]),
$_->h->img(Kitsu::getPosterImage($series)),
), $c['series']);
$media = implode('', array_map('mb_trim', $medias));

View File

@ -1,4 +1,4 @@
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>Add <?= ucfirst($collection_type) ?> to your Collection</h2>
<form action="<?= $action_url ?>" method="post">

View File

@ -1,17 +1,17 @@
<article class="media" id="a-<?= $item['hummingbird_id'] ?>">
<?= $helper->picture("images/anime/{$item['hummingbird_id']}.webp") ?>
<?= $_->h->picture("images/anime/{$item['hummingbird_id']}.webp") ?>
<div class="name">
<a href="<?= $url->generate('anime.details', ['id' => $item['slug']]) ?>">
<a href="<?= $_->urlFromRoute('anime.details', ['id' => $item['slug']]) ?>">
<?= $item['title'] ?>
<?= ($item['alternate_title'] != "") ? "<small><br />{$item['alternate_title']}</small>" : ""; ?>
</a>
</div>
<div class="table">
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<div class="row">
<span class="edit">
<a class="bracketed"
href="<?= $url->generate($collection_type . '.collection.edit.get', [
href="<?= $_->urlFromRoute($collection_type . '.collection.edit.get', [
'id' => $item['hummingbird_id']
]) ?>">Edit</a>
</span>

View File

@ -1,7 +1,7 @@
<?php use function Aviat\AnimeClient\renderTemplate; ?>
<main class="media-list">
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate($collection_type . '.collection.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute($collection_type . '.collection.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -9,16 +9,14 @@
<br />
<label>Filter: <input type='text' class='media-filter' /></label>
<br />
<?= $component->tabs('collection-tab', $sections, static function ($items) use ($auth, $collection_type, $helper, $url, $component) {
<?= $_->component->tabs('collection-tab', $sections, static function ($items) use ($_, $collection_type) {
$rendered = [];
foreach ($items as $item)
{
$rendered[] = renderTemplate(__DIR__ . '/cover-item.php', [
'auth' => $auth,
'_' => $_,
'collection_type' => $collection_type,
'helper' => $helper,
'item' => $item,
'url' => $url,
]);
}

View File

@ -1,5 +1,5 @@
<?php use function Aviat\AnimeClient\renderTemplate ?>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>Edit Anime Collection Item</h2>
<form action="<?= $action_url ?>" method="post">
@ -7,7 +7,7 @@
<tbody>
<tr>
<td rowspan="6" class="align-center">
<?= $helper->picture("images/anime/{$item['hummingbird_id']}-original.webp", "jpg", [], ["width" => "390"]) ?>
<?= $_->h->picture("images/anime/{$item['hummingbird_id']}-original.webp", "jpg", [], ["width" => "390"]) ?>
</td>
</tr>
<tr>
@ -30,7 +30,7 @@
</tr>
<tr>
<td><label for="notes">Notes</label></td>
<td><textarea id="notes" name="notes"><?= $escape->html($item['notes']) ?></textarea></td>
<td><textarea id="notes" name="notes"><?= $_->escape->html($item['notes']) ?></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
@ -44,7 +44,7 @@
</tbody>
</table>
</form>
<form class="js-delete" action="<?= $url->generate($collection_type . '.collection.delete') ?>" method="post">
<form class="js-delete" action="<?= $_->urlFromRoute($collection_type . '.collection.delete') ?>" method="post">
<fieldset>
<legend>Danger Zone</legend>
<table class="form invisible">

View File

@ -1,12 +1,12 @@
<tr>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<td>
<a class="bracketed"
href="<?= $url->generate($collection_type . '.collection.edit.get', ['id' => $item['hummingbird_id']]) ?>">Edit</a>
href="<?= $_->urlFromRoute($collection_type . '.collection.edit.get', ['id' => $item['hummingbird_id']]) ?>">Edit</a>
</td>
<?php endif ?>
<td class="align-left">
<a href="<?= $url->generate('anime.details', ['id' => $item['slug']]) ?>">
<a href="<?= $_->urlFromRoute('anime.details', ['id' => $item['slug']]) ?>">
<?= $item['title'] ?>
</a>
<?= ! empty($item['alternate_title']) ? ' <br /><small> ' . $item['alternate_title'] . '</small>' : '' ?>
@ -18,6 +18,6 @@
<td><?= $item['episode_length'] ?></td>
<td><?= $item['show_type'] ?></td>
<td><?= $item['age_rating'] ?></td>
<?php if ($hasNotes): ?><td class="align-left"><?= nl2br($item['notes'], TRUE) ?></td><?php endif ?>
<?php if ($hasNotes): ?><td class="align-left"><?= nl2br($item['notes'] ?? '', TRUE) ?></td><?php endif ?>
<td class="align-left"><?= implode(', ', $item['genres']) ?></td>
</tr>

View File

@ -1,7 +1,7 @@
<?php use function Aviat\AnimeClient\{colNotEmpty, renderTemplate}; ?>
<main>
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate($collection_type . '.collection.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute($collection_type . '.collection.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -9,10 +9,10 @@
<br />
<label>Filter: <input type='text' class='media-filter' /></label>
<br />
<?= $component->tabs('collection-tab', $sections, static function ($items, $section) use ($auth, $helper, $url, $collection_type) {
<?= $_->component->tabs('collection-tab', $sections, static function ($items, $section) use ($_, $helper, $collection_type) {
$hasNotes = colNotEmpty($items, 'notes');
$hasMedia = $section === 'All';
$firstTh = ($auth->isAuthenticated()) ? '<td>&nbsp;</td>' : '';
$firstTh = ($_->isAuthenticated()) ? '<td>&nbsp;</td>' : '';
$mediaTh = ($hasMedia) ? '<th>Media</th>' : '';
$noteTh = ($hasNotes) ? '<th>Notes</th>' : '';
@ -20,13 +20,12 @@
foreach ($items as $item)
{
$rendered[] = renderTemplate(__DIR__ . '/list-item.php', [
'auth' => $auth,
'_' => $_,
'collection_type' => $collection_type,
'hasMedia' => $hasMedia,
'hasNotes' => $hasNotes,
'helper' => $helper,
'item' => $item,
'url' => $url,
]);
}
$rows = implode('', array_map('mb_trim', $rendered));
@ -53,4 +52,4 @@ HTML;
}) ?>
<?php endif ?>
</main>
<script defer="defer" src="<?= $urlGenerator->assetUrl('js/tables.min.js') ?>"></script>
<script defer="defer" src="<?= $_->assetUrl('js/tables.min.js') ?>"></script>

View File

@ -11,6 +11,6 @@
</div>
</section>
<script nomodule="nomodule" src="https://polyfill.io/v3/polyfill.min.js?features=es5%2CObject.assign"></script>
<script async="async" defer="defer" src="<?= $urlGenerator->assetUrl('js/scripts.min.js') ?>"></script>
<script async="async" defer="defer" src="<?= $_->assetUrl('js/scripts.min.js') ?>"></script>
</body>
</html>

View File

@ -6,25 +6,25 @@
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self'" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=1" />
<link rel="stylesheet" href="<?= $urlGenerator->assetUrl('css/' . $config->get('theme') . '.min.css') ?>" />
<link rel="<?= $config->get('theme') === 'dark' ? '' : 'alternate ' ?>stylesheet" title="Dark Theme" href="<?= $urlGenerator->assetUrl('css/dark.min.css') ?>" />
<link rel="icon" href="<?= $urlGenerator->assetUrl('images/icons/favicon.ico') ?>" />
<link rel="apple-touch-icon" sizes="57x57" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-57x57.png') ?>">
<link rel="apple-touch-icon" sizes="60x60" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-60x60.png') ?>">
<link rel="apple-touch-icon" sizes="72x72" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-72x72.png') ?>">
<link rel="apple-touch-icon" sizes="76x76" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-76x76.png') ?>">
<link rel="apple-touch-icon" sizes="114x114" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-114x114.png') ?>">
<link rel="apple-touch-icon" sizes="120x120" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-120x120.png') ?>">
<link rel="apple-touch-icon" sizes="144x144" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-144x144.png') ?>">
<link rel="apple-touch-icon" sizes="152x152" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-152x152.png') ?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?= $urlGenerator->assetUrl('images/icons/apple-icon-180x180.png') ?>">
<link rel="icon" type="image/png" sizes="192x192" href="<?= $urlGenerator->assetUrl('images/icons/android-icon-192x192.png') ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= $urlGenerator->assetUrl('images/icons/favicon-32x32.png') ?>">
<link rel="icon" type="image/png" sizes="96x96" href="<?= $urlGenerator->assetUrl('images/icons/favicon-96x96.png') ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?= $urlGenerator->assetUrl('images/icons/favicon-16x16.png') ?>">
<link rel="stylesheet" href="<?= $_->assetUrl('css/' . $_->config->get('theme') . '.min.css') ?>" />
<link rel="<?= $_->config->get('theme') === 'dark' ? '' : 'alternate ' ?>stylesheet" title="Dark Theme" href="<?= $_->assetUrl('css/dark.min.css') ?>" />
<link rel="icon" href="<?= $_->assetUrl('images/icons/favicon.ico') ?>" />
<link rel="apple-touch-icon" sizes="57x57" href="<?= $_->assetUrl('images/icons/apple-icon-57x57.png') ?>">
<link rel="apple-touch-icon" sizes="60x60" href="<?= $_->assetUrl('images/icons/apple-icon-60x60.png') ?>">
<link rel="apple-touch-icon" sizes="72x72" href="<?= $_->assetUrl('images/icons/apple-icon-72x72.png') ?>">
<link rel="apple-touch-icon" sizes="76x76" href="<?= $_->assetUrl('images/icons/apple-icon-76x76.png') ?>">
<link rel="apple-touch-icon" sizes="114x114" href="<?= $_->assetUrl('images/icons/apple-icon-114x114.png') ?>">
<link rel="apple-touch-icon" sizes="120x120" href="<?= $_->assetUrl('images/icons/apple-icon-120x120.png') ?>">
<link rel="apple-touch-icon" sizes="144x144" href="<?= $_->assetUrl('images/icons/apple-icon-144x144.png') ?>">
<link rel="apple-touch-icon" sizes="152x152" href="<?= $_->assetUrl('images/icons/apple-icon-152x152.png') ?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?= $_->assetUrl('images/icons/apple-icon-180x180.png') ?>">
<link rel="icon" type="image/png" sizes="192x192" href="<?= $_->assetUrl('images/icons/android-icon-192x192.png') ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= $_->assetUrl('images/icons/favicon-32x32.png') ?>">
<link rel="icon" type="image/png" sizes="96x96" href="<?= $_->assetUrl('images/icons/favicon-96x96.png') ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_->assetUrl('images/icons/favicon-16x16.png') ?>">
</head>
<body class="<?= $escape->attr($url_type) ?> list">
<body class="<?= $_->escape->attr($url_type) ?> list">
<?php include 'setup-check.php' ?>
<header>
<?php

View File

@ -7,14 +7,14 @@
<article class="flex flex-no-wrap flex-justify-start">
<section class="flex-self-center history-img">
<a href="<?= $item['url'] ?>">
<?= $helper->img(
<?= $_->h->img(
$item['coverImg'],
['width' => '110px', 'height' => '156px'],
) ?>
</a>
</section>
<section class="flex-self-center">
<?= $helper->a($item['url'], $item['title']) ?>
<?= $_->h->a($item['url'], $item['title']) ?>
<br />
<br />
<?= $item['action'] ?>

View File

@ -1,7 +1,7 @@
<main>
<h2><?= $config->get('whose_list'); ?>'s Login</h2>
<h2><?= $_->config->get('whose_list'); ?>'s Login</h2>
<?= $message ?>
<form method="post" action="<?= $url->generate('login.post') ?>">
<form method="post" action="<?= $_->urlFromRoute('login.post') ?>">
<table class="form invisible">
<tr>
<td><label for="password">Password: </label></td>

View File

@ -14,8 +14,8 @@
namespace Aviat\AnimeClient;
$whose = $config->get('whose_list') . "'s ";
$lastSegment = $urlGenerator->lastSegment();
$whose = $_->config->get('whose_list') . "'s ";
$lastSegment = $_->lastSegment();
$extraSegment = $lastSegment === 'list' ? '/list' : '';
$hasAnime = str_contains($GLOBALS['_SERVER']['REQUEST_URI'], 'anime');
$hasManga = str_contains($GLOBALS['_SERVER']['REQUEST_URI'], 'manga');
@ -24,89 +24,89 @@ $hasManga = str_contains($GLOBALS['_SERVER']['REQUEST_URI'], 'manga');
<div id="main-nav" class="flex flex-align-end flex-wrap">
<span class="flex-no-wrap grow-1">
<?php if( ! str_contains($route_path, 'collection')): ?>
<?= $helper->a(
$urlGenerator->defaultUrl($url_type),
<?= $_->h->a(
$_->defaultUrl($url_type),
$whose . ucfirst($url_type) . ' List',
['aria-current'=> 'page']
) ?>
<?php if($config->get("show_{$url_type}_collection")): ?>
[<?= $helper->a(
$url->generate("{$url_type}.collection.view") . $extraSegment,
<?php if($_->config->get("show_{$url_type}_collection")): ?>
[<?= $_->h->a(
$_->urlFromRoute("{$url_type}.collection.view") . $extraSegment,
ucfirst($url_type) . ' Collection'
) ?>]
<?php endif ?>
<?php if($config->get("show_{$other_type}_collection")): ?>
[<?= $helper->a(
$url->generate("{$other_type}.collection.view") . $extraSegment,
<?php if($_->config->get("show_{$other_type}_collection")): ?>
[<?= $_->h->a(
$_->urlFromRoute("{$other_type}.collection.view") . $extraSegment,
ucfirst($other_type) . ' Collection'
) ?>]
<?php endif ?>
[<?= $helper->a(
$urlGenerator->defaultUrl($other_type) . $extraSegment,
[<?= $_->h->a(
$_->defaultUrl($other_type) . $extraSegment,
ucfirst($other_type) . ' List'
) ?>]
<?php else: ?>
<?= $helper->a(
$url->generate("{$url_type}.collection.view") . $extraSegment,
<?= $_->h->a(
$_->urlFromRoute("{$url_type}.collection.view") . $extraSegment,
$whose . ucfirst($url_type) . ' Collection',
['aria-current'=> 'page']
) ?>
<?php if($config->get("show_{$other_type}_collection")): ?>
[<?= $helper->a(
$url->generate("{$other_type}.collection.view") . $extraSegment,
<?php if($_->config->get("show_{$other_type}_collection")): ?>
[<?= $_->h->a(
$_->urlFromRoute("{$other_type}.collection.view") . $extraSegment,
ucfirst($other_type) . ' Collection'
) ?>]
<?php endif ?>
[<?= $helper->a($urlGenerator->defaultUrl('anime') . $extraSegment, 'Anime List') ?>]
[<?= $helper->a($urlGenerator->defaultUrl('manga') . $extraSegment, 'Manga List') ?>]
[<?= $_->h->a($_->defaultUrl('anime') . $extraSegment, 'Anime List') ?>]
[<?= $_->h->a($_->defaultUrl('manga') . $extraSegment, 'Manga List') ?>]
<?php endif ?>
<?php if ($auth->isAuthenticated() && $config->get(['cache', 'driver']) !== 'null'): ?>
<?php if ($_->isAuthenticated() && $_->config->get(['cache', 'driver']) !== 'null'): ?>
<span class="flex-no-wrap small-font">
<button type="button" class="js-clear-cache user-btn">Clear API Cache</button>
</span>
<?php endif ?>
</span>
<span class="flex-no-wrap small-font">[<?= $helper->a(
$url->generate('default_user_info'),
'About '. $config->get('whose_list')
<span class="flex-no-wrap small-font">[<?= $_->h->a(
$_->urlFromRoute('default_user_info'),
'About '. $_->config->get('whose_list')
) ?>]</span>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<span class="flex-no-wrap small-font">
<?= $helper->a(
$url->generate('settings'),
<?= $_->h->a(
$_->urlFromRoute('settings'),
'Settings',
['class' => 'bracketed']
) ?>
</span>
<span class="flex-no-wrap small-font">
<?= $helper->a(
$url->generate('logout'),
<?= $_->h->a(
$_->urlFromRoute('logout'),
'Logout',
['class' => 'bracketed']
) ?>
</span>
<?php else: ?>
<span class="flex-no-wrap small-font">
[<?= $helper->a($url->generate('login'), "{$whose} Login") ?>]
[<?= $_->h->a($_->urlFromRoute('login'), "{$whose} Login") ?>]
</span>
<?php endif ?>
</div>
<?php if ($container->get('util')->isViewPage() && ($hasAnime || $hasManga)): ?>
<?php if ($_->isViewPage() && ($hasAnime || $hasManga)): ?>
<nav>
<?= $helper->menu($menu_name) ?>
<?= $_->h->menu($menu_name) ?>
<?php if (stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'history') === FALSE): ?>
<br />
<ul>
<?php $currentView = Util::eq('list', $lastSegment) ? 'list' : 'cover' ?>
<li class="<?= Util::isNotSelected('list', $lastSegment) ?>">
<a aria-current="<?= Util::ariaCurrent($currentView === 'cover') ?>"
href="<?= $urlGenerator->url($route_path) ?>">Cover View</a>
href="<?= $_->urlFromPath($route_path) ?>">Cover View</a>
</li>
<li class="<?= Util::isSelected('list', $lastSegment) ?>">
<a aria-current="<?= Util::ariaCurrent($currentView === 'list') ?>"
href="<?= $urlGenerator->url("{$route_path}/list") ?>">List View</a>
href="<?= $_->urlFromPath("{$route_path}/list") ?>">List View</a>
</li>
</ul>
<?php endif ?>

View File

@ -1,4 +1,4 @@
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>Add Manga to your List</h2>
<form action="<?= $action_url ?>" method="post">

View File

@ -1,6 +1,6 @@
<main class="media-list">
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('manga.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute('manga.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -11,12 +11,12 @@
<?php foreach ($sections as $name => $items): ?>
<?php if (empty($items)): ?>
<section class="status">
<h2><?= $escape->html($name) ?></h2>
<h2><?= $_->escape->html($name) ?></h2>
<h3>There's nothing here!</h3>
</section>
<?php else: ?>
<section class="status">
<h2><?= $escape->html($name) ?></h2>
<h2><?= $_->escape->html($name) ?></h2>
<section class="media-wrap">
<?php foreach($items as $item): ?>
<?= $component->mangaCover($item, $name) ?>

View File

@ -1,7 +1,7 @@
<main class="details fixed">
<section class="flex flex-no-wrap">
<aside class="info">
<?= $helper->img($data['cover_image'], ['class' => 'cover', 'width' => '350']) ?>
<?= $_->h->img($data['cover_image'], ['class' => 'cover', 'width' => '350']) ?>
<br />
@ -72,14 +72,14 @@
<?php if (count($data['characters']) > 0): ?>
<h2>Characters</h2>
<?= $component->tabs('manga-characters', $data['characters'], static function($list, $role) use ($component, $helper, $url) {
<?= $component->tabs('manga-characters', $data['characters'], static function($list, $role) use ($component, $helper, $_) {
$rendered = [];
foreach ($list as $id => $char)
{
$rendered[] = $component->character(
$char['name'],
$url->generate('character', ['slug' => $char['slug']]),
$helper->img($char['image'], ['loading' => 'lazy']),
$_->urlFromRoute('character', ['slug' => $char['slug']]),
$_->h->img($char['image'], ['loading' => 'lazy']),
($role !== 'main') ? 'small-character' : 'character'
);
}
@ -95,8 +95,8 @@
fn($people) => implode('', array_map(
fn ($person) => $component->character(
$person['name'],
$url->generate('person', ['slug' => $person['slug']]),
$helper->img($person['image']),
$_->urlFromRoute('person', ['slug' => $person['slug']]),
$_->h->img($person['image']),
),
$people
))

View File

@ -1,4 +1,4 @@
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<main>
<h2>
Edit Manga List Item
@ -8,9 +8,9 @@
<thead>
<tr>
<th>
<h3><?= $escape->html($item['manga']['title']) ?></h3>
<h3><?= $_->escape->html($item['manga']['title']) ?></h3>
<?php foreach ($item['manga']['titles'] as $title): ?>
<h4><?= $escape->html($title) ?></h4>
<h4><?= $_->escape->html($title) ?></h4>
<?php endforeach ?>
</th>
</tr>
@ -18,7 +18,7 @@
<tbody>
<tr>
<td rowspan="9">
<?= $helper->img($item['manga']['image']) ?>
<?= $_->h->img($item['manga']['image']) ?>
</td>
</tr>
<tr>
@ -64,7 +64,7 @@
<tr>
<td><label for="notes">Notes</label></td>
<td>
<textarea name="notes" id="notes"><?= $escape->html($item['notes']) ?></textarea>
<textarea name="notes" id="notes"><?= $_->escape->html($item['notes']) ?></textarea>
</td>
</tr>
<tr>
@ -83,7 +83,7 @@
</form>
<fieldset>
<legend>Danger Zone</legend>
<form class="js-delete" action="<?= $url->generate('manga.delete') ?>" method="post">
<form class="js-delete" action="<?= $_->urlFromRoute('manga.delete') ?>" method="post">
<table class="form invisible">
<tbody>
<tr>

View File

@ -1,6 +1,6 @@
<main class="media-list">
<?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('manga.add.get') ?>">Add Item</a>
<?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $_->urlFromRoute('manga.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
@ -16,7 +16,7 @@
<table class='media-wrap'>
<thead>
<tr>
<?php if ($auth->isAuthenticated()): ?>
<?php if ($_->isAuthenticated()): ?>
<td>&nbsp;</td>
<?php endif ?>
<th>Title</th>
@ -29,9 +29,9 @@
<tbody>
<?php foreach($items as $item): ?>
<tr id="manga-<?= $item['id'] ?>">
<?php if($auth->isAuthenticated()): ?>
<?php if($_->isAuthenticated()): ?>
<td>
<a class="bracketed" href="<?= $url->generate('edit', [
<a class="bracketed" href="<?= $_->urlFromRoute('edit', [
'controller' => 'manga',
'id' => $item['id'],
'status' => $name
@ -39,7 +39,7 @@
</td>
<?php endif ?>
<td class="align-left">
<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
<a href="<?= $_->urlFromRoute('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $item['manga']['title'] ?>
</a>
<?php foreach($item['manga']['titles'] as $title): ?>
@ -75,4 +75,4 @@
<?php endforeach ?>
<?php endif ?>
</main>
<script defer="defer" src="<?= $urlGenerator->assetUrl('js/tables.min.js') ?>"></script>
<script defer="defer" src="<?= $_->assetUrl('js/tables.min.js') ?>"></script>

View File

@ -1,5 +1,5 @@
<div class="message <?= $escape->attr($message_type) ?>">
<div class="message <?= $_->escape->attr($message_type) ?>">
<span class="icon"></span>
<?= $escape->html($message) ?>
<?= $_->escape->html($message) ?>
<span class="close"></span>
</div>

View File

@ -1,7 +1,7 @@
<main class="details fixed">
<section class="flex flex-no-wrap">
<div>
<?= $helper->img($data['image'], ['class' => 'cover' ]) ?>
<?= $_->h->img($data['image'], ['class' => 'cover' ]) ?>
</div>
<div>
<h2 class="toph"><?= $data['name'] ?></h2>
@ -37,10 +37,10 @@
<section class="content media-wrap flex flex-wrap flex-justify-start">
<?php foreach ($casting as $sid => $series): ?>
<?php $mediaType = in_array($type, ['anime', 'manga'], TRUE) ? $type : 'anime'; ?>
<?= $component->media(
<?= $_->component->media(
$series['titles'],
$url->generate("{$mediaType}.details", ['id' => $series['slug']]),
$helper->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
$_->urlFromRoute("{$mediaType}.details", ['id' => $series['slug']]),
$_->h->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
) ?>
<?php endforeach; ?>
</section>
@ -55,21 +55,21 @@
<?php if ( ! empty($data['characters'])): ?>
<section>
<h3>Voice Acting Roles</h3>
<?= $component->tabs('voice-acting-roles', $data['characters'], static function ($characterList) use ($component, $helper, $url) {
<?= $component->tabs('voice-acting-roles', $data['characters'], static function ($characterList) use ($component, $helper, $_) {
$voiceRoles = [];
foreach ($characterList as $cid => $item):
$character = $component->character(
$item['character']['canonicalName'],
$url->generate('character', ['slug' => $item['character']['slug']]),
$helper->img($item['character']['image'], ['loading' => 'lazy']),
$_->urlFromRoute('character', ['slug' => $item['character']['slug']]),
$_->h->img($item['character']['image'], ['loading' => 'lazy']),
);
$medias = [];
foreach ($item['media'] as $sid => $series)
{
$medias[] = $component->media(
$series['titles'],
$url->generate('anime.details', ['id' => $series['slug']]),
$helper->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
$_->urlFromRoute('anime.details', ['id' => $series['slug']]),
$_->h->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
);
}
$media = implode('', array_map('mb_trim', $medias));

View File

@ -4,19 +4,19 @@
<?php $auth = $anilistModel->checkAuth(); ?>
<?php if (array_key_exists('errors', $auth)): ?>
<p class="static-message error">Anilist API Client is Not Authorized.</p>
<?= $helper->a(
$url->generate('anilist-redirect'),
<?= $_->h->a(
$_->urlFromRoute('anilist-redirect'),
'Link Anilist Account',
['class' => 'bracketed user-btn']
) ?>
<?php else: ?>
<?php $expires = $config->get(['anilist', 'access_token_expires']); ?>
<?php $expires = $_->config->get(['anilist', 'access_token_expires']); ?>
<p class="static-message info">
Linked to Anilist. Your access token will expire around <?= date('F j, Y, g:i a T', $expires) ?>
</p>
<?php require __DIR__ . '/_form.php' ?>
<?= $helper->a(
$url->generate('anilist-redirect'),
<?= $_->h->a(
$_->urlFromRoute('anilist-redirect'),
'Update Access Token',
['class' => 'bracketed user-btn']
) ?>

View File

@ -1,5 +1,5 @@
<article>
<label for="<?= $fieldName ?>"><?= $field['title'] ?></label><br />
<small><?= $field['description'] ?></small><br />
<?= $helper->field($fieldName, $field); ?>
<?= $_->h->field($fieldName, $field); ?>
</article>