本文整理汇总了PHP中PHPCR\Util\PathHelper::normalizePath方法的典型用法代码示例。如果您正苦于以下问题:PHP PathHelper::normalizePath方法的具体用法?PHP PathHelper::normalizePath怎么用?PHP PathHelper::normalizePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCR\Util\PathHelper
的用法示例。
在下文中一共展示了PathHelper::normalizePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNodePath
public function getNodePath($workspace, $path, $withFilename = true)
{
$path = PathHelper::normalizePath($path);
if (substr($path, 0, 1) == '/') {
$path = substr($path, 1);
}
if ($path) {
$path .= '/';
}
$nodeRecordPath = Storage::WORKSPACE_PATH . '/' . $workspace . '/' . $path . 'node.yml';
if ($withFilename === false) {
$nodeRecordPath = dirname($nodeRecordPath);
}
return $nodeRecordPath;
}
示例2: changePathToHistory
/**
* changes path node to history node.
*
* @param NodeInterface $node
* @param SessionInterface $session
* @param string $absSrcPath
* @param string $absDestPath
*/
private function changePathToHistory(NodeInterface $node, SessionInterface $session, $absSrcPath, $absDestPath)
{
// get new path node
$relPath = str_replace($absSrcPath, '', $node->getPath());
$newPath = PathHelper::normalizePath($absDestPath . $relPath);
$newPathNode = $session->getNode($newPath);
// set history to true and set content to new path
$node->setProperty('sulu:content', $newPathNode);
$node->setProperty('sulu:history', true);
// get referenced history
/** @var PropertyInterface $property */
foreach ($node->getReferences('sulu:content') as $property) {
$property->getParent()->setProperty('sulu:content', $newPathNode);
}
}
示例3: cloneFromImmediately
/**
* Implement the workspace clone method. It is dispatched immediately.
* http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.10%20Corresponding%20Nodes
* http://www.day.com/specs/jcr/2.0/10_Writing.html#10.8%20Cloning%20and%20Updating%20Nodes
*
* @param string $srcWorkspace the name of the workspace from which the copy is to be made.
* @param string $srcAbsPath the path of the node to be cloned.
* @param string $destAbsPath the location to which the node at srcAbsPath is to be cloned in this workspace.
* @param boolean $removeExisting
*
* @throws \PHPCR\UnsupportedRepositoryOperationException
* @throws \PHPCR\ItemExistsException
*
* @see Workspace::cloneFrom()
*/
public function cloneFromImmediately($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting)
{
if (!$this->transport instanceof WritingInterface) {
throw new UnsupportedRepositoryOperationException('Transport does not support writing');
}
$srcAbsPath = PathHelper::normalizePath($srcAbsPath);
$destAbsPath = PathHelper::normalizePath($destAbsPath, true);
if (!$removeExisting && $this->session->nodeExists($destAbsPath)) {
throw new ItemExistsException('Node already exists at destination and removeExisting is false');
}
$this->transport->cloneFrom($srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting);
}
示例4: testNormalizePathInvalidNoThrow
/**
* @dataProvider dataproviderNormalizePathInvalid
*/
public function testNormalizePathInvalidNoThrow($input)
{
$this->assertFalse(PathHelper::normalizePath($input, true, false));
}