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


PHP Path::addStartingSlash方法代码示例

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


在下文中一共展示了Path::addStartingSlash方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $from = $this->fetchParam('from', false);
     if (!$from) {
         return null;
     }
     // account for subfolder
     if (strpos($from, Config::getSiteRoot()) !== 0) {
         $from = Path::tidy(Config::getSiteRoot() . $from);
     }
     $from = Path::addStartingSlash($from);
     $content_set = ContentService::getContentByURL($from);
     // filter
     $content_set->filter(array('show_hidden' => $this->fetchParam('show_hidden', false, null, true, false), 'show_drafts' => $this->fetchParam('show_drafts', false, null, true, false), 'show_past' => $this->fetchParam('show_past', true, null, true), 'show_future' => $this->fetchParam('show_future', false, null, true), 'type' => 'all', 'conditions' => trim($this->fetchParam('conditions', null, false, false, false))));
     // limit
     $limit = $this->fetchParam('limit', 1, 'is_numeric');
     $offset = $this->fetchParam('offset', 0, 'is_numeric');
     $content_set->limit($limit, $offset);
     // check for results
     if (!$content_set->count()) {
         return Parse::tagLoop($this->content, array(array('no_results' => true)));
     }
     // if content is used in this entries loop, parse it
     $parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
     return Parse::tagLoop($this->content, $content_set->get($parse_content), false, $this->context);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:26,代码来源:pi.get_content.php

示例2: deleteFile

 public function deleteFile()
 {
     if (!Config::get('allow_file_field_deletions')) {
         return $this->abortDeletion('file_deleting_not_permitted');
     }
     if (!($path = Request::get('path'))) {
         return $this->abortDeletion('file_no_path');
     }
     if (!($destination = Request::get('config'))) {
         return $this->abortDeletion('file_no_config');
     }
     $destination = Path::addStartingSlash(Helper::decrypt(urldecode($destination)));
     if (!Pattern::startsWith($path, $destination) || strpos($path, '../')) {
         return $this->abortDeletion('error');
     }
     $full_path = Path::assemble(BASE_PATH, $path);
     if (!File::exists($full_path)) {
         return $this->abortDeletion('file_doesnt_exist');
     }
     File::delete($full_path);
     return array('success' => true, 'message' => Localization::fetch('file_deleted'));
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:22,代码来源:tasks.file.php

示例3: index

 public function index()
 {
     $from = $this->fetchParam('from', false);
     // defaults to null
     if (!$from) {
         return null;
     }
     $from = Path::addStartingSlash($from);
     $from = strlen($from) > 1 ? rtrim($from, "/") : $from;
     $content_set = ContentService::getContentByURL($from);
     // filter
     $content_set->filter(array('show_all' => $this->fetchParam('show_hidden', false, null, true, false), 'show_past' => $this->fetchParam('show_past', true, null, true), 'show_future' => $this->fetchParam('show_future', false, null, true), 'type' => 'all', 'conditions' => trim($this->fetchParam('conditions', null, false, false, false))));
     // limit
     $limit = $this->fetchParam('limit', 1, 'is_numeric');
     $offset = $this->fetchParam('offset', 0, 'is_numeric');
     $content_set->limit($limit, $offset);
     // check for results
     if (!$content_set->count()) {
         return Parse::tagLoop($this->content, array(array('no_results' => true)));
     }
     // if content is used in this entries loop, parse it
     $parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
     return Parse::tagLoop($this->content, $content_set->get($parse_content));
 }
开发者ID:nob,项目名称:joi,代码行数:24,代码来源:pi.get_content.php

示例4: isset

 */
 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));
 /*
 |--------------------------------------------------------------------------
 | Hook: Can Publish
 |--------------------------------------------------------------------------
 |
 | Gives the ability to prevent editing/publishing.
 |
 */
 $can_edit = Hook::run('control_panel', 'can_publish', 'replace', true, $data);
 if (!$can_edit) {
开发者ID:jalmelb,项目名称:24hl2015,代码行数:31,代码来源:routes.php

示例5: elseif

     } elseif ($form_data['type'] == 'number') {
         $new_numeric = $form_data['meta']['publish-numeric'];
         $new_file = $content_root . "/" . dirname($path) . "/" . $status_prefix . $new_numeric . "." . $new_slug . "." . $content_type;
         // Pages
     } else {
         // Folder/page.md
         if ($index_file) {
             $new_file = str_replace($form_data['original_slug'], $status_prefix . $new_slug, $file);
         } else {
             // Regular page
             $new_file = $content_root . "/" . dirname($path) . "/" . $status_prefix . $new_slug . "." . $content_type;
         }
     }
     // ensure that both variables are coming from the same place
     $file = Path::addStartingSlash($file);
     $new_file = Path::addStartingSlash($new_file);
     if ($file !== $new_file) {
         if ($index_file) {
             // If the page is an index file but not in a directory we want to rename the file not the parent directory.
             if (dirname($file) != dirname($new_file)) {
                 File::rename(dirname($file), dirname($new_file));
             } else {
                 File::rename($file, $new_file);
             }
         } else {
             File::rename($file, $new_file);
         }
     }
 }
 /*
 |--------------------------------------------------------------------------
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:31,代码来源:routes.php


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