本文整理汇总了PHP中UniversalFeedCreator::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP UniversalFeedCreator::addItem方法的具体用法?PHP UniversalFeedCreator::addItem怎么用?PHP UniversalFeedCreator::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniversalFeedCreator
的用法示例。
在下文中一共展示了UniversalFeedCreator::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
global $G;
include_once CLASS_PATH . 'feedcreator.class.php';
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $G['setting']['site_name'];
$rss->description = $this->setting->getValue("site_description");
$rss->link = URL;
$rss->syndicationURL = URL . "rss.php";
//announce
$announce = $this->setting->dbstuff->GetArray("SELECT * FROM {$this->setting->table_prefix}announcements ORDER BY display_order ASC,id DESC LIMIT 0,5");
if (!empty($announce)) {
foreach ($announce as $key => $val) {
$item = new FeedItem();
$item->title = $val['subject'];
$item->link = $this->url(array("module" => "announce", "id" => $val['id']));
$item->description = $val['message'];
$item->date = $val['created'];
$item->source = $this->url(array("module" => "announce", "id" => $val['id']));
$item->author = $G['setting']['company_name'];
$rss->addItem($item);
}
}
$image = new FeedImage();
$image->title = $G['setting']['site_banner_word'];
$image->url = URL . STATICURL . "images/logo.jpg";
$image->link = URL;
$image->description = $rss->description;
$rss->image = $image;
$rss->saveFeed("RSS1.0", DATA_PATH . "appcache/rss.xml");
}
示例2: createXML
function createXML($title = '', $url = '', $rssurl = '', $description = '', $query = NULL)
{
require_once PATH_CORE . '/utilities/feedcreator.class.php';
$rssFeed = new UniversalFeedCreator();
$rssFeed->useCached();
// use cached version if age<1 hour
$rssFeed->title = $title;
$rssFeed->link = $url;
$rssFeed->syndicationURL = $rssFeedurl;
$rssFeed->description = $description;
$rssFeed->descriptionTruncSize = 500;
$rssFeed->descriptionHtmlSyndicated = true;
$rssFeed->language = "en-us";
$number = $this->db->countQ($query);
while ($data = $this->db->readQ($query)) {
$item = new FeedItem();
$temptitle = str_replace("\\'", "'", $data->title);
$temptitle = str_replace('\\"', '"', $temptitle);
$item->title = $temptitle;
$item->link = $this->baseUrl . '?p=read&cid=' . $data->siteContentId . '&viaRSS';
$tempdesc = str_replace("\\'", "'", $data->caption);
$tempdesc = str_replace('\\"', '"', $tempdesc);
$tempdesc = $this->utilObj->shorten($tempdesc, 500);
$item->description = $this->safexml($tempdesc);
$item->descriptionTruncSize = 500;
$item->descriptionHtmlSyndicated = true;
$item->date = $data->mydate;
$item->source = $this->baseUrl;
$rssFeed->addItem($item);
}
$temp_file = PATH_CACHE . '/rss' . rand(1, 1000) . '.tmp';
$text = $rssFeed->saveFeed("RSS2.0", $temp_file, false);
return $text;
}
示例3: handleRSS
function handleRSS($results)
{
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
$query =& $app->getQuery();
import('feedcreator.class.php');
import('Dataface/FeedTool.php');
$ft = new Dataface_FeedTool();
$rss = new UniversalFeedCreator();
$rss->encoding = $app->_conf['oe'];
//$rss->useCached(); // use cached version if age<1 hour
$del =& $record->_table->getDelegate();
if (!$del or !method_exists($del, 'getSingleRecordSearchFeed')) {
$del =& $app->getDelegate();
}
if ($del and method_exists($del, 'getSingleRecordSearchFeed')) {
$feedInfo = $del->getSingleRecordSearchFeed($record, $query);
if (!$feedInfo) {
$feedInfo = array();
}
}
if (isset($feedInfo['title'])) {
$rss->title = $feedInfo['title'];
} else {
$rss->title = $record->getTitle() . '[ Search for "' . $query['--subsearch'] . '"]';
}
if (isset($feedInfo['description'])) {
$rss->description = $feedInfo['description'];
} else {
$rss->description = '';
}
if (isset($feedInfo['link'])) {
$rss->link = $feedInfo['link'];
} else {
$rss->link = htmlentities(df_absolute_url($app->url('') . '&--subsearch=' . urlencode($query['--subsearch'])));
}
$rss->syndicationURL = $rss->link;
$records = array();
foreach ($results as $result) {
foreach ($result as $rec) {
$records[] = $rec->toRecord();
}
}
uasort($records, array($this, 'cmp_last_modified'));
foreach ($records as $rec) {
if ($rec->checkPermission('view') and $rec->checkPermission('view in rss')) {
$rss->addItem($ft->createFeedItem($rec));
}
}
if (!$query['--subsearch']) {
$rss->addItem($ft->createFeedItem($record));
}
header("Content-Type: application/xml; charset=" . $app->_conf['oe']);
echo $rss->createFeed('RSS2.0');
exit;
}
示例4: showRSSActivity
function showRSSActivity(&$rows)
{
$app = JFactory::getApplication();
// Load feed creator class
require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'assets' . DS . 'feedcreator' . DS . 'feedcreator.php';
$rssfile = $app->getCfg('tmp_path') . '/rssAUPactivity.xml';
$rss = new UniversalFeedCreator();
$rss->title = $app->getCfg('sitename');
$rss->description = JText::_('AUP_LASTACTIVITY');
$rss->link = JURI::base();
$rss->syndicationURL = JURI::base();
$rss->cssStyleSheet = NULL;
$rss->descriptionHtmlSyndicated = true;
if ($rows) {
foreach ($rows as $row) {
// exceptions private data
if ($row->plugin_function == 'plgaup_getcouponcode_vm' || $row->plugin_function == 'plgaup_alphagetcouponcode_vm' || $row->plugin_function == 'sysplgaup_buypointswithpaypal') {
$datareference = '';
}
switch ($row->plugin_function) {
case 'sysplgaup_dailylogin':
case 'plgaup_dailylogin':
$row->datareference = JHTML::_('date', $row->datareference, JText::_('DATE_FORMAT_LC1'));
break;
case 'plgaup_getcouponcode_vm':
case 'plgaup_alphagetcouponcode_vm':
case 'sysplgaup_buypointswithpaypal':
$row->datareference = '';
break;
default:
}
$datareference = $row->datareference != '' ? ' (' . $row->datareference . ')' : '';
// special format
//if ( $row->plugin_function=='sysplgaup_dailylogin' ) $datareference = '';
$item = new FeedItem();
$item->title = htmlspecialchars($row->usrname, ENT_QUOTES, 'UTF-8');
$item->description = JText::_($row->rule_name) . "{$datareference} / " . $row->last_points . " " . JText::_('AUP_POINTS');
$item->descriptionTruncSize = 250;
$item->descriptionHtmlSyndicated = true;
@($date = $row->insert_date ? date('r', strtotime($row->insert_date)) : '');
$item->date = $date;
$item->source = JURI::base();
$rss->addItem($item);
}
}
// save feed file
$rss->saveFeed('RSS2.0', $rssfile);
}
示例5: index
public function index()
{
$rss = new UniversalFeedCreator();
$rss->useCached();
// use cached version if age<1 hour
$rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE");
$rss->description = app_conf("SHOP_SEO_TITLE");
//optional
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;
$rss->link = get_domain() . APP_ROOT;
$rss->syndicationURL = get_domain() . APP_ROOT;
//optional
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;
$domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT");
$city = get_current_deal_city();
$city_id = $city['id'];
$deal_list = get_deal_list(app_conf("DEAL_PAGE_SIZE"), 0, 0, array(DEAL_ONLINE), " buy_type <> 1 or ( is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1)");
$deal_list = $deal_list['list'];
foreach ($deal_list as $data) {
$item = new FeedItem();
if ($data['uname'] != '') {
$gurl = url("shop", "goods", array("id" => $data['uname']));
} else {
$gurl = url("shop", "goods", array("id" => $data['id']));
}
$data['url'] = $gurl;
$item->title = msubstr($data['name'], 0, 30);
$item->link = get_domain() . $data['url'];
$data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
$data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
$data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
$item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
//optional
$item->descriptionTruncSize = 500;
$item->descriptionHtmlSyndicated = true;
if ($data['end_time'] != 0) {
$item->date = date('r', $data['end_time']);
}
$item->source = $data['url'];
$item->author = app_conf("SHOP_TITLE");
$rss->addItem($item);
}
$rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml");
}
示例6: indexAction
public static function indexAction()
{
$rss = new \UniversalFeedCreator();
$rss->useCached('RSS1.0', ROOT_DIR . '/runtime/rss.xml');
$rss->title = P_TITLE;
$rss->link = ENV_PREFERED_PROTOCOL . '://' . CONFIG_HOST . P_PREFIX;
$rss->syndicationURL = $rss->link . '/feed';
$posts = \BWBlog\Post::list_all([], 1, 0);
foreach ($posts as $post) {
$item = new \FeedItem();
$item->title = $post['title'];
$item->link = ENV_PREFERED_PROTOCOL . '://' . CONFIG_HOST . P_PREFIX . $post['rest_url'];
$item->description = $post['content']['html'];
$item->date = $post['time']['main'];
$rss->addItem($item);
}
echo $rss->saveFeed('RSS1.0', ROOT_DIR . '/runtime/rss.xml');
}
示例7: UniversalFeedCreator
function create_xml($fileName, &$list, &$ads, &$columns)
{
global $gorumroll;
include FEED_DIR . "/feedcreator.class.php";
$ufc = new UniversalFeedCreator();
$ufc->descriptionHtmlSyndicated = TRUE;
$ufc->title = $list->listTitle;
$ufc->description = $list->listDescription;
$ctrl =& new AppController("customlist/{$list->id}");
$ufc->link = $ctrl->makeUrl(TRUE);
$ufc->syndicationURL = $gorumroll->ctrl->makeUrl(TRUE);
// link to this page
$owner = new User();
foreach ($ads as $ad) {
$item = new FeedItem();
$item->descriptionHtmlSyndicated = TRUE;
$item->title = $ad->getTitle(FALSE);
$ctrl = $ad->getLinkCtrl($item->title);
$item->link = $ctrl->makeUrl(TRUE);
$item->description = $ad->getDescription(FALSE);
// without htmlspecialchars()
$item->date = (int) $ad->creationtime->getTimestamp();
$item->additionalElements = array();
foreach ($columns as $column) {
if (isset($ad->{$column->columnIndex})) {
if ($column->userField) {
$owner->{$column->userColumnIndex} = $ad->{$column->columnIndex};
$content = $owner->showListVal($column->userColumnIndex, "", TRUE);
} else {
$content = $ad->showListVal($column->columnIndex, "", TRUE);
}
$item->additionalElements[$column->showListVal("name")] = array("html" => $column->allowHtml || $column->type == customfield_url || $column->type == customfield_picture || $column->type == customfield_media || $column->columnIndex == "cName" || $column->userColumnIndex == "email", "content" => $content);
}
}
$ufc->addItem($item);
}
$ufc->saveFeed($list->xmlType, $fileName, FALSE);
}
示例8: fab_feed
function fab_feed($type, $filename, $timeout)
{
global $sitename, $slogan, $nuke_url, $backend_image, $backend_title, $backend_width, $backend_height, $backend_language, $storyhome;
include "lib/feedcreator.class.php";
$rss = new UniversalFeedCreator();
$rss->useCached($type, $filename, $timeout);
$rss->title = $sitename;
$rss->description = $slogan;
$rss->descriptionTruncSize = 250;
$rss->descriptionHtmlSyndicated = true;
$rss->link = $nuke_url;
$rss->syndicationURL = $nuke_url . "/backend.php?op=" . $type;
$image = new FeedImage();
$image->title = $sitename;
$image->url = $backend_image;
$image->link = $nuke_url;
$image->description = $backend_title;
$image->width = $backend_width;
$image->height = $backend_height;
$rss->image = $image;
$xtab = news_aff("index", "where ihome='0' and archive='0'", $storyhome, "");
$story_limit = 0;
while ($story_limit < $storyhome and $story_limit < sizeof($xtab)) {
list($sid, $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes) = $xtab[$story_limit];
$story_limit++;
$item = new FeedItem();
$item->title = preview_local_langue($backend_language, str_replace(""", "\"", $title));
$item->link = $nuke_url . "/article.php?sid={$sid}";
$item->description = meta_lang(preview_local_langue($backend_language, $hometext));
$item->descriptionHtmlSyndicated = true;
$item->date = convertdateTOtimestamp($time) + $gmt * 3600;
$item->source = $nuke_url;
$item->author = $aid;
$rss->addItem($item);
}
echo $rss->saveFeed($type, $filename);
}
示例9: updateRSS
/**
* records history events in rss/rss_$project->id.xml
*
* must be called from a project-related page!
*
*
* @param project - current project object used in: proj.inc.php <- function call
*/
static function updateRSS($project)
{
global $PH;
global $auth;
if (!$project) {
return NULL;
}
/**
* only show changes by others
*/
if (Auth::isAnonymousUser()) {
$not_modified_by = NULL;
} else {
$not_modified_by = $auth->cur_user->id;
}
### get all the changes (array of history items) ##
$changes = ChangeLine::getChangeLines(array('project' => $project->id, 'unviewed_only' => false, 'limit_rowcount' => 20, 'type' => array(ITEM_TASK, ITEM_FILE), 'limit_offset' => 0));
/*
$changes= DbProjectItem::getAll(array(
'project' => $project->id, # query only this project history
'alive_only' => false, # get deleted entries
'visible_only' => false, # ignore user viewing rights
'limit_rowcount' => 20, # show only last 20 entries in rss feed
#'show_assignments' => false, # ignore simple assignment events
));
*/
$url = confGet('SELF_PROTOCOL') . '://' . confGet('SELF_URL');
# url part of the link to the task
$from_domain = confGet('SELF_DOMAIN');
# domain url
if (confGet('USE_MOD_REWRITE')) {
$url = str_replace('index.php', '', $url);
}
### define general rss file settings ###
$rss = new UniversalFeedCreator();
$rss->title = "StreberPM: " . $project->name;
$rss->description = "Latest Project News";
$rss->link = "{$url}?go=projView&prj={$project->id}";
$rss->syndicationURL = $url;
# go through all retrieved changes and create rss feed
foreach ($changes as $ch) {
$item = $ch->item;
$name_author = __('???');
if ($person = Person::getVisibleById($item->modified_by)) {
$name_author = $person->name;
}
$str_updated = '';
if ($new = $ch->item->isChangedForUser()) {
if ($new == 1) {
$str_updated = __('New');
} else {
$str_updated = __('Updated');
}
}
$feeditem = new FeedItem();
$feeditem->title = $item->name . " (" . $ch->txt_what . ' ' . __("by") . ' ' . $name_author . ")";
$feeditem->link = $url . "?go=itemView&item={$item->id}";
$feeditem->date = gmdate("r", strToGMTime($item->modified));
$feeditem->source = $url;
$feeditem->author = $name_author;
switch ($ch->type) {
case ChangeLine::COMMENTED:
$feeditem->description = $ch->html_details;
break;
case ChangeLine::NEW_TASK:
$feeditem->description = str_replace("\n", "<br>", $item->description);
break;
default:
$feeditem->description = $ch->type . " " . str_replace("\n", "<br>", $item->description);
break;
}
$rss->addItem($feeditem);
}
/**
* all history items processed ...
* save the rss 2.0 feed to rss/rss_$project->id.xml ...
* false stands for not showing the resulting feed file -> create in background
*/
$rss->saveFeed("RSS2.0", "_rss/proj_{$project->id}.xml", false);
}
示例10: date
//.........这里部分代码省略.........
// ATOM0.3
$cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/atom-style.css";
break;
case "6":
// OPML
$xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/opml.xsl";
break;
case "7":
// HTML
$contenttype = "text/plain";
break;
case "8":
// JS
$contenttype = "text/javascript";
break;
case "9":
// RSS 0.91
$cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css";
break;
}
$rss = new UniversalFeedCreator();
$rss->title = $title;
$rss->description = $desc;
//optional
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;
$rss->cssStyleSheet = htmlspecialchars($cssStyleSheet);
$rss->xslStyleSheet = htmlspecialchars($xslStyleSheet);
$rss->encoding = $encoding;
$rss->language = $this->get_preference("rssfeed_language", "en-us");
$rss->editor = $this->get_preference("rssfeed_editor", "");
$rss->webmaster = $this->get_preference("rssfeed_webmaster", "");
$rss->link = $url;
$rss->feedURL = $url;
$image = new FeedImage();
$image->title = tra("tikiwiki logo");
$image->url = $img;
$image->link = $home;
$image->description = tra(sprintf("Feed provided by %s. Click to visit.", $home));
//optional
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;
$rss->image = $image;
global $dbTiki;
if (!isset($userslib)) {
$userslib = new Userslib($dbTiki);
}
foreach ($changes["data"] as $data) {
$item = new FeedItem();
$item->title = $data["{$titleId}"];
// 2 parameters to replace
if ($urlparam != '') {
$item->link = sprintf($read, urlencode($data["{$id}"]), urlencode($data["{$urlparam}"]));
} else {
$item->link = sprintf($read, urlencode($data["{$id}"]));
}
if (isset($data["{$descId}"])) {
$item->description = $data["{$descId}"];
} else {
$item->description = "";
}
//optional
//item->descriptionTruncSize = 500;
$item->descriptionHtmlSyndicated = true;
$item->date = (int) $data["{$dateId}"];
$item->source = $url;
$item->author = "";
if ($authorId != "") {
if ($userslib->user_exists($data["{$authorId}"])) {
$item->author = $data["{$authorId}"];
// only use realname <email> if existing and
$tmp = "";
if ($this->get_user_preference($data["{$authorId}"], 'user_information', 'private') == 'public') {
$tmp = $this->get_user_preference($data["{$authorId}"], "realName");
}
$epublic = $this->get_user_preference($data["{$authorId}"], 'email is public', 'n');
if ($epublic != 'n') {
$res = $userslib->get_user_info($data["{$authorId}"], false);
if ($tmp != "") {
$tmp .= ' ';
}
$tmp .= "<" . scrambleEmail($res['email'], $epublic) . ">";
}
if ($tmp != "") {
$item->author = $tmp;
}
} else {
$item->author = $data["{$authorId}"];
}
}
$rss->addItem($item);
}
$data = $rss->createFeed($this->get_rss_version_name($rss_version));
$this->put_to_cache($uniqueid, (int) $data, $rss_version);
$output = array();
$output["data"] = $data;
$output["content-type"] = $contenttype;
$output["encoding"] = $encoding;
return $output;
}
示例11: header
header('WWW-Authenticate: Basic realm="ownCloud Login"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
$lang = OC_Preferences::getValue($uid, 'core', 'lang', OC_L10N::findLanguage());
$l = OC_L10N::get('notify', $lang);
//TODO: use different feed creator library (like Zend_Feed) and switch html flag to true
$notifications = OC_Notify::getNotifications($uid, 50, $lang, false);
$baseAddress = (isset($_SERVER["HTTPS"]) ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"];
$rssURI = $baseAddress . $baseuri . 'feed.rss';
$atomURI = $baseAddress . $baseuri . 'feed.atom';
$feed = new UniversalFeedCreator();
$feed->title = $l->t('ownCloud notifications');
$feed->description = $l->t('ownCloud notification stream of the user "%s".', array($uid));
$feed->link = $baseAddress . OC::$WEBROOT;
$feed->syndicationURL = $baseAddress . $_SERVER["PHP_SELF"];
$feed->image = new FeedImage();
$feed->image->title = 'ownCloud';
$feed->image->url = $baseAddress . OCP\Util::imagePath('core', 'logo-inverted.png');
$feed->image->link = $feed->link;
foreach ($notifications as $notification) {
$item = new FeedItem();
$item->title = strip_tags($notification["summary"]);
$item->date = strtotime($notification["moment"]);
$item->link = OCP\Util::linkToAbsolute("notify", "go.php", array("id" => $notification["id"]));
$item->description = $notification["content"];
//TODO image
$item->author = "ownCloud (" . $notification["app"] . " app)";
$feed->addItem($item);
}
$feed->outputFeed($type);
示例12: feed
function feed($id, $showFeed)
{
global $database, $mainframe;
global $mosConfig_live_site, $mosConfig_offset, $mosConfig_absolute_path;
$params = rdRss::getParameters($id);
//print_r($params);
// set filename for live bookmarks feed
if (!$showFeed & $params->live_bookmark) {
// standard bookmark filename
$params->file = $mosConfig_absolute_path . '/cache/' . $params->live_bookmark . "_" . $id;
} else {
// set filename for rss feeds
$params->file = strtolower(str_replace('.', '', $params->feed));
$params->file = $mosConfig_absolute_path . '/cache/' . $params->file . "_" . $id . '.xml';
}
// load feed creator class
$rss = new UniversalFeedCreator();
// load image creator class
$image = new FeedImage();
// loads cache file
if ($showFeed && $params->cache) {
$rss->useCached($params->feed, $params->file, $params->cache_time);
}
$rss->title = $params->title;
$rss->description = $params->description;
$rss->link = $params->link;
$rss->syndicationURL = $params->link;
$rss->cssStyleSheet = NULL;
$rss->encoding = $params->encoding;
if ($params->image) {
$image->url = $params->image;
$image->link = $params->link;
$image->title = $params->image_alt;
$image->description = $params->description;
// loads image info into rss array
$rss->image = $image;
}
if ($id == '1') {
$fp = 1;
} else {
$fp = 0;
}
$rows = rdRss::getData($params, $fp);
if (count($rows) && $params->published) {
foreach ($rows as $row) {
// title for particular item
$item_title = htmlspecialchars($row->title);
$item_title = html_entity_decode($item_title);
// url link to article
// & used instead of & as this is converted by feed creator
$item_link = $mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $mainframe->getItemid($row->id);
$item_link = sefRelToAbs($item_link);
// removes all formating from the intro text for the description text
$item_description = $row->introtext;
$item_description = mosHTML::cleanText($item_description);
$item_description = html_entity_decode($item_description);
if ($params->limit_text) {
if ($params->text_length) {
// limits description text to x words
$item_description_array = split(' ', $item_description);
$count = count($item_description_array);
if ($count > $params->text_length) {
$item_description = '';
for ($a = 0; $a < $params->text_length; $a++) {
$item_description .= $item_description_array[$a] . ' ';
}
$item_description = trim($item_description);
$item_description .= '...';
}
} else {
// do not include description when text_length = 0
$item_description = NULL;
}
}
// load individual item creator class
$item = new FeedItem();
// item info
$item->title = $item_title;
$item->link = $item_link;
$item->description = $item_description;
$item->source = $params->link;
$item->date = date('r', $row->created_ts);
// loads item info into rss array
$rss->addItem($item);
}
}
//save feed file
$rss->saveFeed($params->feed, $params->file, $showFeed);
}
示例13: FeedItem
$repository = "http://svn.svnkit.com/repos/svnkit/tags/";
$contents = read_contents($repository);
if (!$contents) {
echo $rss->createFeed();
exit;
}
$items = publish_rss20($repository, $contents, "http://www.svnkit.com/");
for($i = 0; $i < count($items); $i++) {
$item = $items[$i];
$rssitem = new FeedItem();
$rssitem->title = $item["title"];
$rssitem->source = $item["source"];
$rssitem->link = $item["link"];
$rssitem->author = $item["author"];
$rssitem->date = $item["date"];
$rssitem->authorEmail = "support@svnkit.com";
$rssitem->editorEmail = "support@svnkit.com";
$rssitem->description = $item["rss_description"];
$rss->addItem($rssitem);
}
$rss->saveFeed("RSS2.0", $cacheFile);
readfile($cacheFile);
exit;
?>
示例14: UniversalFeedCreator
/**
* 掲示板RSSを出力する
*
* @param $community_row 対象コミュニティ情報
* @param $bbs_row_array 掲示板親記事一覧
* @param $params パラメータ等
*/
static function print_bbs_rss($community_row, $bbs_row_array, $params)
{
// 使用クラス: acs/webapp/lib/feedcreator/feedcreator.class.php
$rss = new UniversalFeedCreator();
// 概要等 <channel>
$rss->useCached();
$rss->title = $community_row['community_name'];
// コミュニティ名
$rss->description = $community_row['community_profile']['contents_value'];
// プロフィール (公開範囲別)
$rss->link = $params['base_url'] . $community_row['top_page_url'];
// コミュニティトップページURL
$rss->url = $params['base_url'] . $community_row['image_url'];
// 画像URL <image rdf:resource="...">
$rss->syndicationURL = $rss_syndication_url;
// 自身のURL <channel rdf:about="...">
// ロゴ画像 <image>
$image = new FeedImage();
$image->title = $community_row['image_title'];
// ファイル名
$image->link = ACSMsg::get_mdmsg(__FILE__, 'M006');
// 研究室ロゴ画像
$image->url = $params['base_url'] . $community_row['image_url'];
$rss->image = $image;
// 1件のダイアリー: <item>
foreach ($bbs_row_array as $index => $bbs_row) {
// CRLF → LF
$body = preg_replace('/\\r\\n/', "\n", $bbs_row['body']);
$item = new FeedItem();
$item->post_date = $bbs_row['post_date'];
$item->title = $bbs_row['subject'];
$item->link = $params['base_url'] . $bbs_row['bbs_res_url'];
$item->description = $body;
if ($bbs_row['file_url'] != '') {
$item->image_link = $params['base_url'] . $bbs_row['file_url'];
}
$item->description2 = $body;
//第2の本文 <content:encoded>
$rss->addItem($item);
}
// http-header
mb_http_output('pass');
header('Content-type: application/xml; charset=UTF-8');
echo mb_convert_encoding($rss->createFeed("RSS1.0"), 'UTF-8', mb_internal_encoding());
}
示例15: UniversalFeedCreator
function _showrss()
{
$app = JFactory::getApplication();
// Load feed creator class
require_once JPATH_SITE . DS . 'includes' . DS . 'feedcreator.class.php';
$rssfile = $app->getCfg('tmp_path') . '/rss.xml';
$rss = new UniversalFeedCreator();
$rss->title = $app->getCfg('sitename');
$rss->description = $app->getCfg('MetaDesc');
$rss->link = JURI::base();
$rss->syndicationURL = JURI::base();
$rss->cssStyleSheet = NULL;
$rss->descriptionHtmlSyndicated = true;
$rows = $this->rows;
if ($rows) {
foreach ($rows as $row) {
$item = new FeedItem();
$sluggy = $row->slug;
if ($row->catslug && $sluggy != '') {
$sluggy .= "&catid=" . $row->catslug;
}
$sluggy .= "&directory=" . $this->menuid;
$item->title = JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC2')) . " - " . stripslashes($row->title);
$item->link = JURI::base() . "/" . $row->href . $sluggy;
$item->description = $row->text != '' ? $row->text : $row->fulltext;
$item->descriptionTruncSize = 250;
$item->descriptionHtmlSyndicated = true;
@($date = $row->created ? date('r', strtotime($row->created)) : '');
$item->date = $date;
$item->source = JURI::base();
$rss->addItem($item);
}
}
// save feed file
$rss->saveFeed('RSS2.0', $rssfile);
}