add today only for mp

This commit is contained in:
quenousimporte 2024-08-27 10:40:26 +02:00
parent e5e7ab27e3
commit e6c226c100
1 changed files with 7 additions and 2 deletions

View File

@ -19,6 +19,11 @@
function add_mp_article($url, $context, $epub)
{
if (isset($_POST['mptoday']) && $_POST['mptoday'] && !str_contains($url, (new DateTime('today'))->format('dmy')))
{
return;
}
$article = file_get_contents($url, false, $context);
$doc = new DOMDocument();
$doc->loadHTML($article);
@ -26,7 +31,7 @@
$title = $finder->query('//h1')->item(0)->textContent;
$author = $finder->query('//a[contains(@href, "biographie")]')->item(0)->textContent;
$date = $finder->query('//time')->item(1)->textContent;
$date = trim($finder->query('//time')->item(1)->textContent);
$summary = $finder->query('//p[contains(@class, "news__heading__top__intro")]')->item(0)->textContent;
// strip images
@ -607,7 +612,7 @@
<input id="forcempcookies" name="forcempcookies" type="checkbox">
<label for="forcempcookies">Force cookies</label>
<br>
<input id="mptoday" name="mptoday" type="checkbox" disabled>
<input id="mptoday" name="mptoday" type="checkbox">
<label for="mptoday">Today only</label>
<br>