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


PHP Sabre_DAV_URLUtil::splitPath方法代码示例

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


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

示例1: checkQuota

 /**
  * This method is called before any HTTP method and validates there is enough free space to store the file
  *
  * @param string $method
  * @throws Sabre_DAV_Exception
  * @return bool
  */
 public function checkQuota($uri, $data = null)
 {
     $length = $this->getLength();
     if ($length) {
         if (substr($uri, 0, 1) !== '/') {
             $uri = '/' . $uri;
         }
         list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
         $req = $this->server->httpRequest;
         if ($req->getHeader('OC-Chunked')) {
             $info = OC_FileChunking::decodeName($newName);
             $chunkHandler = new OC_FileChunking($info);
             // substract the already uploaded size to see whether
             // there is still enough space for the remaining chunks
             $length -= $chunkHandler->getCurrentSize();
         }
         $freeSpace = $this->getFreeSpace($parentUri);
         if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) {
             if (isset($chunkHandler)) {
                 $chunkHandler->cleanup();
             }
             throw new Sabre_DAV_Exception_InsufficientStorage();
         }
     }
     return true;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:33,代码来源:quotaplugin.php

示例2: testSplitPath

 function testSplitPath()
 {
     $strings = array('/foo/bar' => array('/foo', 'bar'), '/foo/bar/' => array('/foo', 'bar'), 'foo/bar/' => array('foo', 'bar'), 'foo/bar' => array('foo', 'bar'), 'foo/bar/baz' => array('foo/bar', 'baz'), 'foo/bar/baz/' => array('foo/bar', 'baz'), 'foo' => array('', 'foo'), 'foo/' => array('', 'foo'), '/foo/' => array('', 'foo'), '/foo' => array('', 'foo'), '' => array(null, null), "/àfoó/bar" => array("/àfoó", 'bar'), "/àfoo/bür/" => array("/àfoo", "bür"), "foo/àür" => array("foo", "àür"));
     foreach ($strings as $input => $expected) {
         $output = Sabre_DAV_URLUtil::splitPath($input);
         $this->assertEquals($expected, $output, 'The expected output for \'' . $input . '\' was incorrect');
     }
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:8,代码来源:URLUtilTest.php

示例3: setName

 /**
  * Renames the node
  *
  * @param string $name The new name
  * @return void
  */
 public function setName($name)
 {
     list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
     list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
     $newPath = $parentPath . '/' . $newName;
     rename($this->path, $newPath);
     $this->path = $newPath;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:14,代码来源:Node.php

示例4: setName

 /**
  * Renames the node
  * 
  * @throws Sabre_DAV_Exception_Forbidden
  * @param string $name The new name
  * @return void
  */
 public function setName($name)
 {
     self::checkForbiddenFile($name);
     if (!Tinebase_Core::getUser()->hasGrant($this->_getContainer(), Tinebase_Model_Grants::GRANT_EDIT)) {
         throw new Sabre_DAV_Exception_Forbidden('Forbidden to rename file: ' . $this->_path);
     }
     list($dirname, $basename) = Sabre_DAV_URLUtil::splitPath($this->_path);
     Tinebase_FileSystem::getInstance()->rename($this->_path, $dirname . '/' . $name);
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:16,代码来源:Node.php

示例5: nodeExists

 /**
  * This function allows you to check if a node exists.
  *
  * @param string $path 
  * @return bool 
  */
 public function nodeExists($path)
 {
     try {
         list($parent, $base) = Sabre_DAV_URLUtil::splitPath($path);
         $parentNode = $this->getNodeForPath($parent);
         return $parentNode->childExists($base);
     } catch (Sabre_DAV_Exception_FileNotFound $e) {
         return false;
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:16,代码来源:ObjectTree.php

示例6: afterGetProperties

 /**
  * Handler for teh afterGetProperties event 
  * 
  * @param string $path 
  * @param array $properties 
  * @return void
  */
 public function afterGetProperties($path, &$properties)
 {
     if (array_key_exists('{DAV:}getcontenttype', $properties[404])) {
         list(, $fileName) = Sabre_DAV_URLUtil::splitPath($path);
         $contentType = $this->getContentType($fileName);
         if ($contentType) {
             $properties[200]['{DAV:}getcontenttype'] = $contentType;
             unset($properties[404]['{DAV:}getcontenttype']);
         }
     }
 }
开发者ID:mover5,项目名称:imobackup,代码行数:18,代码来源:GuessContentType.php

示例7: setName

 /**
  * Renames the node
  *
  * @param string $name The new name
  * @return void
  */
 public function setName($name)
 {
     list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
     list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
     $newPath = $parentPath . '/' . $newName;
     $oldPath = $this->path;
     OC_Filesystem::rename($this->path, $newPath);
     $this->path = $newPath;
     $query = OC_DB::prepare('UPDATE *PREFIX*properties SET propertypath = ? WHERE userid = ? AND propertypath = ?');
     $query->execute(array($newPath, OC_User::getUser(), $oldPath));
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:17,代码来源:owncloud_lib_connector_sabre_node.php

示例8: move

 /**
  * Moves a file from one location to another 
  * 
  * @param string $sourcePath The path to the file which should be moved 
  * @param string $destinationPath The full destination path, so not just the destination parent node
  * @return int
  */
 public function move($sourcePath, $destinationPath)
 {
     list($sourceDir, $sourceName) = Sabre_DAV_URLUtil::splitPath($sourcePath);
     list($destinationDir, $destinationName) = Sabre_DAV_URLUtil::splitPath($destinationPath);
     if ($sourceDir === $destinationDir) {
         $renameable = $this->getNodeForPath($sourcePath);
         $renameable->setName($destinationName);
     } else {
         $this->copy($sourcePath, $destinationPath);
         $this->getNodeForPath($sourcePath)->delete();
     }
 }
开发者ID:jtietema,项目名称:Fizzy,代码行数:19,代码来源:Tree.php

示例9: getPrincipalByPath

 /**
  * Returns a specific principal, specified by it's path.
  * The returned structure should be the exact same as from
  * getPrincipalsByPrefix.
  *
  * @param string $path
  * @return array
  */
 public function getPrincipalByPath($path)
 {
     list($prefixPath, $userName) = Sabre_DAV_URLUtil::splitPath($path);
     // This backend only support principals in one collection
     if ($prefixPath !== $this->prefix) {
         return null;
     }
     $r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($userName));
     if (count($r) == 0) {
         return array();
     }
     return array('uri' => $this->prefix . '/' . strtolower($r[0]['nickname']), '{DAV:}displayname' => $r[0]['nickname']);
 }
开发者ID:robhell,项目名称:friendica-addons,代码行数:21,代码来源:dav_friendica_principal.inc.php

示例10: getPrincipalsByPrefix

 /**
  * Returns a list of principals based on a prefix.
  *
  * This prefix will often contain something like 'principals'. You are only 
  * expected to return principals that are in this base path.
  *
  * You are expected to return at least a 'uri' for every user, you can 
  * return any additional properties if you wish so. Common properties are:
  *   {DAV:}displayname 
  *   {http://sabredav.org/ns}email-address - This is a custom SabreDAV 
  *     field that's actualy injected in a number of other properties. If
  *     you have an email address, use this property.
  * 
  * @param string $prefixPath 
  * @return array 
  */
 public function getPrincipalsByPrefix($prefixPath)
 {
     $result = $this->pdo->query('SELECT uri, email, displayname FROM `' . $this->tableName . '`');
     $principals = array();
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         // Checking if the principal is in the prefix
         list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
         if ($rowPrefix !== $prefixPath) {
             continue;
         }
         $principals[] = array('uri' => $row['uri'], '{DAV:}displayname' => $row['displayname'] ? $row['displayname'] : basename($row['uri']), '{http://sabredav.org/ns}email-address' => $row['email']);
     }
     return $principals;
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:30,代码来源:owncloud_3rdparty_Sabre_DAVACL_PrincipalBackend_PDO.php

示例11: getGroupMembership

 /**
  * Returns the list of groups a principal is a member of
  *
  * @param string $principal
  * @return array
  */
 public function getGroupMembership($principal)
 {
     list($prefix, $name) = Sabre_DAV_URLUtil::splitPath($principal);
     $group_membership = array();
     if ($prefix == 'principals') {
         $principal = $this->getPrincipalByPath($principal);
         if (!$principal) {
             throw new Sabre_DAV_Exception('Principal not found');
         }
         // TODO: for now the user principal has only its own groups
         return array('principals/' . $name . '/calendar-proxy-read', 'principals/' . $name . '/calendar-proxy-write');
     }
     return $group_membership;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:20,代码来源:principal.php

示例12: getHTTPMethods

 /**
  * Use this method to tell the server this plugin defines additional
  * HTTP methods.
  *
  * This method is passed a uri. It should only return HTTP methods that are 
  * available for the specified uri.
  *
  * @param string $uri
  * @return array 
  */
 public function getHTTPMethods($uri)
 {
     // The MKCALENDAR is only available on unmapped uri's, whose
     // parents extend IExtendedCollection
     list($parent, $name) = Sabre_DAV_URLUtil::splitPath($uri);
     $node = $this->server->tree->getNodeForPath($parent);
     if ($node instanceof Sabre_DAV_IExtendedCollection) {
         try {
             $node->getChild($name);
         } catch (Sabre_DAV_Exception_FileNotFound $e) {
             return array('MKCALENDAR');
         }
     }
     return array();
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:25,代码来源:Plugin.php

示例13: setName

 /**
  * @brief Renames the node
  * @param string $name The new name
  * @return void
  */
 public function setName($name)
 {
     // rename is only allowed if the update privilege is granted
     if (!\OC\Files\Filesystem::isUpdatable($this->path)) {
         throw new \Sabre_DAV_Exception_Forbidden();
     }
     list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
     list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
     $newPath = $parentPath . '/' . $newName;
     $oldPath = $this->path;
     \OC\Files\Filesystem::rename($this->path, $newPath);
     $this->path = $newPath;
     $query = OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?' . ' WHERE `userid` = ? AND `propertypath` = ?');
     $query->execute(array($newPath, OC_User::getUser(), $oldPath));
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:20,代码来源:node.php

示例14: getPrincipalsByPrefix

 /**
  * Returns a list of principals based on a prefix.
  *
  * This prefix will often contain something like 'principals'. You are only
  * expected to return principals that are in this base path.
  *
  * You are expected to return at least a 'uri' for every user, you can
  * return any additional properties if you wish so. Common properties are:
  *   {DAV:}displayname
  *
  * @param string $prefixPath
  * @return array
  */
 public function getPrincipalsByPrefix($prefixPath)
 {
     $query = OC_DB::prepare('SELECT * FROM *PREFIX*principals');
     $result = $query->execute();
     $principals = array();
     while ($row = $result->fetchRow()) {
         // Checking if the principal is in the prefix
         list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
         if ($rowPrefix !== $prefixPath) {
             continue;
         }
         $principals[] = array('uri' => $row['uri'], '{DAV:}displayname' => $row['displayname'] ? $row['displayname'] : basename($row['uri']));
     }
     return $principals;
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:28,代码来源:owncloud_lib_connector_sabre_principal.php

示例15: checkQuota

 /**
  * This method is called before any HTTP method and validates there is enough free space to store the file
  *
  * @param string $method
  * @throws Sabre_DAV_Exception
  * @return bool
  */
 public function checkQuota($uri, $data = null)
 {
     $length = $this->getLength();
     if ($length) {
         if (substr($uri, 0, 1) !== '/') {
             $uri = '/' . $uri;
         }
         list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
         $freeSpace = $this->getFreeSpace($parentUri);
         if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) {
             throw new Sabre_DAV_Exception_InsufficientStorage();
         }
     }
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:22,代码来源:quotaplugin.php


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