Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 30 additions and 23 deletions
Showing only changes of commit e6b534078f - Show all commits

View File

@ -76,12 +76,18 @@
</tbody> </tbody>
</table> </table>
<?php endif ?> <?php endif ?>
<?php if ( ! empty($show_data['trailer_id'])): ?>
<hr />
<h4>Trailer</h4>
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?= $show_data['trailer_id'] ?>" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<?php endif ?>
</div> </div>
</section> </section>
<?php if (count($characters) > 0): ?> <?php if (count($characters) > 0): ?>
<hr />
<h2>Characters</h2> <h2>Characters</h2>
<section class="align_left media-wrap"> <section class="align_center media-wrap">
<?php foreach($characters as $id => $char): ?> <?php foreach($characters as $id => $char): ?>
<?php if ( ! empty($char['image']['original'])): ?> <?php if ( ! empty($char['image']['original'])): ?>
<article class="character"> <article class="character">

View File

@ -31,7 +31,7 @@ class AnimeTransformer extends AbstractTransformer {
* @param array $item API library item * @param array $item API library item
* @return array * @return array
*/ */
public function transform($item) public function transform($item): array
{ {
$item['included'] = JsonAPI::organizeIncludes($item['included']); $item['included'] = JsonAPI::organizeIncludes($item['included']);
@ -42,21 +42,22 @@ class AnimeTransformer extends AbstractTransformer {
$titles = Kitsu::filterTitles($item); $titles = Kitsu::filterTitles($item);
return [ return [
'id' => $item['id'],
'slug' => $item['slug'],
'title' => $titles[0],
'titles' => $titles,
'status' => Kitsu::getAiringStatus($item['startDate'], $item['endDate']),
'cover_image' => $item['posterImage']['small'],
'show_type' => $this->string($item['showType'])->upperCaseFirst()->__toString(),
'episode_count' => $item['episodeCount'],
'episode_length' => $item['episodeLength'],
'synopsis' => $item['synopsis'],
'age_rating' => $item['ageRating'], 'age_rating' => $item['ageRating'],
'age_rating_guide' => $item['ageRatingGuide'], 'age_rating_guide' => $item['ageRatingGuide'],
'url' => "https://kitsu.io/anime/{$item['slug']}", 'cover_image' => $item['posterImage']['small'],
'episode_count' => $item['episodeCount'],
'episode_length' => $item['episodeLength'],
'genres' => $item['genres'], 'genres' => $item['genres'],
'streaming_links' => Kitsu::parseStreamingLinks($item['included']) 'id' => $item['id'],
'show_type' => $this->string($item['showType'])->upperCaseFirst()->__toString(),
'slug' => $item['slug'],
'status' => Kitsu::getAiringStatus($item['startDate'], $item['endDate']),
'streaming_links' => Kitsu::parseStreamingLinks($item['included']),
'synopsis' => $item['synopsis'],
'title' => $titles[0],
'titles' => $titles,
'trailer_id' => $item['youtubeVideoId'],
'url' => "https://kitsu.io/anime/{$item['slug']}",
]; ];
} }
} }

View File

@ -149,7 +149,7 @@ class Controller {
* @throws NotFoundException * @throws NotFoundException
* @return void * @return void
*/ */
public function setSessionRedirect(string $url = NULL) public function setSessionRedirect(string $url = NULL): void
{ {
$serverParams = $this->request->getServerParams(); $serverParams = $this->request->getServerParams();
@ -252,13 +252,13 @@ class Controller {
$csp = [ $csp = [
"default-src 'self'", "default-src 'self'",
"object-src 'none'", "object-src 'none'",
"child-src 'none'", "frame-src *.youtube.com",
]; ];
$view->addHeader('Content-Security-Policy', implode('; ', $csp)); $view->addHeader('Content-Security-Policy', implode('; ', $csp));
$view->appendOutput($this->loadPartial($view, 'header', $data)); $view->appendOutput($this->loadPartial($view, 'header', $data));
if (array_key_exists('message', $data) && is_array($data['message'])) if (array_key_exists('message', $data) && \is_array($data['message']))
{ {
$view->appendOutput($this->loadPartial($view, 'message', $data['message'])); $view->appendOutput($this->loadPartial($view, 'message', $data['message']));
} }
@ -300,7 +300,7 @@ class Controller {
* @throws \Aviat\Ion\Di\NotFoundException * @throws \Aviat\Ion\Di\NotFoundException
* @return void * @return void
*/ */
public function errorPage(int $httpCode, string $title, string $message, string $long_message = "") public function errorPage(int $httpCode, string $title, string $message, string $long_message = ''): void
{ {
$this->outputHTML('error', [ $this->outputHTML('error', [
'title' => $title, 'title' => $title,
@ -314,7 +314,7 @@ class Controller {
* *
* @return void * @return void
*/ */
public function redirectToDefaultRoute() public function redirectToDefaultRoute(): void
{ {
$defaultType = $this->config->get(['routes', 'route_config', 'default_list']) ?? 'anime'; $defaultType = $this->config->get(['routes', 'route_config', 'default_list']) ?? 'anime';
$this->redirect($this->urlGenerator->defaultUrl($defaultType), 303); $this->redirect($this->urlGenerator->defaultUrl($defaultType), 303);
@ -328,7 +328,7 @@ class Controller {
* @param string $type * @param string $type
* @return void * @return void
*/ */
public function setFlashMessage(string $message, string $type = "info") public function setFlashMessage(string $message, string $type = 'info'): void
{ {
static $messages; static $messages;
@ -406,7 +406,7 @@ class Controller {
* @throws DoubleRenderException * @throws DoubleRenderException
* @return void * @return void
*/ */
protected function outputJSON($data = 'Empty response', int $code = 200) protected function outputJSON($data = 'Empty response', int $code = 200): void
{ {
(new JsonView($this->container)) (new JsonView($this->container))
->setStatusCode($code) ->setStatusCode($code)
@ -421,7 +421,7 @@ class Controller {
* @param int $code * @param int $code
* @return void * @return void
*/ */
protected function redirect(string $url, int $code) protected function redirect(string $url, int $code): void
{ {
$http = new HttpView($this->container); $http = new HttpView($this->container);
$http->redirect($url, $code); $http->redirect($url, $code);