当前位置: 首页>>代码示例>>PHP>>正文


PHP eZRSSExport::create方法代码示例

本文整理汇总了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);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:67,代码来源:ezcontentoperationcollection.php

示例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();
开发者ID:netbliss,项目名称:ezpublish,代码行数:31,代码来源:edit_export.php

示例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();
        }
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:32,代码来源:ezsiteinstaller.php

示例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;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:30,代码来源:ezrss_export_test.php

示例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;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:31,代码来源:ezrss_export_test.php


注:本文中的eZRSSExport::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。