本文整理汇总了PHP中UniversalFeedCreator类的典型用法代码示例。如果您正苦于以下问题:PHP UniversalFeedCreator类的具体用法?PHP UniversalFeedCreator怎么用?PHP UniversalFeedCreator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UniversalFeedCreator类的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: generate
/**
* Generate the feed fully populated. Defaults to RSS2.0
*
*
* @param string $f Optional. Name of file to save feed to
* @param string $type Optional. Which type of feed to generate. Supported are RSS2.0, RSS1.0, RSS0.92, ATOM1.0, ATOM03
* @return mixed If a filename is passed, then nothing is returned, otherwise an XML datastream
*/
function generate($type = null, $f = null)
{
include_once '3rdparty/feedcreator/feedcreator.class.php';
$ft = $type;
$feed = new UniversalFeedCreator();
$feed->UseCached();
$feed->title = C_BLOGNAME;
$feed->description = C_BLOG_DESCRIPTION;
$feed->link = BLOGURL;
$feed->syndicationURL = BLOGURL . basename($_SERVER['SCRIPT_NAME']);
$posts = $this->_ph->get_posts(array('order' => 'ORDER BY posts.posttime DESC', 'num' => 20));
foreach ($posts as $post) {
$item = new FeedItem();
$item->title = $post['title'];
$item->link = $post['permalink'];
$item->guid = $post['permalink'];
$item->description = $post['body'];
$item->source = $feed->link;
$item->author = $post['author']['fullname'];
$item->authorEmail = $post['author']['email'];
$feed->additem($item);
}
if (!is_null($f)) {
if (file_exists($f) && is_writable($f)) {
$feed->savefeed($ft, $f);
}
//right here we need to generate and catch an error
} else {
$feed->outputfeed($ft);
}
}
示例4: 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;
}
示例5: 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);
}
示例6: 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");
}
示例7: 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');
}
示例8: create_xml
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);
}
示例9: 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);
}
示例10: str_replace
|--------------------------------------------------------------------------
| Return
|--------------------------------------------------------------------------
|
*/
$link = str_replace('inc/rss.php', '', get_current_url(true));
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
switch ($format) {
case 'ATOM':
case 'RSS':
require 'classes/Feedcreator.php';
define('TIME_ZONE', $tz);
define('FEEDCREATOR_VERSION', 'Pimp My Log v' . get_current_pml_version());
$rss = new UniversalFeedCreator();
$rss->title = sprintf(__("Pimp My Log : %s"), $files[$file_id]['display']);
$rss->description = empty($search) ? sprintf(__("Pimp logs for file %s"), $files[$file_id]['path']) : sprintf(__("Pimp logs for file %s with search %s"), $files[$file_id]['path'], $search);
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;
$rss->link = $link;
$rss->syndicationURL = get_current_url(true);
$image = new FeedImage();
$image->title = $rss->title;
$image->url = str_replace('inc/rss.php', 'img/icon72.png', get_current_url());
$image->link = $link;
$image->description = __("Feed provided by Pimp My Log");
$image->descriptionTruncSize = 500;
$image->descriptionHtmlSyndicated = true;
$rss->image = $image;
if (isset($logs['logs']) && is_array($logs['logs'])) {
示例11: UniversalFeedCreator
<?php
// RSSサンプル
$rss = new UniversalFeedCreator();
$rss->useCached();
//システム情報の取得
$system_config_keyword_value = $request->getAttribute('system_config_keyword_value');
$rss->title = $system_config_keyword_value['SYSTEM_NAME'];
$rss->description = $system_config_keyword_value['SYSTEM_OUTLINE'];
$rss->link = $system_config_keyword_value['SYSTEM_BASE_URL'];
$rss->syndicationURL = $request->getAttribute('rss_syndicationURL');
$image = new FeedImage();
$image->title = $system_config_keyword_value['SYSTEM_IMAGE']['title'];
$image->url = $system_config_keyword_value['SYSTEM_IMAGE']['url'];
$image->link = $system_config_keyword_value['SYSTEM_IMAGE']['link'];
$image->description = $system_config_keyword_value['SYSTEM_IMAGE']['description'];
$rss->image = $image;
// get news items from somewhere:
$bbs_rss_array = $request->getAttribute('bbs_rss_array');
$system_top_address = $request->getAttribute('system_top_address');
$rss_display_max_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D06'), 'RSS_DISPLAY_MAX_COUNT');
$rss_count = 0;
foreach ($bbs_rss_array as $index => $data) {
// CRLF → LF
$body = preg_replace('/\\r\\n/', "\n", $data['body']);
$item = new FeedItem();
$item->post_date = $data['post_date'];
$item->title = $data['community_id_name'] . "::" . $data['subject'];
$item->link = $system_top_address . $data['bbs_url'];
$item->description = $body;
$item->image_link = $data['file_url'];
示例12: decks
function decks()
{
$criteria = $_GET['show'];
if (!isset($criteria)) {
die("error in receiving feed criteria!");
}
$feed_type = $_GET['output'];
if (!isset($feed_type)) {
$feed_type = "RSS1.0";
}
$deckList = new DeckList();
switch ($criteria) {
case "new":
$title = "SlideWiki -- New Presentations";
$description = "list of new presentations";
$link = "http://slidewiki.org/search/order/date";
$syndicationURL = "http://slidewiki.org/feed/decks/new";
$decks = $deckList->getAllDecks(15);
break;
case "popular":
$title = "SlideWiki -- Popular Presentations";
$description = "list of popular presentations";
$link = "http://slidewiki.org/search/order/popularity";
$syndicationURL = "http://slidewiki.org/feed/decks/popular";
$decks = $deckList->getAllPopular(15);
break;
case "featured":
$title = "SlideWiki -- Featured Presentations";
$description = "list of featured presentations";
$link = "http://slidewiki.org/search/order/featured";
$syndicationURL = "http://slidewiki.org/feed/decks/featured";
$decks = $deckList->getAllFeatured(15);
break;
}
//define channel
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $title;
$rss->description = $description;
$rss->link = $link;
$rss->syndicationURL = $syndicationURL;
//channel items/entries
foreach ($decks as $deck) {
$item = new FeedItem();
$item->title = $deck->title;
$item->link = "http://slidewiki.org/deck/" . $deck->id . '_' . $deck->slug_title;
$item->description = $deck->abstract;
$item->source = "http://slidewiki.org/";
$item->date = strtotime($deck->revisionTime);
$item->author = $deck->owner->username;
$rss->addItem($item);
}
//Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS
$rss->outputFeed($feed_type);
}
示例13: explode
$feed = explode("|", $feed);
$feed = array_map('trim', $feed);
$f[$feed[0]] = array('class' => $feed[0], 'file' => $feed[1], 'name' => $feed[2], 'active' => $feed[3], 'header' => $feed[4]);
}
if (!isset($f[$action])) {
$t = current($f);
$action = $t['class'];
}
$format = $f[$action];
if ($format['header'] == 1) {
$h = false;
} else {
$h = true;
}
// Header of feeds
$rss = new UniversalFeedCreator();
$rss->encoding = 'UTF-8';
$rss->setDir("feeds/topics_");
$rss->useCached($action, '', $h);
$rss->title = $config['fname'];
$rss->description = $config['fdesc'];
$rss->link = $config['furl'] . "/forum.php";
$rss->language = $lang->phrase('rss_language');
$rss->ttl = $config['rssttl'];
$rss->copyright = $config['fname'];
$rss->lastBuildDate = time();
$rss->editor = $config['fname'];
if ($config['syndication_insert_email'] == 1) {
$rss->editorEmail = $config['forenmail'];
} else {
$rss->editorEmail = '';
示例14: UniversalFeedCreator
$info['cache_time'] = $params->def('cache_time', 3600);
$info['count'] = $params->def('count', 5);
$info['orderby'] = $params->def('orderby', '');
$info['title'] = $params->def('title', 'Powered by Mambo 4.5.1');
$info['description'] = $params->def('description', 'Mambo site syndication');
$info['image_file'] = $params->def('image_file', 'mambo_rss.png');
if ($info['image_file'] == -1) {
$info['image'] = NULL;
} else {
$info['image'] = $mosConfig_live_site . '/images/M_images/' . $info['image_file'];
}
$info['image_alt'] = $params->def('image_alt', 'Powered by Mambo 4.5.1');
$info['limit_text'] = $params->def('limit_text', 1);
$info['text_length'] = $params->def('text_length', 20);
// load feed creator class
$rss = new UniversalFeedCreator();
// load image creator class
$image = new FeedImage();
// get feedtype from url
$info['feed '] = mosGetParam($_GET, 'feed', 'RSS2.0');
// set filename for feed
$info['file '] = strtolower(str_replace('.', '', $info['feed ']));
$info['file '] = $GLOBALS['mosConfig_absolute_path'] . '/cache/' . $info['file '] . '.xml';
// loads cache file
if ($info['cache']) {
$rss->useCached($info['feed '], $info['file '], $info['cache_time']);
}
$rss->title = $info['title'];
$rss->description = $info['description'];
$rss->link = $info['link'];
$rss->syndicationURL = $info['link'];
示例15: UniversalFeedCreator
<?php
require "init.php";
include "./include/class.rss.php";
$rss = new UniversalFeedCreator();
$rss->useCached();
$action = getArrayVal($_GET, "action");
$user = getArrayVal($_GET, "user");
$project = getArrayVal($_GET, "project");
$username = $_SESSION["username"];
error_reporting(0);
if (!empty($settings["rssuser"]) and !empty($settings["rsspass"])) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Collabtive"');
header('HTTP/1.0 401 Unauthorized');
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "{$errtxt}<br>{$noperm}");
$template->display("error.tpl");
die;
}
$authuser = $_SERVER['PHP_AUTH_USER'];
$authpw = $_SERVER['PHP_AUTH_PW'];
if ($authuser != $settings["rssuser"] or $authpw != $settings["rsspass"]) {
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "{$errtxt}<br>{$noperm}");
$template->display("error.tpl");
die;