本文整理汇总了PHP中eZURLAliasML::convertToAliasCompat方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::convertToAliasCompat方法的具体用法?PHP eZURLAliasML::convertToAliasCompat怎么用?PHP eZURLAliasML::convertToAliasCompat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::convertToAliasCompat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSubTreePath
function updateSubTreePath($updateParent = true, $nodeMove = false)
{
$changeCount = 0;
$nodeID = $this->attribute('node_id');
$parentNodeID = $this->attribute('parent_node_id');
// Avoid recursion due to database inconsistencies
if ($nodeID === $parentNodeID) {
eZDebug::writeError("Parent node ID equals node ID for node: {$nodeID}. The node cannot be a parent of itself!", __METHOD__);
return false;
}
// Only set name if current node is not the content root
$ini = eZINI::instance('content.ini');
$contentRootID = $ini->variable('NodeSettings', 'RootNode');
$obj = $this->object();
$alwaysMask = $obj->attribute('language_mask') & 1;
$languages = $obj->allLanguages();
$nameList = array();
$initialLanguageID = $obj->attribute('initial_language_id');
$pathIdentificationName = false;
foreach ($languages as $language) {
$nodeName = '';
if ($nodeID != $contentRootID) {
$objClass = $obj->attribute('content_class');
$nodeName = $objClass->urlAliasName($obj, false, $language->attribute('locale'));
$nodeName = eZURLAliasFilter::processFilters($nodeName, $language, $this);
$nodeName = eZURLAliasML::convertToAlias($nodeName, 'node_' . $nodeID);
$nodeName = $this->adjustPathElement($nodeName, $nodeMove);
// Compatibility mode:
// Store name for the 'path_identification_string' column.
if ($initialLanguageID == $language->attribute('id')) {
$pathIdentificationName = eZURLAliasML::convertToAliasCompat($nodeName, 'node_' . $nodeID);
}
}
$nameList[] = array('text' => $nodeName, 'language' => $language);
}
$parentActionName = "eznode";
$parentActionValue = $parentNodeID;
$parentElementID = false;
$existingElements = eZURLAliasML::fetchByAction("eznode", $nodeID);
$existingElementID = null;
if (count($existingElements) > 0) {
$existingElementID = $existingElements[0]->attribute('id');
$parentElementID = $existingElements[0]->attribute('parent');
}
// If we have parent element it means the node is already published
// and we have to see if it has been moved
if ($parentNodeID != 1 and $updateParent) {
$parents = eZURLAliasML::fetchByAction("eznode", $parentNodeID);
if (count($parents) == 0) {
$parentNode = $this->fetchParent();
if (!$parentNode) {
return false;
}
$result = $parentNode->updateSubTreePath();
if (!$result) {
return false;
}
$parents = eZURLAliasML::fetchByAction($parentActionName, $parentActionValue);
if (count($parents) == 0) {
return false;
}
$oldParentElementID = $parentElementID;
foreach ($parents as $paren) {
$parentElementID = 0;
if ($paren->attribute('text') != '') {
$parentElementID = (int) $paren->attribute('link');
break;
}
}
} else {
$oldParentElementID = $parentElementID;
$parentElementID = 0;
foreach ($parents as $paren) {
if ($paren->attribute('text') != '') {
$parentElementID = (int) $paren->attribute('link');
break;
}
}
}
} else {
}
$this->updatePathIdentificationString($pathIdentificationName);
$languageID = $obj->attribute('initial_language_id');
$cleanup = false;
foreach ($nameList as $nameEntry) {
$text = $nameEntry['text'];
$language = $nameEntry['language'];
$result = eZURLAliasML::storePath($text, 'eznode:' . $nodeID, $language, false, $alwaysMask, $parentElementID, $cleanup);
if ($result['status'] === true) {
$changeCount++;
}
}
return $changeCount;
}