mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-03-09 01:46:14 -04:00
* More PHP type hints for Fever
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201
Related to https://github.com/FreshRSS/FreshRSS/issues/4200
* Detail
* Draft
* Progress
* More draft
* Fix thumbnail PHP type hint
https://github.com/FreshRSS/FreshRSS/issues/4215
* More types
* A bit more
* Refactor FreshRSS_Entry::fromArray
* Progress
* Starts to work
* Categories
* Fonctional
* Layout update
* Fix relative URLs
* Cache system
* Forgotten files
* Remove a debug line
* Automatic form validation of XPath expressions
* data-leave-validation
* Fix reload action
* Simpler examples
* Fix column type for PostgreSQL
* Enforce HTTP encoding
* Readme
* Fix get full content
* target="_blank"
* gitignore
* htmlspecialchars_utf8
* Implement HTML <base>
And fix/revert `xml:base` support in SimplePie e49c578817
* SimplePie upstream PR merged
https://github.com/simplepie/simplepie/pull/723
78 lines
2.1 KiB
PHTML
78 lines
2.1 KiB
PHTML
<?php
|
|
/** @var FreshRSS_View $this */
|
|
$username = Minz_Session::param('currentUser', '_');
|
|
|
|
$options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
|
|
|
$articles = array(
|
|
'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type,
|
|
'title' => $this->list_title,
|
|
'author' => $username,
|
|
'items' => array(),
|
|
);
|
|
|
|
echo rtrim(json_encode($articles, $options), " ]}\n\r\t"), "\n";
|
|
$first = true;
|
|
|
|
if (empty($this->entryIdsTagNames)) {
|
|
$this->entryIdsTagNames = array();
|
|
}
|
|
|
|
foreach ($this->entriesRaw as $entryRaw) {
|
|
if ($entryRaw == null) {
|
|
continue;
|
|
}
|
|
$entry = FreshRSS_Entry::fromArray($entryRaw);
|
|
if (!isset($this->feed)) {
|
|
$feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed());
|
|
if ($feed === null) {
|
|
$feed = $entry->feed(true);
|
|
}
|
|
} else {
|
|
$feed = $this->feed;
|
|
}
|
|
|
|
$article = array(
|
|
'id' => $entry->guid(),
|
|
'timestampUsec' => '' . $entry->id(),
|
|
'categories' => array_values($entry->tags()),
|
|
'title' => $entry->title(),
|
|
'author' => $entry->authors(true),
|
|
'published' => $entry->date(true),
|
|
'updated' => $entry->date(true),
|
|
'alternate' => array(array(
|
|
'href' => htmlspecialchars_decode($entry->link(), ENT_QUOTES),
|
|
'type' => 'text/html',
|
|
)),
|
|
'content' => array(
|
|
'content' => $entry->content(),
|
|
),
|
|
'origin' => array(
|
|
'streamId' => $feed == null ? '' : $feed->id(),
|
|
'title' => $feed == null ? '' : $feed->name(),
|
|
'htmlUrl' => $feed == null ? '' : $feed->website(),
|
|
'feedUrl' => $feed == null ? '' : $feed->url(),
|
|
)
|
|
);
|
|
$article['categories'][] = $entry->isRead() ? 'user/-/state/com.google/read' : 'user/-/state/com.google/unread';
|
|
if ($entry->isFavorite()) {
|
|
$article['categories'][] = 'user/-/state/com.google/starred';
|
|
}
|
|
$tagNames = isset($this->entryIdsTagNames['e_' . $entry->id()]) ? $this->entryIdsTagNames['e_' . $entry->id()] : array();
|
|
foreach ($tagNames as $tagName) {
|
|
$article['categories'][] = 'user/-/label/' . $tagName;
|
|
}
|
|
|
|
$line = json_encode($article, $options);
|
|
if ($line != '') {
|
|
if ($first) {
|
|
$first = false;
|
|
} else {
|
|
echo ",\n";
|
|
}
|
|
echo $line;
|
|
}
|
|
}
|
|
|
|
echo "\n]}\n";
|