Compare commits

..

2 Commits

Author SHA1 Message Date
quenousimporte 3e9dae2526 simplify params 2024-09-04 18:20:11 +02:00
quenousimporte 0f2449c3ca fix blockquotes 2024-09-04 18:20:01 +02:00
1 changed files with 14 additions and 17 deletions

View File

@ -17,8 +17,13 @@
$innerHTM = ''; $innerHTM = '';
foreach ($node->childNodes as $childNode){ foreach ($node->childNodes as $childNode){
$nodeHTML = $childNode->ownerDocument->saveHTML($childNode); $nodeHTML = $childNode->ownerDocument->saveHTML($childNode);
$nodeHTML = str_replace('<aside', '<b><i', $nodeHTML); $nodeHTML = str_replace('<aside', '<b><i', $nodeHTML);
$nodeHTML = str_replace('</aside', '</i></b', $nodeHTML); $nodeHTML = str_replace('</aside', '</i></b', $nodeHTML);
$nodeHTML = str_replace('<blockquote', '<b><i', $nodeHTML);
$nodeHTML = str_replace('</blockquote', '</i></b', $nodeHTML);
$innerHTML .= $nodeHTML; $innerHTML .= $nodeHTML;
} }
return '<div>' . strip_tags($innerHTML, '<p><b><h2><i><strong>') . '</div>'; return '<div>' . strip_tags($innerHTML, '<p><b><h2><i><strong>') . '</div>';
@ -185,7 +190,7 @@
// Cafeyn // Cafeyn
if (isset($_POST['cafeyn']) && $_POST['cafeyn']) if (isset($_POST['cafeyn']) && $_POST['cafeyn'])
{ {
$url = $_POST['cafeynurl']; $url = $_POST['cafeyn'];
// extract url from curl command // extract url from curl command
if (str_starts_with($url, 'curl ')) if (str_starts_with($url, 'curl '))
@ -284,7 +289,7 @@
// Le Monde // Le Monde
if (isset($_POST['lemonde']) && $_POST['lemonde']) if (isset($_POST['lemonde']) && $_POST['lemonde'])
{ {
$url = $_POST['lmurl']; $url = $_POST['lemonde'];
// extract url from curl command // extract url from curl command
if (str_starts_with($url, 'curl ')) if (str_starts_with($url, 'curl '))
@ -400,11 +405,7 @@
// Politis RSS // Politis RSS
if (isset($_POST['politis']) && $_POST['politis']) if (isset($_POST['politis']) && $_POST['politis'])
{ {
$issuenb = ''; $issuenb = $_POST['politis'];
if (isset($_POST['politisnb']))
{
$issuenb = $_POST['politisnb'];
}
$feedurl = 'https://www.politis.fr/flux-rss-politis-fr/'; $feedurl = 'https://www.politis.fr/flux-rss-politis-fr/';
$opts = [ $opts = [
'http' => [ 'http' => [
@ -432,7 +433,7 @@
$url = $item->link; $url = $item->link;
$article = file_get_contents($url, false, $context); $article = file_get_contents($url, false, $context);
if ($issuenb && !str_contains($article, ' dans lhebdo N° ' . $issuenb)) if (!str_contains($article, ' dans lhebdo N° ' . $issuenb))
{ {
continue; continue;
} }
@ -640,14 +641,12 @@
<label for="mptoday">Today only</label> <label for="mptoday">Today only</label>
<h2>Le Monde</h2> <h2>Le Monde</h2>
<input id="lemonde" name="lemonde" type="checkbox"> <label for="lemonde">"GetPublicationContentItems" json url: </label>
<label for="lemonde">From "GetPublicationContentItems" json url: </label> <input id="lemonde" name="lemonde">
<input name="lmurl">
<h2>Cafeyn</h2> <h2>Cafeyn</h2>
<input id="cafeyn" name="cafeyn" type="checkbox"> <label for="cafeyn">"material" json url: </label>
<label for="cafeyn">From "material" json url: </label> <input id="cafeyn" name="cafeyn">
<input name="cafeynurl">
<h2>The New York Times</h2> <h2>The New York Times</h2>
<input id="nyt" name="nyt" type="checkbox"> <input id="nyt" name="nyt" type="checkbox">
@ -657,9 +656,7 @@
<label for="nyttoday">From today's paper embedded script</label> <label for="nyttoday">From today's paper embedded script</label>
<h2>Politis</h2> <h2>Politis</h2>
<input id="politis" name="politis" type="checkbox"> <label for="politis">Issue number: </label><input id="politis" name="politis">
<label for="politis">From RSS.</label>
<label for="politisnb">Optional issue number: </label><input id="politisnb" name="politisnb">
<h2>Admin</h2> <h2>Admin</h2>
<input id="emptycache" name="emptycache" type="checkbox" checked> <input id="emptycache" name="emptycache" type="checkbox" checked>