本文整理汇总了PHP中UniversalFeedCreator::createFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP UniversalFeedCreator::createFeed方法的具体用法?PHP UniversalFeedCreator::createFeed怎么用?PHP UniversalFeedCreator::createFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniversalFeedCreator
的用法示例。
在下文中一共展示了UniversalFeedCreator::createFeed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _show_feed
/**
* Displays the feed
*
* @param mixed $handler_id The ID of the handler.
* @param array &$data The local request data.
*/
public function _show_feed($handler_id, array &$data)
{
$data['feedcreator'] =& $this->_feed;
// Add each article now.
if ($this->_articles) {
foreach ($this->_articles as $article) {
$this->_datamanager->autoset_storage($article);
$data['article'] =& $article;
$data['datamanager'] =& $this->_datamanager;
midcom_show_style('feeds-item');
}
}
switch ($handler_id) {
case 'feed-rss2':
case 'feed-category-rss2':
echo $this->_feed->createFeed('RSS2.0');
break;
case 'feed-rss1':
echo $this->_feed->createFeed('RSS1.0');
break;
case 'feed-rss091':
echo $this->_feed->createFeed('RSS0.91');
break;
case 'feed-atom':
echo $this->_feed->createFeed('ATOM');
break;
}
}
示例2: foreach
/**
* Displays the feed
*
* @param mixed $handler_id The ID of the handler.
* @param mixed &$data The local request data.
*/
function _show_rss($handler_id, &$data)
{
$data['feedcreator'] =& $this->_feed;
// Add each event now.
if ($this->_events) {
foreach ($this->_events as $event) {
$this->_datamanager->autoset_storage($event);
$data['event'] =& $event;
$data['datamanager'] =& $this->_datamanager;
midcom_show_style('feeds-item');
}
}
echo $this->_feed->createFeed('RSS2.0');
}
示例3: 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());
}
示例4: rss
function rss() {
$database = JFactory::getDBO();
$cfg = BidsHelperTools::getConfig();
ob_end_clean();
$feed = $cfg->bid_opt_RSS_feedtype;
$cat = JRequest::getInt('cat', '');
$user = JRequest::getInt('user', '');
$limit = $cfg->bid_opt_RSS_description ? intval($cfg->bid_opt_RSS_nritems) : intval($cfg->bid_opt_nr_items_per_page);
if (!$limit)
$limit = 10;
require_once (JPATH_COMPONENT_SITE.DS.'libraries'.DS.'feedcreator'.DS.'feedcreator.php');
$rss = new UniversalFeedCreator();
$rss->title = $cfg->bid_opt_RSS_title;
$rss->description = $cfg->bid_opt_RSS_description;
$rss->link = htmlspecialchars(JURI::root());
$rss->syndicationURL = htmlspecialchars(JURI::root());
$rss->cssStyleSheet = null;
$rss->encoding = 'UTF-8';
$where = " where a.published=1 and a.close_offer=0 and a.close_by_admin=0 ";
if ($cat) {
if (!$cfg->bid_opt_inner_categories) {
$where .= " and a.cat = '" . $cat . "' ";
} else {
$catOb = BidsHelperTools::getCategoryModel();
$cTree = $catOb->getCategoryTree($cat,true);
$cat_ids = array();
if ($cTree) {
foreach ($cTree as $cc) {
if (!empty($cc->id)) {
$cat_ids[] = $cc->id;
}
}
}
if (count($cat_ids))
$cat_ids = implode(",", $cat_ids);
$where .= " and ( a.cat IN (" . $cat_ids . ") )";
}
}
if ($user) {
$where .= " AND userid=".$database->quote($user);
}
$database->setQuery("select a.* from #__bid_auctions a left join #__categories c on c.id=a.cat ".$where." order by id desc", 0, $limit);
$rows = $database->loadObjectList();
for ($i = 0; $i < count($rows); $i++) {
$auction = $rows[$i];
$item_link = JHtml::_('auctiondetails.auctionDetailsURL',$auction, false);
// removes all formating from the intro text for the description text
$item_description = $auction->description;
$item_description = JFilterOutput::cleanText($item_description);
$item_description = html_entity_decode($item_description);
// load individual item creator class
$item = new FeedItem();
// item info
$item->title = $auction->title;
$item->link = $item_link;
$item->description = $item_description;
$item->source = $rss->link;
$item->date = date('r', strtotime($auction->start_date));
$database->setQuery( "select title from #__categories where id=".$database->quote($auction->cat) );
$item->category = $database->loadResult();
$rss->addItem($item);
}
echo $rss->createFeed($feed);
}
示例5: FeedItem
$item = new FeedItem();
$item->guid = $img->gridimage_id;
$item->title = $img->grid_reference . " : " . $img->title;
$item->link = "http://{$_SERVER['HTTP_HOST']}/photo/{$img->gridimage_id}";
if (!empty($img->dist_string) || !empty($img->imagetakenString)) {
$item->description = $img->dist_string . (!empty($img->imagetakenString) ? ' Taken: ' . $img->imagetakenString : '') . "<br/>" . $img->comment;
$item->descriptionHtmlSyndicated = true;
} else {
$item->description = $img->comment;
}
if (!empty($img->imagetaken) && strpos($img->imagetaken, '-00') === FALSE) {
$item->imageTaken = $img->imagetaken;
}
$item->date = strtotime($img->submitted);
$item->source = "http://{$_SERVER['HTTP_HOST']}/";
$item->author = $img->realname;
$item->lat = $img->wgs84_lat;
$item->long = $img->wgs84_long;
$details = $img->getThumbnail(120, 120, 2);
$item->thumb = $details['server'] . $details['url'];
$item->thumbTag = $details['html'];
$item->licence = "© Copyright <i class=\"attribution\">" . htmlspecialchars($img->realname) . "</i> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a>";
$rss->addItem($item);
}
}
customExpiresHeader(86400, true);
header("Content-type: application/vnd.google-earth.kml+xml");
header("Content-Disposition: attachment; filename=\"geograph.kml\"");
//we store in var so can be by reference
$feed =& $rss->createFeed($format);
echo $feed;
示例6: die
$res2 = mysql_query($query);
if ($res2 == FALSE)
{
echo "Mysql error on query: $query";
die();
}
$r2 = mysql_fetch_array($res2);
$fid = $r2["parent_id"];
$forum = $r2["forum_name"].(($forum == "") ? "" : " -> ").$forum;
$it++;
if ($it > 100)
{
die("Too many iterations when fetching forum category");
}
}while ($fid != "0");
$title = "( ".$author." ) ".$forum." -> ".$thread;
$link = "http://springrts.com/phpbb/viewtopic.php?t=".$row["topic_id"];
$item->title = $title;
$item->link = $link;
$item->author = $author;
$rss->addItem($item);
}
//echo "\t</channel>\n";
//echo "</rss>\n";
echo $rss->createFeed("RSS2.0");
?>
示例7: sms_board_output_rss
function sms_board_output_rss($keyword, $line = "10")
{
global $apps_path, $web_title;
include_once $apps_path['plug'] . "/feature/sms_board/lib/external/feedcreator/feedcreator.class.php";
$keyword = strtoupper($keyword);
if (!$line) {
$line = "10";
}
$format_output = "RSS0.91";
$rss = new UniversalFeedCreator();
$db_query1 = "SELECT * FROM " . _DB_PREF_ . "_featureBoard_log WHERE in_keyword='{$keyword}' ORDER BY in_datetime DESC LIMIT 0,{$line}";
$db_result1 = dba_query($db_query1);
while ($db_row1 = dba_fetch_array($db_result1)) {
$title = $db_row1['in_masked'];
$description = $db_row1['in_msg'];
$datetime = $db_row1['in_datetime'];
$items = new FeedItem();
$items->title = $title;
$items->description = $description;
$items->comments = $datetime;
$items->date = strtotime($datetime);
$rss->addItem($items);
}
$feeds = $rss->createFeed($format_output);
return $feeds;
}
示例8: strtoupper
} else {
$description .= "<li>To Be Announced</li>";
}
$description .= "</ol><br /><br />";
$description .= "Cohort: " . html_encode(groups_get_name($result["event_cohort"])) . "<br />";
$description .= "Phase: " . strtoupper($result["event_phase"]) . "<br />";
$description .= "Event Date/Time: " . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "<br />";
$description .= "Event Duration: " . ($result["event_duration"] ? $result["event_duration"] . " minutes" : "Not provided") . "<br />";
$description .= "Event Location: " . ($result["event_location"] ? $result["event_location"] : "Not provided") . "<br />";
$description .= "<br />Podcast Description / Details:<br />";
$description .= html_encode($result["event_message"]);
$item = new FeedItem();
$item->title = $result["event_title"] . ": " . $result["file_title"];
$item->link = ENTRADA_URL . "/events?id=" . $result["event_id"];
$item->date = date("r", $result["event_start"]);
$item->description = $description;
$item->descriptionHtmlSyndicated = true;
$item->podcast = new PodcastItem();
$item->podcast->block = "yes";
$item->podcast->author = $primary_contact["fullname"];
$item->podcast->duration = $result["event_duration"] * 60;
$item->podcast->enclosure_url = ENTRADA_URL . "/podcasts/download/" . $result["efile_id"] . "/" . $result["file_name"];
$item->podcast->enclosure_length = $result["file_size"];
$item->podcast->enclosure_type = $result["file_type"];
$rss->addItem($item);
}
}
echo $rss->createFeed("PODCAST");
add_statistic("podcasts", "view", "proxy_id", $USER_PROXY_ID, $USER_PROXY_ID);
break;
}
示例9: stripslashes
$item->description = $prebold . $app->name . ' (' . $app->latest_version . ')' . $postbold . $br;
$item->description .= $preitalic . $app->company . $postitalic . $br;
$item->description .= $prebold . 'Category: ' . $postbold . $app->category_name . $br;
$item->description .= $prebold . 'Price: ' . $postbold . $app->price . $br;
if ($cracker) {
$item->description .= $prebold . 'Cracker: ' . $postbold . stripslashes($app->latest_version_first_cracker) . $br . $br;
} else {
$item->description .= $br;
}
$item->description .= $prebold . "Application Description:" . $postbold . $br;
$item->description .= $desc . $br . $br;
if ($whats_new) {
$item->description .= $prebold . "New in this Version:" . $postbold . $br;
$item->description .= $whats_new . $br . $br;
}
$item->description .= $prebold . preg_replace('/\\%LINK\\%/', $item->link, $linkline) . $postbold;
if ($sort == 'newapps') {
$item->date = strtotime($app->date_added);
} else {
$item->date = strtotime($app->latest_version_added);
}
$item->guid = $app->id . '-' . $app->latest_version;
$item->source = Config::getVal('general', 'site_name');
$item->author = Config::getVal('general', 'site_name');
$rss->addItem($item);
}
// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM0.3, HTML, JS
$rendered = $rss->createFeed("RSS0.91");
// Write it
echo $rendered;
示例10: foreach
foreach ($watching as $w) {
list($rc, $events) = al_getrecentevents('watch:' . $w['eventid']);
if ($rc != 0) {
continue;
}
foreach ($events as $e) {
$item = new FeedItem();
$item->title = $e['subject'];
$item->link = $GLOBALS['SITE_URL'] . $e['url'];
$item->date = (int) $e['time'];
$item->description = formatText($e['body']);
$rss->addItem($item);
}
}
}
$rss->title = '[FF] ' . $user . '\'s News';
$rss->description = $user . '\'s FOSS Factory news';
$rss->link = $GLOBALS['SITE_URL'];
} else {
header('Location: index.php');
exit;
}
}
}
}
if ($file !== null) {
$rss->saveFeed('RSS2.0', $file, false);
@readfile($file);
} else {
echo $rss->createFeed('RSS2.0');
}
示例11: generate_feed
//.........这里部分代码省略.........
AND (s.date_unpublish = 0 OR s.date_unpublish > ' . core_time() . ')
AND s.permission = 0
AND (s.access = 0)
AND (i.access = 0)
AND d.website = i.website
AND d.node_type = "item"
AND d.subtype = "title"
AND d.node_id = i.id
AND d.lang = ' . protect($current['lang']) . '
ORDER BY pdate DESC
LIMIT ' . $limit . '
OFFSET 0');
$rs = $DB->result();
for ($x = 0; $x < count($rs); $x++) {
if (nvweb_object_enabled($rs[$x])) {
$texts = webdictionary::load_element_strings('item', $rs[$x]->id);
$paths = path::loadElementPaths('item', $rs[$x]->id);
$fitem = new FeedItem();
$fitem->title = $texts[$current['lang']]['title'];
$fitem->link = $website->absolute_path() . $paths[$current['lang']];
switch ($item->content) {
case 'title':
// no description
break;
case 'content':
$fitem->description = $texts[$current['lang']]['section-main'];
break;
case 'summary':
default:
$fitem->description = $texts[$current['lang']]['section-main'];
$fitem->description = str_replace(array('</p>', '<br />', '<br/>', '<br>'), array('</p>' . "\n", '<br />' . "\n", '<br/>' . "\n", '<br>' . "\n"), $fitem->description);
$fitem->description = core_string_cut($fitem->description, 500, '…');
break;
}
$fitem->date = $rs[$x]->date_to_display;
// find an image to attach to the item
// A) first enabled image in item gallery
// B) first image on properties
$image = '';
if (!empty($rs[$x]->galleries)) {
$galleries = mb_unserialize($rs[$x]->galleries);
$photo = @array_shift(array_keys($galleries[0]));
if (!empty($photo)) {
$image = $website->absolute_path(false) . '/object?type=image&id=' . $photo;
}
}
if (empty($image)) {
// no image found on galleries, look for image properties
$properties = property::load_properties("item", $rs[$x]->template, "item", $rs[$x]->id);
for ($p = 0; $p < count($properties); $p++) {
if ($properties[$p]->type == 'image') {
if (!empty($properties[$p]->value)) {
$image = $properties[$p]->value;
} else {
if (!empty($properties[$p]->dvalue)) {
$image = $properties[$p]->dvalue;
}
}
if (is_array($image)) {
$image = array_values($image);
$image = $image[0];
}
if (!empty($image)) {
$image = $website->absolute_path(false) . '/object?type=image&id=' . $image;
}
}
// we only need the first image
if (!empty($image)) {
break;
}
}
}
if (!empty($image)) {
$fitem->image = $image;
// feedly will only display images of >450px --> http://blog.feedly.com/2015/07/31/10-ways-to-optimize-your-feed-for-feedly/
if (strpos($item->format, 'RSS') !== false) {
$fitem->description = '<img src="' . $image . '&width=640"><br />' . $fitem->description;
}
}
//$item->author = $contents->rows[$x]->author_name;
$feed->addItem($fitem);
}
}
// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM10, ATOM0.3, HTML, JS
//echo $rss->saveFeed("RSS1.0", "news/feed.xml");
}
$xml = $feed->createFeed($item->format);
if ($item->format == "RSS2.0") {
// add extra tweaks to improve the feed
$xml = str_replace('<rss ', '<rss xmlns:webfeeds="http://webfeeds.org/rss/1.0" ', $xml);
// also available:
// <webfeeds:cover image="http://yoursite.com/a-large-cover-image.png" />\n
// <webfeeds:accentColor>00FF00</webfeeds:accentColor>
$xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:related layout="card" target="browser" />', $xml);
$xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:logo>' . file::file_url($item->image) . '</webfeeds:logo>', $xml);
$xml = str_replace('<channel>', '<channel>' . "\n\t\t" . '<webfeeds:icon>' . file::file_url($website->favicon) . '</webfeeds:icon>', $xml);
}
return $xml;
}
示例12: array
$query = "\tSELECT a.`page_url`\n\t\t\t\t\t\t\t\t\t\tFROM `community_pages` AS a\n\t\t\t\t\t\t\t\t\t\tJOIN `communities_modules` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`module_shortname` = a.`page_type`\n\t\t\t\t\t\t\t\t\t\tWHERE b.`module_id` = " . $db->qstr($result["record_id"]) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($result["community_id"]) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`page_active` = '1'";
$page_url = $db->GetOne($query);
}
if ($result["history_key"]) {
$history_message = $translate->_($result["history_key"]);
$record_title = "";
$parent_id = 0;
community_history_record_title($result["history_key"], $result["record_id"], $result["cpage_id"], $result["community_id"]);
} else {
$history_message = $result["history_message"];
}
$content_search = array("%SITE_COMMUNITY_URL%", "%SYS_PROFILE_URL%", "%PAGE_URL%", "%RECORD_ID%", "%RECORD_TITLE%", "%PARENT_ID%");
$content_replace = array(COMMUNITY_URL . $community_url, ENTRADA_URL . "/people", $page_url, $result["record_id"], $record_title, $parent_id);
$history_message = str_replace($content_search, $content_replace, $history_message);
$item = new FeedItem();
$link = substr($history_message, stripos($history_message, "href=\"") + 6);
$link = substr($link, 0, stripos($link, "\""));
$item->link = (isset($link) && $link ? $link : COMMUNITY_URL . $community_url) . (strpos($link, "?") ? "&" : "?") . "auth=true";
$item->title = strip_tags(html_decode($history_message));
$item->date = (int) date("U", $result["history_timestamp"]);
$item->author = $result["email"] . " (" . $result["author_name"] . ")";
$item->description = strip_tags($history_message);
$item->descriptionHtmlSyndicated = true;
$rss->addItem($item);
}
}
header("Content-type: text/xml");
echo $rss->createFeed($rss_version);
break;
}
}
示例13: strtoupper
if (!isset($_GET['format']))
$_GET['format'] = 'ATOM';
$format = strtoupper($_GET['format']);
if (isset($results) && is_object($results) && $results->response->numFound > 0) {
foreach ($results->response->docs as $package) {
$description = $package->desclong;
if (empty($package->desclong))
$description = $package->descshort;
$date = $package->infofilechanged;
$date = rtrim($date, 'Z?');
$title = $distributions[$package->dist_id]->getDescription() . ": " . $package->pkg_id;
$title .= " (" . $package->descshort . ")";
$item = new FeedItem();
$item->title = $title;
$item->link = $url_root . "/package.php/" . $package->name . "?rel_id=" . $package->rel_id;
$item->description = $description;
$item->date = $date;
$item->source = $url_root . "/rss.php?" . get_query_params();
$item->author = $package->maintainer;
$rss->addItem($item);
}
}
echo $rss->createFeed($format);
?>
示例14: date
// In the case of RecentChanges.xml, we must unescape the url before giving it to FC
$item->date = date('r', strtotime($page['time']));
// RFC2822
$item->description = sprintf(T_("By %s"), $page['user']) . ($page['note'] ? ' (' . $page['note'] . ')' : '') . "\n";
$item->source = WIKKA_BASE_URL;
// @@@ JW: ^ should link to *actual* page not root
/*
http://dublincore.org/documents/1999/07/02/dces/
Element: Source
Name: Source
Identifier: Source
Definition: A Reference to a resource from which the present resource
is derived.
Comment: The present resource may be derived from the Source resource
in whole or in part. Recommended best practice is to reference
the resource by means of a string or number conforming to a
formal identification system.
*/
if (($f == 'ATOM1.0' || $f == 'RSS1.0') && $this->LoadUser($page['user'])) {
$item->author = $page['user'];
# RSS0.91 and RSS2.0 require authorEmail
}
$rss->addItem($item);
}
}
}
ob_end_clean();
//output feed
echo $rss->createFeed($f);
示例15: outputtorss
function outputtorss($code, $line = "10")
{
global $apps_path, $web_title;
include_once "{$apps_path['libs']}/gpl/feedcreator.class.php";
$code = strtoupper($code);
if (!$line) {
$line = "10";
}
$format_output = "RSS0.91";
$rss = new UniversalFeedCreator();
$db_query1 = "SELECT * FROM playsms_tblSMSIncoming WHERE in_code='{$code}' ORDER BY in_datetime DESC LIMIT 0,{$line}";
$db_result1 = dba_query($db_query1);
while ($db_row1 = dba_fetch_array($db_result1)) {
$title = $db_row1[in_masked];
$description = $db_row1[in_msg];
$datetime = $db_row1[in_datetime];
$items = new FeedItem();
$items->title = $title;
$items->description = $description;
$items->comments = $datetime;
$items->date = strtotime($datetime);
$rss->addItem($items);
}
$feeds = $rss->createFeed($format_output);
return $feeds;
}