mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-22 12:44:25 +00:00
order keywords by quantity matches in content
This commit is contained in:
parent
2682666b94
commit
8308ab28f9
@ -262,16 +262,26 @@ class TorrentController extends AbstractController
|
|||||||
|
|
||||||
// Generate keywords by extension
|
// Generate keywords by extension
|
||||||
$keywords = [];
|
$keywords = [];
|
||||||
|
|
||||||
foreach ($file->getFileList() as $item)
|
foreach ($file->getFileList() as $item)
|
||||||
{
|
{
|
||||||
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
||||||
{
|
{
|
||||||
$keywords[] = mb_strtolower($keyword);
|
$keyword = mb_strtolower($keyword);
|
||||||
|
|
||||||
|
if (isset($keywords[$keyword]))
|
||||||
|
{
|
||||||
|
$keywords[$keyword]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$keywords[$keyword] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$keywords = array_unique($keywords);
|
|
||||||
|
|
||||||
sort($keywords);
|
arsort($keywords);
|
||||||
|
|
||||||
// Push torrent
|
// Push torrent
|
||||||
$torrents[] =
|
$torrents[] =
|
||||||
@ -401,16 +411,26 @@ class TorrentController extends AbstractController
|
|||||||
|
|
||||||
// Generate keywords by extension
|
// Generate keywords by extension
|
||||||
$keywords = [];
|
$keywords = [];
|
||||||
|
|
||||||
foreach ($file->getFileList() as $item)
|
foreach ($file->getFileList() as $item)
|
||||||
{
|
{
|
||||||
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
||||||
{
|
{
|
||||||
$keywords[] = mb_strtolower($keyword);
|
$keyword = mb_strtolower($keyword);
|
||||||
|
|
||||||
|
if (isset($keywords[$keyword]))
|
||||||
|
{
|
||||||
|
$keywords[$keyword]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$keywords[$keyword] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$keywords = array_unique($keywords);
|
|
||||||
|
|
||||||
sort($keywords);
|
arsort($keywords);
|
||||||
|
|
||||||
// Push torrent
|
// Push torrent
|
||||||
$torrents[] =
|
$torrents[] =
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if torrents %}
|
{% if torrents %}
|
||||||
{% for torrent in torrents %}
|
{% for torrent in torrents %}
|
||||||
<div class="padding-16-px margin-y-8-px border-radius-3-px background-color-night{% if torrent.sensitive == true or torrent.approved == false %} opacity-06{% endif %}">
|
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night{% if torrent.sensitive == true or torrent.approved == false %} opacity-06{% endif %}">
|
||||||
<a name="{{ torrent.id }}"></a>
|
<a name="{{ torrent.id }}"></a>
|
||||||
<div class="margin-b-16-px">
|
<div class="margin-b-16-px">
|
||||||
<h2>
|
<h2>
|
||||||
@ -44,8 +44,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if torrent.keywords %}
|
{% if torrent.keywords %}
|
||||||
<div class="margin-b-16-px">
|
<div class="margin-b-16-px">
|
||||||
{% for keyword in torrent.keywords %}
|
{% for keyword, quantity in torrent.keywords %}
|
||||||
<a href="{{ path('torrent_search', { query : keyword | url_encode(true) }) }}">
|
<a href="{{ path('torrent_search', { query : keyword | url_encode(true) }) }}" title="{{ 'Contains' | trans }}: {{ quantity }}">
|
||||||
#{{ keyword }}
|
#{{ keyword }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user