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


PHP Path::pretty方法代码示例

本文整理汇总了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'], '/');
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:16,代码来源:core.revisions.php

示例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;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:17,代码来源:statamic.php

示例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));
 /*
开发者ID:jalmelb,项目名称:24hl2015,代码行数:31,代码来源:routes.php


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