本文整理汇总了PHP中eZRSSExport::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZRSSExport::create方法的具体用法?PHP eZRSSExport::create怎么用?PHP eZRSSExport::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZRSSExport
的用法示例。
在下文中一共展示了eZRSSExport::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFeedForNode
/**
* Creates a RSS/ATOM Feed export for a node
*
* @param int $nodeID Node ID
*
* @since 4.3
*/
public static function createFeedForNode($nodeID)
{
$hasExport = eZRSSFunctionCollection::hasExportByNode($nodeID);
if (isset($hasExport['result']) && $hasExport['result']) {
eZDebug::writeError('There is already a rss/atom export feed for this node: ' . $nodeID, __METHOD__);
return array('status' => false);
}
$node = eZContentObjectTreeNode::fetch($nodeID);
$currentClassIdentifier = $node->attribute('class_identifier');
$config = eZINI::instance('site.ini');
$feedItemClasses = $config->variable('RSSSettings', 'DefaultFeedItemClasses');
if (!$feedItemClasses || !isset($feedItemClasses[$currentClassIdentifier])) {
eZDebug::writeError("EnableRSS: content class {$currentClassIdentifier} is not defined in site.ini[RSSSettings]DefaultFeedItemClasses[<class_id>].", __METHOD__);
return array('status' => false);
}
$object = $node->object();
$objectID = $object->attribute('id');
$currentUserID = eZUser::currentUserID();
$rssExportItems = array();
$db = eZDB::instance();
$db->begin();
$rssExport = eZRSSExport::create($currentUserID);
$rssExport->setAttribute('access_url', 'rss_feed_' . $nodeID);
$rssExport->setAttribute('node_id', $nodeID);
$rssExport->setAttribute('main_node_only', '1');
$rssExport->setAttribute('number_of_objects', $config->variable('RSSSettings', 'NumberOfObjectsDefault'));
$rssExport->setAttribute('rss_version', $config->variable('RSSSettings', 'DefaultVersion'));
$rssExport->setAttribute('status', eZRSSExport::STATUS_VALID);
$rssExport->setAttribute('title', $object->name());
$rssExport->store();
$rssExportID = $rssExport->attribute('id');
foreach (explode(';', $feedItemClasses[$currentClassIdentifier]) as $classIdentifier) {
$iniSection = 'RSSSettings_' . $classIdentifier;
if ($config->hasVariable($iniSection, 'FeedObjectAttributeMap')) {
$feedObjectAttributeMap = $config->variable($iniSection, 'FeedObjectAttributeMap');
$subNodesMap = $config->hasVariable($iniSection, 'Subnodes') ? $config->variable($iniSection, 'Subnodes') : array();
$rssExportItem = eZRSSExportItem::create($rssExportID);
$rssExportItem->setAttribute('class_id', eZContentObjectTreeNode::classIDByIdentifier($classIdentifier));
$rssExportItem->setAttribute('title', $feedObjectAttributeMap['title']);
if (isset($feedObjectAttributeMap['description'])) {
$rssExportItem->setAttribute('description', $feedObjectAttributeMap['description']);
}
if (isset($feedObjectAttributeMap['category'])) {
$rssExportItem->setAttribute('category', $feedObjectAttributeMap['category']);
}
if (isset($feedObjectAttributeMap['enclosure'])) {
$rssExportItem->setAttribute('enclosure', $feedObjectAttributeMap['enclosure']);
}
$rssExportItem->setAttribute('source_node_id', $nodeID);
$rssExportItem->setAttribute('status', eZRSSExport::STATUS_VALID);
$rssExportItem->setAttribute('subnodes', isset($subNodesMap[$currentClassIdentifier]) && $subNodesMap[$currentClassIdentifier] === 'true');
$rssExportItem->store();
} else {
eZDebug::writeError("site.ini[{$iniSection}]Source[] setting is not defined.", __METHOD__);
}
}
$db->commit();
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
return array('status' => true);
}
示例2:
}
break;
case 'ImageSource':
$imageNodeIDArray = $http->hasPostVariable('SelectedNodeIDArray') ? $http->postVariable('SelectedNodeIDArray') : null;
if (isset($imageNodeIDArray) && !$http->hasPostVariable('BrowseCancelButton')) {
$rssExport->setAttribute('image_id', $imageNodeIDArray[0]);
}
break;
}
} else {
$user = eZUser::currentUser();
$user_id = $user->attribute("contentobject_id");
$db = eZDB::instance();
$db->begin();
// Create default rssExport object to use
$rssExport = eZRSSExport::create($user_id);
$rssExport->store();
$rssExportID = $rssExport->attribute('id');
// Create One empty export item
$rssExportItem = eZRSSExportItem::create($rssExportID);
$rssExportItem->store();
$db->commit();
}
$tpl = eZTemplate::factory();
$config = eZINI::instance('site.ini');
$rssVersionArray = $config->variable('RSSSettings', 'AvailableVersionList');
$rssDefaultVersion = $config->variable('RSSSettings', 'DefaultVersion');
$numberOfObjectsArray = $config->variable('RSSSettings', 'NumberOfObjectsList');
$numberOfObjectsDefault = $config->variable('RSSSettings', 'NumberOfObjectsDefault');
// Get Classes and class attributes
$classArray = eZContentClass::fetchList();
示例3: setRSSExport
function setRSSExport( $params )
{
// Create default rssExport object to use
$rssExport = eZRSSExport::create( $params['creator'] );
$rssExport->setAttribute( 'access_url', $params['access_url'] );
$rssExport->setAttribute( 'main_node_only', $params['main_node_only'] );
$rssExport->setAttribute( 'number_of_objects', $params['number_of_objects'] );
$rssExport->setAttribute( 'rss_version', $params['rss_version'] );
$rssExport->setAttribute( 'status', $params['status'] );
$rssExport->setAttribute( 'title', $params['title'] );
$rssExport->store();
$rssExportID = $rssExport->attribute( 'id' );
foreach( $params['rss_export_itmes'] as $item )
{
// Create One empty export item
$rssExportItem = eZRSSExportItem::create( $rssExportID );
$rssExportItem->setAttribute( 'class_id', $item['class_id'] );
$rssExportItem->setAttribute( 'description', $item['description'] );
$rssExportItem->setAttribute( 'source_node_id', $item['source_node_id'] );
$rssExportItem->setAttribute( 'status', $item['status'] );
$rssExportItem->setAttribute( 'title', $item['title'] );
if ( isset( $item['enclosure'] ) )
{
$rssExportItem->setAttribute( 'enclosure', $item['enclosure'] );
}
$rssExportItem->store();
}
}
示例4: createEZPRSSExport
/**
* Creates an RSS export object and returns it.
*
* @param string $version One of '1.0', '2.0' or 'ATOM'
* @param int $folderId
* @param string $title
* @param string $description
* @return eZRSSExport
*/
public function createEZPRSSExport($version, $folderId, $title, $description)
{
// Create default rssExport object to use
$rssExport = eZRSSExport::create($this->ezp_admin_id);
$rssExport->setAttribute('node_id', $folderId);
$rssExport->setAttribute('rss_version', $version);
$rssExport->setAttribute('title', $title);
$rssExport->setAttribute('description', $description);
$rssExport->store();
$rssExportID = $rssExport->attribute('id');
// Create one empty export item
$rssExportItem = eZRSSExportItem::create($this->ezp_admin_id);
$rssExportItem->setAttribute('title', 'title');
$rssExportItem->setAttribute('class_id', 2);
// 2 = article
$rssExportItem->setAttribute('rssexport_id', $rssExportID);
$rssExportItem->setAttribute('description', 'intro');
$rssExportItem->setAttribute('source_node_id', $folderId);
$rssExportItem->store();
return $rssExport;
}
示例5: createEZPRSSExport
/**
* Creates an RSS export object and returns it.
*
* @param string $version One of '1.0', '2.0' or 'ATOM'
* @param int $folderId
* @param string $title
* @param string $description
* @return eZRSSExport
*/
public function createEZPRSSExport($version, $folderId, $title, $description)
{
$userId = $this->loginEZPUser($GLOBALS['ezp_username'], $GLOBALS['ezp_password']);
// Create default rssExport object to use
$rssExport = eZRSSExport::create($userId);
$rssExport->setAttribute('node_id', $folderId);
$rssExport->setAttribute('rss_version', $version);
$rssExport->setAttribute('title', $title);
$rssExport->setAttribute('description', $description);
$rssExport->store();
$rssExportID = $rssExport->attribute('id');
// Create one empty export item
$rssExportItem = eZRSSExportItem::create($userId);
$rssExportItem->setAttribute('title', 'title');
$rssExportItem->setAttribute('class_id', 2);
// 2 = article
$rssExportItem->setAttribute('rssexport_id', $rssExportID);
$rssExportItem->setAttribute('description', 'intro');
$rssExportItem->setAttribute('source_node_id', $folderId);
$rssExportItem->store();
return $rssExport;
}