refactor
This commit is contained in:
parent
c6f604c28b
commit
2a0274068a
24
epub.php
24
epub.php
|
@ -150,16 +150,6 @@
|
|||
return $temp_img_path;
|
||||
}
|
||||
|
||||
function inner_html($node)
|
||||
{
|
||||
$innerHTML = '';
|
||||
foreach ($node->childNodes as $childNode)
|
||||
{
|
||||
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
|
||||
}
|
||||
return $innerHTML;
|
||||
}
|
||||
|
||||
function get_json($url)
|
||||
{
|
||||
// cache json in case url expires
|
||||
|
@ -178,7 +168,7 @@
|
|||
}
|
||||
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
$date = (new DateTime('today'))->format('Ymd');
|
||||
$today = (new DateTime('today'))->format('Ymd');
|
||||
|
||||
if (isset($_POST['emptycache']) && $_POST['emptycache'])
|
||||
{
|
||||
|
@ -211,7 +201,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/' . $pubname . '.epub';
|
||||
$epub->title = $pubname . ' ' . $date ;
|
||||
$epub->title = $pubname . ' ' . $today ;
|
||||
|
||||
$list = (array)$publication->articles;
|
||||
$page = 1;
|
||||
|
@ -296,7 +286,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/lemonde.epub';
|
||||
$epub->title = 'Le Monde ' . $date ;
|
||||
$epub->title = 'Le Monde ' . $today;
|
||||
|
||||
$publication = get_json($url);
|
||||
$content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; });
|
||||
|
@ -382,7 +372,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/mediapart.epub';
|
||||
$epub->title = 'Mediapart - RSS ' . $date;
|
||||
$epub->title = 'Mediapart - RSS ' . $today;
|
||||
|
||||
// load feeds
|
||||
$feed = file_get_contents($feedurl);
|
||||
|
@ -412,7 +402,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/mediaparthome.epub';
|
||||
$epub->title = 'Mediapart - A la une ' . $date;
|
||||
$epub->title = 'Mediapart - A la une ' . $today;
|
||||
|
||||
$home = file_get_contents($homeurl, false, $context);
|
||||
$doc = new DOMDocument();
|
||||
|
@ -446,7 +436,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/newyorktimes.epub';
|
||||
$epub->title = 'The New York Times ' . $date;
|
||||
$epub->title = 'The New York Times ' . $today;
|
||||
|
||||
// load feeds
|
||||
$feed = file_get_contents($feedurl);
|
||||
|
@ -502,7 +492,7 @@
|
|||
$epub = new TPEpubCreator();
|
||||
$epub->temp_folder = 'temp/';
|
||||
$epub->epub_file = 'epub/newyorktimestoday.epub';
|
||||
$epub->title = 'The New York Times today\'s paper ' . $date;
|
||||
$epub->title = 'The New York Times today\'s paper ' . $today;
|
||||
|
||||
// grab today's paper
|
||||
$start = strpos($todaypage, "window.__preloadedData = ") + 25;
|
||||
|
|
Loading…
Reference in New Issue