本文整理汇总了PHP中eZContentObjectTreeNode::fetchByRemoteID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::fetchByRemoteID方法的具体用法?PHP eZContentObjectTreeNode::fetchByRemoteID怎么用?PHP eZContentObjectTreeNode::fetchByRemoteID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::fetchByRemoteID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchContentNode
public static function fetchContentNode($nodeID, $nodePath, $languageCode, $remoteID = false)
{
$contentNode = null;
if ($nodeID) {
if (!isset($languageCode)) {
$languageCode = false;
}
$contentNode = eZContentObjectTreeNode::fetch($nodeID, $languageCode);
} else {
if ($nodePath) {
$nodeID = eZURLAliasML::fetchNodeIDByPath($nodePath);
if ($nodeID) {
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
}
} else {
if ($remoteID) {
$contentNode = eZContentObjectTreeNode::fetchByRemoteID($remoteID);
}
}
}
if ($contentNode === null) {
$retVal = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
} else {
$retVal = array('result' => $contentNode);
}
return $retVal;
}
示例2: isValidNodeRemoteID
/**
* test if the new node remote id is available (or already used by this node)
* @param string $remoteID
* @param int $currentNodeID
* @param array $errors
* @param boolean $allowBlank
* @return boolean
*/
public static function isValidNodeRemoteID($remoteID, $currentNodeID = false, &$errors = array(), $allowBlank = false)
{
if (!self::isValidRemoteIDText($remoteID, $errors, $allowBlank)) {
return false;
}
if ($existingNode = eZContentObjectTreeNode::fetchByRemoteID($remoteID, false)) {
$existingNodeIDList = array();
if (isset($existingNode['node_id'])) {
$existingNodeIDList[] = $existingNode['node_id'];
} else {
foreach ($existingNode as $node) {
$existingNodeIDList[] = $node['node_id'];
}
}
if (!in_array($currentNodeID, $existingNodeIDList)) {
$errors[] = ezpI18n::tr('remoteid/update', 'Node Remote ID %1 already used by node %2', '', array('%1' => $remoteID, '%2' => join(', ', $existingNodeIDList)));
eZDebug::writeDebug('Node Remote ID ' . $remoteID . ' used by node ' . join(', ', $existingNodeIDList), '', __CLASS__);
return false;
}
}
return true;
}
示例3: publishNode
public static function publishNode($parentNodeID, $objectID, $versionNum, $mainNodeID)
{
$object = eZContentObject::fetch($objectID);
$nodeAssignment = eZNodeAssignment::fetch($objectID, $versionNum, $parentNodeID);
$version = $object->version($versionNum);
$fromNodeID = $nodeAssignment->attribute('from_node_id');
$originalObjectID = $nodeAssignment->attribute('contentobject_id');
$nodeID = $nodeAssignment->attribute('parent_node');
$opCode = $nodeAssignment->attribute('op_code');
$parentNode = eZContentObjectTreeNode::fetch($nodeID);
// if parent doesn't exist, return. See issue #18320
if (!$parentNode instanceof eZContentObjectTreeNode) {
eZDebug::writeError("Parent node doesn't exist. object id: {$objectID}, node_assignment id: " . $nodeAssignment->attribute('id'), __METHOD__);
return;
}
$parentNodeID = $parentNode->attribute('node_id');
$existingNode = null;
$db = eZDB::instance();
$db->begin();
if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
$existingNode = eZContentObjectTreeNode::fetchByRemoteID($nodeAssignment->attribute('parent_remote_id'));
}
if (!$existingNode) {
}
$existingNode = eZContentObjectTreeNode::findNode($nodeID, $object->attribute('id'), true);
$updateSectionID = false;
// now we check the op_code to see what to do
if (($opCode & 1) == eZNodeAssignment::OP_CODE_NOP) {
// There is nothing to do so just return
$db->commit();
if ($mainNodeID == false) {
return $object->attribute('main_node_id');
}
return;
}
$updateFields = false;
if ($opCode == eZNodeAssignment::OP_CODE_MOVE || $opCode == eZNodeAssignment::OP_CODE_CREATE) {
// if ( $fromNodeID == 0 || $fromNodeID == -1)
if ($opCode == eZNodeAssignment::OP_CODE_CREATE || $opCode == eZNodeAssignment::OP_CODE_SET) {
// If the node already exists it means we have a conflict (for 'CREATE').
// We resolve this by leaving node-assignment data be.
if ($existingNode == null) {
$parentNode = eZContentObjectTreeNode::fetch($nodeID);
$user = eZUser::currentUser();
if (!eZSys::isShellExecution() and !$user->isAnonymous()) {
eZContentBrowseRecent::createNew($user->id(), $parentNode->attribute('node_id'), $parentNode->attribute('name'));
}
$updateFields = true;
$existingNode = $parentNode->addChild($object->attribute('id'), true);
if ($fromNodeID == -1) {
$updateSectionID = true;
}
} elseif ($opCode == eZNodeAssignment::OP_CODE_SET) {
$updateFields = true;
}
} elseif ($opCode == eZNodeAssignment::OP_CODE_MOVE) {
if ($fromNodeID == 0 || $fromNodeID == -1) {
eZDebug::writeError("NodeAssignment '" . $nodeAssignment->attribute('id') . "' is marked with op_code='{$opCode}' but has no data in from_node_id. Cannot use it for moving node.", __METHOD__);
} else {
// clear cache for old placement.
$additionalNodeIDList = array($fromNodeID);
eZContentCacheManager::clearContentCacheIfNeeded($objectID, $versionNum, $additionalNodeIDList);
$originalNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $fromNodeID);
if ($originalNode->attribute('main_node_id') == $originalNode->attribute('node_id')) {
$updateSectionID = true;
}
$originalNode->move($parentNodeID);
$existingNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $parentNodeID);
$updateFields = true;
}
}
} elseif ($opCode == eZNodeAssignment::OP_CODE_REMOVE) {
$db->commit();
return;
}
if ($updateFields) {
if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
$existingNode->setAttribute('remote_id', $nodeAssignment->attribute('parent_remote_id'));
}
$existingNode->setAttribute('sort_field', $nodeAssignment->attribute('sort_field'));
$existingNode->setAttribute('sort_order', $nodeAssignment->attribute('sort_order'));
}
$existingNode->setAttribute('contentobject_is_published', 1);
eZDebug::createAccumulatorGroup('nice_urls_total', 'Nice urls');
if ($mainNodeID > 0) {
$existingNodeID = $existingNode->attribute('node_id');
if ($existingNodeID != $mainNodeID) {
eZContentBrowseRecent::updateNodeID($existingNodeID, $mainNodeID);
}
$existingNode->setAttribute('main_node_id', $mainNodeID);
} else {
$existingNode->setAttribute('main_node_id', $existingNode->attribute('node_id'));
}
$existingNode->store();
if ($updateSectionID) {
eZContentOperationCollection::updateSectionID($objectID, $versionNum);
}
$db->commit();
if ($mainNodeID == false) {
return $existingNode->attribute('node_id');
//.........这里部分代码省略.........
示例4: installFetchAliases
function installFetchAliases( $fetchAliasListNode, &$parameters )
{
if ( !$fetchAliasListNode )
{
return true;
}
$fetchAliasINIArray = array();
foreach( $fetchAliasListNode->getElementsByTagName( 'fetch-alias' ) as $blockNode )
{
if ( isset( $parameters['site_access_map'][$blockNode->getAttribute( 'site-access' )] ) )
{
$newSiteAccess = $parameters['site_access_map'][$blockNode->getAttribute( 'site-access' )];
}
else
{
$newSiteAccess = $parameters['site_access_map']['*'];
}
if ( !isset( $fetchAliasINIArray[$newSiteAccess] ) )
{
$fetchAliasINIArray[$newSiteAccess] = eZINI::instance( 'fetchalias.ini.append.php', "settings/siteaccess/$newSiteAccess", null, null, true );
}
$blockArray = array();
$blockName = $blockNode->getAttribute( 'name' );
$blockArray[$blockName] = eZContentObjectPackageHandler::createArrayFromDOMNode( $blockNode->getElementsByTagName( $blockName )->item( 0 ) );
//$blockArray[$blockName] = $blockArray[$blockName][0];
if ( isset( $blockArray[$blockName]['Constant'] ) && is_array( $blockArray[$blockName]['Constant'] ) && count( $blockArray[$blockName]['Constant'] ) > 0 )
{
foreach( $blockArray[$blockName]['Constant'] as $matchKey => $value )
{
if ( strpos( $matchKey, 'class_' ) === 0 &&
is_int( $value ) )
{
$contentClass = eZContentClass::fetchByRemoteID( $blockArray[$blockName]['Constant']['class_remote_id'] );
$blockArray[$blockName]['Constant'][$matchKey] = $contentClass->attribute( 'id' );
unset( $blockArray[$blockName]['Constant']['class_remote_id'] );
}
if( strpos( $matchKey, 'node_' ) === 0 &&
is_int( $value ) )
{
$contentTreeNode = eZContentObjectTreeNode::fetchByRemoteID( $blockArray[$blockName]['Constant']['node_remote_id'] );
$blockArray[$blockName]['Constant'][$matchKey] = $contentTreeNode->attribute( 'node_id' );
unset( $blockArray[$blockName]['Constant']['node_remote_id'] );
}
if( strpos( $matchKey, 'parent_node_' ) === 0 &&
is_int( $value ) )
{
$contentTreeNode = eZContentObjectTreeNode::fetchByRemoteID( $blockArray[$blockName]['Constant']['parent_node_remote_id'] );
$blockArray[$blockName]['Constant'][$matchKey] = $contentTreeNode->attribute( 'node_id' );
unset( $blockArray[$blockName]['Constant']['parent_node_remote_id'] );
}
if( strpos( $matchKey, 'object_' ) === 0 &&
is_int( $value ) )
{
$contentObject = eZContentObject::fetchByRemoteID( $blockArray[$blockName]['Constant']['object_remote_id'] );
$blockArray[$blockName]['Constant'][$matchKey] = $contentTreeNode->attribute( 'id' );
unset( $blockArray[$blockName]['Constant']['object_remote_id'] );
}
}
}
$fetchAliasINIArray[$newSiteAccess]->setVariables( $blockArray );
}
foreach( $fetchAliasINIArray as $siteAccess => $iniFetchAlias )
{
$fetchAliasINIArray[$siteAccess]->save();
}
return true;
}
示例5: unserialize
static function unserialize($contentNodeDOMNode, $contentObject, $version, $isMain, &$nodeList, &$options, $handlerType = 'ezcontentobject')
{
$parentNodeID = -1;
$remoteID = $contentNodeDOMNode->getAttribute('remote-id');
$parentNodeRemoteID = $contentNodeDOMNode->getAttribute('parent-node-remote-id');
$node = eZContentObjectTreeNode::fetchByRemoteID($remoteID);
if (is_object($node)) {
$description = "Node with remote ID {$remoteID} already exists.";
$choosenAction = eZPackageHandler::errorChoosenAction(eZContentObject::PACKAGE_ERROR_EXISTS, $options, $description, $handlerType, false);
switch ($choosenAction) {
// In case user have choosen "Keep existing object and create new"
case eZContentObject::PACKAGE_NEW:
$newRemoteID = eZRemoteIdUtility::generate('node');
$node->setAttribute('remote_id', $newRemoteID);
$node->store();
$nodeInfo = array('contentobject_id' => $node->attribute('contentobject_id'), 'contentobject_version' => $node->attribute('contentobject_version'), 'parent_remote_id' => $remoteID);
$nodeAssignment = eZPersistentObject::fetchObject(eZNodeAssignment::definition(), null, $nodeInfo);
if (is_object($nodeAssignment)) {
$nodeAssignment->setAttribute('parent_remote_id', $newRemoteID);
$nodeAssignment->store();
}
break;
// When running non-interactively with ezpm.php
// When running non-interactively with ezpm.php
case eZPackage::NON_INTERACTIVE:
case eZContentObject::PACKAGE_UPDATE:
// Update existing node settigns.
if (!$parentNodeRemoteID) {
// when top node of subtree export, only update node sort field and sort order
$node->setAttribute('sort_field', eZContentObjectTreeNode::sortFieldID($contentNodeDOMNode->getAttribute('sort-field')));
$node->setAttribute('sort_order', $contentNodeDOMNode->getAttribute('sort-order'));
$node->store();
return true;
}
break;
default:
// This error may occur only if data integrity is broken
$options['error'] = array('error_code' => eZContentObject::PACKAGE_ERROR_NODE_EXISTS, 'element_id' => $remoteID, 'description' => $description);
return false;
break;
}
}
if ($parentNodeRemoteID) {
$parentNode = eZContentObjectTreeNode::fetchByRemoteID($parentNodeRemoteID);
if ($parentNode !== null) {
$parentNodeID = $parentNode->attribute('node_id');
}
} else {
if (isset($options['top_nodes_map'][$contentNodeDOMNode->getAttribute('node-id')]['new_node_id'])) {
$parentNodeID = $options['top_nodes_map'][$contentNodeDOMNode->getAttribute('node-id')]['new_node_id'];
} else {
if (isset($options['top_nodes_map']['*'])) {
$parentNodeID = $options['top_nodes_map']['*'];
} else {
eZDebug::writeError('New parent node not set ' . $contentNodeDOMNode->getAttribute('name'), __METHOD__);
}
}
}
$isMain = $isMain && $contentNodeDOMNode->getAttribute('is-main-node');
$nodeInfo = array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => $version, 'is_main' => $isMain, 'parent_node' => $parentNodeID, 'parent_remote_id' => $remoteID, 'sort_field' => eZContentObjectTreeNode::sortFieldID($contentNodeDOMNode->getAttribute('sort-field')), 'sort_order' => $contentNodeDOMNode->getAttribute('sort-order'));
if ($parentNodeID == -1 && $parentNodeRemoteID) {
if (!isset($options['suspended-nodes'])) {
$options['suspended-nodes'] = array();
}
$options['suspended-nodes'][$parentNodeRemoteID] = array('nodeinfo' => $nodeInfo, 'priority' => $contentNodeDOMNode->getAttribute('priority'));
return true;
}
$existNodeAssignment = eZPersistentObject::fetchObject(eZNodeAssignment::definition(), null, $nodeInfo);
$nodeInfo['priority'] = $contentNodeDOMNode->getAttribute('priority');
if (!is_object($existNodeAssignment)) {
$nodeAssignment = eZNodeAssignment::create($nodeInfo);
$nodeList[] = $nodeInfo;
$nodeAssignment->store();
}
return true;
}
示例6: transformRemoteLinksToLinks
static function transformRemoteLinksToLinks(DOMNodeList $nodeList, $objectAttribute)
{
$modified = false;
$contentObject = $objectAttribute->attribute('object');
foreach ($nodeList as $node) {
$objectRemoteID = $node->getAttribute('object_remote_id');
$nodeRemoteID = $node->getAttribute('node_remote_id');
if ($objectRemoteID) {
$objectArray = eZContentObject::fetchByRemoteID($objectRemoteID, false);
if (!is_array($objectArray)) {
eZDebug::writeWarning("Can't fetch object with remoteID = {$objectRemoteID}", __METHOD__);
continue;
}
$objectID = $objectArray['id'];
if ($node->localName == 'object') {
$node->setAttribute('id', $objectID);
} else {
$node->setAttribute('object_id', $objectID);
}
$node->removeAttribute('object_remote_id');
$modified = true;
// add as related object
if ($contentObject) {
$relationType = $node->localName == 'link' ? eZContentObject::RELATION_LINK : eZContentObject::RELATION_EMBED;
$contentObject->addContentObjectRelation($objectID, $objectAttribute->attribute('version'), 0, $relationType);
}
} elseif ($nodeRemoteID) {
$nodeArray = eZContentObjectTreeNode::fetchByRemoteID($nodeRemoteID, false);
if (!is_array($nodeArray)) {
eZDebug::writeWarning("Can't fetch node with remoteID = {$nodeRemoteID}", __METHOD__);
continue;
}
$node->setAttribute('node_id', $nodeArray['node_id']);
$node->removeAttribute('node_remote_id');
$modified = true;
// add as related object
if ($contentObject) {
$relationType = $node->nodeName == 'link' ? eZContentObject::RELATION_LINK : eZContentObject::RELATION_EMBED;
$contentObject->addContentObjectRelation($nodeArray['contentobject_id'], $objectAttribute->attribute('version'), 0, $relationType);
}
}
}
return $modified;
}
示例7: unserialize
/**
* Unserialize xml structure. Creates an object from xml input.
*
* Transaction unsafe. If you call several transaction unsafe methods you must enclose
* the calls within a db transaction; thus within db->begin and db->commit.
*
* @param mixed $package
* @param DOMElement $domNode
* @param array $options
* @param int|bool $ownerID Override owner ID, null to use XML owner id (optional)
* @param string $handlerType
* @return array|bool|eZContentObject|null created object, false if could not create object/xml invalid
*/
static function unserialize( $package, $domNode, &$options, $ownerID = false, $handlerType = 'ezcontentobject' )
{
if ( $domNode->localName != 'object' )
{
$retValue = false;
return $retValue;
}
$initialLanguage = eZContentObject::mapLanguage( $domNode->getAttribute( 'initial_language' ), $options );
if( $initialLanguage === 'skip' )
{
$retValue = true;
return $retValue;
}
$sectionID = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'section_id' );
if ( $ownerID === false )
{
$ownerID = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'owner_id' );
}
$remoteID = $domNode->getAttribute( 'remote_id' );
$name = $domNode->getAttribute( 'name' );
$classRemoteID = $domNode->getAttribute( 'class_remote_id' );
$classIdentifier = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'class_identifier' );
$alwaysAvailable = ( $domNode->getAttributeNS( 'http://ez.no/ezobject', 'always_available' ) == '1' );
$contentClass = eZContentClass::fetchByRemoteID( $classRemoteID );
if ( !$contentClass )
{
$contentClass = eZContentClass::fetchByIdentifier( $classIdentifier );
}
if ( !$contentClass )
{
$options['error'] = array( 'error_code' => self::PACKAGE_ERROR_NO_CLASS,
'element_id' => $remoteID,
'description' => "Can't install object '$name': Unable to fetch class with remoteID: $classRemoteID." );
$retValue = false;
return $retValue;
}
/** @var DOMElement $versionListNode */
$versionListNode = $domNode->getElementsByTagName( 'version-list' )->item( 0 );
$importedLanguages = array();
foreach( $versionListNode->getElementsByTagName( 'version' ) as $versionDOMNode )
{
/** @var DOMElement $versionDOMNode */
foreach ( $versionDOMNode->getElementsByTagName( 'object-translation' ) as $versionDOMNodeChild )
{
/** @var DOMElement $versionDOMNodeChild */
$importedLanguage = eZContentObject::mapLanguage( $versionDOMNodeChild->getAttribute( 'language' ), $options );
$language = eZContentLanguage::fetchByLocale( $importedLanguage );
// Check if the language is allowed in this setup.
if ( $language )
{
$hasTranslation = true;
}
else
{
if ( $importedLanguage == 'skip' )
continue;
// if there is no needed translation in system then add it
$locale = eZLocale::instance( $importedLanguage );
$translationName = $locale->internationalLanguageName();
$translationLocale = $locale->localeCode();
if ( $locale->isValid() )
{
eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );
$hasTranslation = true;
}
else
$hasTranslation = false;
}
if ( $hasTranslation )
{
$importedLanguages[] = $importedLanguage;
$importedLanguages = array_unique( $importedLanguages );
}
}
}
// If object exists we return a error.
// Minimum install element is an object now.
//.........这里部分代码省略.........
示例8: findNodeFromPath
/**
* @param string $path
* @param MerckManualShowcase $app
* @return bool|eZContentObjectTreeNode
*/
public static function findNodeFromPath( $path, &$app )
{
/* We remove the publisher folder id at the beginning of the url as we already have it */
$path = preg_replace('#^/\d+/#', '/', $path );
$manualAppNode = eZContentObjectTreeNode::fetch( self::rootNodeId() );
$manualAppNodePathName = $manualAppNode->pathWithNames();
$tabNodePath = explode('/', substr($path, 1));
$remoteId = end($tabNodePath);
if(preg_match('/^[a-f0-9]{32}$/', $remoteId))
{
$nodeRemote = eZContentObjectTreeNode::fetchByRemoteID($remoteId);
if($nodeRemote instanceof eZContentObjectTreeNode)
{
$app->fullContext = 'topic';
return $nodeRemote;
}
}
$pathParts = explode('/', substr($path, 1));
if ( $pathParts[0] == 'table' )
{
$app->fullContext = 'table';
return eZContentObjectTreeNode::fetch($pathParts[1]);
}
// Url with topic
list($sectionName, $chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
// Url without topic
$matches = array();
if ( preg_match('/media-([a-z]+)/', $topicName, $matches) )
{
list($sectionName, $chapterName, $mediaType, $mediaName, $other) = $pathParts;
$topicName = null;
}
// Full section
if ( $sectionName != null && is_null( $chapterName ) && is_null( $topicName ) )
{
$app->fullContext = 'section';
$app->section = MerckManualFunctionCollection::fetchSection('url', $sectionName);
return eZContentObjectTreeNode::fetch(MerckManualShowcase::rootNodeId());
}
if ( $sectionName == 'about-us' )
{
list($chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
}
$path = $manualAppNodePathName;
// Full of chapter
if ( $chapterName )
{
$app->fullContext = 'chapter';
$path .= '/' . $chapterName;
}
// Full of topic
if ( $topicName )
{
$app->fullContext = 'topic';
$path .= '/' . $topicName;
}
$nodeId = eZURLAliasML::fetchNodeIDByPath($path);
if ( $nodeId )
{
if ( $mediaName )
{
$mediaType = str_replace('media-', '', $mediaType);
// Get media node
// Full of html table image
// /topic_name/(media-image-file)/oscar2/filename
if ( $mediaType == 'image-file' )
{
$app->fullContext = $mediaType;
$app->oscarFolder = $mediaName;
$app->mediaName = $other;
}
// Full of inline audio, video, image
elseif ( $mediaType )
{
// Construct the remote_id of the media folder
/* @type $dataMap eZContentObjectAttribute[] */
$contentObject = eZContentObject::fetchByNodeID($nodeId);
$dataMap = $contentObject->dataMap();
$publisherAttrContent = $dataMap['publisher']->content();
//.........这里部分代码省略.........
示例9: array
<?php
require_once 'kernel/common/template.php';
include_once 'kernel/classes/ezcontentobjecttreenode.php';
include_once "lib/ezutils/classes/ezmail.php";
include_once 'extension/jajnewsletter/modules/newsletter/classes/jajsubscriptionuser.php';
$http = eZHTTPTool::instance();
$Module =& $Params['Module'];
$remoteID = $Params['RemoteID'];
$node = eZContentObjectTreeNode::fetchByRemoteID($remoteID);
if (!$node) {
return $Module->handleError(EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel');
}
// TODO CHECK FOR TRASH
// TODO CHECK FOR READ
$success = array();
$error = array();
$email = "";
$name = "";
do {
if ($http->hasPostVariable('SignupButton')) {
$email = trim($http->variable('email'));
$name = trim($http->variable('name'));
if (!eZMail::validate($email)) {
$error['email'] = true;
}
if (strlen($name) == 0) {
$error['name'] = true;
}
if (!empty($error)) {
continue;
示例10: getNodeFromPath
/**
* @param string $nodePath
* @param eZContentObjectTreeNode[] $publisherFolderNodes
* @return eZContentObjectTreeNode
*/
static protected function getNodeFromPath ( $nodePath, $publisherFolderNodes )
{
// Remove view parameters
$nodePath = preg_replace( '#/\([^\)]+\)/.*$#', '', $nodePath );
$node = false;
foreach ( $publisherFolderNodes as $publisherFolderNode )
{
$nodeFullPath = '/' . $publisherFolderNode->attribute('url_alias') . '/' . $nodePath;
$node = eZContentObjectTreeNode::fetchByURLPath( $nodeFullPath );
if (!$node)
{
$node = eZContentObjectTreeNode::fetchByPath($nodeFullPath);
if (!$node)
{
$cleanableHref = $nodeFullPath;
$aliasTranslate = eZURLAliasML::translate($cleanableHref);
while ( $aliasTranslate !== true && $aliasTranslate !== false )
{
$cleanableHref = $aliasTranslate;
$aliasTranslate = eZURLAliasML::translate($cleanableHref);
}
if ( $aliasTranslate === true )
{
$lastSlashPosition = strrpos($cleanableHref, '/');
if( $lastSlashPosition !== false )
$node = eZContentObjectTreeNode::fetch(substr($cleanableHref, $lastSlashPosition+1));
}
}
if (!$node)
{
$tabNodePath = explode('/', substr($nodeFullPath, 1));
$remoteId = end($tabNodePath);
$nodeRemote = eZContentObjectTreeNode::fetchByRemoteID($remoteId);
if($nodeRemote && $publisherFolderNode)
{
$rootNodeID = $publisherFolderNode->attribute('node_id');
$tabNodeRemote = $nodeRemote->pathArray();
$nodeId = $nodeRemote->attribute('node_id');
if(in_array($rootNodeID, $tabNodeRemote) && $rootNodeID != $nodeId)
$node = $nodeRemote;
/*******************************************************************************
* TODO : Delete after PF Refactor
*******************************************************************************/
else
{
$publisherFolderPathArray = $publisherFolderNode->pathArray();
foreach ( $nodeRemote->object()->assignedNodes() as $location )
{
if ( in_array( $publisherFolderPathArray[2], $location->pathArray() ) )
{
$node = $location;
break;
}
}
}
/*******************************************************************************
* TODO : END : Delete after PF Refactor
*******************************************************************************/
}
}
}
if ($node instanceof eZContentObjectTreeNode)
break;
}
// if we still do not have a node, we try to look in the old locations
if ( !($node instanceof eZContentObjectTreeNode) )
{
$pfrLocation = null;
if ( preg_match('#node_(?P<node_id>\d+)/?$#', $nodePath, $m) )
{
$nodeId = $m['node_id'];
$pfrLocation = PfrLocation::fetchByNodeId( $nodeId );
}
else
{
$remoteId = basename( rtrim($nodePath, '/') );
$pfrLocation = PfrLocation::fetchByRemoteId( $remoteId );
}
if ( $pfrLocation instanceof PfrLocation )
{
$node = $pfrLocation->node( $publisherFolderNodes );
//.........这里部分代码省略.........