prepare mp refactor home and rss

This commit is contained in:
quenousimporte 2024-08-26 18:10:14 +02:00
parent cb59059a2b
commit b97f730205
1 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,11 @@
require 'settings.php';
require 'TPEpubCreator.php';
function add_mp_article($url, $context, $epub)
{
}
function get_mp_cookie()
{
global $mp_user;
@ -325,17 +330,18 @@
foreach ($items as $item)
{
$title = $item->title;
$url = $item->link;
$category = $item->xpath('dc:subject')[0];
$author = $item->xpath('dc:creator')[0];
$summary = $item->description;
$article = file_get_contents($item->link, false, $context);
$article = file_get_contents($url, false, $context);
$doc = new DOMDocument();
$doc->loadHTML($article);
$finder = new DomXPath($doc);
$title = $item->title;
$author = $item->xpath('dc:creator')[0];
$date = $item->pubDate;
$summary = $item->description;
// strip images
$toremove = $finder->query('//svg');
foreach ($toremove as $elt)
@ -355,7 +361,7 @@
$result = '<h1>' . $title . '</h1>';
$result .= '<p>' . $author . '</p>';
$result .= '<p>' . $item->pubDate . '</p>';
$result .= '<p>' . $date . '</p>';
$result .= '<p><b>' . $summary . '</b></p>';
$nodes = $finder->query('//div[contains(@class, "paywall-restricted-content")]');
@ -501,8 +507,6 @@
foreach ($items as $item)
{
$title = $item->title;
$category = $item->xpath('dc:subject')[0];
$author = $item->xpath('dc:creator')[0];
$summary = $item->description;
@ -662,7 +666,7 @@
<label for="forcempcookies">Force cookies</label>
<br>
<input id="mptoday" name="mptoday" type="checkbox" disabled>
<label for="mptoday">Today only</label>
<label for="mptoday">Today only</label>
<br>
<br><br>