implement cafeyn
This commit is contained in:
parent
fcb68a62dc
commit
d22c73b14f
42
epub.php
42
epub.php
|
@ -136,7 +136,47 @@
|
|||
$articleurl = str_replace('material', 'article/' . $entry->hash . '.json', $url);
|
||||
$articlejson = file_get_contents($articleurl);
|
||||
$article = json_decode($articlejson);
|
||||
$epub->AddPage($article->title, false, $article->title);
|
||||
|
||||
$content = '<h1>' . $article->title . '</h1>';
|
||||
$content .= '<b>' . $article->abstract . '</b>';
|
||||
|
||||
if (count($article->rubrics))
|
||||
{
|
||||
$content .= '<div>Rubriques: ' . implode(',', $article->rubrics) . '</div>';
|
||||
}
|
||||
if (count($article->authors))
|
||||
{
|
||||
$content .= '<div>Auteurs: ' . implode(',', $article->authors) . '</div>';
|
||||
}
|
||||
|
||||
foreach ($article->content->sections as $section)
|
||||
{
|
||||
foreach ($section->items as $item)
|
||||
{
|
||||
if ($item->type == 'text')
|
||||
{
|
||||
if ($item->class == 'quote')
|
||||
{
|
||||
$content .= '<blockquote>' .$item->content . '</blockquote>';
|
||||
}
|
||||
else if ($item->class == 'paragraphTitle')
|
||||
{
|
||||
$content .= '<h2>' .$item->content . '</h2>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= '<p>' .$item->content . '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if ($article->imageUrl)
|
||||
{
|
||||
$epub->AddPage('<img style="width: 100%" src="' . $article->imageUrl . '">', false, 'Page ' . $article->page, true);
|
||||
}*/
|
||||
$epub->AddPage($content, false, $article->title);
|
||||
|
||||
}
|
||||
write_epub($epub);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue