本文整理汇总了PHP中eZRSSExport::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZRSSExport::fetch方法的具体用法?PHP eZRSSExport::fetch怎么用?PHP eZRSSExport::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZRSSExport
的用法示例。
在下文中一共展示了eZRSSExport::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$tpl->setVariable('rss_export', $rssExport);
$tpl->setVariable('rss_export_id', $rssExportID);
$tpl->setVariable('lock_timeout', $timeOut);
$Result = array();
$Result['content'] = $tpl->fetch('design:rss/edit_export_denied.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/rss', 'Really Simple Syndication')));
return $Result;
} else {
if ($timeOut > 0 && $rssExport->attribute('modified') + $timeOut < time()) {
$rssExport->removeThis();
$rssExport = false;
}
}
}
if (!$rssExport) {
$rssExport = eZRSSExport::fetch($RSSExportID, true, eZRSSExport::STATUS_VALID);
if ($rssExport) {
$db = eZDB::instance();
$db->begin();
$rssItems = $rssExport->fetchItems();
$rssExport->setAttribute('status', eZRSSExport::STATUS_DRAFT);
$rssExport->store();
foreach ($rssItems as $rssItem) {
$rssItem->setAttribute('status', eZRSSExport::STATUS_DRAFT);
$rssItem->store();
}
$db->commit();
} else {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
}
示例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();
//.........这里部分代码省略.........
示例3: array
* @version 2012.6
* @package kernel
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('NewExportButton')) {
return $Module->run('edit_export', array());
} else {
if ($http->hasPostVariable('RemoveExportButton') && $http->hasPostVariable('DeleteIDArray')) {
$deleteArray = $http->postVariable('DeleteIDArray');
foreach ($deleteArray as $deleteID) {
$rssExport = eZRSSExport::fetch($deleteID, true, eZRSSExport::STATUS_DRAFT);
if ($rssExport) {
$rssExport->remove();
}
$rssExport = eZRSSExport::fetch($deleteID, true, eZRSSExport::STATUS_VALID);
if ($rssExport) {
$rssExport->remove();
}
}
} else {
if ($http->hasPostVariable('NewImportButton')) {
return $Module->run('edit_import', array());
} else {
if ($http->hasPostVariable('RemoveImportButton') && $http->hasPostVariable('DeleteIDArrayImport')) {
$deleteArray = $http->postVariable('DeleteIDArrayImport');
foreach ($deleteArray as $deleteID) {
$rssImport = eZRSSImport::fetch($deleteID, true, eZRSSImport::STATUS_DRAFT);
if ($rssImport) {
$rssImport->remove();
}