本文整理汇总了PHP中eZContentObject::fetchByRemoteID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fetchByRemoteID方法的具体用法?PHP eZContentObject::fetchByRemoteID怎么用?PHP eZContentObject::fetchByRemoteID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fetchByRemoteID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchContentObject
public static function fetchContentObject($objectID, $remoteID = false)
{
if ($objectID === false && $remoteID !== false) {
$contentObject = eZContentObject::fetchByRemoteID($remoteID);
} else {
$contentObject = eZContentObject::fetch($objectID);
}
if ($contentObject === null) {
$result = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
} else {
$result = array('result' => $contentObject);
}
return $result;
}
示例2: isValidObjectRemoteID
/**
* test if the new object remote id is available (or already used by this object)
* @param string $remoteID
* @param int $currentObjectID
* @param array $errors
* @return boolean
*/
public static function isValidObjectRemoteID($remoteID, $currentObjectID = false, &$errors = array())
{
if (!self::isValidRemoteIDText($remoteID, $errors)) {
return false;
}
if ($existingObject = eZContentObject::fetchByRemoteID($remoteID, false)) {
if ($existingObject['id'] != $currentObjectID) {
$errors[] = ezpI18n::tr('remoteid/update', 'Object Remote ID %1 already used by object %2', '', array('%1' => $remoteID, '%2' => $existingObject['id']));
eZDebug::writeDebug('Object Remote ID ' . $remoteID . ' used by object ' . $existingObject['id'], '', __CLASS__);
return false;
}
}
return true;
}
示例3: getContent
public function getContent($forceSynchronization=true)
{
if (!$this->content)
{
$contentObject = eZContentObject::fetchByRemoteID( $this->remoteId() );
if ($contentObject instanceof eZContentObject)
{
$this->content = SQLIContent::fromContentObject( $contentObject );
}
if (!$contentObject || $forceSynchronization || $this->synchronizer->option('ForceSynchronization'))
{
$this->synchronize();
}
}
return $this->content;
}
示例4: __construct
public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
{
parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
foreach( $this->applicationLocalized()->publisherFolders as $publisherFolder )
{
/* @var $publisherFolder PublisherFolder */
$publisherFolderObject = eZContentObject::fetchByRemoteID( 'publisher_folder-'.$publisherFolder->attribute('path') );
/* @var $publisherFolderNode eZContentObjectTreeNode */
$publisherFolderNode = $publisherFolderObject->mainNode();
foreach( $publisherFolderNode->children() as $child )
{
/* @var $child eZContentObjectTreeNode */
if( $child->classIdentifier() == 'article' )
{
$this->node = $child;
$this->isFull = true;
header('x-ez-node: ' . 'P'.$this->node->attribute('node_id').'P' );
}
}
}
}
示例5: 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;
}
示例6: postUnserializeContentObjectAttribute
function postUnserializeContentObjectAttribute($package, $objectAttribute)
{
$xmlString = $objectAttribute->attribute('data_text');
$doc = $this->parseXML($xmlString);
$rootNode = $doc->documentElement;
$relationList = $rootNode->getElementsByTagName('relation-list')->item(0);
if (!$relationList) {
return false;
}
$relationItems = $relationList->getElementsByTagName('relation-item');
for ($i = $relationItems->length - 1; $i >= 0; $i--) {
$relationItem = $relationItems->item($i);
$relatedObjectRemoteID = $relationItem->getAttribute('contentobject-remote-id');
$object = eZContentObject::fetchByRemoteID($relatedObjectRemoteID);
if ($object === null) {
eZDebug::writeWarning("Object with remote id '{$relatedObjectRemoteID}' not found: removing the link.", __METHOD__);
$relationItem->parentNode->removeChild($relationItem);
continue;
}
$relationItem->setAttribute('contentobject-id', $object->attribute('id'));
$relationItem->setAttribute('contentobject-version', $object->attribute('current_version'));
$relationItem->setAttribute('node-id', $object->attribute('main_node_id'));
$relationItem->setAttribute('parent-node-id', $object->attribute('main_parent_node_id'));
$relationItem->setAttribute('contentclass-id', $object->attribute('contentclass_id'));
$relationItem->setAttribute('contentclass-identifier', $object->attribute('class_identifier'));
}
$newXmlString = $doc->saveXML($rootNode);
$objectAttribute->setAttribute('data_text', $newXmlString);
return true;
}
示例7: loginUser
//.........这里部分代码省略.........
}
return false;
}
while (!feof($handle)) {
$line = trim(fgets($handle, 4096));
if ($line === '') {
continue;
}
if ($separator == "tab") {
$userArray = explode("\t", $line);
} else {
$userArray = explode($separator, $line);
}
$uid = $userArray[$loginColumnNr - 1];
$email = $userArray[$emailColumnNr - 1];
$pass = $userArray[$passwordColumnNr - 1];
$firstName = $userArray[$firstNameColumnNr - 1];
$lastName = $userArray[$lastNameColumnNr - 1];
if ($login == $uid) {
if (trim($pass) == $password) {
$createNewUser = true;
$existUser = eZUser::fetchByName($login);
if ($existUser != null) {
$createNewUser = false;
}
if ($createNewUser) {
$userClassID = $ini->variable("UserSettings", "UserClassID");
$userCreatorID = $ini->variable("UserSettings", "UserCreatorID");
$defaultSectionID = $ini->variable("UserSettings", "DefaultSectionID");
$remoteID = "TextFile_" . $login;
$db->begin();
// The content object may already exist if this process has failed once before, before the eZUser object was created.
// Therefore we try to fetch the eZContentObject before instantiating it.
$contentObject = eZContentObject::fetchByRemoteID($remoteID);
if (!is_object($contentObject)) {
$class = eZContentClass::fetch($userClassID);
$contentObject = $class->instantiate($userCreatorID, $defaultSectionID);
}
$contentObject->setAttribute('remote_id', $remoteID);
$contentObject->store();
$contentObjectID = $contentObject->attribute('id');
$userID = $contentObjectID;
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObjectID, 'contentobject_version' => 1, 'parent_node' => $defaultUserPlacement, 'is_main' => 1));
$nodeAssignment->store();
$version = $contentObject->version(1);
$version->setAttribute('modified', time());
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$contentObjectID = $contentObject->attribute('id');
$contentObjectAttributes = $version->contentObjectAttributes();
$contentObjectAttributes[0]->setAttribute('data_text', $firstName);
$contentObjectAttributes[0]->store();
$contentObjectAttributes[1]->setAttribute('data_text', $lastName);
$contentObjectAttributes[1]->store();
$user = eZUser::create($userID);
$user->setAttribute('login', $login);
$user->setAttribute('email', $email);
$user->setAttribute('password_hash', "");
$user->setAttribute('password_hash_type', 0);
$user->store();
eZUser::updateLastVisit($userID);
eZUser::setCurrentlyLoggedInUser($user, $userID);
// Reset number of failed login attempts
eZUser::setFailedLoginAttempts($userID, 0);
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObjectID, 'version' => 1));
$db->commit();
示例8: handleInlineNode
//.........这里部分代码省略.........
switch ($alignment) {
case "left":
$imageAlignment = "left";
break;
case "right":
$imageAlignment = "right";
break;
default:
$imageAlignment = "center";
break;
}
break;
}
}
if (file_exists($href)) {
// Calculate RemoteID based on image md5:
$remoteID = "ezoo-" . md5(file_get_contents($href));
/*
// Check if an image with the same remote ID already exists
$db = eZDB::instance();
$imageParentNodeID = $GLOBALS["OOImportObjectID"];
$resultArray = $db->arrayQuery( 'SELECT id, node_id, ezcontentobject.remote_id
FROM ezcontentobject, ezcontentobject_tree
WHERE ezcontentobject.remote_id = "' . $remoteID. '" AND
ezcontentobject.id=ezcontentobject_tree.contentobject_id AND
ezcontentobject_tree.parent_node_id=' . $imageParentNodeID );
$contentObject = false;
if ( count( $resultArray ) >= 1 )
{
$contentObject = eZContentObject::fetch( $resultArray[0]['id'], true );
$contentObjectID = $resultArray[0]['id'];
}
*/
$contentObject = eZContentObject::fetchByRemoteID($remoteID);
// If image does not already exist, create it as an object
if (!$contentObject) {
// Import image
$ooINI = eZINI::instance('odf.ini');
$imageClassIdentifier = $ooINI->variable("ODFImport", "DefaultImportImageClass");
$class = eZContentClass::fetchByIdentifier($imageClassIdentifier);
$creatorID = $this->currentUserID;
$contentObject = $class->instantiate($creatorID, 1);
$contentObject->setAttribute("remote_id", $remoteID);
$contentObject->store();
$version = $contentObject->version(1);
$version->setAttribute('modified', eZDateTime::currentTimeStamp());
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$contentObjectID = $contentObject->attribute('id');
$dataMap = $contentObject->dataMap();
// set image name
$dataMap['name']->setAttribute('data_text', $imageName);
$dataMap['name']->store();
// set image caption
if (isset($dataMap['caption'])) {
$captionContentAttibute = $dataMap['caption'];
$captionText = "{$imageName}";
// create new xml for caption
$xmlInputParser = new eZXMLInputParser();
$dom = $xmlInputParser->createRootNode();
$captionNode = $dom->createElement('paragraph', $captionText);
$dom->documentElement->appendChild($captionNode);
$xmlString = $dom->saveXML();
$captionContentAttibute->setAttribute('data_text', $xmlString);
$captionContentAttibute->store();
} else {
示例9: getNamedContent
protected function getNamedContent($name, $forceSynchronization)
{
$contentName = 'content' . $name;
if (!$this->$contentName)
{
$contentObject = eZContentObject::fetchByRemoteID( $this->{'remoteId' . $name}() );
if ( !$forceSynchronization && !$this->synchronizer->option('ForceSynchronization') && $contentObject instanceof eZContentObject )
{
$this->$contentName = SQLIContent::fromContentObject( $contentObject );
if ($this->$contentName instanceof SQLIContent)
{
$this->{$contentName}->setActiveLanguage($this->source['pf_default_language']);
}
}
else
{
$this->synchronize();
}
}
return $this->$contentName;
}
示例10: fetchbyremoteid
private function fetchbyremoteid($remoteId)
{
$contentObject = eZContentObject::fetchByRemoteID($remoteId);
$this->dumpContentObjectInfo($contentObject);
}
示例11: run
public function run($remove = false, $useStateHashes = true, $update = true, $create = true)
{
$contentClass = $this->config->getContentClass();
$allOjectsInFeedRemoteIDs = array();
$dataList = $this->config->getDataList();
$dataListCount = count($dataList);
if ($dataListCount > 0) {
foreach ($dataList as $key => &$objectData) {
$memoryUsage = number_format(memory_get_usage(true) / (1024 * 1024), 2);
$this->debug(number_format($key / $dataListCount * 100, 2) . '% (' . ($key + 1) . '/' . $dataListCount . '), Memory usage: ' . $memoryUsage . ' Mb', array('red'));
$objectData['remoteID'] = $this->config->getObjectRemoteID($objectData);
$objectData['mainParentNodeID'] = $this->config->getMainParentNodeID($objectData);
$objectData['adittionalParentNodeIDs'] = (array) $this->config->getAdittionalParentNodeIDs($objectData);
$objectData['attributes'] = (array) $this->config->transformObjectAttributes($objectData);
$objectData['language'] = $this->config->getLanguage($objectData);
$objectData['versionStatus'] = $this->config->getVersionStatus($objectData);
$objectData['mainNodePriority'] = $this->config->getMainNodePriority($objectData);
$objectData['visibility'] = $this->config->isVisible($objectData);
$currentStateHash = $this->config->getStateHash($objectData);
$allOjectsInFeedRemoteIDs[] = $objectData['remoteID'];
$object = eZContentObject::fetchByRemoteID($objectData['remoteID']);
$result = $this->config->preProcessCallback($object, $objectData);
if ($result === false) {
$this->debug('[Skipped by preProcessCallback] Remote ID: "' . $objectData['remoteID'] . '"', array('blue'));
$this->skip($object, $objectData);
continue;
}
$skipped = false;
if ($object instanceof eZContentObject) {
if ($update === false) {
$this->debug('[Skipped] "' . $object->attribute('name') . '"', array('blue'));
$this->skip($object, $objectData);
$skipped = true;
} else {
$storedStateHash = nxcImportStateHash::get($objectData['remoteID']);
if ($currentStateHash == $storedStateHash && $useStateHashes === true) {
$this->debug('[Skipped] "' . $object->attribute('name') . '" (Node ID: ' . $object->attribute('main_node_id') . ')', array('blue'));
$this->skip($object, $objectData);
$skipped = true;
} else {
$parentNode = false;
if ($objectData['mainParentNodeID'] !== false) {
$parentNode = eZContentObjectTreeNode::fetch($objectData['mainParentNodeID']);
}
if ($objectData['mainParentNodeID'] !== false && $parentNode instanceof eZContentObjectTreeNode === false) {
$this->remove($object, $objectData);
nxcImportStateHash::remove($object->attribute('remote_id'));
$this->pcHandler->removeObject($object);
} else {
$params = array('object' => $object, 'attributes' => $objectData['attributes'], 'additionalParentNodeIDs' => $objectData['adittionalParentNodeIDs'], 'visibility' => (bool) $objectData['visibility']);
if ($objectData['mainParentNodeID'] !== false) {
$params['parentNode'] = $parentNode;
}
$this->pcHandler->updateObject($params);
$this->update($object, $objectData);
nxcImportStateHash::update($objectData['remoteID'], $currentStateHash);
$object->resetDataMap();
eZContentObject::clearCache($object->attribute('id'));
}
}
}
} else {
if ($create === false) {
$this->debug('[Skipped]', array('blue'));
$this->skip($object, $objectData);
$skipped = true;
} else {
$object = $this->pcHandler->createObject(array('class' => $contentClass, 'parentNodeID' => $objectData['mainParentNodeID'], 'attributes' => $objectData['attributes'], 'remoteID' => $objectData['remoteID'], 'additionalParentNodeIDs' => $objectData['adittionalParentNodeIDs'], 'languageLocale' => isset($objectData['language']) ? $objectData['language'] : false, 'visibility' => (bool) $objectData['visibility']));
if ($object instanceof eZContentObject) {
$this->create($object, $objectData);
nxcImportStateHash::update($objectData['remoteID'], $currentStateHash);
if ($objectData['mainNodePriority'] !== false) {
$mainNode = $object->attribute('main_node');
$mainNode->setAttribute('priority', $objectData['mainNodePriority']);
$mainNode->store();
}
$object->resetDataMap();
eZContentObject::clearCache($object->attribute('id'));
}
}
}
$this->config->postProcessCallback($object, $objectData, $skipped);
}
$allOjectsInFeedRemoteIDs = array_unique($allOjectsInFeedRemoteIDs);
if ($remove && count($allOjectsInFeedRemoteIDs) > 0) {
$publishedObjects = $contentClass->objectList();
foreach ($publishedObjects as $object) {
if (in_array($object->attribute('remote_id'), $allOjectsInFeedRemoteIDs) === false) {
$this->remove($object, $objectData);
nxcImportStateHash::remove($object->attribute('remote_id'));
$this->pcHandler->removeObject($object);
}
}
}
}
}
示例12: array
$cli->error( "You must specify a --clusterIdentifier\n" );
$script->showHelp();
$script->shutdown( 1 );
}
$db = MMDB::instance();
$remoteIDsToFetch = array(
"html-$clusterIdentifier-footer1",
"html-$clusterIdentifier-footer2",
"html-$clusterIdentifier-footer2_for_cookie_law"
);
$exportedPagesCount = 0;
foreach( $remoteIDsToFetch as $remoteID )
{
$footersObject = eZContentObject::fetchByRemoteID( $remoteID );
if( $footersObject )
{
$dm = $footersObject->DataMap();
if( $dm )
{
$queryDelete = sprintf(
'DELETE FROM mm_footer WHERE cluster_identifier = "%s" AND block_identifier = "%s"',
$clusterIdentifier,
array_pop( explode( '-', $remoteID ) )
);
$db->query( $queryDelete );
$queryInsert = sprintf(
'INSERT INTO mm_footer (`cluster_identifier`, `block_identifier`, `content`) VALUES ("%s", "%s", "%s")',
$clusterIdentifier,
示例13: array
$mdb = eZDB::instance();
$query = 'SELECT remote_id, cluster_identifier, count FROM mm_readcount_remote WHERE to_reindex = 1 GROUP BY remote_id';
$i = 0;
/* We construct an array of [ object_id_1 => [node_id_1, node_id_2, ..],
* object_id_2 => [node_id_1, node_id_2, node_id_3, ..]
* ...] */
$objectIds = array();
$varnish_node_ids = array();
$solrJsonObjects = array();
foreach($mdb->arrayQuery($query) as $row)
{
$object = eZContentObject::fetchByRemoteID($row["remote_id"]);
if($object)
{
$objectId = $object->attribute("id");
$objectIds[] = $objectId;
$varnish_node_ids[] = $object->mainNode()->attribute('parent_node_id');
}
else
{
//test if solrObject
$fields = array(
'views' => 'attr_view_counter_'.$row['cluster_identifier'].'_i',
);
示例14: eZSolr
<?php
$module = $Params['ObjectID'];
$tpl = eZTemplate::factory();
$error = false;
$info = false;
$detail = false;
$xml = false;
$solr = false;
$objectID = $Params['ObjectID'];
if (NULL == $Params['ObjectID']) {
$error = "Object ID or object remote_id not found";
} else {
$object = eZContentObject::fetch(intval($objectID));
if (!$object instanceof eZContentObject) {
$object = eZContentObject::fetchByRemoteID($objectID);
}
if ($object instanceof eZContentObject) {
if ($object->attribute('can_read')) {
$searchEngine = new eZSolr();
$result = $searchEngine->addObject($object, true);
$xmlData = fakeAddObject($object);
if ($xmlData == false) {
$result = false;
$xmlData = array();
}
$info = array('object' => $object, 'result' => $result);
$detail = array();
$attributes = $object->dataMap();
foreach ($attributes as $attribute) {
$isSearchable = $attribute->attribute('contentclass_attribute')->attribute('is_searchable');
示例15: loadLocalObjectsByRemoteId
public function loadLocalObjectsByRemoteId($unparsed_json)
{
$json_array = json_decode($unparsed_json, true);
$returnArray = array();
foreach ($json_array as $key => $arrayRemoteId) {
foreach ($arrayRemoteId as $remoteId) {
$eZContentObject = eZContentObject::fetchByRemoteID($remoteId);
if ($eZContentObject instanceof eZContentObject) {
array_push($returnArray, $eZContentObject);
}
}
}
if (itobjectsutils::isEmptyArray($returnArray)) {
return array();
}
return $this->itFiltersUtil->updatablestatusobjects($returnArray);
}