Compare commits
3 Commits
e5e7ab27e3
...
6aeeeb22ca
Author | SHA1 | Date |
---|---|---|
quenousimporte | 6aeeeb22ca | |
quenousimporte | 6bc2a004fd | |
quenousimporte | e6c226c100 |
|
@ -0,0 +1,12 @@
|
|||
RewriteEngine on
|
||||
|
||||
# Redirection du www vers non-www en HTTPS
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
|
||||
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# Redirection vers HTTPS
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteCond %{HTTP:X-Forwarded-Proto} !https
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# See https://ouvaton.coop/certificat-ssl/
|
15
epub.php
15
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
|
||||
|
@ -375,7 +380,8 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/mediapart.epub';
|
||||
$epub->title = 'Mediapart ' . $date;
|
||||
$epub->title = 'Mediapart RSS ' . $date;
|
||||
$epub->AddImage('https://www.mediapart.fr/icon-news-180x180.png', 'image/jpeg', true);
|
||||
|
||||
// load feeds
|
||||
$feed = file_get_contents($feedurl);
|
||||
|
@ -405,7 +411,8 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/mediaparthome.epub';
|
||||
$epub->title = 'Mediapart home ' . $date;
|
||||
$epub->title = 'Mediapart A la une ' . $date;
|
||||
$epub->AddImage('https://www.mediapart.fr/icon-news-180x180.png', 'image/jpeg', true);
|
||||
|
||||
$home = file_get_contents($homeurl, false, $context);
|
||||
$doc = new DOMDocument();
|
||||
|
@ -607,7 +614,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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue