diff --git a/epub.php b/epub.php index f1518fe..5c2b919 100644 --- a/epub.php +++ b/epub.php @@ -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 @@
- +