Example #1
0
    public function header($id)
    {
        $title = Format::getLongDescription($id);
        static $cssLinks = null;
        if ($cssLinks === null) {
            $cssLinks = $this->createCSSLinks();
        }
        $header = <<<HEADER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>{$title}</title>
{$cssLinks}
 </head>
 <body class="docs">
HEADER;
        $next = $prev = $up = array("href" => null, "desc" => null);
        $nextLink = $prevLink = $upLink = '';
        if ($prevId = Format::getPrevious($id)) {
            $prev = array("href" => $this->getFilename($prevId) . $this->getExt(), "desc" => $this->getShortDescription($prevId));
            $prevLink = "<li style=\"float: left;\"><a href=\"{$prev["href"]}\">« {$prev["desc"]}</a></li>";
        }
        if ($nextId = Format::getNext($id)) {
            $next = array("href" => $this->getFilename($nextId) . $this->getExt(), "desc" => $this->getShortDescription($nextId));
            $nextLink = "<li style=\"float: right;\"><a href=\"{$next["href"]}\">{$next["desc"]} »</a></li>";
        }
        if ($parentId = Format::getParent($id)) {
            $up = array("href" => $this->getFilename($parentId) . $this->getExt(), "desc" => $this->getShortDescription($parentId));
            if ($up['href'] != 'index.html') {
                $upLink = "<li><a href=\"{$up["href"]}\">{$up["desc"]}</a></li>";
            }
        }
        $nav = <<<NAV
<div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      {$prevLink}
      {$nextLink}
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    {$upLink}
    <li>{$title}</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content">
NAV;
        $header .= $nav;
        return $header;
    }
Example #2
0
File: Web.php Project: philip/phd
    /**
     * Add the header to this file.
     *
     * @param string $id The id of this chunk
     *
     * @return string
     */
    public function header($id)
    {
        $ext = $this->ext;
        $parent = Format::getParent($id);
        //we link toc feeds if there are children
        if (count($this->getChildren($id)) > 0) {
            $extraHeader = <<<XML
 <link rel="alternate" type="application/atom+xml" title="Live Bookmarks" href="feeds/{$id}.atom" />

XML;
        } else {
            $extraHeader = '';
        }
        if (!$parent || $parent == 'ROOT') {
            return '<?php
sendManualHeaders("UTF-8","en");
setupNavigation(array(
  "home" => array("index.php", "' . addslashes($this->title) . '"),
  "prev" => array("#", ""),
  "next" => array("#", ""),
  "up"   => array("#", ""),
  "toc"  => array(
    array("#", ""))));
manualHeader("index.php"' . ', ' . var_export($this->title, true) . ', ' . var_export($extraHeader, true) . ');
?>
';
        }
        $toc = array();
        $siblingIDs = Format::getChildren($parent);
        foreach ($siblingIDs as $sid) {
            $sdesc = Format::getShortDescription($sid);
            $ldesc = Format::getLongDescription($sid);
            $toc[] = array($sid . $ext, empty($sdesc) ? $ldesc : $sdesc);
        }
        $prev = $next = array(null, null);
        if ($prevID = Format::getPrevious($id)) {
            $prev = array(Format::getFilename($prevID) . $ext, Format::getLongDescription($prevID));
        }
        if ($nextID = Format::getNext($id)) {
            $next = array(Format::getFilename($nextID) . $ext, Format::getLongDescription($nextID));
        }
        // Build the PEAR navigation table
        $nav = array('home' => array('index' . $ext, $this->title), 'prev' => $prev, 'next' => $next, 'up' => array($this->getFilename($parent) . $ext, Format::getLongDescription($parent)), 'toc' => $toc);
        return "<?php \n" . "sendManualHeaders(\"UTF-8\", \"{$this->lang}\");\n" . "setupNavigation(" . var_export($nav, true) . ");\n" . 'manualHeader("' . $this->getFilename($id) . $ext . '"' . ', ' . var_export(Format::getLongDescription($id), true) . ', ' . var_export($extraHeader, true) . ');' . "\n" . "?>\n";
    }
Example #3
0
    public function header($id)
    {
        $title = Format::getLongDescription($id);
        static $cssLinks = null;
        if ($cssLinks === null) {
            $cssLinks = $this->createCSSLinks();
        }
        $header = <<<HEADER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>{$title}</title>
{$cssLinks}
 </head>
 <body>
HEADER;
        $parent = Format::getParent($id);
        $next = $prev = $up = array("href" => null, "desc" => null);
        if ($parent && $parent != "ROOT") {
            if ($prevId = Format::getPrevious($id)) {
                $prev = array("href" => $this->getFilename($prevId) . $this->getExt(), "desc" => $this->getShortDescription($prevId));
            }
            if ($nextId = Format::getNext($id)) {
                $next = array("href" => $this->getFilename($nextId) . $this->getExt(), "desc" => $this->getShortDescription($nextId));
            }
            if ($parentId = Format::getParent($id)) {
                $up = array("href" => $this->getFilename($parentId) . $this->getExt(), "desc" => $this->getShortDescription($parentId));
            }
        }
        $nav = <<<NAV
<div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="{$prev["href"]}">{$prev["desc"]}</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="{$next["href"]}">{$next["desc"]}</a></div>
 <div class="up"><a href="{$up["href"]}">{$up["desc"]}</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div>
NAV;
        $header .= $nav . "<hr />";
        $this->nav = $nav;
        return $header;
    }
Example #4
0
    public function header($id)
    {
        $title = Format::getShortDescription($id);
        $parent = Format::getParent($id);
        $next = $prev = $up = array(null, null);
        if ($parent && $parent != "ROOT") {
            $siblings = Format::getChildren($parent);
            if ($nextId = Format::getNext($id)) {
                $next = array(Format::getFilename($nextId) . $this->getExt(), Format::getShortDescription($nextId));
            }
            if ($prevId = Format::getPrevious($id)) {
                $prev = array(Format::getFilename($prevId) . $this->getExt(), Format::getShortDescription($prevId));
            }
            $up = array($parent . $this->getExt(), Format::getShortDescription($parent));
        }
        $this->nav = <<<NAV
<div style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="{$prev[0]}">{$prev[1]}</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="{$next[0]}">{$next[1]}</a></div>
 <div class="up"><a href="{$up[0]}">{$up[1]}</a></div>
</div>
NAV;
        return "<?php include_once '../include/init.inc.php'; echo site_header('{$title}');?>\n" . $this->nav . "<hr />\n";
    }
Example #5
0
    public function header($id)
    {
        static $written_toc = array();
        $ext = $this->getExt();
        $parent = Format::getParent($id);
        $filename = "toc" . DIRECTORY_SEPARATOR . $parent . ".inc";
        $up = array(0 => null, 1 => null);
        $incl = '';
        $next = $prev = array(null, null);
        if ($parent && $parent != "ROOT") {
            $siblings = Format::getChildren($parent);
            if (!isset($written_toc[$filename])) {
                $written_toc[$filename] = true;
                $toc = $toc_deprecated = array();
                foreach ($siblings as $sid) {
                    $sibling_short_desc = Format::getShortDescription($sid);
                    $entry = array(Format::getFilename($sid) . $ext, $sibling_short_desc);
                    if (isset($this->deprecated[$sibling_short_desc])) {
                        $toc_deprecated[] = $entry;
                    } else {
                        $toc[] = $entry;
                    }
                }
                $parents = array();
                $p = $parent;
                while (($p = Format::getParent($p)) && $p != "ROOT") {
                    $parents[] = array(Format::getFilename($p) . $ext, Format::getShortDescription($p));
                }
                $content = '<?php
$TOC = ' . var_export($toc, true) . ';
$TOC_DEPRECATED = ' . var_export($toc_deprecated, true) . ';
$PARENTS = ' . var_export($parents, true) . ';';
                file_put_contents($this->getOutputDir() . $filename, $content);
                v("Wrote TOC (%s)", $this->getOutputDir() . $filename, VERBOSE_TOC_WRITING);
            }
            $incl = 'include_once dirname(__FILE__) ."/toc/' . $parent . '.inc";';
            $up = array(Format::getFilename($parent) . $ext, Format::getShortDescription($parent));
            if ($prevId = Format::getPrevious($id)) {
                $prev = array(Format::getFilename($prevId) . $ext, Format::getShortDescription($prevId));
            }
            if ($nextId = Format::getNext($id)) {
                $next = array(Format::getFilename($nextId) . $ext, Format::getShortDescription($nextId));
            }
        }
        $setup = array("home" => array('index' . $ext, $this->getTitle()), "head" => array("UTF-8", $this->lang), "this" => array($id . $ext, Format::getShortDescription($id)), "up" => $up, "prev" => $prev, "next" => $next, "alternatives" => $this->cchunk["alternatives"]);
        if ($this->getChildren($id)) {
            $lang = Config::language();
            $setup["extra_header_links"] = array("rel" => "alternate", "href" => "/manual/{$lang}/feeds/{$id}.atom", "type" => "application/atom+xml");
        }
        $var = var_export($setup, true);
        return '<?php
include_once $_SERVER[\'DOCUMENT_ROOT\'] . \'/include/shared-manual.inc\';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
' . $incl . '
$setup = ' . $var . ';
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
';
    }
Example #6
0
    public function header($id)
    {
        $title = $this->getLongDescription($id);
        $lang = Config::language();
        $root = Format::getRootIndex();
        static $cssLinks = null;
        if ($cssLinks === null) {
            $cssLinks = $this->createCSSLinks();
        }
        $prev = $next = $parent = array("href" => null, "desc" => null);
        if ($parentId = $this->getParent($id)) {
            $parent = array("href" => $this->getFilename($parentId) . $this->getExt(), "desc" => $this->getShortDescription($parentId));
        }
        if ($prevId = Format::getPrevious($id)) {
            $prev = array("href" => Format::getFilename($prevId) . $this->getExt(), "desc" => $this->getShortDescription($prevId));
        }
        if ($nextId = Format::getNext($id)) {
            $next = array("href" => Format::getFilename($nextId) . $this->getExt(), "desc" => $this->getShortDescription($nextId));
        }
        $navBar = $this->createNavBar($id);
        return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $lang . '" lang="' . $lang . '">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>' . ($title != $root["ldesc"] ? $root["ldesc"] . ': ' : "") . $title . '</title>
' . $cssLinks . '
</head>
<body>
<table width="100%">
    <tr valign="top">
        <td style="font-size: smaller;" width="15%">
' . $navBar . '
        </td>
        <td width="85%">
            <div style="text-align: center;">
                ' . ($prevId ? '<div class="prev" style="text-align: left; float: left;"><a href="' . $prev["href"] . '">' . $prev["desc"] . '</a></div>' : '') . '
                ' . ($nextId ? '<div class="next" style="text-align: right; float: right;"><a href="' . $next["href"] . '">' . $next["desc"] . '</a></div>' : '') . '
                ' . ($parentId ? '<div class="up"><a href="' . $parent["href"] . '">' . $parent["desc"] . '</a></div>' : '') . '
                <div class="home"><a href="' . $root["filename"] . $this->getExt() . '">' . $root["ldesc"] . '</a></div>
            </div><hr/>
';
    }
Example #7
0
    /**
     * Generates the header HTML for the given ID.
     * Full doctype, html head, begin of body tag and top navigation.
     *
     * @param string $id Page ID
     *
     * @return string Header HTML
     */
    public function header($id)
    {
        $title = $this->getShortDescription($id);
        $lang = Config::language();
        static $cssLinks = null;
        if ($cssLinks === null) {
            $cssLinks = $this->createCSSLinks();
        }
        $this->prev = $this->next = $this->up = array("href" => null, "desc" => null);
        $strPrev = $strNext = '';
        if ($parentId = $this->getParent($id)) {
            $this->up = array("href" => $this->getFilename($parentId) . $this->ext, "desc" => $this->getShortDescription($parentId));
        }
        if ($prevId = Format::getPrevious($id)) {
            $this->prev = array("href" => Format::getFilename($prevId) . $this->ext, "desc" => $this->getShortDescription($prevId));
        }
        if ($nextId = Format::getNext($id)) {
            $this->next = array("href" => Format::getFilename($nextId) . $this->ext, "desc" => $this->getShortDescription($nextId));
        }
        $header = '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>' . $title . '</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <meta name="generator" content="PhD" />
' . $cssLinks . '
  <link rel="start" href="index.html" title="' . $this->title . '" />
';
        if ($this->up["href"]) {
            $header .= '  <link rel="up" href="' . $this->up["href"] . '" title="' . $this->up["desc"] . '" />
';
        }
        if ($this->prev["href"]) {
            $strPrev = '<a href="' . $this->prev["href"] . '" title="' . $this->prev["desc"] . '">Prev</a>';
            $header .= '  <link rel="prev" href="' . $this->prev["href"] . '" title="' . $this->prev["desc"] . '" />
';
        }
        if ($this->next["href"]) {
            $strNext = '<a href="' . $this->next["href"] . '" title="' . $this->next["desc"] . '">Next</a>';
            $header .= '  <link rel="next" href="' . $this->next["href"] . '" title="' . $this->next["desc"] . '" />
';
        }
        $header .= ' </head>
 <body>
';
        $nav = <<<NAV
<div class="navheader">
 <table style="width: 100%;">
  <tr><th colspan="3" style="text-align: center">{$title}</th></tr>
  <tr>
   <td style="width: 40%; text-align: left;">{$strPrev}</td>
   <td style="width: 20%;"></td>
   <td style="width: 40%; text-align: right;">{$strNext}</td>
  </tr>
 </table>
 <hr/>
</div>

NAV;
        $header .= $nav . "<div id=\"body\">\n";
        return $header;
    }