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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?php use function Aviat\AnimeClient\colNotEmpty; ?> <?php use function Aviat\AnimeClient\colNotEmpty; ?>
<main class="media-list"> <main class="media-list">
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a> <a class="bracketed" href="<?= $_->urlFromRoute('anime.add.get') ?>">Add Item</a>
<?php endif ?> <?php endif ?>
<?php if (empty($sections)): ?> <?php if (empty($sections)): ?>
<h3>There's nothing here!</h3> <h3>There's nothing here!</h3>
@ -20,7 +20,7 @@
<table class='media-wrap'> <table class='media-wrap'>
<thead> <thead>
<tr> <tr>
<?php if($auth->isAuthenticated()): ?> <?php if($_->isAuthenticated()): ?>
<td class="no-border">&nbsp;</td> <td class="no-border">&nbsp;</td>
<?php endif ?> <?php endif ?>
<th>Title</th> <th>Title</th>
@ -35,11 +35,11 @@
</thead> </thead>
<tbody> <tbody>
<?php foreach($items as $item): ?> <?php foreach($items as $item): ?>
<?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?> <?php if ($item['private'] && ! $_->isAuthenticated()) continue; ?>
<tr id="a-<?= $item['id'] ?>"> <tr id="a-<?= $item['id'] ?>">
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<td> <td>
<a class="bracketed" href="<?= $url->generate('edit', [ <a class="bracketed" href="<?= $_->urlFromRoute('edit', [
'controller' => 'anime', 'controller' => 'anime',
'id' => $item['id'], 'id' => $item['id'],
'status' => $item['watching_status'] 'status' => $item['watching_status']
@ -47,7 +47,7 @@
</td> </td>
<?php endif ?> <?php endif ?>
<td class="align-left justify"> <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'] ?> <?= $item['anime']['title'] ?>
</a> </a>
<br /> <br />
@ -65,7 +65,7 @@
<?php foreach($item['anime']['streaming_links'] as $link): ?> <?php foreach($item['anime']['streaming_links'] as $link): ?>
<?php if ($link['meta']['link'] !== FALSE): ?> <?php if ($link['meta']['link'] !== FALSE): ?>
<a href="<?= $link['link'] ?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>"> <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', 'class' => 'small-streaming-logo',
'width' => 25, 'width' => 25,
'height' => 25, 'height' => 25,
@ -73,7 +73,7 @@
]) ?> ]) ?>
</a> </a>
<?php else: ?> <?php else: ?>
<?= $helper->img("/public/images/{$link['meta']['image']}", [ <?= $_->h->img("/public/images/{$link['meta']['image']}", [
'class' => 'small-streaming-logo', 'class' => 'small-streaming-logo',
'width' => 25, 'width' => 25,
'height' => 25, 'height' => 25,
@ -101,7 +101,7 @@
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</td> </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> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
@ -110,4 +110,4 @@
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
</main> </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"> <main class="character-page details fixed">
<section class="flex flex-no-wrap"> <section class="flex flex-no-wrap">
<aside> <aside>
<?= $helper->img($data['image']) ?> <?= $_->h->img($data['image']) ?>
</aside> </aside>
<div> <div>
<h2 class="toph"><?= $data['name'] ?></h2> <h2 class="toph"><?= $data['name'] ?></h2>
@ -34,14 +34,14 @@ use Aviat\AnimeClient\Kitsu;
<?php if ( ! (empty($data['media']['anime']) || empty($data['media']['manga']))): ?> <?php if ( ! (empty($data['media']['anime']) || empty($data['media']['manga']))): ?>
<h3>Media</h3> <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 = []; $rendered = [];
foreach ($media as $id => $item) foreach ($media as $id => $item)
{ {
$rendered[] = $component->media( $rendered[] = $_->component->media(
array_merge([$item['title']], $item['titles']), array_merge([$item['title']], $item['titles']),
$url->generate("{$mediaType}.details", ['id' => $item['slug']]), $_->urlFromRoute("{$mediaType}.details", ['id' => $item['slug']]),
$helper->img(Kitsu::getPosterImage($item), ['width' => 220, 'loading' => 'lazy']), $_->h->img(Kitsu::getPosterImage($item), ['width' => 220, 'loading' => 'lazy']),
); );
} }
@ -72,10 +72,10 @@ use Aviat\AnimeClient\Kitsu;
<td> <td>
<article class="character"> <article class="character">
<?php <?php
$link = $url->generate('person', ['id' => $c['person']['id']]); $link = $_->urlFromRoute('person', ['id' => $c['person']['id']]);
?> ?>
<a href="<?= $link ?>"> <a href="<?= $link ?>">
<?= $helper->img($c['person']['image']) ?> <?= $_->h->img($c['person']['image']) ?>
<div class="name"> <div class="name">
<?= $c['person']['name'] ?> <?= $c['person']['name'] ?>
</div> </div>
@ -87,11 +87,11 @@ use Aviat\AnimeClient\Kitsu;
<?php foreach ($c['series'] as $series): ?> <?php foreach ($c['series'] as $series): ?>
<article class="media"> <article class="media">
<?php <?php
$link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]); $link = $_->urlFromRoute('anime.details', ['id' => $series['attributes']['slug']]);
$titles = Kitsu::filterTitles($series['attributes']); $titles = Kitsu::filterTitles($series['attributes']);
?> ?>
<a href="<?= $link ?>"> <a href="<?= $link ?>">
<?= $helper->img(Kitsu::getPosterImage($series['attributes'])) ?> <?= $_->h->img(Kitsu::getPosterImage($series['attributes'])) ?>
</a> </a>
<div class="name"> <div class="name">
<a href="<?= $link ?>"> <a href="<?= $link ?>">
@ -115,18 +115,18 @@ use Aviat\AnimeClient\Kitsu;
<?php if ( ! empty($vas)): ?> <?php if ( ! empty($vas)): ?>
<h4>Voice Actors</h4> <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 = []; $castings = [];
foreach ($casting as $id => $c): foreach ($casting as $id => $c):
$person = $component->character( $person = $_->component->character(
$c['person']['name'], $c['person']['name'],
$url->generate('person', ['slug' => $c['person']['slug']]), $_->urlFromRoute('person', ['slug' => $c['person']['slug']]),
$helper->img($c['person']['image']['original']['url']), $_->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']), array_merge([$series['title']], $series['titles']),
$url->generate('anime.details', ['id' => $series['slug']]), $_->urlFromRoute('anime.details', ['id' => $series['slug']]),
$helper->img(Kitsu::getPosterImage($series)), $_->h->img(Kitsu::getPosterImage($series)),
), $c['series']); ), $c['series']);
$media = implode('', array_map('mb_trim', $medias)); $media = implode('', array_map('mb_trim', $medias));

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?php use function Aviat\AnimeClient\renderTemplate ?> <?php use function Aviat\AnimeClient\renderTemplate ?>
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<main> <main>
<h2>Edit Anime Collection Item</h2> <h2>Edit Anime Collection Item</h2>
<form action="<?= $action_url ?>" method="post"> <form action="<?= $action_url ?>" method="post">
@ -7,7 +7,7 @@
<tbody> <tbody>
<tr> <tr>
<td rowspan="6" class="align-center"> <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> </td>
</tr> </tr>
<tr> <tr>
@ -30,7 +30,7 @@
</tr> </tr>
<tr> <tr>
<td><label for="notes">Notes</label></td> <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>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
@ -44,7 +44,7 @@
</tbody> </tbody>
</table> </table>
</form> </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> <fieldset>
<legend>Danger Zone</legend> <legend>Danger Zone</legend>
<table class="form invisible"> <table class="form invisible">

View File

@ -1,12 +1,12 @@
<tr> <tr>
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<td> <td>
<a class="bracketed" <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> </td>
<?php endif ?> <?php endif ?>
<td class="align-left"> <td class="align-left">
<a href="<?= $url->generate('anime.details', ['id' => $item['slug']]) ?>"> <a href="<?= $_->urlFromRoute('anime.details', ['id' => $item['slug']]) ?>">
<?= $item['title'] ?> <?= $item['title'] ?>
</a> </a>
<?= ! empty($item['alternate_title']) ? ' <br /><small> ' . $item['alternate_title'] . '</small>' : '' ?> <?= ! empty($item['alternate_title']) ? ' <br /><small> ' . $item['alternate_title'] . '</small>' : '' ?>
@ -18,6 +18,6 @@
<td><?= $item['episode_length'] ?></td> <td><?= $item['episode_length'] ?></td>
<td><?= $item['show_type'] ?></td> <td><?= $item['show_type'] ?></td>
<td><?= $item['age_rating'] ?></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> <td class="align-left"><?= implode(', ', $item['genres']) ?></td>
</tr> </tr>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<main class="media-list"> <main class="media-list">
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('manga.add.get') ?>">Add Item</a> <a class="bracketed" href="<?= $_->urlFromRoute('manga.add.get') ?>">Add Item</a>
<?php endif ?> <?php endif ?>
<?php if (empty($sections)): ?> <?php if (empty($sections)): ?>
<h3>There's nothing here!</h3> <h3>There's nothing here!</h3>
@ -16,7 +16,7 @@
<table class='media-wrap'> <table class='media-wrap'>
<thead> <thead>
<tr> <tr>
<?php if ($auth->isAuthenticated()): ?> <?php if ($_->isAuthenticated()): ?>
<td>&nbsp;</td> <td>&nbsp;</td>
<?php endif ?> <?php endif ?>
<th>Title</th> <th>Title</th>
@ -29,9 +29,9 @@
<tbody> <tbody>
<?php foreach($items as $item): ?> <?php foreach($items as $item): ?>
<tr id="manga-<?= $item['id'] ?>"> <tr id="manga-<?= $item['id'] ?>">
<?php if($auth->isAuthenticated()): ?> <?php if($_->isAuthenticated()): ?>
<td> <td>
<a class="bracketed" href="<?= $url->generate('edit', [ <a class="bracketed" href="<?= $_->urlFromRoute('edit', [
'controller' => 'manga', 'controller' => 'manga',
'id' => $item['id'], 'id' => $item['id'],
'status' => $name 'status' => $name
@ -39,7 +39,7 @@
</td> </td>
<?php endif ?> <?php endif ?>
<td class="align-left"> <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'] ?> <?= $item['manga']['title'] ?>
</a> </a>
<?php foreach($item['manga']['titles'] as $title): ?> <?php foreach($item['manga']['titles'] as $title): ?>
@ -75,4 +75,4 @@
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
</main> </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> <span class="icon"></span>
<?= $escape->html($message) ?> <?= $_->escape->html($message) ?>
<span class="close"></span> <span class="close"></span>
</div> </div>

View File

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

View File

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

View File

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

View File

@ -19,6 +19,6 @@
<?php elseif ( ! empty($field['display'])): ?> <?php elseif ( ! empty($field['display'])): ?>
<?php include '_field.php' ?> <?php include '_field.php' ?>
<?php else: ?> <?php else: ?>
<?php $hiddenFields[] = $helper->field($fieldName, $field); ?> <?php $hiddenFields[] = $_->h->field($fieldName, $field); ?>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>

View File

@ -15,6 +15,6 @@
<?php if ( ! empty($field['display'])): ?> <?php if ( ! empty($field['display'])): ?>
<?php include '_field.php' ?> <?php include '_field.php' ?>
<?php else: ?> <?php else: ?>
<?php $hiddenFields[] = $helper->field($fieldName, $field); ?> <?php $hiddenFields[] = $_->h->field($fieldName, $field); ?>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>

View File

@ -1,5 +1,5 @@
<?php <?php
if ( ! $auth->isAuthenticated()) if ( ! $_->isAuthenticated())
{ {
echo '<h1>Not Authorized</h1>'; echo '<h1>Not Authorized</h1>';
return; return;
@ -16,7 +16,7 @@ $hiddenFields = [];
$nestedPrefix = 'config'; $nestedPrefix = 'config';
?> ?>
<form action="<?= $url->generate('settings-post') ?>" method="POST"> <form action="<?= $_->urlFromRoute('settings-post') ?>" method="POST">
<main class='settings form'> <main class='settings form'>
<button type="submit">Save Changes</button> <button type="submit">Save Changes</button>
<div class="tabs"> <div class="tabs">

View File

@ -2,7 +2,7 @@
use function Aviat\AnimeClient\checkFolderPermissions; use function Aviat\AnimeClient\checkFolderPermissions;
$setupErrors = checkFolderPermissions($container->get('config')); $setupErrors = checkFolderPermissions($_->config);
?> ?>
<?php if ( ! empty($setupErrors)): ?> <?php if ( ! empty($setupErrors)): ?>

View File

@ -4,7 +4,7 @@ use Aviat\AnimeClient\Kitsu;
<main class="user-page details"> <main class="user-page details">
<h2 class="toph"> <h2 class="toph">
About About
<?= $helper->a( <?= $_->h->a(
"https://kitsu.io/users/{$data['slug']}", "https://kitsu.io/users/{$data['slug']}",
$data['name'], [ $data['name'], [
'title' => 'View profile on Kitsu' 'title' => 'View profile on Kitsu'
@ -17,9 +17,9 @@ use Aviat\AnimeClient\Kitsu;
<table class="media-details invisible"> <table class="media-details invisible">
<tr> <tr>
<?php if($data['avatar'] !== null): ?> <?php if($data['avatar'] !== null): ?>
<td><?= $helper->img($data['avatar'], ['alt' => '', 'width' => '225']); ?></td> <td><?= $_->h->img($data['avatar'], ['alt' => '', 'width' => '225']); ?></td>
<?php endif ?> <?php endif ?>
<td><?= $escape->html($data['about']) ?></td> <td><?= $_->escape->html($data['about']) ?></td>
</tr> </tr>
</table> </table>
<br /> <br />
@ -41,20 +41,20 @@ use Aviat\AnimeClient\Kitsu;
<?php if ($data['website'] !== null): ?> <?php if ($data['website'] !== null): ?>
<tr> <tr>
<td>Website</td> <td>Website</td>
<td><?= $helper->a($data['website'], $data['website']) ?></td> <td><?= $_->h->a($data['website'], $data['website']) ?></td>
</tr> </tr>
<?php endif ?> <?php endif ?>
<?php if ($data['waifu']['character'] !== null): ?> <?php if ($data['waifu']['character'] !== null): ?>
<tr> <tr>
<td><?= $escape->html($data['waifu']['label']) ?></td> <td><?= $_->escape->html($data['waifu']['label']) ?></td>
<td> <td>
<?php <?php
$character = $data['waifu']['character']; $character = $data['waifu']['character'];
echo $component->character( echo $_->component->character(
$character['names']['canonical'], $character['names']['canonical'],
$url->generate('character', ['slug' => $character['slug']]), $_->urlFromRoute('character', ['slug' => $character['slug']]),
$helper->img(Kitsu::getImage($character)) $_->h->img(Kitsu::getImage($character))
); );
?> ?>
</td> </td>
@ -75,8 +75,7 @@ use Aviat\AnimeClient\Kitsu;
<article> <article>
<?php if ( ! empty($data['favorites'])): ?> <?php if ( ! empty($data['favorites'])): ?>
<h3>Favorites</h3> <h3>Favorites</h3>
<?= $component->tabs('user-favorites', $data['favorites'], static function ($items, $type) use ($component, $helper, $url) { <?= $_->component->tabs('user-favorites', $data['favorites'], static function ($items, $type) use ($_) {
$rendered = [];
if ($type === 'character') if ($type === 'character')
{ {
uasort($items, fn ($a, $b) => $a['names']['canonical'] <=> $b['names']['canonical']); uasort($items, fn ($a, $b) => $a['names']['canonical'] <=> $b['names']['canonical']);
@ -86,28 +85,21 @@ use Aviat\AnimeClient\Kitsu;
uasort($items, fn ($a, $b) => $a['titles']['canonical'] <=> $b['titles']['canonical']); uasort($items, fn ($a, $b) => $a['titles']['canonical'] <=> $b['titles']['canonical']);
} }
foreach ($items as $id => $item) $rendered = array_map(fn ($item) => match ($type) {
{ 'character' => $_->component->character(
if ($type === 'character') $item['names']['canonical'],
{ $_->urlFromRoute('character', ['slug' => $item['slug']]),
$rendered[] = $component->character( $_->h->img(Kitsu::getImage($item))
$item['names']['canonical'], ),
$url->generate('character', ['slug' => $item['slug']]), default => $_->component->media(
$helper->img(Kitsu::getImage($item)) array_merge(
); [$item['titles']['canonical']],
} Kitsu::getFilteredTitles($item['titles']),
else ),
{ $_->urlFromRoute("{$type}.details", ['id' => $item['slug']]),
$rendered[] = $component->media( $_->h->img(Kitsu::getPosterImage($item), ['width' => 220]),
array_merge( ),
[$item['titles']['canonical']], }, $items);
Kitsu::getFilteredTitles($item['titles']),
),
$url->generate("{$type}.details", ['id' => $item['slug']]),
$helper->img(Kitsu::getPosterImage($item), ['width' => 220]),
);
}
}
return implode('', array_map('mb_trim', $rendered)); return implode('', array_map('mb_trim', $rendered));