本文整理汇总了PHP中Format::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::getChildren方法的具体用法?PHP Format::getChildren怎么用?PHP Format::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
/**
* 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";
}
示例2: 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";
}
示例3: 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();
?>
';
}
示例4: collectContent
private function collectContent($attrs)
{
if (isset($attrs[Reader::XMLNS_XML]["id"]) && $this->isChunkID($attrs[Reader::XMLNS_XML]["id"])) {
$id = $attrs[Reader::XMLNS_XML]["id"];
$this->lastContent = array("name" => Format::getShortDescription($id), "reference" => "res\\" . (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->ext, "hasChild" => count(Format::getChildren($id)) > 0);
}
}
示例5: format_tocsect2
public function format_tocsect2($open, $name, $attrs)
{
if (!isset($attrs[Reader::XMLNS_XML]["id"])) {
return "";
}
$id = $attrs[Reader::XMLNS_XML]["id"];
$hasChild = count(Format::getChildren($id)) > 0;
if ($open) {
$name = htmlspecialchars(Format::getShortDescription($id), ENT_QUOTES, 'UTF-8');
$url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
fwrite($this->getFileStream(), " <tocsect2 name=\"{$name}\" url=\"{$url}\"/>\n");
}
return "";
}
示例6: format_root_chunk
public function format_root_chunk($open, $name, $attrs)
{
$this->CURRENT_CHUNK = $this->CURRENT_ID = $id = $attrs[Reader::XMLNS_XML]["id"];
if ($open) {
$this->notify(Render::CHUNK, Render::OPEN);
return '<div id="' . $id . '" class="' . $name . '">';
}
$this->notify(Render::CHUNK, Render::CLOSE);
$chunks = Format::getChildren($id);
$content = '<ul class="chunklist chunklist_' . $name . '">';
foreach ($chunks as $chunkid) {
$href = $this->chunked ? $chunkid . $this->ext : "#{$chunkid}";
$long = Format::getLongDescription($chunkid);
$short = Format::getShortDescription($chunkid);
if ($long && $short && $long != $short) {
$content .= '<li><a href="' . $href . '">' . $short . '</a> — ' . $long;
} else {
$content .= '<li><a href="' . $href . '">' . ($long ? $long : $short) . '</a>';
}
$children = Format::getChildren($chunkid);
if (count($children)) {
$content .= '<ul class="chunklist chunklist_' . $name . ' chunklist_children">';
foreach (Format::getChildren($chunkid) as $childid) {
$href = $this->chunked ? $childid . $this->ext : "#{$childid}";
$long = Format::getLongDescription($childid);
$short = Format::getShortDescription($childid);
if ($long && $short && $long != $short) {
$content .= '<li><a href="' . $href . '">' . $short . '</a> — ' . $long . '</li>';
} else {
$content .= '<li><a href="' . $href . '">' . ($long ? $long : $short) . '</a></li>';
}
}
$content .= "</ul>";
}
$content .= "</li>";
}
$content .= "</ul></div>";
return $content;
}