Exemplo n.º 1
0
/**
 * Show Template
 *
 * @author Jad Bou Chebl
 * @version 2009-01-10
 * @param string $template
 */
function showTpl($template)
{
    global $_SESSION;
    global $cssIncludes, $jsIncludes, $id1, $id2, $jsOnReady, $title, $content;
    $tpl = file_get_contents(PROJECT_TPL_PATH . $template);
    $tpl = str_replace("\$projectName", PROJECT_NAME, $tpl);
    $cssIncludes ? $tpl = str_replace("\$cssIncludes", $cssIncludes, $tpl) : ($tpl = str_replace("\$cssIncludes", "", $tpl));
    $jsIncludes ? $tpl = str_replace("\$jsIncludes", $jsIncludes, $tpl) : ($tpl = str_replace("\$jsIncludes", "", $tpl));
    $id1 ? $tpl = str_replace("\$id1", $id1, $tpl) : ($tpl = str_replace("\$id1", "", $tpl));
    $id2 ? $tpl = str_replace("\$id2", $id2, $tpl) : ($tpl = str_replace("\$id2", "", $tpl));
    $jsOnReady ? $tpl = str_replace("\$jsOnReady", $jsOnReady, $tpl) : ($tpl = str_replace("\$jsOnReady", "", $tpl));
    $title ? $tpl = str_replace("\$title", $title, $tpl) : ($tpl = str_replace("\$title", "", $tpl));
    $content ? $tpl = str_replace("\$content", $content, $tpl) : ($tpl = str_replace("\$content", "", $tpl));
    /**
     * Manage common includes
     */
    $tpl = str_replace("\$left_menu", file_get_contents(PROJECT_PATH . 'ssi/left_menu.html'), $tpl);
    $tpl = str_replace("\$chapters", getChapters(null), $tpl);
    $tpl = str_replace("\$banner1", getBanner(null, 1), $tpl);
    $tpl = str_replace("\$under_banner_left", file_get_contents(PROJECT_PATH . 'ssi/under_banner_left.html'), $tpl);
    $tpl = str_replace("\$login", include $_SESSION['fe_us_id'] ? 'ssi/logout.php' : 'ssi/login.php', $tpl);
    $tpl = str_replace("\$right_links", include 'ssi/right_links.php', $tpl);
    $tpl = str_replace("\$under_right_links", include 'ssi/under_right_links.php', $tpl);
    $tpl = str_replace("\$banner5", getBanner(null, 5), $tpl);
    $tpl = str_replace("\$footer", file_get_contents(PROJECT_PATH . 'ssi/footer.html'), $tpl);
    print $tpl;
    exit;
}
Exemplo n.º 2
0
function fetchMangaData($mangaUrl)
{
    // getChapters :: String -> Maybe (Collection Chapter)
    return getChapters($mangaUrl)->map(function (Collection $chapters) {
        return $chapters->bind(function (Chapter $chapter) {
            // getChapterPages :: Chapter -> Maybe (Collection Page)
            return getChapterPages($chapter)->bind(function (Collection $pages) use($chapter) {
                return $pages->bind(function (Page $page) use($chapter) {
                    // getPagesImageURL :: Page -> Maybe (Collection PageImage)
                    return getPagesImageURL($page)->bind(function (Collection $images) use($chapter, $page) {
                        return $images->bind(function (PageImage $image) use($chapter, $page) {
                            return Maybe\Just::of(new ChapterPage($chapter, $page, $image));
                        });
                    });
                });
            });
        });
    });
}