Example #1
0
        $cssData .= file_get_contents($value);
    }
    $book->addCSSFile("styles.css", "css1", $cssData);
    // This test requires you have an image, change "demo/cover-image.jpg" to match your location.
    $book->setCoverImage("Cover.jpg", file_get_contents($metadatas["ebook-cover-image"]), "image/jpeg");
    // Titre et courte description de l'ouvrage
    $cover = $content_start . '<h1>' . $metadatas["ebook-title"] . '</h1>' . "\n" . '<h2>' . _t('TAGS_BY') . ': ' . $metadatas["ebook-author"] . '</h2>' . "\n" . $metadatas["ebook-description"] . $bookEnd;
    $book->addChapter(_t('TAGS_ABOUT_THIS_EBOOK'), "Cover.html", $cover);
    // on recupere les include pour faire les chapitres
    preg_match_all("/{{include.*page=\"(.*)\".*class=\"(.*)\".*}}/U", $this->page["body"], $matches);
    foreach ($matches[1] as $nb => $pageWiki) {
        $page = $this->LoadPage($pageWiki);
        $url = explode('wakka.php', $this->config['base_url']);
        if (TEMPLATES_DEFAULT_CHARSET != 'UTF-8') {
            $contentpage = utf8_encode($content_start . str_replace('<img src="' . $url[0], '<img src="', $this->Format('{{include page="' . $pageWiki . '" class="' . $matches[2][$nb] . '"}}')) . $bookEnd);
        } else {
            $contentpage = $content_start . str_replace('<img src="' . $url[0], '<img src="', $this->Format('{{include page="' . $pageWiki . '" class="' . $matches[2][$nb] . '"}}')) . $bookEnd;
        }
        $book->addChapter(get_title_from_body($page), $pageWiki . ".html", $contentpage, false, EPub::EXTERNAL_REF_ADD);
    }
    $book->finalize();
    // Finalize the book, and build the archive.
    // Save book as a file relative to your script (for local ePub generation)
    // Notice that the extions .epub will be added by the script.
    // The second parameter is a directory name which is '.' by default. Don't use trailing slash!
    $book->saveBook($this->getPageTag(), 'cache');
    // Send the book to the client. ".epub" will be appended if missing.
    $zipData = $book->sendBook($this->getPageTag());
} else {
    echo $this->Header() . '<div class="alert alert-danger">' . _t('TAGS_NO_EBOOK_METADATAS') . '</div>' . $this->Footer();
}
Example #2
0
        }
    }
}
$text = '';
// affiche le resultat de la recherche
$resultat = $this->PageList($tags, $type, $nb, $tri, $template, $class, $lienedit);
if ($resultat) {
    $nb_total = count($resultat);
    foreach ($resultat as $page) {
        $element[$page['tag']]['tagnames'] = '';
        $element[$page['tag']]['tagbadges'] = '';
        $element[$page['tag']]['body'] = $page['body'];
        $element[$page['tag']]['owner'] = $page['owner'];
        $element[$page['tag']]['user'] = $page['user'];
        $element[$page['tag']]['time'] = $page['time'];
        $element[$page['tag']]['title'] = get_title_from_body($page);
        $element[$page['tag']]['image'] = get_image_from_body($page);
        $element[$page['tag']]['desc'] = tokenTruncate(strip_tags($this->Format($page['body'])), $nbcartrunc);
        $pagetags = $this->GetAllTriplesValues($page['tag'], 'http://outils-reseaux.org/_vocabulary/tag', '', '');
        foreach ($pagetags as $tag) {
            $element[$page['tag']]['tagnames'] .= sanitizeEntity($tag['value']) . ' ';
            $element[$page['tag']]['tagbadges'] .= '<span class="tag-label label label-primary">' . $tag['value'] . '</span>&nbsp;';
        }
    }
    $squel->set(array('elements' => $element));
    $text .= $squel->analyser();
} else {
    $nb_total = 0;
}
$output .= '<div class="alert alert-info">' . "\n";
if ($nb_total > 1) {