本文整理汇总了PHP中UniversalFeedCreator::saveFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP UniversalFeedCreator::saveFeed方法的具体用法?PHP UniversalFeedCreator::saveFeed怎么用?PHP UniversalFeedCreator::saveFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniversalFeedCreator
的用法示例。
在下文中一共展示了UniversalFeedCreator::saveFeed方法的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: 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");
}
示例4: 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');
}
示例5: 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);
}
示例6: 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);
}
示例7: getTeamNameForId
$losepoints = $data->losepoints;
if (strlen($loser2) > 0) {
$loserdisplay = $loser . "/" . $loser2;
$losepoints2 = $data->losepoints2;
$losepointsdisplay = $losepoints . "/" . $losepoints2;
} else {
$loserdisplay = $loser;
$losepointsdisplay = $losepoints;
}
$titleRSS = "Game :: " . $winnerdisplay . " " . $data->winnerresult . " - " . $data->loserresult . " " . $loserdisplay;
$winnerteam = getTeamNameForId($data->winnerteam);
if (empty($winnerteam)) {
$winnerteam = "Not specified";
}
$loserteam = getTeamNameForId($data->loserteam);
if (empty($loserteam)) {
$loserteam = "Not specified";
}
$ladder = getLadderForVersion($data->version);
$description = "[" . $ladder . "] [" . $winabb . "] (+" . $data->winpoints . ") " . $winnerdisplay . " " . $data->winnerresult . " - " . $data->loserresult . " " . $loserdisplay . " (-" . $data->losepoints . ") [" . $loseabb . "] - " . $data->comment . "";
$item = new FeedItem();
$item->title = $titleRSS;
$item->link = $directory . "/games.php#" . $data->game_id;
$item->description = $description;
$item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
$item->source = "http://www.yoursite";
$item->author = "yoursite";
$rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed_irc_games.xml");
示例8: getTeamNameForId
$losepoints = $data->losepoints;
if (strlen($loser2) > 0) {
$loserdisplay = $loser . "/" . $loser2;
$losepoints2 = $data->losepoints2;
$losepointsdisplay = $losepoints . "/" . $losepoints2;
} else {
$loserdisplay = $loser;
$losepointsdisplay = $losepoints;
}
$titleRSS = "Game :: " . $winnerdisplay . " " . $data->winnerresult . " - " . $data->loserresult . " " . $loserdisplay;
$winnerteam = getTeamNameForId($data->winnerteam);
if (empty($winnerteam)) {
$winnerteam = "Not specified";
}
$loserteam = getTeamNameForId($data->loserteam);
if (empty($loserteam)) {
$loserteam = "Not specified";
}
$ladder = getLadderForVersion($data->version);
$description = "(+" . $data->winpoints . ") " . $winnerdisplay . " (" . $winabb . ") " . $data->winnerresult . " - " . $data->loserresult . " (" . $loseabb . ") " . $loserdisplay . " (-" . $data->losepoints . ") - " . $data->comment . "";
$item = new FeedItem();
$item->title = $titleRSS;
$item->link = $directory . "/games.php#" . $data->game_id;
$item->description = $description;
$item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
$item->source = "http://www.yoursite";
$item->author = "Ike";
$rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed_test.xml");
示例9: MangleDate
$date_number = mktime($hour, $minute, $second, $month, $day, $year);
// Add a channel item to the RSS feed.
$item = new FeedItem();
$item->title = $heading . " Building Permit Summary";
$item->link = "http://www.city.charlottetown.pe.ca/" . $url;
$item->description = "<a href=\"http://www.city.charlottetown.pe.ca/{$url}\">{$heading} Building Permit Summary</a>";
$item->date = strftime("%Y-%m-%dT%H:%M:%S%z", $date_number);
$item->source = "http://www.city.charlottetown.pe.ca/residents/application_fees.cfm";
$item->guid = "http://www.city.charlottetown.pe.ca/" . $url;
$item->addEnclosure("http://www.city.charlottetown.pe.ca/" . $url, $filesize, "text/pdf");
$item->author = "peter@rukavina.net (Peter Rukavina)";
$rss->addItem($item);
$currentrecord++;
}
// Save the RSS feed. This should be a web-accessible location.
$rss->saveFeed("RSS2.0", $rssfile, FALSE);
/**
* Parse apart the part of the filename that contains the date, and make it standard.
* There is inconsistency in the date format used in URLs. Examples of formats used:
*
* May 28 05
* August 27 2005
* Feb 4 2006
*
* The format is always Month - space - day - space - year, but the month can
* be abbreviated or spelled out in full, and the year can be two- or four-digit.
*/
function MangleDate($target)
{
print $target . "\n";
$target = str_replace("-08", ", 2008", $target);
示例10: noHTML
$item->authorEmail = $row->authorEmail;
}
//If needed, trigger content plugins on the row content.
//TODO - expand this to allow for individual paramters for the plugin instances
$dispatcher->trigger('onPrepareNinjaRSSFeedRow', array(&$item));
$rss->addItem($item);
}
//If needed, trigger content plugins on the feed as a whole.
//TODO - expand this to allow for individual paramters for the plugin instances
$dispatcher->trigger('onPrepareNinjaRSSFeed', array(&$rss));
ob_end_clean();
ob_start();
//If we are using the cache and the time out is greater than 0, then generate and use a file.
//Otherwise generate the feed on the fly
if (intval($docache) == 1 && $this->cache > 0) {
$rss->saveFeed($this->type, $filename, true);
} else {
$rss->outputFeed($this->type);
}
function noHTML($words)
{
$words = preg_replace("'<script[^>]*>.*?</script>'si", "", $words);
$words = preg_replace('/<a\\s+.*?href="([^"]+)"[^>]*>([^<]+)<\\/a>/is', '\\2 (\\1)', $words);
$words = preg_replace('/<!--.+?-->/', '', $words);
//$words = preg_replace('/{.+?}/','',$words);
$words = strip_tags($words);
$words = preg_replace('/ /', ' ', $words);
//$words = preg_replace('/&/','&',$words);
//$words = preg_replace('/"/','"',$words);
return $words;
}
示例11: generateRss
protected function generateRss($key, $items, $title, $nopre = false)
{
// This is not a layout page
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
// Set the timezone to the user timezone
$timezone = $this->_properties->getProperty('timezone');
date_default_timezone_set($timezone);
// Get a few user preferences
$config = Zend_Registry::get("configuration");
$root = Zend_Registry::get("root");
$host = $this->getHostname();
$preamble = $nopre ? false : $this->_properties->getProperty('preamble', true);
$username = $this->_user->username;
// Get the domain right
$domain = Zend_Registry::get("host");
// Get the cache path for feeds
if (isset($config->path->feeds)) {
$path = $config->path->feeds;
} else {
$path = dirname($root) . "/feeds/";
}
// Render the RSS feed
// Go ahead and display the page
$rss = new UniversalFeedCreator();
$rss->encoding = "UTF-8";
// Get the cached object
$rss_key = "RSS_" . $username . "_" . md5($key);
$rss->useCached("RSS2.0", $path . "/{$rss_key}.xml", 300);
// use cached version if age<10 minutes
// Get all the items and build rss
$rss->title = $title;
$rss->descriptionTruncSize = 0;
$rss->descriptionHtmlSyndicated = true;
$rss->link = "http://{$domain}";
if (isset($items) && is_array($items)) {
for ($i = 0; $i < count($items); $i++) {
$item = $items[$i];
$source_id = $item->getSource();
$item_id = $item->getID();
$type = $item->getType();
$slug = $item->getSlug();
$title = $item->getTitle();
$pream = $preamble ? $item->getPreamble() : "";
$entry = new FeedItem();
$entry->guid = "/entry/{$source_id}/{$item_id}";
$entry->title = $pream . ($title ? $title : "Untitled");
$entry->link = "http://{$domain}/entry/{$slug}";
$entry->description = $item->getRssBody();
$entry->descriptionHtmlSyndicated = true;
$entry->source = $item->getLink();
$entry->descriptionTruncSize = 0;
$entry->date = (int) $item->getTimestamp();
$entry->author = $username;
if ($type == SourceItem::AUDIO_TYPE) {
$enclosure = array();
$enclosure['url'] = $item->getAudioUrl();
$enclosure['type'] = "audio/mpeg";
$entry->enclosure = $enclosure;
}
$rss->addItem($entry);
}
}
$rss->saveFeed("RSS2.0", $path . "/{$rss_key}.xml");
}
示例12: make_rss
/**
* Genera el RSS.XML con una clase bajada de internet,
* ya voy a mejorar eso, pero por ahora NO.
*
* @return string
*/
function make_rss()
{
global $db, $preferences;
$rss = new UniversalFeedCreator();
$rss->useCached();
// use cached version if age < 1 hour
$rss->title = preg_replace("/(\\<)(.*?)(\\>)/mi", "", $preferences['site_name']);
$rss->description = $preferences['site_description'];
$rss->link = $preferences['site_url'];
$rss->syndicationURL = $preferences['site_url'] . '/rss.xml';
list($data) = get_posts();
foreach ($data as $key => $value) {
$item = new FeedItem();
$item->title = preg_replace("/(\\<)(.*?)(\\>)/mi", "", $value['title']);
$item->link = $preferences['site_url'] . '/?id_posts=' . $value['id_posts'];
$item->description = $value['content'];
$item->date = $value['date'];
$item->source = $preferences['site_url'];
$item->author = $value['user'];
$rss->addItem($item);
}
return $rss->saveFeed("RSS1.0", "../rss.xml", false);
}
示例13: split
// limits description text to x words
$item_description_array = split(' ', $item_description);
$count = count($item_description_array);
if ($count > $info['text_length']) {
$item_description = '';
for ($a = 0; $a < $info['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->date =
$item->source = $info['link'];
$item->author = $row->author;
// loads item info into rss array
$rss->addItem($item);
}
// save feed file
$rss->saveFeed($info['feed '], $info['file '], true);
示例14: Settings
uses("setting");
$setting = new Settings();
include_once PHPB2B_ROOT . 'libraries/feedcreator.class.php';
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $_PB_CACHE['setting']['site_name'];
$rss->description = $setting->getValue("site_description");
$rss->link = URL;
$rss->syndicationURL = URL . "rss.php";
//announce
$announce = $pdb->GetArray("SELECT * FROM {$tb_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 = URL . "announce.php?id=" . $val['id'];
$item->description = $val['message'];
$item->date = $val['created'];
$item->source = URL . "announce.php?id=" . $val['id'];
$item->author = $_PB_CACHE['setting']['company_name'];
$rss->addItem($item);
}
}
$image = new FeedImage();
$image->title = $_PB_CACHE['setting']['site_banner_word'];
$image->url = URL . "images/logo.gif";
$image->link = URL;
$image->description = $rss->description;
$rss->image = $image;
$rss->saveFeed("RSS1.0", "data/appcache/rss.xml");
示例15: getTeamNameForId
$losepoints = $data->losepoints;
if (strlen($loser2) > 0) {
$loserdisplay = $loser . "/" . $loser2;
$losepoints2 = $data->losepoints2;
$losepointsdisplay = $losepoints . "/" . $losepoints2;
} else {
$loserdisplay = $loser;
$losepointsdisplay = $losepoints;
}
$titleRSS = "Game :: " . $winnerdisplay . " " . $data->winnerresult . " - " . $data->loserresult . " " . $loserdisplay;
$winnerteam = getTeamNameForId($data->winnerteam);
if (empty($winnerteam)) {
$winnerteam = "Not specified";
}
$loserteam = getTeamNameForId($data->loserteam);
if (empty($loserteam)) {
$loserteam = "Not specified";
}
$ladder = getLadderForVersion($data->version);
$description = "<p>Game played: " . date("m/d/Y h:i a", $data->date) . $br . "Ladder: " . $ladder . "</p>" . "<p>" . $winnerdisplay . " team: " . $winnerteam . " (won " . $data->winpoints . " points)" . $br . $loserdisplay . " team: " . $loserteam . " (lost " . $losepointsdisplay . " points)</p>" . "<p>" . $data->winner . "'s comment: " . $br . $data->comment . "</p>";
$item = new FeedItem();
$item->title = $titleRSS;
$item->link = $directory . "/games.php#" . $data->game_id;
$item->description = $description;
$item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
$item->source = "http://www.yoursite";
$item->author = "yoursite";
$rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed.xml");