本文整理汇总了PHP中Format::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::getParent方法的具体用法?PHP Format::getParent怎么用?PHP Format::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::getParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
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;
}
示例2: header
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;
}
示例3: header
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";
}
示例4: header
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();
?>
';
}
示例5: footer
/**
* Create the footer for the given page id and return it.
*
* In this instance, we return raw php with the pearweb manual footer call.
*
* @param string $id Page ID
*
* @return string Footer code
*/
public function footer($id)
{
$ext = $this->ext;
$parent = Format::getParent($id);
return '<?php manualFooter("' . $this->getFilename($id) . $ext . '", ' . var_export(Format::getLongDescription($id), true) . '); ?>';
}
示例6: format_tocnode
public function format_tocnode($open, $name, $attrs, $props, $newpage = false)
{
if ($open) {
if ($newpage) {
parent::getPdfDoc()->add(PdfWriter::PAGE);
} else {
parent::getPdfDoc()->add(PdfWriter::LINE_JUMP);
}
if (isset($attrs[Reader::XMLNS_XML]["base"]) && ($base = $attrs[Reader::XMLNS_XML]["base"])) {
parent::setChunkInfo("xml-base", $base);
}
if (isset($attrs[Reader::XMLNS_XML]["id"]) && ($id = $attrs[Reader::XMLNS_XML]["id"])) {
$parentId = Format::getParent($id);
if (isset($this->cchunk["id-to-outline"][$parentId])) {
$this->cchunk["id-to-outline"][$id] = parent::getPdfDoc()->createOutline(Format::getShortDescription($id), $this->cchunk["id-to-outline"][$parentId], false);
} else {
$this->cchunk["id-to-outline"][$id] = parent::getPdfDoc()->createOutline(Format::getShortDescription($id), $this->cchunk["root-outline"], false);
}
$this->setIdToPage($id);
}
parent::setChunkInfo("examplenumber", 0);
}
return "";
}