本文整理汇总了PHP中Path::pretty方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::pretty方法的具体用法?PHP Path::pretty怎么用?PHP Path::pretty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::pretty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPath
/**
* Get the path of the current file
*
* @return string Full path
*/
public function getPath()
{
// Get the query string and remove the ordering
$url = Path::pretty(Request::get('path'));
// Remove the 'page' if it's a page.md
$url = Pattern::endsWith($url, 'page') ? URL::popLastSegment($url) : $url;
// Get the content
$content = Content::get($url);
// Path is inside the content
return ltrim($content['_local_path'], '/');
}
示例2: get_listings
public static function get_listings()
{
$listings = array();
$finder = new Finder();
$files = $finder->files()->in(Config::getContentRoot())->name('fields.yaml')->followLinks();
foreach ($files as $file) {
$slug = Path::trimSlashes(Path::makeRelative($file->getPath(), Config::getContentRoot()));
$meta = array('slug' => $slug, 'title' => ucwords(ltrim(Path::pretty('/' . $slug), '/')));
$item = self::yamlize_content(BASE_PATH . '/' . $file->getPath() . '/page.' . Config::getContentType());
$listings[] = is_array($item) ? array_merge($meta, $item) : $meta;
}
// Sort by Title
uasort($listings, function ($a, $b) {
return strcmp($a['title'], $b['title']);
});
return $listings;
}
示例3: array_set
array_set($data, 'fields:content', $content_defaults);
$data['full_slug'] = Path::tidy($data['full_slug']);
/*
|--------------------------------------------------------------------------
| Status bar message
|--------------------------------------------------------------------------
|
| Gawd this is awful. Can't wait to refactor this spaghetti.
|
*/
if ($data['type'] === 'none' || $data['type'] === 'none' && $original_slug !== 'page') {
$data['status_message'] = isset($new) ? Localization::fetch('editing_page') : Localization::fetch('edit_page');
$data['identifier'] = $data['page'] === 'page' ? Path::pretty($data['folder']) : Path::pretty($data['full_slug']);
} else {
$data['status_message'] = isset($new) ? Localization::fetch('new_entry') : Localization::fetch('editing_entry');
$data['identifier'] = isset($new) ? Path::pretty($folder . '/') : Path::pretty($data['full_slug']);
}
if ($new) {
$data['status_message'] .= ' ' . Localization::fetch('in', null, true);
}
// Set the return URL
if ($custom_return = Request::get('return')) {
$data['return'] = $app->request()->getRootUri() . $custom_return;
} else {
$data['return'] = $data['type'] == 'none' ? $app->urlFor('pages') . "?path=" . Path::addStartingSlash($folder) : $app->urlFor('entries') . "?path=" . Path::addStartingSlash($folder);
}
$data['templates'] = Theme::getTemplates();
$data['layouts'] = Theme::getLayouts();
$template_list = array("publish");
Statamic_View::set_templates(array_reverse($template_list));
/*