本文整理汇总了PHP中eZContentObject::attribute方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::attribute方法的具体用法?PHP eZContentObject::attribute怎么用?PHP eZContentObject::attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: message
public static function message($publishHandler, eZContentObject $object, $message, $messageLength = 400, $options)
{
$url = false;
$share = array('title' => $object->attribute('name'));
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;
}
}
$messageLength = $messageLength - strlen($url) - 1;
$share['submitted-url'] = $url;
}
if (class_exists('Normalizer')) {
$message = Normalizer::normalize($message, Normalizer::FORM_C);
}
$message = mb_substr($message, 0, $messageLength);
if ($url) {
$message .= ' ' . $url;
}
$share['description'] = $message;
return $share;
}
示例2: 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();
}
}
示例3: addPendingClearCacheIfNeeded
/**
* Adds a "pending clear cache" action if ViewCaching is disabled.
* This method should be called at publish time.
* Cache should then be cleared by a cronjob
* @return void
*/
public function addPendingClearCacheIfNeeded()
{
if (eZINI::instance()->variable('ContentSettings', 'ViewCaching') === 'disabled') {
$rowPending = array('action' => self::ACTION_CLEAR_CACHE, 'created' => time(), 'param' => $this->contentObject->attribute('id'));
$pendingItem = new eZPendingActions($rowPending);
$pendingItem->store();
}
}
示例4: 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;
}
示例5: appendAdditionalNodeIDs
/**
* Appends additional node IDs.
*
* @param eZContentObject $contentObject
* @param array $nodeIDList
*/
private static function appendAdditionalNodeIDs(eZContentObject $contentObject, &$nodeIDList)
{
$contentObjectId = $contentObject->attribute('id');
if (!isset(self::$additionalNodeIDsPerObject[$contentObjectId])) {
return;
}
foreach (self::$additionalNodeIDsPerObject[$contentObjectId] as $nodeID) {
$nodeIDList[] = $nodeID;
}
}
示例6: processXmlTextData
private function processXmlTextData($xml, $attribute)
{
$parser = new eZSimplifiedXMLInputParser($this->object->attribute('id'));
$parser->ParseLineBreaks = true;
$xml = $parser->process($xml);
$xml = eZXMLTextType::domString($xml);
$urlIdArray = $parser->getUrlIDArray();
if (count($urlIdArray) > 0) {
eZSimplifiedXMLInput::updateUrlObjectLinks($attribute, $urlIdArray);
}
return $xml;
}
示例7: createNewVersionWithImage
protected function createNewVersionWithImage(eZContentObject $object)
{
$version = $object->createNewVersion(false, true, false, false, eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
$contentObjectAttributes = $version->contentObjectAttributes();
foreach ($contentObjectAttributes as $contentObjectAttribute) {
if ($contentObjectAttribute->attribute('contentclass_attribute_identifier') != 'image') {
continue;
}
$contentObjectAttribute->fromString(self::IMAGE_FILE_PATH);
$contentObjectAttribute->store();
break;
}
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object->attribute('id'), 'version' => $version->attribute('version')));
self::assertEquals(1, $operationResult['status']);
return $this->forceFetchContentObject($object->attribute('id'));
}
示例8: modify
/**
* The modify method gets the current content object AND the list of
* Solr Docs (for each available language version).
*
*
* @param eZContentObject $contentObect
* @param array $docList
*/
public function modify(eZContentObject $contentObject, &$docList)
{
$contentNode = $contentObject->attribute('main_node');
$parentNode = $contentNode->attribute('parent');
if ($parentNode instanceof eZContentObjectTreeNode) {
$parentObject = $parentNode->attribute('object');
$parentVersion = $parentObject->currentVersion();
if ($parentVersion === false) {
return;
}
$availableLanguages = $parentVersion->translationList(false, false);
foreach ($availableLanguages as $languageCode) {
$docList[$languageCode]->addField('extra_parent_node_name_t', $parentObject->name(false, $languageCode));
}
}
}
示例9: getCurrentDraft
/**
* Returns current draft for current content object.
* If there is no current draft, a new one will be created in provided language.
* @param string|bool $lang Valid locale xxx-XX. If not provided, default edit language will be used
* @see eZContentObject::createNewVersionIn()
* @return eZContentObjectVersion
*/
public function getCurrentDraft($lang = false)
{
$currentDraft = null;
$db = eZDB::instance();
// First check if we already have a draft
$aFilter = array('contentobject_id' => $this->contentObject->attribute('id'), 'status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)));
$res = eZContentObjectVersion::fetchFiltered($aFilter, null, null);
if (count($res) > 0 && $res[0] instanceof eZContentObjectVersion) {
$currentDraft = $res[0];
// FIXME : Fetch may result several drafts. We should take the last one (highest version)
$currentDraft->setAttribute('modified', eZDateTime::currentTimeStamp());
$currentDraft->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$currentDraft->store();
} else {
$db->begin();
$currentDraft = $this->contentObject->createNewVersionIn($lang, false, $this->contentObject->attribute('current_version'));
$currentDraft->store();
$db->commit();
}
return $currentDraft;
}
示例10: selfPolicies
/**
* Checks if the current user has a 'self' edit/delete policy
*
* @param eZContentObject $contentObject Used to check with a possible section
*
* @return array An array with edit and delete as keys, and booleans as values
*/
public static function selfPolicies($contentObject)
{
$return = array('edit' => false, 'delete' => false);
$sectionID = $contentObject->attribute('section_id');
$user = eZUser::currentUser();
foreach (array_keys($return) as $functionName) {
$policies = $user->hasAccessTo(self::$moduleName, $functionName);
// unlimited policy, not personal
if ($policies['accessWord'] !== 'limited') {
$return[$functionName] = false;
} else {
// scan limited policies
foreach ($policies['policies'] as $limitationArray) {
// a self limitation exists
if (isset($limitationArray[self::$commentCreatorKey])) {
// but it also has a section limitation
if (isset($limitationArray[self::$sectionKey])) {
if (in_array($sectionID, $limitationArray[self::$sectionKey])) {
$return[$functionName] = true;
break;
}
} else {
$return[$functionName] = true;
break;
}
}
}
}
}
return array('result' => $return);
}
示例11: serializeObject
/**
* Serialize the eZContentObject to be used to build the result in
* JavaScript
*
* @param eZContentObject $object
* @return array
*/
public function serializeObject(eZContentObject $contentObject)
{
$section = eZSection::fetch($contentObject->attribute('section_id'));
return array('object_info' => array('id' => $contentObject->attribute('id'), 'name' => $contentObject->attribute('name'), 'class_name' => $contentObject->attribute('class_name'), 'section_name' => $section->attribute('name'), 'published' => ezpI18n::tr('design/standard/content/datatype', 'Yes')));
}
示例12: updateGlobalLimitation
/**
* @param eZContentObject $contentObject
* @param bool|null $parentIsInvisible Only defined as boolean true|false if we are recursively going in a child
*/
public static function updateGlobalLimitation ( $contentObject, $parentIsInvisible = null )
{
/* @type $contentMainNode eZContentObjectTreeNode */
$db = eZDB::instance();
$contentObjectID = $contentObject->attribute('id');
$contentMainNode = $contentObject->mainNode();
if ( !($contentMainNode instanceof eZContentObjectTreeNode) )
return;
/* @type $dm eZContentObjectAttribute[] */
$contentDepth = $contentMainNode->attribute('depth');
$merckINI = eZINI::instance('merck.ini');
$onlineDateAttribute = $merckINI->variable("ArticleVisibility","OnlineDate");
$offlineDateAttribute = $merckINI->variable("ArticleVisibility","OfflineDate");
$dm = $contentObject->attribute("data_map");
if ( !is_array($dm) )
return;
/* @type $onlineDateContent eZDateTime */
/* @type $offlineDateContent eZDateTime */
$onlineDateContent = $dm[$onlineDateAttribute]->content();
$onlineDate = $onlineDateContent->timeStamp();
$offlineDateContent = $dm[$offlineDateAttribute]->content();
$offlineDate = $offlineDateContent->timeStamp();
$visibility = MMEventManager::visibilityDates($contentObject);
$isInvisible = !$visibility;
// We have a parent article, we check its visibility
if ( !$isInvisible && $parentIsInvisible === null && $contentDepth > 4 )
{
$parentNode = $contentMainNode->fetchParent();
$isInvisible = self::isGloballyLimited( $parentNode->attribute('contentobject_id') );
}
elseif ( !$isInvisible )
{
if ( $parentIsInvisible !== null && $parentIsInvisible === true )
$isInvisible = true;
}
$db->beginQuery();
$visibilityChange = self::updateGlobalLimitationEntry( $contentObjectID, $offlineDate, $onlineDate, $visibility, $isInvisible);
if ( $visibilityChange && $visibility && !$isInvisible )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'show');
}
elseif ( $visibilityChange && ( !$visibility || $isInvisible ) )
{
eZSearch::updateNodeVisibility($contentObject->mainNodeID(), 'hide');
}
if ( $visibilityChange )
self::spreadGlobalLimitationChange( $contentMainNode, $isInvisible );
$db->commitQuery();
}
示例13: checkMediaFromArticle
/**
* Check state of all medias related to the article
* @param eZContentObject $articleContentObject
* @return bool
*/
private static function checkMediaFromArticle( $articleContentObject )
{
/* @type $mediaClassIdentifiers array */
$siteIni = eZINI::instance( 'site.ini' );
$mediaClassIdentifiers = $siteIni->variable( 'EventManager', 'MediaClassIdentifiers' );
//Retrieve all media related to the article
/* @type $articleDataMap eZContentObjectAttribute[] */
$articleDataMap = $articleContentObject->dataMap();
if( !isset( $articleDataMap['media_content'] ) )
return true;
$mediaContent = $articleDataMap['media_content']->content();
if( empty( $mediaContent['relation_list'] ) )
return true;
foreach( $mediaContent['relation_list'] as $mediaData )
{
if( !in_array( $mediaData['contentclass_identifier'], $mediaClassIdentifiers ) )
continue;
if(!self::mediaIsCompleted($mediaData['contentobject_id']))
return false;
}
// retrieve all medias in core content related to the article
$relatedCoreContentList = RelatedCoreContent::getMediasFromArticle($articleContentObject->attribute("id"), $articleContentObject->currentLanguage());
/** @var RelatedCoreContent $relatedCoreContent */
foreach($relatedCoreContentList as $relatedCoreContent)
{
if(!self::mediaIsCompleted($relatedCoreContent->attribute("media_object_id")))
return false;
}
return true;
}
示例14: fromObject
/**
* Instanciates an ezpContent from an eZContentObject
* @param eZContentObject $objectId
* @return ezpContent
*/
public static function fromObject(eZContentObject $object, $checkAccess = true)
{
if ($checkAccess && !$object->attribute('can_read')) {
throw new ezpContentAccessDeniedException($object->attribute('id'));
}
$content = new ezpContent();
$content->fields = ezpContentFieldSet::fromContentObject($object);
$content->object = $object;
return $content;
}
示例15: checkAccess
protected function checkAccess()
{
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
$accessResult = $user->hasAccessTo('exportas', $this->functionName);
$accessWord = $accessResult['accessWord'];
if ($accessWord == 'yes') {
return true;
} else {
if ($accessWord == 'no') {
return false;
} else {
$policies =& $accessResult['policies'];
$access = 'denied';
foreach (array_keys($policies) as $pkey) {
$limitationArray =& $policies[$pkey];
if ($access == 'allowed') {
break;
}
$limitationList = array();
if (isset($limitationArray['Subtree'])) {
$checkedSubtree = false;
} else {
$checkedSubtree = true;
$accessSubtree = false;
}
if (isset($limitationArray['Node'])) {
$checkedNode = false;
} else {
$checkedNode = true;
$accessNode = false;
}
foreach (array_keys($limitationArray) as $key) {
$access = 'denied';
switch ($key) {
case 'Class':
if (!$this->mainClass) {
$access = 'denied';
$limitationList = array('Limitation' => $key, 'Required' => $limitationArray[$key]);
} elseif (in_array($this->mainClass->attribute('id'), $limitationArray[$key])) {
$access = 'allowed';
} else {
$access = 'denied';
$limitationList = array('Limitation' => $key, 'Required' => $limitationArray[$key]);
}
break;
case 'Section':
case 'User_Section':
if (in_array($this->mainObject->attribute('section_id'), $limitationArray[$key])) {
$access = 'allowed';
} else {
$access = 'denied';
$limitationList = array('Limitation' => $key, 'Required' => $limitationArray[$key]);
}
break;
case 'Node':
$accessNode = false;
$mainNodeID = $this->mainObject->attribute('main_node_id');
foreach ($limitationArray[$key] as $nodeID) {
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
$limitationNodeID = $node['main_node_id'];
if ($mainNodeID == $limitationNodeID) {
$access = 'allowed';
$accessNode = true;
break;
}
}
$checkedNode = true;
break;
default:
if (strncmp($key, 'StateGroup_', 11) === 0) {
if (count(array_intersect($limitationArray[$key], $this->mainObject->attribute('state_id_array'))) == 0) {
$access = 'denied';
$limitationList = array('Limitation' => $key, 'Required' => $limitationArray[$key]);
} else {
$access = 'allowed';
}
}
}
if ($access == 'denied') {
break;
}
}
$policyList[] = array('PolicyID' => $pkey, 'LimitationList' => $limitationList);
}
if ($access == 'denied') {
return array('FunctionRequired' => array('Module' => 'exportas', 'Function' => $this->functionName), 'PolicyList' => $policyList);
} else {
return true;
}
}
}
}