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"); }
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; }
/** * 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); } }
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; }
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); }
/** * 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; } }
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"); }
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'); }
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); }
/** * 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'); }
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); }
|-------------------------------------------------------------------------- | 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'])) {
<?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'];
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); }
$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 = '';
$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'];
<?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;
function generate_feed($feed, $uniqueid, $rss_version, $changes, $itemurl, $urlparam, $id, $title, $titleId, $desc, $descId, $dateId, $authorId) { global $tikiIndex; global $userslib; if ($rss_version == '') { // override version if set as request parameter if (isset($_REQUEST["ver"])) { $ver = $_REQUEST["ver"]; $rss_version = $this->get_rss_version($ver); } else { $rss_version = 9; // default to RSS 0.91 } } else { $rss_version = $this->get_rss_version($rss_version); } $now = date("U"); $output = $this->get_from_cache($uniqueid, $rss_version); if ($output != "EMPTY") { return $output; } $urlarray = parse_url($_SERVER["REQUEST_URI"]); /* this gets the correct directory name aka dirname when tikiwiki is on the main directory, i mean when ur site is www.yoursite.com, the dirname of your site is "/" and when tikiwiki is not on main directory, i mean www.yoursite.com/tiki, the dirname returns "/tiki". so, on URLs, we just need to add a extra slash when the tikiwiki isnt on the main directory, what means, dirname($urlarray["path"]) equals to "/tiki", otherwise we can ommit them. This is a quick hack to solve the infamous double-slash problem, which was introduced somewhen after 1.9.0 release http://dev.tikiwiki.org/tiki-view_tracker_item.php?trackerId=5&itemId=291 */ $dirname = dirname($urlarray["path"]) != "/" ? "/" : ""; $url = htmlspecialchars($this->httpPrefix() . $_SERVER["REQUEST_URI"]); $home = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $tikiIndex); $img = htmlspecialchars($this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "img/tiki.jpg"); $title = htmlspecialchars($title); $desc = htmlspecialchars($desc); $read = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . $itemurl; // different stylesheets for atom and rss $cssStyleSheet = ""; $xslStyleSheet = ""; $encoding = "ISO-8859-1"; $encoding = "UTF-8"; $contenttype = "application/xml"; // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS // valid format ids : 9 , 1 , 2 , 3 , 4 , 6 , 5 , 7 , 8 switch ($rss_version) { case "1": // RSS 1.0 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css"; break; case "2": // RSS 2.0 $cssStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss-style.css"; $xslStyleSheet = $this->httpPrefix() . dirname($urlarray["path"]) . $dirname . "lib/rss/rss20.xsl"; break; case "3": // PIE 0.1 break; case "4": // MBOX $contenttype = "text/plain"; break; case "5": // 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; }
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; }
support. <enclosure> support is useful if you are into podcasting or publishing photoblog. the required parameter for enclosure is url, length and type (as in MIME-type) */ <?php include "include/feedcreator.class.php"; //define channel $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = "Personal News Site"; $rss->description = "daily news from me"; $rss->link = "http://mydomain.net/"; $rss->syndicationURL = "http://mydomain.net/{$PHP_SELF}"; //channel items/entries $item = new FeedItem(); $item->title = "test berita pertama"; $item->link = "http://mydomain.net/news/somelinks.html"; $item->description = "hahaha aku berjaya!"; $item->source = "http://mydomain.net"; $item->author = "*****@*****.**"; //optional enclosure support $item->enclosure = new EnclosureItem(); $item->enclosure->url = 'http://mydomain.net/news/picture.jpg';
exit; } } if (!isset($_SERVER["PHP_AUTH_USER"]) or !OCP\User::checkPassword($uid = $_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { 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
<?php require '../variables.php'; require '../variablesdb.php'; require '../functions.php'; include "feedcreator.class.php"; $br = "<br />"; $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = $leaguename . ".com Games"; $rss->description = "The latest games from {$leaguename}!"; $rss->link = $directory; $rss->syndicationURL = $directory . $PHP_SELF; $sql = "SELECT g.*, t.abbreviation as winabb, u.abbreviation as loseabb FROM {$gamestable} g " . "left join {$teamstable} t on g.winnerteam = t.id " . "left join {$teamstable} u on g.loserteam = u.id " . "where g.deleted='no' ORDER BY g.game_id DESC LIMIT 0,20"; $res = mysql_query($sql); while ($data = mysql_fetch_object($res)) { $winner = $data->winner; $winner2 = $data->winner2; $winabb = $data->winabb; $loseabb = $data->loseabb; if (strlen($winner2) > 0) { $winnerdisplay = $winner . "/" . $winner2; } else { $winnerdisplay = $winner; } $loser = $data->loser; $loser2 = $data->loser2; $losepoints = $data->losepoints; if (strlen($loser2) > 0) { $loserdisplay = $loser . "/" . $loser2; $losepoints2 = $data->losepoints2;
$html = stream_get_contents($handle); fclose($handle); // Instantiate the handler $handler = new MyHandler(); // Instantiate the parser $parser =& new XML_HTMLSax(); // Register the handler with the parser $parser->set_object($handler); // Set a parser option $parser->set_option('XML_OPTION_TRIM_DATA_NODES'); // Set the handlers $parser->set_element_handler('openHandler', 'closeHandler'); // Parse the document $parser->parse($html); // Begin creation of the RSS feed. $rss = new UniversalFeedCreator(); $rss->title = $blogtitle; $rss->description = $blogexp; $rss->link = $blogurl; $rss->syndicationURL = $blogrss; $rss->copyright = strftime("%Y") . " " . $blogauthor; // Grab the most recent 100 of the cached URLs (i.e. building permit summaries) from the MySQL table. $query = "SELECT url,heading,dateadded,filesize from permitcache order by dateadded DESC limit 10"; $result = MYSQL_QUERY($query); $howmanyrecords = MYSQL_NUMROWS($result); $currentrecord = 0; while ($currentrecord < $howmanyrecords) { $url = mysql_result($result, $currentrecord, "url"); $heading = mysql_result($result, $currentrecord, "heading"); $dateadded = mysql_result($result, $currentrecord, "dateadded"); $filesize = mysql_result($result, $currentrecord, "filesize");
$feedid = $this->id; $docache = intval($this->cache) > 0 ? 1 : 0; //add_stats($lists); /*<< MAD 2007/09/28 */ //Oct 24 2008 //if type is Summaries then get numwords from db $numWords = $this->numWords > 0 ? $this->numWords : 10000; // numWord == 0 represents ALL /*if type is RSS then use admin defined default if (($this->type=="RSS") || ($this->type=="RSSSUMM")) { //$this->type = "RSS".$row->defaultType; $this->type = "RSS2.0";// TO-DO } */ //make a feed id based filename $filename = JPATH_COMPONENT . DS . "feed" . DS . "feed" . $feedid . ".xml"; $rss = new UniversalFeedCreator(); //Use cache if docache is set to 1 if (intval($docache) == 1) { $rss->useCached($this->type, $filename, $this->cache); // use cached version if age<1 hour. May not return! } //$rss->title = htmlspecialchars($this->title, ENT_QUOTES); $rss->title = $this->title; $rss->description = $this->description; $rss->link = JURI::root(); $u = JFactory::getURI(); $rss->syndicationURL = $u->toString(); $rss->descriptionHtmlSyndicated = true; $image = new FeedImage(); $image->title = $mainframe->getCfg('sitename'); $image->url = $this->imgUrl;
/** * 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); }
Loader::model("collection_types"); $ct = Collection::getByID($cat); //$a=$ct->getAttribute('easynews_section'); //if(empty($a)||(!$a)){ // die(); //} $cvID = CollectionVersion::getNumericalVersionID($ct->getCollectionID(), 'ACTIVE'); $vObj = CollectionVersion::get($ct, $cvID); $newsList = new PageList(); $newsList->filterByParentID($cat); $newsList->sortBy('cvDatePublic', 'desc'); $newsPage = $newsList->getPage(); //Start creation Loader::library('3rdparty/feedcreator/include/feedcreator.class', $pkgHandle); //define channel $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = SITE . ' - ' . $vObj->cvName; $rss->description = $vObj->cvName . ' updates'; $rss->link = SITE_URL; $rss->syndicationURL = EasyNewsController::getRssPagePath() . '?c=' . $cat; //channel items/entries foreach ($newsPage as $page) { $item = new FeedItem(); $item->title = $page->getCollectionName(); $item->link = BASE_URL . Loader::helper('navigation')->getLinkToCollection($page); $item->description = $page->getCollectionDescription(); $item->source = BASE_URL; $user = UserInfo::getByID($page->getCollectionUserID()); $item->author = $user->getUserName(); $item->date = date('r', strtotime($page->getCollectionDatePublic()));
/** * 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); }
break; case "staff": $rss_feed_name = "Staff Feed"; $notice_where_clause = "(a.`target` = 'all' OR a.`target` = 'staff')"; break; case "student": default: $rss_feed_name = "Student Feed" . ((int) $TARGET ? ", Class of " . $TARGET : ""); $notice_where_clause = "(" . ((int) $TARGET ? "a.`target`=" . $db->qstr($TARGET) . " OR " : "") . "a.`target` = 'all' OR a.`target` = 'students')"; break; } if (isset($_GET["o"]) && ($sanitized = clean_input($_GET["o"], array("int")))) { $ORGANISATION = $sanitized; $notice_where_clause .= 'AND (a.`organisation_id` IS NULL OR a.`organisation_id` = ' . $ORGANISATION . ')'; } $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = "Undergrad Notices: " . $rss_feed_name; $rss->description = "Announcements, Schedule Changes, Updates and more from the Undergraduate Medicial Education Office, Queen's University."; $rss->link = ENTRADA_URL . "/dashboard"; $rss->syndicationURL = ENTRADA_URL . "/notices/" . $TARGET; $query = "\n\t\tSELECT a.*\n\t\tFROM `notices` AS a\n\t\tWHERE " . ($notice_where_clause ? $notice_where_clause . " AND" : "") . "\n\t\t(a.`display_from`='0' OR a.`display_from` <= '" . time() . "')\n\t\tORDER BY a.`updated_date` DESC, a.`display_from` DESC"; $results = USE_CACHE ? $db->CacheGetAll(CACHE_TIMEOUT, $query) : $db->GetAll($query); if ($results) { foreach ($results as $result) { $item = new FeedItem(); $item->title = $result["notice_summary"]; $item->link = ENTRADA_URL . "/dashboard"; $item->description = $result["notice_summary"]; $item->date = unixstamp_to_iso8601((int) $result["display_from"] ? $result["display_from"] : time()); $item->source = ENTRADA_URL . "/dashboard";
if (!empty($_GET['format']) && in_array($_GET['format'], $valid_formats)) { $format = $_GET['format']; } if ($format == 'KML') { if (!isset($_GET['simple'])) { $_GET['simple'] = 1; } //default to on $extension = empty($_GET['simple']) ? 'kml' : 'simple.kml'; } elseif ($format == 'GPX') { $extension = 'gpx'; } else { $extension = 'xml'; } $rssfile = $_SERVER['DOCUMENT_ROOT'] . "/rss/events-{$format}-" . empty($_GET['admin']) . ".{$extension}"; $rss = new UniversalFeedCreator(); if (empty($_GET['refresh'])) { $rss->useCached($format, $rssfile); } $rss->title = 'Geograph Events'; $rss->link = "http://{$_SERVER['HTTP_HOST']}/article/"; $rss->description = "Upcoming Geograph British Isles Events"; if (empty($_GET['admin'])) { $isadmin = 0; $rss->syndicationURL = "http://{$_SERVER['HTTP_HOST']}/events/syndicator.php?format={$format}"; } else { $isadmin = 1; $rss->title = 'Geograph Pending Articles'; $rss->syndicationURL = "http://{$_SERVER['HTTP_HOST']}/article/syndicator.php?format={$format}&admin=1"; } if ($format == 'KML' || $format == 'GeoRSS' || $format == 'GPX') {