本文整理匯總了PHP中eZURLAliasML::convertPathToAlias方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZURLAliasML::convertPathToAlias方法的具體用法?PHP eZURLAliasML::convertPathToAlias怎麽用?PHP eZURLAliasML::convertPathToAlias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::convertPathToAlias方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetchParentNodeByTranslation
/**
* Attempts to fetch a possible node by translating the provided
* string/path to a node-number.
*
* The last section of the path is removed before the actual
* translation: hence, the PARENT node is returned.
*
* @param string $nodePathString Eg. 'Folder1/file1.txt'
* @return eZContentObject Eg. the node of 'Folder1'
*/
protected function fetchParentNodeByTranslation($nodePathString)
{
// Strip extensions. E.g. .jpg
$nodePathString = $this->fileBasename($nodePathString);
// Strip away last slash
if (strlen($nodePathString) > 0 and $nodePathString[strlen($nodePathString) - 1] === '/') {
$nodePathString = substr($nodePathString, 0, strlen($nodePathString) - 1);
}
$nodePathString = $this->splitLastPathElement($nodePathString, $element);
if (strlen($nodePathString) === 0) {
$nodePathString = '/';
}
$nodePathString = eZURLAliasML::convertPathToAlias($nodePathString);
// Attempt to translate the URL to something like "/content/view/full/84".
$translateResult = eZURLAliasML::translate($nodePathString);
// handle redirects
while ($nodePathString === 'error/301') {
$nodePathString = $translateResult;
$translateResult = eZURLAliasML::translate($nodePathString);
}
// Get the ID of the node (which is the last part of the translated path).
if (preg_match("#^content/view/full/([0-9]+)\$#", $nodePathString, $matches)) {
$nodeID = $matches[1];
} else {
$ini = eZINI::instance('webdav.ini');
if ($ini->hasVariable('GeneralSettings', 'StartNode')) {
$nodeID = $ini->variable('GeneralSettings', 'StartNode');
}
}
// Attempt to fetch the node.
$node = eZContentObjectTreeNode::fetch($nodeID);
// Return the node.
return $node;
}
示例2: fetchParentNodeByTranslation
function fetchParentNodeByTranslation( $nodePathString )
{
// Strip extensions. E.g. .jpg
$nodePathString = $this->fileBasename( $nodePathString );
// Strip away last slash
if ( strlen( $nodePathString ) > 0 and
$nodePathString[strlen( $nodePathString ) - 1] == '/' )
{
$nodePathString = substr( $nodePathString, 0, strlen( $nodePathString ) - 1 );
}
$nodePathString = $this->splitLastPathElement( $nodePathString, $element );
if ( strlen( $nodePathString ) == 0 )
$nodePathString = '/';
$nodePathString = eZURLAliasML::convertPathToAlias( $nodePathString );
// Attempt to translate the URL to something like "/content/view/full/84".
$translateResult = eZURLAliasML::translate( $nodePathString );
// handle redirects
while ( $nodePathString == 'error/301' )
{
$nodePathString = $translateResult;
$translateResult = eZURLAliasML::translate( $nodePathString );
}
// Get the ID of the node (which is the last part of the translated path).
if ( preg_match( "#^content/view/full/([0-9]+)$#", $nodePathString, $matches ) )
{
$nodeID = $matches[1];
$this->appendLogEntry( "NodeID: $nodeID", 'CS:fetchParentNodeByTranslation' );
}
else
{
$this->appendLogEntry( "Root node", 'CS:fetchParentNodeByTranslation' );
$nodeID = 2;
}
// Attempt to fetch the node.
$node = eZContentObjectTreeNode::fetch( $nodeID );
// Return the node.
return $node;
}