mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-10 11:25:04 -05:00
[add] rss for tag
This commit is contained in:
parent
4886ed6d36
commit
f778e47283
@ -446,8 +446,11 @@ class Poche
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'tags':
|
case 'tags':
|
||||||
|
$token = $this->user->getConfigValue('token');
|
||||||
$tags = $this->store->retrieveAllTags();
|
$tags = $this->store->retrieveAllTags();
|
||||||
$tpl_vars = array(
|
$tpl_vars = array(
|
||||||
|
'token' => $token,
|
||||||
|
'user_id' => $this->user->getId(),
|
||||||
'tags' => $tags,
|
'tags' => $tags,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -884,9 +887,9 @@ class Poche
|
|||||||
$_SESSION['poche_user']->setConfig($currentConfig);
|
$_SESSION['poche_user']->setConfig($currentConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateFeeds($token, $user_id, $type = 'home')
|
public function generateFeeds($token, $user_id, $tag_id, $type = 'home')
|
||||||
{
|
{
|
||||||
$allowed_types = array('home', 'fav', 'archive');
|
$allowed_types = array('home', 'fav', 'archive', 'tag');
|
||||||
$config = $this->store->getConfigUser($user_id);
|
$config = $this->store->getConfigUser($user_id);
|
||||||
|
|
||||||
if (!in_array($type, $allowed_types) ||
|
if (!in_array($type, $allowed_types) ||
|
||||||
@ -901,7 +904,13 @@ class Poche
|
|||||||
$feed->setChannelElement('updated', date(DATE_RSS , time()));
|
$feed->setChannelElement('updated', date(DATE_RSS , time()));
|
||||||
$feed->setChannelElement('author', 'poche');
|
$feed->setChannelElement('author', 'poche');
|
||||||
|
|
||||||
$entries = $this->store->getEntriesByView($type, $user_id);
|
if ($type == 'tag') {
|
||||||
|
$entries = $this->store->retrieveEntriesByTag($tag_id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$entries = $this->store->getEntriesByView($type, $user_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (count($entries) > 0) {
|
if (count($entries) > 0) {
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
$newItem = $feed->createNewItem();
|
$newItem = $feed->createNewItem();
|
||||||
|
@ -75,7 +75,8 @@ if (isset($_GET['login'])) {
|
|||||||
$poche->generateToken();
|
$poche->generateToken();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$poche->generateFeeds($_GET['token'], $_GET['user_id'], $_GET['type']);
|
$tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
|
||||||
|
$poche->generateFeeds($_GET['token'], $_GET['user_id'], $tag_id, $_GET['type']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
themes/default/img/default/rss.png
Normal file
BIN
themes/default/img/default/rss.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 288 B |
@ -4,5 +4,5 @@
|
|||||||
{% include '_menu.twig' %}
|
{% include '_menu.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% for tag in tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}
|
{% for tag in tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.value }}</a> {% if token != '' %}<a href="?feed&type=tag&user_id={{ user_id }}&tag_id={{ tag.id }}&token={{ token }}" target="_blank"><img src="{{ poche_url }}/themes/{{ theme }}/img/{{ theme }}/rss.png" /></a>{% endif %} {% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user