當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。