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


PHP Path::trimSlashes方法代码示例

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


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

示例1: getFiles

 public function getFiles($formset, $path, $extension = "yaml")
 {
     if (!Folder::exists($path)) {
         return array();
     }
     $finder = new Finder();
     $matches = $finder->name("*." . $extension)->depth(0)->files()->followLinks()->in($path);
     $files = array();
     foreach ($matches as $file) {
         // Ignore page.md
         if ($file->getFilename() == 'page.md') {
             continue;
         }
         $file_data = Parse::yaml($file->getContents());
         $file_data['datestamp'] = date(array_get($this->config, 'datestamp_format', "m/d/Y"), $file->getMTime());
         $meta = array('path' => $file->getRealpath(), 'filename' => $file->getFilename(), 'formset' => $formset, 'extension' => $file->getExtension(), 'datestamp' => $file->getMTime());
         $meta['edit_path'] = Path::trimSlashes(Path::trimFileSystemFromContent(substr($meta['path'], 0, -1 - strlen($meta['extension']))));
         $data = array('meta' => $meta, 'fields' => $file_data);
         $files[] = $data;
     }
     return array_reverse($files);
 }
开发者ID:Synergy23,项目名称:RealEstate,代码行数:22,代码来源:tasks.raven.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: substr

    |--------------------------------------------------------------------------
    | Done. Let's redirect!
    |--------------------------------------------------------------------------
    |
    | Pages go back to the tree, entries to their respective Entry Listing
    | Or, if a custom return was specified, we'll go there.
    |
    */
    if ($form_data['type'] == 'none') {
        $app->flash('success', Localization::fetch('page_saved'));
    } else {
        $app->flash('success', Localization::fetch('entry_saved'));
    }
    $return = Request::post('return');
    if (Request::post('continue')) {
        $path = Path::trimSlashes(str_replace(Config::getContentRoot(), '', Path::tidy($file)));
        $path = preg_replace('/\\.' . Config::getContentType() . '$/', '', $path);
        $redirect_url = $admin_app->urlFor('publish') . '?path=' . $path;
        if (strpos(Request::getReferrer(), 'return=')) {
            // maintain the 'return' in the URL
            $return_uri = substr($return, strlen($app->request()->getRootUri()));
            $redirect_url .= '&return=' . $return_uri;
        }
        $app->redirect($redirect_url);
    } else {
        $app->redirect($return);
    }
});
// GET: DELETE ENTRY
$admin_app->map('/delete/entry', function () use($admin_app) {
    authenticateForRole('admin');
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:31,代码来源:routes.php

示例4: rtrim

    /*
    |--------------------------------------------------------------------------
    | Done. Let's redirect!
    |--------------------------------------------------------------------------
    |
    | Pages go back to the tree, entries to their respective Entry Listing
    | Or, if a custom return was specified, we'll go there.
    |
    */
    if ($form_data['type'] == 'none') {
        $app->flash('success', Localization::fetch('page_saved'));
    } else {
        $app->flash('success', Localization::fetch('entry_saved'));
    }
    if (Request::post('continue')) {
        $path = rtrim(Path::trimSlashes(str_replace(Config::getContentRoot(), '', Path::tidy($file))), '.' . Config::getContentType());
        $app->redirect($admin_app->urlFor('publish') . '?path=' . $path);
    } else {
        $app->redirect(Request::post('return'));
    }
});
// GET: DELETE ENTRY
$admin_app->map('/delete/entry', function () use($admin_app) {
    authenticateForRole('admin');
    doStatamicVersionCheck($admin_app);
    $content_root = Config::getContentRoot();
    $content_type = Config::getContentType();
    $entries = (array) Request::fetch('entries');
    $count = count($entries);
    foreach ($entries as $path) {
        $file = $content_root . "/" . $path . "." . $content_type;
开发者ID:jalmelb,项目名称:24hl2015,代码行数:31,代码来源:routes.php

示例5: trim_slashes

 /**
  * trim_slashes
  * Removes any extra "/" at the beginning or end of a given $string
  *
  * @deprecated  Use Path::trimSlashes() instead
  *
  * @param string  $string  String to trim
  * @return string
  */
 public static function trim_slashes($string)
 {
     Log::warn("Use of Statamic_Helper::trim_slashes() is deprecated. Use Path::trimSlashes() instead.", "core", "Statamic_Helper");
     return Path::trimSlashes($string);
 }
开发者ID:nob,项目名称:joi,代码行数:14,代码来源:helper.php


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