本文整理汇总了PHP中Docs::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Docs::url方法的具体用法?PHP Docs::url怎么用?PHP Docs::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Docs
的用法示例。
在下文中一共展示了Docs::url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parse a comment to extract the description and the tags
*
* @param string the comment retreived using ReflectionClass->getDocComment()
* @return array array(string $description, array $tags)
*/
public static function parse($comment)
{
// Normalize all new lines to \n
$comment = str_replace(array("\r\n", "\n"), "\n", $comment);
// Remove the phpdoc open/close tags and split
$comment = array_slice(explode("\n", $comment), 1, -1);
// Tag content
$tags = array();
foreach ($comment as $i => $line) {
// Remove all leading whitespace
$line = preg_replace('/^\\s*\\* ?/m', '', $line);
// Search this line for a tag
if (preg_match('/^@(\\S+)(?:\\s*(.+))?$/', $line, $matches)) {
// This is a tag line
unset($comment[$i]);
$name = $matches[1];
$text = isset($matches[2]) ? $matches[2] : '';
switch ($name) {
case 'license':
if (strpos($text, '://') !== FALSE) {
// Convert the lincense into a link
$text = HTML::anchor($text);
}
break;
case 'link':
$text = preg_split('/\\s+/', $text, 2);
$text = HTML::anchor($text[0], isset($text[1]) ? $text[1] : $text[0]);
break;
case 'copyright':
if (strpos($text, '(c)') !== FALSE) {
// Convert the copyright sign
$text = str_replace('(c)', '©', $text);
}
break;
case 'throws':
if (preg_match('/^(\\w+)\\W(.*)$/', $text, $matches)) {
$text = HTML::anchor(Docs::url($matches[1]), $matches[1]) . ' ' . $matches[2];
} else {
$text = HTML::anchor(Docs::url($text), $text);
}
break;
case 'uses':
if (preg_match('/^([a-z_]+)::([a-z_]+)$/i', $text, $matches)) {
// Make a class#method API link
$text = HTML::anchor(Docs::url($matches[1]) . '#' . $matches[2], $text);
//->uri(array('class' => $matches[1])).'#'.$matches[2], $text);
}
break;
// Don't show @access lines, they are shown elsewhere
// Don't show @access lines, they are shown elsewhere
case 'access':
continue 2;
}
// Add the tag
$tags[$name][] = $text;
} else {
// Overwrite the comment line
$comment[$i] = (string) $line;
}
}
// Concat the comment lines back to a block of text
if ($comment = trim(implode("\n", $comment))) {
// Parse the comment with Markdown
$comment = Markdown($comment);
}
return array($comment, $tags);
}
示例2:
}
$declares = $method->method->getDeclaringClass();
?>
<h2 id="<?php
echo $method->method->name;
?>
">
<?php
echo $method->modifiers, $method->method->name;
?>
( <?php
echo $method->params ? $method->params_short() : '';
?>
)
<br/><ul class="ul"><li><small>└ <?php
echo HTML::anchor(Docs::url($declares->name), $declares->name);
?>
</small></li></ul>
</h2>
<div class="description">
<?php
echo $method->description;
?>
</div>
<?php
if ($method->tags) {
View::factory('docs/api/tags')->set('tags', $method->tags)->render(true);
}
?>
示例3: foreach
height:28px;
line-height:28px;
overflow:hidden;
margin-left:15px;
display:inline;
}
</style>
<ul class="dir_ul">
<?php
if ($arr_docs) {
foreach ($arr_docs as $item) {
if (false) {
$item = new Docs_Class();
}
$methods = $item->methods();
$class_url = Docs::url($item->class->name);
echo '<li class="dir_class_name"><h2><a href="' . $class_url . '">' . $item->class->name . '</a></h2><ul>';
if ($methods) {
foreach ($methods as $m) {
if (false) {
$m = new Docs_Method();
}
echo '<li class="dir_method_name"><a href="' . $class_url . '#' . $m->method->name . '" title="' . $m->method->name . '()">' . $m->method->name . '()</a></li>';
}
}
echo '</ul><div style="clear:both;"></div></li>';
}
} else {
echo '<li style="padding:10px 10px 20px 10px;">本目录文件为空</li>';
}
?>
示例4: while
$parent = $doc->class;
$endtag = '';
$i = 0;
while ($parent = $parent->getParentClass()) {
if ($i == 0) {
echo '<h2 style="margin-top:0;">';
}
$filename = str_replace(array('\\', '/'), '_', strtolower($parent->getFileName()));
if (preg_match('#_([a-z0-9]+)_' . preg_quote(strtolower($parent->name) . EXT) . '$#', $filename, $m)) {
$pdir = $m[1];
} else {
$pdir = $dir;
}
?>
<ul class="ul"><li><small>└ <?php
echo HTML::anchor(Docs::url($parent->name), $parent->name);
?>
</small></li>
<?php
$endtag .= '</ul>';
$i++;
}
echo $endtag;
if ($i > 0) {
echo '</h2>';
}
?>
<?php
echo $doc->description;
?>
示例5: showlist
function showlist($files, $nowfilepath, $project, $path)
{
echo '<ul class="dir2">';
if ($files) {
foreach ($files as $k => $v) {
if (is_array($v) || $v === true) {
$itempath = substr($k, strlen($path . '/'));
if (!$itempath) {
continue;
}
echo '<li class="dir2">';
if ($k == $nowfilepath) {
echo '<b>' . $itempath . '</b>';
} else {
echo '<a href="' . Docs::url($k, true, true) . '">' . substr($k, strlen($path . '/')) . '</a>';
}
if (is_array($v)) {
showlist($v, $nowfilepath, $project, $path . '/' . $itempath);
}
echo '</li>';
} else {
$fname = substr($k, strlen($path . '/'));
if ($k == $nowfilepath) {
echo '<li class="phpfile"><b>' . $fname . '</b></li>';
} else {
echo '<li class="phpfile"><a href="' . Docs::url($k, true, true) . '">' . $fname . '</a></li>';
}
}
}
}
echo '</ul>';
}
示例6: _convert_api_link
public function _convert_api_link($matches)
{
$link = $matches[1];
if (strpos($link, '::')) {
// Split the class and method
list($class, $method) = explode('::', $link, 2);
if ($method[0] === '$') {
// Class property, not method
$method = 'property:' . substr($method, 1);
}
// Add the id symbol to the method
$method = '#' . $method;
} else {
// Class with no method
$class = $link;
$method = NULL;
}
return HTML::anchor(Docs::url($class) . $method, $link);
}