本文整理汇总了PHP中eZContentObject类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject类的具体用法?PHP eZContentObject怎么用?PHP eZContentObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: copyObject
/**
* Create a copy of an object.
*
* The basis for this method is taken from kernel/content/copy.php
*
* @todo Merge this method into kernel wrapper's object class.
*
* @param eZContentObject $object
* @param int $newParentNodeID
* @return eZContentObject
*/
public static function copyObject($object, $newParentNodeID)
{
$newParentNode = eZContentObjectTreeNode::fetch($newParentNodeID);
$db = eZDB::instance();
$db->begin();
$newObject = $object->copy(true);
// We should reset section that will be updated in updateSectionID().
// If sectionID is 0 than the object has been newly created
$newObject->setAttribute('section_id', 0);
$newObject->store();
$curVersion = $newObject->attribute('current_version');
$curVersionObject = $newObject->attribute('current');
$newObjAssignments = $curVersionObject->attribute('node_assignments');
unset($curVersionObject);
// remove old node assignments
foreach ($newObjAssignments as $assignment) {
$assignment->purge();
}
// and create a new one
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $newObject->attribute('id'), 'contentobject_version' => $curVersion, 'parent_node' => $newParentNodeID, 'is_main' => 1));
$nodeAssignment->store();
// publish the newly created object
eZOperationHandler::execute('content', 'publish', array('object_id' => $newObject->attribute('id'), 'version' => $curVersion));
// Update "is_invisible" attribute for the newly created node.
$newNode = $newObject->attribute('main_node');
eZContentObjectTreeNode::updateNodeVisibility($newNode, $newParentNode);
$db->commit();
return $newObject;
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:40,代码来源:ezcontentobject_regression.php
示例2: message
public static function message($publishHandler, eZContentObject $object, $message, $messageLength = null, $options)
{
$url = false;
if (isset($options['include_url']) && (bool) $options['include_url'] === true) {
$url = $object->attribute('main_node')->attribute('url_alias');
eZURI::transformURI($url, true, 'full');
if (isset($options['shorten_url']) && (bool) $options['shorten_url'] === true) {
$urlReturned = $publishHandler->shorten($url, $options['shorten_handler']);
if (is_string($urlReturned)) {
$url = $urlReturned;
}
}
if ($messageLength != null) {
$messageLength = $messageLength - strlen($url) - 1;
}
}
if (class_exists('Normalizer')) {
$message = Normalizer::normalize($message, Normalizer::FORM_C);
}
if ($messageLength != null) {
$message = mb_substr($message, 0, $messageLength);
}
if ($url) {
$message .= ' ' . $url;
}
return $message;
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:27,代码来源:nxcSocialNetworksMessageHandlerDefault.php
示例3: removeObject
/**
* Removes object $contentObject from the search database.
*
* @deprecated Since 5.0, use removeObjectById()
* @param eZContentObject $contentObject the content object to remove
* @param bool $commit Whether to commit after removing the object
* @return bool True if the operation succeed.
*/
static function removeObject($contentObject, $commit = null)
{
$searchEngine = eZSearch::getEngine();
if ($searchEngine instanceof ezpSearchEngine) {
return $searchEngine->removeObjectById($contentObject->attribute("id"), $commit);
}
return false;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:16,代码来源:ezsearch.php
示例4: unLock
function unLock(eZContentObject $object)
{
$filterConds = array('action' => 'creating_translation', 'param' => $object->attribute('id'));
$rows = eZPersistentObject::fetchObjectList(eZPendingActions::definition(), null, $filterConds);
foreach ($rows as $row) {
$row->remove();
}
}
开发者ID:rantoniazzi,项目名称:ocbootstrap,代码行数:8,代码来源:translate.php
示例5: fetchByObject
static function fetchByObject(eZContentObject $object)
{
$attributes = $object->fetchDataMap();
foreach ($attributes as $attribute) {
if ($attribute->DataTypeString == 'xrowmetadata' and $attribute->hasContent()) {
return $attribute->content();
}
}
return false;
}
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:10,代码来源:xrowmetadatatools.php
示例6: fromContentObject
/**
* Initializes a level one ezpContentFieldSet from an eZContentObject
* @param eZContentObject $contentObject
* @return ezpContentFieldSet
*/
public static function fromContentObject(eZContentObject $contentObject)
{
$set = new ezpContentFieldSet();
$languages = $contentObject->availableLanguages();
foreach ($languages as $language) {
$set->childrenFieldSets[$language] = ezpContentFieldSet::fromDataMap($contentObject->fetchDataMap(false, $language));
}
// this sequence is REALLY ugly
reset($languages);
$set->setActiveLanguage(current($languages));
return $set;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:17,代码来源:field_set.php
示例7: getDataMember
/**
* Returns part of the data for the attribute
*
* @param string $dataMember
*
* @return string
*/
public function getDataMember($dataMember)
{
if ($dataMember === 'related_images') {
$images = array();
$relations = $this->ContentObjectAttribute->attribute('content');
foreach ($relations['relation_list'] as $relation) {
$object = eZContentObject::fetch($relation['contentobject_id']);
if ($object instanceof eZContentObject) {
$dataMap = $object->attribute('data_map');
foreach ($dataMap as $attribute) {
/** @var eZContentObjectAttribute $attribute */
if ($attribute->attribute('data_type_string') !== eZImageType::DATA_TYPE_STRING) {
continue;
}
if ($attribute->hasContent()) {
$imageAliasHandler = $attribute->attribute('content');
$imageAlias = $imageAliasHandler->imageAlias('opengraph');
if ($imageAlias['is_valid'] == 1) {
$images[] = eZSys::serverURL() . '/' . $imageAlias['full_path'];
}
}
}
}
}
if (empty($images)) {
$images[] = eZSys::serverURL() . eZURLOperator::eZImage(null, 'opengraph_default_image.png', '');
}
return $images;
}
return $this->getData();
}
开发者ID:netgen,项目名称:ngopengraph,代码行数:38,代码来源:ngopengraphobjectrelationlist.php
示例8: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($parameters['object_id']);
$versionID = $parameters['version'];
if (!$object) {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$version = $object->version($versionID);
if (!$version) {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$akismetObject = new eZContentObjectAkismet();
$comment = $akismetObject->akismetInformationExtractor($version);
if ($comment) {
$akismet = new eZAkismet($comment);
if ($akismet) {
$isSpam = $akismet->isCommentSpam();
eZDebug::writeDebug($comment);
eZDebug::writeDebug("this is spam: " . $isSpam);
} else {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if (!$isSpam) {
$response = $akismet->submitHam();
return eZWorkflowType::STATUS_ACCEPTED;
}
return eZWorkflowType::STATUS_REJECTED;
}
}
开发者ID:BGCX067,项目名称:ezakismet-svn-to-git,代码行数:30,代码来源:ezakismettype.php
示例9: contentObject
/**
* get the contentobject of one comment
* @return eZContentObject
*/
public function contentObject()
{
if (isset($this->ContentObjectID) and $this->ContentObjectID) {
return eZContentObject::fetch($this->ContentObjectID);
}
return null;
}
开发者ID:legende91,项目名称:ez,代码行数:11,代码来源:ezcomcomment.php
示例10: remove
static function remove($objectID, $removeSubtrees = true)
{
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
$object = eZContentObject::fetch($objectID);
if (!is_object($object)) {
return false;
}
// TODO: Is content cache cleared for all objects in subtree ??
if ($removeSubtrees) {
$assignedNodes = $object->attribute('assigned_nodes');
if (count($assignedNodes) == 0) {
$object->purge();
eZContentObject::expireAllViewCache();
return true;
}
$assignedNodeIDArray = array();
foreach ($assignedNodes as $node) {
$assignedNodeIDArray[] = $node->attribute('node_id');
}
eZContentObjectTreeNode::removeSubtrees($assignedNodeIDArray, false);
} else {
$object->purge();
}
return true;
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:25,代码来源:ezcontentobjectoperations.php
示例11: runOperation
function runOperation(&$node)
{
$object = $node->attribute('object');
$object_id = $object->attribute('id');
$objectLocales = $object->attribute('available_languages');
// If the alternative locale does not exist for object, create it
if (!in_array($this->altLocale, $objectLocales)) {
// The only translation is in locate to be removed - create a version in another locale first.
echo "Copying the single translation in " . $this->remLocale . " to " . $this->altLocale . " so former could be removed.\n";
$newVersion = $object->createNewVersionIn($this->altLocale, $this->remLocale, false, true, eZContentObjectVersion::STATUS_DRAFT);
$publishResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object_id, 'version' => $newVersion->attribute('version')));
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
}
// Change objects main language to alternative language, if its current main language is to be removed.
if ($object->attribute('initial_language_code') == $this->remLocale) {
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
echo "Switching initial language to {$this->altLocale} so that " . $this->remLocale . " could be removed.\n";
$updateResult = eZContentOperationCollection::updateInitialLanguage($object_id, $this->altLangID);
$object->store();
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
}
// Now it should be safe to remove translation.
return $object->removeTranslation($this->remLangID);
}
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:27,代码来源:noderemovetranslation.php
示例12: feZMetaData_ContentActionHandler
function feZMetaData_ContentActionHandler( &$module, &$http, &$objectID )
{
// Action when user clicks on the Add Button
if( $http->hasPostVariable( 'AddMetaDataButton' ) )
{
$link = 'fezmetadata/edit/0/(contentObjectID)/'.$objectID;
$link .= '/(metaDataName)/'.$_POST['metaDataName'];
$link .= '/(language)/'.$_POST['language'];
eZURI::transformURI( $link );
$http->redirect( $link );
}
// Action when user clicks on the Remove Button
if( $http->hasPostVariable( 'RemoveMetaDataButton' ) and $http->hasPostVariable( 'MetaDataIDSelection' ) )
{
$metaDataSelection = $http->postVariable( 'MetaDataIDSelection' );
foreach( $metaDataSelection as $metaData )
{
$metaDataObject = feZMetaData::fetch( $metaData );
$metaDataObject->remove();
}
eZContentCacheManager::clearContentCache( $objectID );
$ContentObject = eZContentObject::fetch( $objectID );
$ContentNodeID = $ContentObject->mainNodeID();
return $module->redirect( 'content', 'view', array( 'full', $ContentNodeID ) );
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:27,代码来源:content_actionhandler.php
示例13: akismet_ContentActionHandler
function akismet_ContentActionHandler($module, $http, $objectID)
{
$object = eZContentObject::fetch($objectID);
$version = $object->attribute('current');
if ($http->hasPostVariable('AkismetSubmitSpam')) {
$user = eZUser::currentUser();
$accessResult = $user->hasAccessTo('akismet', 'submit');
if ($accessResult['accessWord'] === 'yes') {
$mainNode = $object->attribute('main_node');
$module->redirectTo($mainNode->attribute('url_alias'));
$akismetObject = new eZContentObjectAkismet();
$comment = $akismetObject->akismetInformationExtractor($version);
if ($comment) {
$akismet = new eZAkismet($comment);
if ($akismet) {
$feedback = $akismet->submitSpam();
$response[] = $feedback[1];
} else {
$response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet.");
}
} else {
$response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet.");
}
}
$mainNode = $object->attribute('main_node');
$module->redirectTo($mainNode->attribute('url_alias'));
return true;
}
}
开发者ID:BGCX067,项目名称:ezakismet-svn-to-git,代码行数:29,代码来源:content_actionhandler.php
示例14: testIssue19174
/**
* Regression test for issue {@see #19174 http://issues.ez.no/19174}
*/
public function testIssue19174()
{
$bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
// add a secondary language
$locale = eZLocale::instance('fre-FR');
$translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
// create related objects
$relatedObjectsIds = array($this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation());
$xmlTextEn = "<embed href=\"ezobject://{$relatedObjectsIds[0]}\" /><link href=\"ezobject://{$relatedObjectsIds[1]}\">link</link>";
$xmlTextFr = "<embed href=\"ezobject://{$relatedObjectsIds[2]}\" /><link href=\"ezobject://{$relatedObjectsIds[3]}\">link</link>";
// Create an article in eng-GB, and embed related object one in the intro
$article = new ezpObject('article', 2, 14, 1, 'eng-GB');
$article->title = __METHOD__ . ' eng-GB';
$article->intro = $xmlTextEn;
$articleId = $article->publish();
// Workaround as setting folder->name directly doesn't produce the expected result
$article->addTranslation('fre-FR', array('title' => __METHOD__ . ' fre-FR', 'intro' => $xmlTextFr));
$relatedObjects = eZContentObject::fetch($articleId)->relatedObjects(false, false, 0, false, array('AllRelations' => eZContentObject::RELATION_LINK | eZContentObject::RELATION_EMBED));
self::assertEquals(4, count($relatedObjects));
$expectedRelations = array_flip($relatedObjectsIds);
foreach ($relatedObjects as $relatedObject) {
if (isset($expectedRelations[$relatedObject->ID])) {
unset($expectedRelations[$relatedObject->ID]);
}
}
self::assertEquals(0, count($expectedRelations));
$article->remove();
$translation->removeThis();
eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:33,代码来源:ezxmltexttype_regression.php
示例15: solrMetaDataExists
private function solrMetaDataExists( $contentObjectID=0, $attributeIdentifier='', $subattr='' )
{
try
{
$contentObject = eZContentObject::fetch( $contentObjectID );
$dataMap = $contentObject->dataMap();
if ( array_key_exists( $attributeIdentifier, $dataMap ) )
{
$contentObjectAttribute = $dataMap[$attributeIdentifier];
$eZType = eZDataType::create( solrMetaDataType::DATA_TYPE_STRING );
$value = $eZType->getValue( $contentObjectAttribute->ID, $subattr );
return ( ! empty( $value ) );
}
else
{
eZDebug::writeError( 'Object '.$contentObjectID.' has no attribute '.$attributeIdentifier, 'solrMetaDataExists Error' );
}
return false;
}
catch ( Exception $e )
{
eZDebug::writeError( $e, 'solrMetaDataExists Exception' );
return false;
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:25,代码来源:kdatatypes_operators.php
示例16: execute
function execute($process, $event)
{
// get object being published
$parameters = $process->attribute('parameter_list');
$objectID = $parameters['object_id'];
eZDebug::writeDebug('Update object state for object: ' . $objectID);
$object = eZContentObject::fetch($objectID);
$state_before = $event->attribute('state_before');
$state_after = $event->attribute('state_after');
if ($object == null) {
eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if ($state_before == null || $state_after == null) {
eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$currentStateIDArray = $object->attribute('state_id_array');
if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
$canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
} else {
eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
} else {
eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
}
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:33,代码来源:objectstateupdatetype.php
示例17: execute
public function execute($process, $event)
{
$params = $process->attribute('parameter_list');
$object_id = $params['object_id'];
$object = eZContentObject::fetch($object_id);
if (!is_object($object)) {
eZDebug::writeError("Unable to fetch object: '{$object_id}'", __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// current parent node(s)
$parentNodeIds = $object->attribute('parent_nodes');
$checkedObjs = array();
foreach ($parentNodeIds as $parentNodeId) {
//eZDebug::writeDebug( "Checking parent node: " . $parentNodeId, __METHOD__ );
$parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
$parentObj = $parentNode->attribute('object');
if (!in_array($parentObj->attribute('id'), $checkedObjs)) {
//eZDebug::writeDebug( "Checking all nodes of parent obj: " . $parentObj->attribute( 'id' ), __METHOD__ );
foreach ($parentObj->attribute('assigned_nodes') as $node) {
if (!in_array($node->attribute('node_id'), $parentNodeIds)) {
//eZDebug::writeDebug( "Found a node which is not parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
// the current obj has no node which is children of the given node of one of its parent objects
$operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $object->attribute('main_node_id'), 'object_id' => $object->attribute('id'), 'select_node_id_array' => array($node->attribute('node_id'))), null, true);
if ($operationResult == null || $operationResult['status'] != true) {
eZDebug::writeError("Unable to add new location to object: " . $object->attribute('id'), __METHOD__);
}
} else {
//eZDebug::writeDebug( "Found a node which is already parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
}
}
}
$checkedObjs[] = $parentObj->attribute('id');
}
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:35,代码来源:copynodetoallparentlocationstype.php
示例18: remove
static function remove($classID)
{
$contentClass = eZContentClass::fetch($classID);
if ($contentClass == null or !$contentClass->isRemovable()) {
return false;
}
// Remove all objects
$contentObjects = eZContentObject::fetchSameClassList($classID);
foreach ($contentObjects as $contentObject) {
eZContentObjectOperations::remove($contentObject->attribute('id'));
}
if (count($contentObjects) == 0) {
eZContentObject::expireAllViewCache();
}
eZContentClassClassGroup::removeClassMembers($classID, 0);
eZContentClassClassGroup::removeClassMembers($classID, 1);
// Fetch real version and remove it
$contentClass->remove(true);
// Fetch temp version and remove it
$tempDeleteClass = eZContentClass::fetch($classID, true, 1);
if ($tempDeleteClass != null) {
$tempDeleteClass->remove(true, 1);
}
return true;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:25,代码来源:ezcontentclassoperations.php
示例19: modifier
function modifier()
{
if ($this->Modifier === null) {
$this->Modifier = eZContentObject::fetch($this->ModifierID);
}
return $this->Modifier;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:7,代码来源:ezorderstatushistory.php
示例20: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$token = $this->getToken();
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
$queryStringPosition = strpos($url, '?');
$queryString = substr($url, $queryStringPosition + 1);
$url = substr($url, 0, $queryStringPosition);
$queryStringParts = array();
parse_str($queryString, $queryStringParts);
$queryStringParts[self::SESSION_ID_FIELD] = $token;
$queryString = http_build_query($queryStringParts);
$url .= '?' . $queryString;
return $url;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:externallinkhandlermedienspiegel.php
注:本文中的eZContentObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论