本文整理汇总了PHP中eZContentObject::name方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::name方法的具体用法?PHP eZContentObject::name怎么用?PHP eZContentObject::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alignArticle
/**
* Aligns articles published under given publisher folder
* @param eZContentObject $publisherObject
*/
function alignArticle( $publisherObject, $checkModified = false, $checkLocations = false, $checkLanguages = false, $checkHidden = false, $timingDelay = 0, $forceLast = 0, $sleepTime = 1 )
{
echo "Starting treatment of publisher folder : " . $publisherObject->name() . "\n";
echo "Fetching solr informations\n";
$eZSolr = eZSearch::getEngine();
$offset = 0;
$forced = 0;
$limit = 200;
$publisherNode = $publisherObject->mainNode();
$doCheck = $checkModified || $checkLocations || $checkLanguages || $checkHidden;
$solrInfos = fetchSolrPublisherFolder ( $publisherNode, $checkModified, $checkLocations, $checkLanguages, $checkHidden, $sleepTime );
echo "Solr count : " . count($solrInfos) . "\n";
while ( true )
{
$params = array(
'Offset' => $offset,
'Limit' => $limit,
'ClassFilterType' => 'include',
'ClassFilterArray' => array( 'article' ),
'LoadDataMap' => false,
'AsObject' => false,
'MainNodeOnly' => true,
);
if ($forceLast > 0)
$params['SortBy'] = array ( array('published', false ) );
$nodeList = $publisherNode->subtree( $params );
echo "\neZ Offset : $offset\n";
if ( count( $nodeList ) == 0 )
{
break;
}
foreach ( $nodeList as $mainNode )
{
$nodeId = $mainNode['node_id'];
$objectId = $mainNode['contentobject_id'];
$toUpdate = false;
if ( $forceLast > 0 && $forced < $forceLast )
$toUpdate = true;
elseif ( isset($solrInfos[$nodeId]) )
{
if ( $doCheck )
{
if ( $checkLanguages )
{
$eZLanguages = eZContentObject::fetch($objectId)->languages();
$toUpdate = compareLanguages( array_keys($eZLanguages), $solrInfos[$nodeId]['languages'] );
showInvalidTranslations(array_keys($eZLanguages), $solrInfos[$nodeId]['languages'], $objectId);
}
if (!$toUpdate && $checkModified)
$toUpdate = compareDates($mainNode['modified'], $solrInfos[$nodeId]['modified'], $timingDelay);
if (!$toUpdate && $checkLocations)
$toUpdate = compareLocations($objectId, $solrInfos[$nodeId]['locations']);
if (!$toUpdate && $checkHidden)
$toUpdate = compareHidden($objectId, $solrInfos[$nodeId]['hiddenCount'], $solrInfos[$nodeId]['notHiddenCount']);
}
unset($solrInfos[$nodeId]);
}
else
$toUpdate = true;
if ( $toUpdate )
{
$return = $eZSolr->addObject( eZContentObject::fetch($objectId), false );
echo ( !$return ? '!' . $objectId . '!' : '+' );
}
else
echo '-';
$forced++;
}
$offset += $limit;
eZContentObject::clearCache();
if ( $sleepTime > 0 )
sleep ($sleepTime);
}
echo "\nArticles in solr but unknown from eZPublish : " . count($solrInfos) . " articles\n";
}
示例2: getArrayRelatedObject
protected function getArrayRelatedObject(eZContentObject $relatedObject, $contentClassAttribute, $metaData = null)
{
if ($metaData === null) {
$metaData = array();
}
if ($relatedObject instanceof eZContentObject && $relatedObject->attribute('main_node_id') > 0) {
$objectName = $relatedObject->name(false, $this->ContentObjectAttribute->attribute('language_code'));
$fieldName = parent::generateSubattributeFieldName($contentClassAttribute, 'name', self::DEFAULT_SUBATTRIBUTE_TYPE);
if (isset($metaData[$fieldName])) {
$metaData[$fieldName] = array_merge($metaData[$fieldName], array($objectName));
} else {
$metaData[$fieldName] = array($objectName);
}
/** @var ezfSolrDocumentFieldBase[] $baseList */
$baseList = $this->getBaseList($relatedObject->attribute('current'));
foreach ($baseList as $field) {
/** @var eZContentClassAttribute $tmpClassAttribute */
$tmpClassAttribute = $field->ContentObjectAttribute->attribute('contentclass_attribute');
$fieldName = $field->ContentObjectAttribute->attribute('contentclass_attribute_identifier');
$fieldNameArray = array();
foreach (array_keys(eZSolr::$fieldTypeContexts) as $context) {
$fieldNameArray[] = parent::generateSubattributeFieldName($contentClassAttribute, $fieldName, ezfSolrDocumentFieldBase::getClassAttributeType($tmpClassAttribute, null, $context));
}
$fieldNameArray = array_unique($fieldNameArray);
if ($tmpClassAttribute->attribute('data_type_string') == 'ezobjectrelation' or $tmpClassAttribute->attribute('data_type_string') == 'ezobjectrelationlist') {
/** @var self $field */
$finalValue = $field->getPlainTextRepresentation();
} else {
$finalValue = $this->preProcessValue($field->ContentObjectAttribute->metaData(), parent::getClassAttributeType($tmpClassAttribute));
}
foreach ($fieldNameArray as $fieldNameValue) {
//eZCLI::instance()->output(var_dump($metaData));
if (is_array($finalValue)) {
$finalValue = self::recursive_implode($finalValue);
}
$finalValue = trim($finalValue, "\t\r\n ");
if (!empty($finalValue)) {
if (isset($metaData[$fieldNameValue])) {
$metaData[$fieldNameValue] = array_merge($metaData[$fieldNameValue], array($finalValue));
} else {
$metaData[$fieldNameValue] = array($finalValue);
}
}
}
}
$metaAttributeValues = eZSolr::getMetaAttributesForObject($relatedObject);
foreach ($metaAttributeValues as $metaInfo) {
$value = ezfSolrDocumentFieldBase::preProcessValue($metaInfo['value'], $metaInfo['fieldType']);
if (!is_array($value)) {
$value = array($value);
}
$metaData[ezfSolrDocumentFieldBase::generateSubmetaFieldName($metaInfo['name'], $contentClassAttribute)] = $value;
}
}
return $metaData;
}
示例3: createNameListDOMElementFromContentObject
/**
* Create NameList element.
*
* @param DOMDocument Owner DOMDocument
* @param eZContentObject eZContentObject object.
*
* @return DOMElement NameList DOMDocument, example:
*
* <NameList>
* <Name locale="eng-GB">eZ Publish rocks</Name>
* </NameList>
*/
protected function createNameListDOMElementFromContentObject(DOMDocument $domDocument, eZContentObject $object)
{
$languageListElement = $domDocument->createElement('NameList');
// Add language names.
foreach ($object->attribute('current')->translationList(false, false) as $locale) {
$languageElement = $domDocument->createElement('Name');
$languageElement->setAttribute('locale', $locale);
$languageElement->appendChild($domDocument->createTextNode($object->name(false, $locale)));
$languageListElement->appendChild($languageElement);
}
return $languageListElement;
}
示例4: alignArticleLocation
/**
* Aligns location of the articles published under given publisher folder
* @param eZContentObject $publisherObject
*/
function alignArticleLocation( $publisherObject, $offset = 0 )
{
$limit = 200;
$continue = true;
$publisherNode = $publisherObject->mainNode();
$globalVarName = 'contentServiceMainNodeID';
if ( !isset( $GLOBALS[$globalVarName] ) )
{
$GLOBALS[$globalVarName] = array();
}
echo "Starting treatment of publisher folder : " . $publisherObject->name() . "\n";
while ( true )
{
$params = array(
'Offset' => $offset,
'Limit' => $limit,
'ClassFilterType' => 'include',
'ClassFilterArray' => array(
'article'
),
'LoadDataMap' => false,
'AsObject' => false,
'MainNodeOnly' => true,
);
$nodeList = $publisherNode->subtree( $params );
echo " // Offset : $offset // ";
if ( count( $nodeList ) == 0 )
{
break;
}
foreach ( $nodeList as $mainNode )
{
$object = eZContentObject::fetch( $mainNode["contentobject_id"] );
deploymentType::addListNodesIdToAddLocation($object);
}
$offset += $limit;
eZContentObject::clearCache();
}
}