And more snake case to camel case
This commit is contained in:
parent
b902464446
commit
365da603fa
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->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">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -10,9 +10,9 @@
|
|||||||
<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->is_authenticated()) continue; ?>
|
<?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?>
|
||||||
<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->is_authenticated()): ?>
|
<?php if ($auth->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 ?>
|
||||||
<img src="<?= $item['anime']['image'] ?>" alt="" />
|
<img src="<?= $item['anime']['image'] ?>" alt="" />
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="edit">
|
<span class="edit">
|
||||||
<a class="bracketed" title="Edit information about this anime" href="<?= $urlGenerator->url("anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
|
<a class="bracketed" title="Edit information about this anime" href="<?= $urlGenerator->url("anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
|
||||||
@ -85,6 +85,6 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</main>
|
</main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<script defer="defer" src="<?= $urlGenerator->assetUrl('js.php/g/edit') ?>"></script>
|
<script defer="defer" src="<?= $urlGenerator->assetUrl('js.php/g/edit') ?>"></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->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">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if($auth->is_authenticated()): ?>
|
<?php if($auth->isAuthenticated()): ?>
|
||||||
<td class="no_border"> </td>
|
<td class="no_border"> </td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
@ -26,9 +26,9 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($items as $item): ?>
|
<?php foreach($items as $item): ?>
|
||||||
<?php if ($item['private'] && ! $auth->is_authenticated()) continue; ?>
|
<?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?>
|
||||||
<tr id="a-<?= $item['id'] ?>">
|
<tr id="a-<?= $item['id'] ?>">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<td>
|
<td>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->url("/anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
|
<a class="bracketed" href="<?= $urlGenerator->url("/anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
|
||||||
</td>
|
</td>
|
||||||
@ -86,5 +86,5 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</main>
|
</main>
|
||||||
<?php $group = ($auth->is_authenticated()) ? 'table_edit' : 'table' ?>
|
<?php $group = ($auth->isAuthenticated()) ? 'table_edit' : 'table' ?>
|
||||||
<script defer="defer" src="<?= $urlGenerator->assetUrl("js.php/g/{$group}") ?>"></script>
|
<script defer="defer" src="<?= $urlGenerator->assetUrl("js.php/g/{$group}") ?>"></script>
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<main>
|
<main>
|
||||||
<h2>Add Anime to your Collection</h2>
|
<h2>Add Anime to your Collection</h2>
|
||||||
<form action="<?= $action_url ?>" method="post">
|
<form action="<?= $action_url ?>" method="post">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $url->generate('collection.add.get') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $url->generate('collection.add.get') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -19,7 +19,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="edit"><a class="bracketed" href="<?= $urlGenerator->url("collection/edit/{$item['hummingbird_id']}") ?>">Edit</a></span>
|
<span class="edit"><a class="bracketed" href="<?= $urlGenerator->url("collection/edit/{$item['hummingbird_id']}") ?>">Edit</a></span>
|
||||||
<?php /*<span class="delete"><a class="bracketed" href="<?= $urlGenerator->url("collection/delete/{$item['hummingbird_id']}") ?>">Delete</a></span> */ ?>
|
<?php /*<span class="delete"><a class="bracketed" href="<?= $urlGenerator->url("collection/delete/{$item['hummingbird_id']}") ?>">Delete</a></span> */ ?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->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">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->fullUrl('collection/add', 'anime') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $urlGenerator->fullUrl('collection/add', 'anime') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if($auth->is_authenticated()): ?>
|
<?php if($auth->isAuthenticated()): ?>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($items as $item): ?>
|
<?php foreach($items as $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if($auth->is_authenticated()): ?>
|
<?php if($auth->isAuthenticated()): ?>
|
||||||
<td>
|
<td>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->fullUrl("collection/edit/{$item['hummingbird_id']}") ?>">Edit</a>
|
<a class="bracketed" href="<?= $urlGenerator->fullUrl("collection/edit/{$item['hummingbird_id']}") ?>">Edit</a>
|
||||||
<?php /*<a class="bracketed" href="<?= $urlGenerator->fullUrl("collection/delete/{$item['hummingbird_id']}") ?>">Delete</a>*/ ?>
|
<?php /*<a class="bracketed" href="<?= $urlGenerator->fullUrl("collection/delete/{$item['hummingbird_id']}") ?>">Delete</a>*/ ?>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
[<a href="<?= $urlGenerator->defaultUrl('manga') ?>">Manga List</a>]
|
[<a href="<?= $urlGenerator->defaultUrl('manga') ?>">Manga List</a>]
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</span>
|
</span>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<span class="flex-no-wrap"> </span>
|
<span class="flex-no-wrap"> </span>
|
||||||
<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>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<span class="flex-no-wrap"> </span>
|
<span class="flex-no-wrap"> </span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<span class="flex-no-wrap small-font">
|
<span class="flex-no-wrap small-font">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $url->generate('logout') ?>">Logout</a>
|
<a class="bracketed" href="<?= $url->generate('logout') ?>">Logout</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
[<a href="<?= $url->generate('login'); ?>"><?= $config->get('whose_list') ?>'s Login</a>]
|
[<a href="<?= $url->generate('login'); ?>"><?= $config->get('whose_list') ?>'s Login</a>]
|
||||||
@ -37,8 +37,8 @@
|
|||||||
<?= $helper->menu($menu_name) ?>
|
<?= $helper->menu($menu_name) ?>
|
||||||
<br />
|
<br />
|
||||||
<ul>
|
<ul>
|
||||||
<li class="<?= Util::is_not_selected('list', $urlGenerator->last_segment()) ?>"><a href="<?= $urlGenerator->url($route_path) ?>">Cover View</a></li>
|
<li class="<?= Util::is_not_selected('list', $urlGenerator->lastSegment()) ?>"><a href="<?= $urlGenerator->url($route_path) ?>">Cover View</a></li>
|
||||||
<li class="<?= Util::is_selected('list', $urlGenerator->last_segment()) ?>"><a href="<?= $urlGenerator->url("{$route_path}/list") ?>">List View</a></li>
|
<li class="<?= Util::is_selected('list', $urlGenerator->lastSegment()) ?>"><a href="<?= $urlGenerator->url("{$route_path}/list") ?>">List View</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->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">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->url('manga/add') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $urlGenerator->url('manga/add') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
<section class="media-wrap">
|
<section class="media-wrap">
|
||||||
<?php foreach($items as $item): ?>
|
<?php foreach($items as $item): ?>
|
||||||
<article class="media" id="manga-<?= $item['id'] ?>">
|
<article class="media" id="manga-<?= $item['id'] ?>">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->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>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="edit">
|
<span class="edit">
|
||||||
<a class="bracketed" title="Edit information about this manga" href="<?= $urlGenerator->url("manga/edit/{$item['id']}/{$name}") ?>">Edit</a>
|
<a class="bracketed" title="Edit information about this manga" href="<?= $urlGenerator->url("manga/edit/{$item['id']}/{$name}") ?>">Edit</a>
|
||||||
@ -55,6 +55,6 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</main>
|
</main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<script defer="defer" src="<?= $urlGenerator->assetUrl('js.php/g/edit') ?>"></script>
|
<script defer="defer" src="<?= $urlGenerator->assetUrl('js.php/g/edit') ?>"></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
@ -1,4 +1,4 @@
|
|||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<main>
|
<main>
|
||||||
<h1>
|
<h1>
|
||||||
Edit <?= $item['manga']['titles'][0] ?>
|
Edit <?= $item['manga']['titles'][0] ?>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<main>
|
<main>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->url('manga/add') ?>">Add Item</a>
|
<a class="bracketed" href="<?= $urlGenerator->url('manga/add') ?>">Add Item</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (empty($sections)): ?>
|
<?php if (empty($sections)): ?>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ($auth->is_authenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<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->is_authenticated()): ?>
|
<?php if($auth->isAuthenticated()): ?>
|
||||||
<td>
|
<td>
|
||||||
<a class="bracketed" href="<?= $urlGenerator->url("manga/edit/{$item['id']}/{$name}") ?>">Edit</a>
|
<a class="bracketed" href="<?= $urlGenerator->url("manga/edit/{$item['id']}/{$name}") ?>">Edit</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -102,7 +102,7 @@ class Auth {
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function is_authenticated()
|
public function isAuthenticated()
|
||||||
{
|
{
|
||||||
return ($this->get_auth_token() !== FALSE);
|
return ($this->get_auth_token() !== FALSE);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class Anime extends BaseController {
|
|||||||
*/
|
*/
|
||||||
public function index($type = AnimeWatchingStatus::WATCHING, string $view = NULL)
|
public function index($type = AnimeWatchingStatus::WATCHING, string $view = NULL)
|
||||||
{
|
{
|
||||||
$type_title_map = [
|
$typeTitleMap = [
|
||||||
'all' => 'All',
|
'all' => 'All',
|
||||||
AnimeWatchingStatus::WATCHING => 'Currently Watching',
|
AnimeWatchingStatus::WATCHING => 'Currently Watching',
|
||||||
AnimeWatchingStatus::PLAN_TO_WATCH => 'Plan to Watch',
|
AnimeWatchingStatus::PLAN_TO_WATCH => 'Plan to Watch',
|
||||||
@ -88,7 +88,7 @@ class Anime extends BaseController {
|
|||||||
AnimeWatchingStatus::COMPLETED => 'Completed'
|
AnimeWatchingStatus::COMPLETED => 'Completed'
|
||||||
];
|
];
|
||||||
|
|
||||||
$model_map = [
|
$modelMap = [
|
||||||
'watching' => AnimeWatchingStatus::WATCHING,
|
'watching' => AnimeWatchingStatus::WATCHING,
|
||||||
'plan_to_watch' => AnimeWatchingStatus::PLAN_TO_WATCH,
|
'plan_to_watch' => AnimeWatchingStatus::PLAN_TO_WATCH,
|
||||||
'on_hold' => AnimeWatchingStatus::ON_HOLD,
|
'on_hold' => AnimeWatchingStatus::ON_HOLD,
|
||||||
@ -97,21 +97,21 @@ class Anime extends BaseController {
|
|||||||
'completed' => AnimeWatchingStatus::COMPLETED
|
'completed' => AnimeWatchingStatus::COMPLETED
|
||||||
];
|
];
|
||||||
|
|
||||||
$title = (array_key_exists($type, $type_title_map))
|
$title = (array_key_exists($type, $typeTitleMap))
|
||||||
? $this->config->get('whose_list') .
|
? $this->config->get('whose_list') .
|
||||||
"'s Anime List · {$type_title_map[$type]}"
|
"'s Anime List · {$typeTitleMap[$type]}"
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
$view_map = [
|
$viewMap = [
|
||||||
'' => 'cover',
|
'' => 'cover',
|
||||||
'list' => 'list'
|
'list' => 'list'
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = ($type !== 'all')
|
$data = ($type !== 'all')
|
||||||
? $this->model->getList($model_map[$type])
|
? $this->model->getList($modelMap[$type])
|
||||||
: $this->model->get_all_lists();
|
: $this->model->get_all_lists();
|
||||||
|
|
||||||
$this->outputHTML('anime/' . $view_map[$view], [
|
$this->outputHTML('anime/' . $viewMap[$view], [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'sections' => $data
|
'sections' => $data
|
||||||
]);
|
]);
|
||||||
|
@ -33,11 +33,11 @@ class AnimeCollection extends Collection {
|
|||||||
*/
|
*/
|
||||||
public function getCollection()
|
public function getCollection()
|
||||||
{
|
{
|
||||||
$raw_collection = $this->_getCollection();
|
$rawCollection = $this->getCollectionFromDatabase();
|
||||||
|
|
||||||
$collection = [];
|
$collection = [];
|
||||||
|
|
||||||
foreach ($raw_collection as $row)
|
foreach ($rawCollection as $row)
|
||||||
{
|
{
|
||||||
if (array_key_exists($row['media'], $collection))
|
if (array_key_exists($row['media'], $collection))
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ class AnimeCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _getCollection()
|
private function getCollectionFromDatabase()
|
||||||
{
|
{
|
||||||
if ( ! $this->validDatabase)
|
if ( ! $this->validDatabase)
|
||||||
{
|
{
|
||||||
@ -183,13 +183,13 @@ class AnimeCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Get the details of a collection item
|
* Get the details of a collection item
|
||||||
*
|
*
|
||||||
* @param int $hummingbird_id
|
* @param int $kitsuId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get($hummingbird_id)
|
public function get($kitsuId)
|
||||||
{
|
{
|
||||||
$query = $this->db->from('anime_set')
|
$query = $this->db->from('anime_set')
|
||||||
->where('hummingbird_id', $hummingbird_id)
|
->where('hummingbird_id', $kitsuId)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $query->fetch(PDO::FETCH_ASSOC);
|
return $query->fetch(PDO::FETCH_ASSOC);
|
||||||
@ -198,16 +198,16 @@ class AnimeCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Update genre information for selected anime
|
* Update genre information for selected anime
|
||||||
*
|
*
|
||||||
* @param int $anime_id The current anime
|
* @param int $animeId The current anime
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function updateGenre($anime_id)
|
private function updateGenre($animeId)
|
||||||
{
|
{
|
||||||
$genre_info = $this->getGenreData();
|
$genreInfo = $this->getGenreData();
|
||||||
extract($genre_info);
|
extract($genreInfo);
|
||||||
|
|
||||||
// Get api information
|
// Get api information
|
||||||
$anime = $this->animeModel->getAnimeById($anime_id);
|
$anime = $this->animeModel->getAnimeById($animeId);
|
||||||
|
|
||||||
foreach ($anime['genres'] as $genre)
|
foreach ($anime['genres'] as $genre)
|
||||||
{
|
{
|
||||||
@ -222,23 +222,23 @@ class AnimeCollection extends Collection {
|
|||||||
|
|
||||||
// Update link table
|
// Update link table
|
||||||
// Get id of genre to put in link table
|
// Get id of genre to put in link table
|
||||||
$flipped_genres = array_flip($genres);
|
$flippedGenres = array_flip($genres);
|
||||||
|
|
||||||
$insert_array = [
|
$insertArray = [
|
||||||
'hummingbird_id' => $anime_id,
|
'hummingbird_id' => $animeId,
|
||||||
'genre_id' => $flipped_genres[$genre]
|
'genre_id' => $flippedGenres[$genre]
|
||||||
];
|
];
|
||||||
|
|
||||||
if (array_key_exists($anime_id, $links))
|
if (array_key_exists($animeId, $links))
|
||||||
{
|
{
|
||||||
if ( ! in_array($flipped_genres[$genre], $links[$anime_id]))
|
if ( ! in_array($flippedGenres[$genre], $links[$animeId]))
|
||||||
{
|
{
|
||||||
$this->db->set($insert_array)->insert('genre_anime_set_link');
|
$this->db->set($insertArray)->insert('genre_anime_set_link');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->set($insert_array)->insert('genre_anime_set_link');
|
$this->db->set($insertArray)->insert('genre_anime_set_link');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
use Aviat\Ion\StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base for routing/url classes
|
* Base for routing/url classes
|
||||||
*/
|
*/
|
||||||
class RoutingBase {
|
class RoutingBase {
|
||||||
|
|
||||||
use \Aviat\Ion\StringWrapper;
|
use StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection Container
|
* Injection Container
|
||||||
@ -47,7 +48,7 @@ class RoutingBase {
|
|||||||
* Route configuration options
|
* Route configuration options
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $route_config;
|
protected $routeConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -58,9 +59,9 @@ class RoutingBase {
|
|||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->config = $container->get('config');
|
$this->config = $container->get('config');
|
||||||
$base_routes = $this->config->get('routes');
|
$baseRoutes = $this->config->get('routes');
|
||||||
$this->routes = $base_routes['routes'];
|
$this->routes = $baseRoutes['routes'];
|
||||||
$this->route_config = $base_routes['route_config'];
|
$this->routeConfig = $baseRoutes['route_config'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,11 +72,11 @@ class RoutingBase {
|
|||||||
*/
|
*/
|
||||||
public function __get($key)
|
public function __get($key)
|
||||||
{
|
{
|
||||||
$routing_config =& $this->route_config;
|
$routingConfig =& $this->routeConfig;
|
||||||
|
|
||||||
if (array_key_exists($key, $routing_config))
|
if (array_key_exists($key, $routingConfig))
|
||||||
{
|
{
|
||||||
return $routing_config[$key];
|
return $routingConfig[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,13 +89,13 @@ class RoutingBase {
|
|||||||
{
|
{
|
||||||
$request = $this->container->get('request');
|
$request = $this->container->get('request');
|
||||||
$path = $request->getUri()->getPath();
|
$path = $request->getUri()->getPath();
|
||||||
$cleaned_path = $this->string($path)
|
$cleanedPath = $this->string($path)
|
||||||
->replace('%20', '')
|
->replace('%20', '')
|
||||||
->trim()
|
->trim()
|
||||||
->trimRight('/')
|
->trimRight('/')
|
||||||
->ensureLeft('/');
|
->ensureLeft('/');
|
||||||
|
|
||||||
return (string)$cleaned_path;
|
return (string)$cleanedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +115,7 @@ class RoutingBase {
|
|||||||
* @param int $num
|
* @param int $num
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function get_segment($num)
|
public function getSegment($num)
|
||||||
{
|
{
|
||||||
$segments = $this->segments();
|
$segments = $this->segments();
|
||||||
return (array_key_exists($num, $segments)) ? $segments[$num] : NULL;
|
return (array_key_exists($num, $segments)) ? $segments[$num] : NULL;
|
||||||
@ -125,7 +126,7 @@ class RoutingBase {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function last_segment()
|
public function lastSegment()
|
||||||
{
|
{
|
||||||
$segments = $this->segments();
|
$segments = $this->segments();
|
||||||
return end($segments);
|
return end($segments);
|
||||||
|
@ -19,13 +19,13 @@ class RoutingBaseTest extends AnimeClient_TestCase {
|
|||||||
'requestUri' => ' // ',
|
'requestUri' => ' // ',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'segments' => ['', ''],
|
'segments' => ['', ''],
|
||||||
'last_segment' => NULL
|
'lastSegment' => NULL
|
||||||
],
|
],
|
||||||
'three_segments' => [
|
'three_segments' => [
|
||||||
'requestUri' => '/anime/watching/list ',
|
'requestUri' => '/anime/watching/list ',
|
||||||
'path' => '/anime/watching/list',
|
'path' => '/anime/watching/list',
|
||||||
'segments' => ['', 'anime', 'watching', 'list'],
|
'segments' => ['', 'anime', 'watching', 'list'],
|
||||||
'last_segment' => 'list'
|
'lastSegment' => 'list'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -43,11 +43,11 @@ class RoutingBaseTest extends AnimeClient_TestCase {
|
|||||||
|
|
||||||
$this->assertEquals($path, $this->routingBase->path(), "Path is invalid");
|
$this->assertEquals($path, $this->routingBase->path(), "Path is invalid");
|
||||||
$this->assertEquals($segments, $this->routingBase->segments(), "Segments array is invalid");
|
$this->assertEquals($segments, $this->routingBase->segments(), "Segments array is invalid");
|
||||||
$this->assertEquals($lastSegment, $this->routingBase->last_segment(), "Last segment is invalid");
|
$this->assertEquals($lastSegment, $this->routingBase->lastSegment(), "Last segment is invalid");
|
||||||
|
|
||||||
foreach($segments as $i => $value)
|
foreach($segments as $i => $value)
|
||||||
{
|
{
|
||||||
$this->assertEquals($value, $this->routingBase->get_segment($i), "Segment {$i} is invalid");
|
$this->assertEquals($value, $this->routingBase->getSegment($i), "Segment {$i} is invalid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user