本文整理汇总了PHP中eZRSSExport类的典型用法代码示例。如果您正苦于以下问题:PHP eZRSSExport类的具体用法?PHP eZRSSExport怎么用?PHP eZRSSExport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZRSSExport类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: removeFeedForNode
/**
* Removes a RSS/ATOM Feed export for a node
*
* @param int $nodeID Node ID
*
* @since 4.3
*/
public static function removeFeedForNode($nodeID)
{
$rssExport = eZPersistentObject::fetchObject(eZRSSExport::definition(), null, array('node_id' => $nodeID, 'status' => eZRSSExport::STATUS_VALID), true);
if (!$rssExport instanceof eZRSSExport) {
eZDebug::writeError('DisableRSS: There is no rss/atom feeds left to delete for this node: ' . $nodeID, __METHOD__);
return array('status' => false);
}
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node instanceof eZContentObjectTreeNode) {
eZDebug::writeError('DisableRSS: Could not fetch node: ' . $nodeID, __METHOD__);
return array('status' => false);
}
$objectID = $node->attribute('contentobject_id');
$rssExport->removeThis();
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
return array('status' => true);
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:24,代码来源:ezcontentoperationcollection.php
示例2: storeRSSExport
static function storeRSSExport($Module, $http, $publish = false, $skipValuesID = null)
{
$valid = true;
$validationErrors = array();
/* Kill the RSS cache in all siteaccesses */
$config = eZINI::instance('site.ini');
$cacheDir = eZSys::cacheDirectory();
$availableSiteAccessList = $config->variable('SiteAccessSettings', 'AvailableSiteAccessList');
foreach ($availableSiteAccessList as $siteAccess) {
$cacheFilePath = $cacheDir . '/rss/' . md5($siteAccess . $http->postVariable('Access_URL')) . '.xml';
$cacheFile = eZClusterFileHandler::instance($cacheFilePath);
if ($cacheFile->exists()) {
$cacheFile->delete();
}
}
$db = eZDB::instance();
$db->begin();
/* Create the new RSS feed */
for ($itemCount = 0; $itemCount < $http->postVariable('Item_Count'); $itemCount++) {
if ($skipValuesID == $http->postVariable('Item_ID_' . $itemCount)) {
continue;
}
$rssExportItem = eZRSSExportItem::fetch($http->postVariable('Item_ID_' . $itemCount), true, eZRSSExport::STATUS_DRAFT);
if ($rssExportItem == null) {
continue;
}
// RSS is supposed to feed certain objects from the subnodes
if ($http->hasPostVariable('Item_Subnodes_' . $itemCount)) {
$rssExportItem->setAttribute('subnodes', 1);
} else {
$rssExportItem->setAttribute('subnodes', 0);
}
$rssExportItem->setAttribute('class_id', $http->postVariable('Item_Class_' . $itemCount));
$class = eZContentClass::fetch($http->postVariable('Item_Class_' . $itemCount));
$titleClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Title_' . $itemCount);
$descriptionClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Description_' . $itemCount);
$categoryClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Category_' . $itemCount);
if (!$class) {
$validated = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Selected class does not exist');
} else {
$dataMap = $class->attribute('data_map');
if (!isset($dataMap[$titleClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for title class %1 does not have attribute "%2"', null, array($class->attribute('name'), $titleClassAttributeIdentifier));
}
if ($descriptionClassAttributeIdentifier != '' && !isset($dataMap[$descriptionClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for description class %1 does not have attribute "%2"', null, array($class->attribute('name'), $descriptionClassAttributeIdentifier));
}
if ($categoryClassAttributeIdentifier != '' && !isset($dataMap[$categoryClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for category class %1 does not have attribute "%2"', null, array($class->attribute('name'), $categoryClassAttributeIdentifier));
}
}
$rssExportItem->setAttribute('title', $http->postVariable('Item_Class_Attribute_Title_' . $itemCount));
$rssExportItem->setAttribute('description', $http->postVariable('Item_Class_Attribute_Description_' . $itemCount));
$rssExportItem->setAttribute('category', $http->postVariable('Item_Class_Attribute_Category_' . $itemCount));
if ($http->hasPostVariable('Item_Class_Attribute_Enclosure_' . $itemCount)) {
$rssExportItem->setAttribute('enclosure', $http->postVariable('Item_Class_Attribute_Enclosure_' . $itemCount));
}
if ($publish && $valid) {
$rssExportItem->setAttribute('status', eZRSSExport::STATUS_VALID);
$rssExportItem->store();
// delete drafts
$rssExportItem->setAttribute('status', eZRSSExport::STATUS_DRAFT);
$rssExportItem->remove();
} else {
$rssExportItem->store();
}
}
$rssExport = eZRSSExport::fetch($http->postVariable('RSSExport_ID'), true, eZRSSExport::STATUS_DRAFT);
$rssExport->setAttribute('title', $http->postVariable('title'));
$rssExport->setAttribute('url', $http->postVariable('url'));
// $rssExport->setAttribute( 'site_access', $http->postVariable( 'SiteAccess' ) );
$rssExport->setAttribute('description', $http->postVariable('Description'));
$rssExport->setAttribute('rss_version', $http->postVariable('RSSVersion'));
$rssExport->setAttribute('number_of_objects', $http->postVariable('NumberOfObjects'));
$rssExport->setAttribute('image_id', $http->postVariable('RSSImageID'));
if ($http->hasPostVariable('active')) {
$rssExport->setAttribute('active', 1);
} else {
$rssExport->setAttribute('active', 0);
}
$rssExport->setAttribute('access_url', str_replace(array('/', '?', '&', '>', '<'), '', $http->postVariable('Access_URL')));
if ($http->hasPostVariable('MainNodeOnly')) {
$rssExport->setAttribute('main_node_only', 1);
} else {
$rssExport->setAttribute('main_node_only', 0);
}
$published = false;
if ($publish && $valid) {
$rssExport->store(true);
// remove draft
$rssExport->remove();
$published = true;
} else {
$rssExport->store();
}
$db->commit();
//.........这里部分代码省略.........
开发者ID:legende91,项目名称:ez,代码行数:101,代码来源:edit_functions.php
示例3:
}
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
示例4: foreach
foreach ($deleteArray as $deleteID) {
$rssImport = eZRSSImport::fetch($deleteID, true, eZRSSImport::STATUS_DRAFT);
if ($rssImport) {
$rssImport->remove();
}
$rssImport = eZRSSImport::fetch($deleteID, true, eZRSSImport::STATUS_VALID);
if ($rssImport) {
$rssImport->remove();
}
}
}
}
}
}
// Get all RSS Exports
$exportArray = eZRSSExport::fetchList();
$exportList = array();
foreach ($exportArray as $export) {
$exportList[$export->attribute('id')] = $export;
}
// Get all RSS imports
$importArray = eZRSSImport::fetchList();
$importList = array();
foreach ($importArray as $import) {
$importList[$import->attribute('id')] = $import;
}
$tpl = eZTemplate::factory();
$tpl->setVariable('rssexport_list', $exportList);
$tpl->setVariable('rssimport_list', $importList);
$Result = array();
$Result['content'] = $tpl->fetch("design:rss/list.tpl");
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:list.php
示例5: intval
<?php
/**
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
* @package kernel
*/
$Module = $Params['Module'];
if (!isset($Params['RSSFeed'])) {
eZDebug::writeError('No RSS feed specified');
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$feedName = $Params['RSSFeed'];
$RSSExport = eZRSSExport::fetchByName($feedName);
// Get and check if RSS Feed exists
if (!$RSSExport) {
eZDebug::writeError('Could not find RSSExport : ' . $Params['RSSFeed']);
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$config = eZINI::instance('site.ini');
$cacheTime = intval($config->variable('RSSSettings', 'CacheTime'));
$lastModified = gmdate('D, d M Y H:i:s', time()) . ' GMT';
eZURI::setTransformURIMode('full');
if ($cacheTime <= 0) {
$xmlDoc = $RSSExport->attribute('rss-xml-content');
$rssContent = $xmlDoc;
} else {
$cacheDir = eZSys::cacheDirectory();
$currentSiteAccessName = $GLOBALS['eZCurrentAccess']['name'];
$cacheFilePath = $cacheDir . '/rss/' . md5($currentSiteAccessName . $feedName) . '.xml';
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:feed.php
示例6: fetchList
static function fetchList( $asObject = true )
{
return eZPersistentObject::fetchObjectList( eZRSSExport::definition(),
null, array( 'status' => self::STATUS_VALID ), null, null,
$asObject );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:6,代码来源:ezrssexport.php
示例7: 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
示例8: 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
示例9: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论