当前位置: 首页>>代码示例>>PHP>>正文


PHP Format::getFilename方法代码示例

本文整理汇总了PHP中Format::getFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::getFilename方法的具体用法?PHP Format::getFilename怎么用?PHP Format::getFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Format的用法示例。


在下文中一共展示了Format::getFilename方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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";
    }
开发者ID:philip,项目名称:phd,代码行数:52,代码来源:Web.php

示例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";
    }
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:24,代码来源:HowTo.php

示例3: format_link

 /**
  * Format a link for an element
  *
  * @param bool   $open  If the link should be opened.
  * @param string $name  Name of the element.
  * @param array  $attrs Attributes present for the element. Array keys are the attribute namespaces.
  * @param array  $props Properties
  *
  * @return string
  */
 public function format_link($open, $name, $attrs, $props)
 {
     if ($open) {
         $content = $fragment = '';
         $class = $name;
         if (isset($attrs[Reader::XMLNS_DOCBOOK]['linkend'])) {
             $linkto = $attrs[Reader::XMLNS_DOCBOOK]['linkend'];
             $id = $href = Format::getFilename($linkto);
             if ($id != $linkto) {
                 $fragment = "#{$linkto}";
             }
             if ($this->chunked) {
                 $href .= $this->ext;
             }
         } elseif (isset($attrs[Reader::XMLNS_XLINK]['href'])) {
             $href = $attrs[Reader::XMLNS_XLINK]['href'];
             $class .= ' external';
         }
         if ($name == 'xref') {
             if ($this->chunked) {
                 $link = $href;
             } else {
                 $link = '#';
                 if (isset($linkto)) {
                     $link .= $linkto;
                 } else {
                     $link .= $href;
                 }
             }
             return '<a href="' . htmlspecialchars($link) . '" class="' . $class . '">' . ($content . Format::getShortDescription($id)) . '</a>';
         } elseif ($props['empty']) {
             if ($this->chunked) {
                 $link = '';
             } else {
                 $link = '#';
             }
             return '<a href="' . $link . $href . $fragment . '" class="' . $class . '">' . $content . $href . $fragment . '</a>';
         } else {
             if ($this->chunked) {
                 $link = $href . $fragment;
             } elseif (isset($linkto)) {
                 if ($fragment) {
                     $link = $fragment;
                 } else {
                     $link = "#{$href}";
                 }
             } else {
                 $link = $href;
             }
             return '<a href="' . htmlspecialchars($link) . '" class="' . $class . '">' . $content;
         }
     }
     return '</a>';
 }
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:64,代码来源:XHTML.php

示例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();
?>
';
    }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:66,代码来源:Web.php

示例5: 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);
     }
 }
开发者ID:philip,项目名称:phd,代码行数:7,代码来源:CHM.php

示例6: header

    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/>
';
    }
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:43,代码来源:ChunkedXHTML.php

示例7: format_refentry

 public function format_refentry($open, $name, $attrs)
 {
     if (!isset($attrs[Reader::XMLNS_XML]["id"])) {
         return "";
     }
     $id = $attrs[Reader::XMLNS_XML]["id"];
     if ($open) {
         $this->currentEntryName = null;
     }
     if (!$open && $this->currentEntryName) {
         $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
         $this->index[$this->currentEntryName] = $url;
     }
     return "";
 }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:15,代码来源:KDevelop.php

示例8: format_type_text

 public function format_type_text($type, $tagname)
 {
     $type = trim(preg_replace('/[ \\n\\t]+/', ' ', $type));
     $t = strtolower($type);
     $href = $fragment = "";
     switch ($t) {
         case "bool":
             $href = "language.types.boolean";
             break;
         case "int":
         case "long":
             $href = "language.types.integer";
             break;
         case "double":
             $href = "language.types.float";
             break;
         case "void":
         case "boolean":
         case "integer":
         case "float":
         case "string":
         case "array":
         case "object":
         case "resource":
         case "null":
         case "callable":
             $href = "language.types.{$t}";
             break;
         case "mixed":
         case "number":
         case "callback":
             // old name for callable
             $href = "language.pseudo-types";
             $fragment = "language.types.{$t}";
             break;
         case "array|object":
             $href = "language.pseudo-types";
             $fragment = "language.types.array-object";
             break;
         default:
             /* Check if its a classname. */
             $t = strtolower(str_replace(array("_", "::", "->"), array("-", "-", "-"), $t));
             $href = Format::getFilename("class.{$t}");
     }
     parent::getPdfDoc()->setFont(PdfWriter::FONT_NORMAL, 12, array(0, 0, 1));
     // blue
     $linkAreas = parent::getPdfDoc()->add(PdfWriter::LINK_ANNOTATION, $type);
     $linksToResolve = parent::getChunkInfo("links-to-resolve");
     if (!isset($linksToResolve[$href])) {
         $linksToResolve[$href] = array();
     }
     foreach ($linkAreas as $area) {
         $linksToResolve[$href][] = $area;
     }
     parent::setChunkInfo("links-to-resolve", $linksToResolve);
     parent::getPdfDoc()->revertFont();
     return '';
 }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:58,代码来源:PDF.php

示例9: format_type_text

 public function format_type_text($type, $tagname)
 {
     $t = strtr(strtolower($type), "_", "-");
     $href = $fragment = "";
     switch ($t) {
         case "bool":
             $href = "language.types.boolean";
             break;
         case "int":
             $href = "language.types.integer";
             break;
         case "double":
             $href = "language.types.float";
             break;
         case "boolean":
         case "integer":
         case "float":
         case "string":
         case "array":
         case "object":
         case "resource":
         case "null":
         case "callable":
             $href = "language.types.{$t}";
             break;
         case "mixed":
         case "number":
         case "callback":
             // old name for callable
             $href = "language.pseudo-types";
             $fragment = "language.types.{$t}";
             break;
         case "array|object":
             $href = "language.pseudo-types";
             $fragment = "language.types.array-object";
             break;
         default:
             /* Check if its a classname. */
             $href = Format::getFilename("class.{$t}");
     }
     if ($href && $this->chunked) {
         return '<a href="' . $href . $this->getExt() . ($fragment ? "#{$fragment}" : "") . '" class="' . $tagname . ' ' . $type . '">' . $type . '</a>';
     }
     if ($href) {
         return '<a href="#' . ($fragment ? $fragment : $href) . '" class="' . $tagname . ' ' . $type . '">' . $type . '</a>';
     }
     return '<span class="' . $tagname . ' ' . $type . '">' . $type . '</span>';
 }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:48,代码来源:XHTML.php

示例10: header

    /**
     * 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;
    }
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:70,代码来源:ChunkedXHTML.php


注:本文中的Format::getFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。