Files
FreshRSS/app/views/helpers/export/articles.phtml
Alexandre Alapetite fd33d92d41 Require PHP 5.5+ (#2495)
* Require PHP 5.5+

https://github.com/FreshRSS/FreshRSS/issues/2469#issuecomment-522255093
I think it would be reasonable to require PHP 5.5+ for the core of
FreshRSS after all.

As Frenzie said, WordPress currently requires PHP 5.6.20+, and it is the
most popular PHP application.

We would loose about 20% of the PHP servers according to
https://w3techs.com/technologies/details/pl-php/5/all but I expect this
number to drop fast after the release of CentOS 8 (CentOS accounts for
17% of Linux servers
https://w3techs.com/technologies/details/os-linux/all/all ).

Distributions:
* no impact on Ubuntu, Fedora, Alpine, OpenWRT, FreeBSD, OpenSuze,
Mageia, as all active versions have PHP > 7
* no impact on OpenSuze, Synology, as all active versions have PHP > 5.5
* we drop Debian 8 Jessie (-2020) - we keep supporting Debian 9 Stretch
(2017-06) - current is Debian 10 Buster
* we drop Red Hat 7 (-2024) - we keep supporting RHEL 8 (2019-05)
* we drop CentOS 7 (-2024) - we will support CentOS 8 (to be released
soonish)

When dropping older versions, I can better like when it is for a good
reason, and there is actually one with PHP 5.5, namely generators
(yield) https://php.net/language.generators.overview which I consider
using.

* Version note for JSON.php

* hex2bin

* Update .travis.yml

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
2019-08-20 14:55:43 +02:00

77 lines
2.1 KiB
PHTML

<?php
$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_EntryDAO::daoToEntry($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";