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


PHP Path类代码示例

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


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

示例1: getRelativePath

 /**
  * {@inheritdoc}
  */
 public function getRelativePath(PathInterface $reference)
 {
     if ($this->sameValueAs($reference)) {
         return '';
     }
     $ref_path = array_values($reference->toArray());
     $this_path = array_values($this->data);
     $filename = array_pop($this_path);
     //retrieve the final consecutive identical segment in the current path
     $index = 0;
     foreach ($ref_path as $offset => $value) {
         if (!isset($this_path[$offset]) || $value != $this_path[$offset]) {
             break;
         }
         $index++;
     }
     //deduce the number of similar segment according to the reference path
     $nb_common_segment = count($ref_path) - $index;
     $nb_segments = array();
     if ($nb_common_segment) {
         $nb_segments = array_fill(0, $nb_common_segment, '..');
     }
     //let's output the relative path using a new Path object
     $res = new Path(array_merge($nb_segments, array_slice($this_path, $index), array($filename)));
     return $res->__toString();
 }
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:29,代码来源:Path.php

示例2: __construct

 public function __construct(\Path $path)
 {
     $this->archive = \RarArchive::open($path->getPathName());
     if (!$this->archive) {
         throw new Exception('Failed to open archive');
     }
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:7,代码来源:RarArchive.php

示例3: download

 protected function download(Path $path)
 {
     // check basic auth headers as well, so if specified,
     // client doesn't have to go through the login and cookie dance.
     Auth::onceBasic("username");
     // check we're logged in
     if (!Auth::check()) {
         Session::flash('redirect', URL::current());
         return Redirect::route('login');
     }
     // record the download in the db
     $record = $path->loadCreateRecord($path);
     $record->downloaded_at = $record->freshTimestamp();
     $record->increment('downloads');
     $record->save();
     $isMisc = strpos($path->getRelative(), '/Misc/') === 0;
     if ($isMisc || $path->isSafeExtension()) {
         // check if the extension is safe to download
         $file = new AsciiSafeDownloadFile($path->getPathname());
         // see comments in AsciiSafeDownloadFile class
         $baseName = $path->getBasename();
         $baseName = str_replace('%', '', $baseName);
         try {
             return Response::download($file, $baseName);
         } catch (InvalidArgumentException $e) {
             App::abort(500, 'This file has a malformed filename. Please contact an admin.');
         }
     } else {
         App::abort(403, sprintf('File type "%s" not allowed', $path->getExtension()));
     }
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:31,代码来源:BaseController.php

示例4: folder

 /**
  * {@inheritdoc}
  */
 public function folder(string $url) : string
 {
     $this->validateUrl($url);
     $parsed = $this->parser->parseUrl($url);
     $path = new Path($parsed->path);
     return (string) new ParsedUrl($parsed->scheme, $parsed->user, $parsed->pass, $parsed->host, $parsed->port, (string) $path->folder(), '', '');
 }
开发者ID:innmind,项目名称:url-resolver,代码行数:10,代码来源:UrlResolver.php

示例5: testLineTo

 /**
  * @dataProvider lineProvider
  */
 public function testLineTo($x, $y, $coords, $result)
 {
     $path = new Path($x, $y);
     foreach ($coords as $coord) {
         $path->lineTo($coord['x'], $coord['y'], $coord['relative']);
     }
     $this->assertEquals($result, (string) $path);
 }
开发者ID:hpainter,项目名称:identicon,代码行数:11,代码来源:PathTest.php

示例6: __construct

 public function __construct(\Path $path)
 {
     $this->archive = new \ZipArchive();
     $result = $this->archive->open($path->getPathName());
     if (!$result) {
         throw new Exception('Failed to open archive');
     }
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:8,代码来源:ZipArchive.php

示例7: encode

 public function encode(Path $path)
 {
     $parts = explode(Path::PATH_PART_SEPARATOR, $path->get());
     foreach ($parts as $partIndex => $part) {
         $parts[$partIndex] = rawurlencode($part);
     }
     return new Path(implode(Path::PATH_PART_SEPARATOR, $parts));
 }
开发者ID:webignition,项目名称:url,代码行数:8,代码来源:Encoder.php

示例8: listACLsByPath

function listACLsByPath($pathname)
{
    $me = $_SERVER["PHP_SELF"];
    if (!canEdit($pathname)) {
        echo "Ihnen fehlt leider die Berechtigung, das Verzeichnis {$pathname} zu bearbeiten";
        return false;
    }
    // Verzeichnisobjekt holen
    $path = new Path();
    if (!$path->selectByName($pathname)) {
        fehlerausgabe("Das Verzeichnis {$pathname} konnte nicht aus der DB gewählt werden");
        return false;
    }
    // ACLs fuer das Verzeichnis holen
    $acllist = new ACLList();
    if (!$acllist->selectByPath($pathname)) {
        fehlerausgabe("Die zum Verzeichnis {$pathname} gehörigen ACLs konnten nicht aus der DB gewählt werden");
        return false;
    }
    echo "ACLs für Pfad {$pathname}:";
    echo <<<EOF
<form name="acleditor" method="post" action="{$me}">
<select name="cmd">
    <option value="edit">Eine ACL bearbeiten</option>
    <option value="del">L&ouml;schen</option>
</select>
<input type="hidden" name="pathname" value="{$pathname}" />
<input type="submit" value="Los" />
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
    <tr>
        <td>User</td>
        <td>L&ouml;schen</td>
        <td>Schreiben</td>
        <td>Lesen</td>
        <td>Umbenennen</td>
    </tr>
EOF;
    $user = new User();
    for ($i = 0; $i < count($acllist->list); $i++) {
        $acl = $acllist->list[$i];
        $user->selectByID($acl->user_id);
        echo <<<EOF
<tr>
    <td><input type="checkbox" name="aclid[]" value="{$acl->acl_id}" />{$user->loginname}</td>
    <td>{$acl->delete_path}</td>
    <td>{$acl->write_path}</td>
    <td>{$acl->read_path}</td>
    <td>{$acl->rename_path}</td>
</tr>
EOF;
    }
    echo <<<EOF
</table>
</form>
EOF;
    return true;
}
开发者ID:BackupTheBerlios,项目名称:sage,代码行数:58,代码来源:acledit.inc.php

示例9: sinvactu

 function sinvactu()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:10,代码来源:sinvactu.php

示例10: Catalogo

 function Catalogo()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/inventario');
     $this->upload_path = $path->getPath();
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:10,代码来源:catalogo.php

示例11: match

 public function match(Path $path)
 {
     $values = array();
     if (preg_match($this->regex, $path->value(), $values) == 1) {
         array_shift($values);
         $this->parameterValues = $values;
         return true;
     }
     return false;
 }
开发者ID:npacker,项目名称:nFramework,代码行数:10,代码来源:PathMatcher.class.php

示例12: modulos

 function modulos()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/graficos');
     $this->upload_path = $path->getPath() . '/';
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:10,代码来源:modulos.php

示例13: logo

 function logo()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->helper('download');
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('base_url'));
     $path->append('images');
     echo $this->upload_path = $path->getPath() . '/';
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:11,代码来源:logo.php

示例14: Publicidad

 function Publicidad()
 {
     parent::Controller();
     $this->load->library("rapyd");
     $this->load->library("path");
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('publicidad');
     $this->upload_path = $path->getPath() . '/';
     //$this->datasis->modulo_id(907,1);
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:11,代码来源:publicidad.php

示例15: logo

 function logo()
 {
     parent::Controller();
     $this->load->library('rapyd');
     $this->load->helper('download');
     $this->load->library('path');
     $path = new Path();
     $path->setPath($this->config->item('base_url'));
     $path->append('images');
     $this->upload_path = $path->getPath() . '/';
     $this->write = is_writable('images');
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:12,代码来源:logo.php


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