本文整理汇总了PHP中fetch_rss函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_rss函数的具体用法?PHP fetch_rss怎么用?PHP fetch_rss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_rss函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: theme_updates
function theme_updates()
{
global $newversion, $version, $themename, $shortname;
// Get latest version
// Use MagpieRSS
require_once ABSPATH . WPINC . '/rss.php';
// Feed where updates are located
$rss = fetch_rss('http://www.photocrati.com/theme-updates/photocrati-updates-v' . $version . '.xml');
if ($rss) {
//loop through the latest rss items
foreach ($rss->items as $item) {
// Do our shornames match up?
if ($item['shortname'] == $shortname) {
$newversion = $item['version'];
}
}
}
if ($newversion > $version) {
echo '<input type="hidden" name="theme-version" value="' . $newversion . '">';
echo '<input type="hidden" name="theme-name" value="photocrati-theme">';
echo '<p><div class="submit-button-wrapper"><input type="button" id="update-theme" value="» Get Update Now" style="clear:none;background:#0F7C11;color:#FFF;" /></div>';
echo '<div id="loader" style="float:left;display:none;margin-top:7px;"><img src="' . get_template_directory_uri() . '/admin/images/ajax-loader.gif"></div><div id="msg" style="float:left;"></div></p>';
} else {
echo '<p>There are no updates to this theme available at this time.</p>';
}
}
开发者ID:nicoladj77,项目名称:code-veronica,代码行数:26,代码来源:get-updates.php
示例2: widget
function widget($args = array()) {
$show = get_option('show_yoast_widget');
if ($show != 'noshow') {
if (is_array($args))
extract( $args, EXTR_SKIP );
echo $before_widget.$before_title.$widget_name.$after_title;
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss('http://feeds.feedburner.com/viadat');
if ($rss) {
$items = array_slice($rss->items, 0, 4);
}
?>
<?php if (empty($items)) { echo '<li>No items</li>'; }
else {
echo '<div class="rss-widget"><ul>';
//<!--div style="float:right"><a href="http://www.viadat.com/"><img style="margin: 0 0 5px 5px;" src="http://www.viadat.com/images/viadat_emblem_white.jpg" alt="Viadat Creations"/></a></div-->
foreach ( $items as $item ) : ?>
<li><a class="rsswidget" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a> <span class="rss-date"><?php echo date('F j, Y',strtotime($item['pubdate'])); ?></span><!--br/><br/-->
<!--p><?php //$item['description'] /*echo substr($item['description'],0,strpos($item['description'], "This is a post from"))*/; ?></p--></li>
<?php endforeach;
print "</ul></div>";
}
echo $after_widget;
}
}
开发者ID:robbiespire,项目名称:paQui,代码行数:26,代码来源:via-latest.php
示例3: OW_liste_rss
function OW_liste_rss($maxbillets = 10)
{
global $db;
$rssman = new rssManager($db);
$urls = $rssman->getUrlList();
$billets = array();
foreach ($urls as $url) {
$rss = fetch_rss($url['uti_rss']);
if ($rss) {
foreach ($rss->items as $item) {
$item['channel_title'] = $rss->channel['title'];
$item['channel_link'] = $rss->channel['link'];
$item['ow_auteur'] = $url['uti_prenom'] . ' ' . $url['uti_nom'];
$billets[] = $item;
}
}
}
if (count($billets)) {
usort($billets, "cmpBillets");
echo '<ul>';
$i = 0;
foreach ($billets as $billet) {
echo '<li><a href="', $billet['link'], '">', htmlspecialchars($billet['title']), '</a> ';
echo 'sur ', htmlspecialchars($billet['channel_title']);
echo ' le ', date('d-m-Y H:i:s', $billet['date_timestamp']);
echo '</li>';
if (++$i > $maxbillets) {
break;
}
}
echo '</ul>';
} else {
echo '<p>Pas de billets pour le moment.</p>';
}
}
开发者ID:BackupTheBerlios,项目名称:openweb-cms-svn,代码行数:35,代码来源:html_agreg_rss.inc.php
示例4: magpienav
function magpienav($url, $num_items = NULL, $title = NULL, $html1 = NULL, $html2 = NULL, $html3 = NULL, $html4 = NULL, $html5 = NULL, $format = NULL)
{
define('MAGPIE_DIR', 'FeedOnFeeds/magpierss/');
require_once MAGPIE_DIR . 'rss_fetch.inc';
$error_level_tmp = error_reporting();
error_reporting(E_ERROR);
$rss = fetch_rss($url);
error_reporting($error_level_tmp);
if ($rss) {
if (!$num_items) {
$num_items = 5;
}
$items = array_slice($rss->items, 0, $num_items);
if (!$title) {
$title = $rss->channel['title'];
}
$shownav .= $html1 . $title . $html2;
foreach ($items as $item) {
if (isset($format) && function_exists($format)) {
$shownav = $format($item);
} else {
$href = $item['link'];
$title = $item['title'];
$shownav .= $html3 . "<a href={$href} class=sidelist>{$title}</a>" . $html4;
}
}
} else {
$shownav .= $html1 . $html2;
}
$shownav .= $html5;
return $shownav;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:32,代码来源:navselect.php
示例5: show_rss
function show_rss($url, $max_count, $show_descr)
{
$count = 0;
$rss = fetch_rss($url);
foreach ($rss->items as $item) {
$link = $item['link'];
$title = $item['title'];
$pubdate = date('Y-m-d g:i', strtotime($item['pubdate']));
/* BUG FIX: the new SourceForge news system now includes
comments on news items in the news feed. we don't want
that, so only print items that DON'T have "discussion"
in the title. (i.e. strpos is FALSE) */
if (strpos($title, "discussion") == FALSE) {
if ($count++ < $max_count) {
echo "<h4><a href=\"{$link}\">{$title}</a></h4>\n";
echo "<p><span class=\"date\">{$pubdate}</span>\n";
if ($show_descr) {
$description = $item['description'];
echo "{$description}\n";
}
echo "</p>\n";
}
}
}
}
开发者ID:emilymeyer,项目名称:freedosweb,代码行数:25,代码来源:show_rss.php
示例6: print_rss
function print_rss($feed, $maxcount)
{
// print at most $maxcount items from an RSS feed.
// if $maxcount is negative, print items in reverse order, from the end.
/* assumes MagpieRSS */
$rss = fetch_rss($feed);
/* MagpieRSS */
if ($maxcount < 0) {
$rss_items = array_reverse($rss->items);
} else {
$rss_items = $rss->items;
}
$max_count = abs($maxcount);
$count = 0;
foreach ($rss_items as $item) {
/*
BUGFIX: The updated SourceForge news system now includes
comments on news items from the news feed. We don't want
that, so only print items that DO NOT have "discussion"
in the title. (i.e. strpos is FALSE) */
/*
/*
TODO: a better solution is to fix the rss so it doesn't
include the SF comments.
*/
if (strpos($item['title'], "discussion") === FALSE) {
if ($count++ < $max_count) {
print_rss_item($item['title'], $item['pubdate'], $item['description'], $item['link']);
}
}
}
}
开发者ID:emilymeyer,项目名称:freedosweb,代码行数:33,代码来源:print_rss.php
示例7: EIP_Feed_Field_Select
function EIP_Feed_Field_Select($feed_url = "")
{
$rss = fetch_rss($feed_url);
$x = sizeof($rss->items[1]);
$z = $rss->items[0];
$TheTextToReturn = "\toptions: {";
$count = 0;
foreach ($z as $item => $key) {
if ($count < $x) {
//echo $item . "<BR>";
if (is_array($z[$item])) {
foreach ($z[$item] as $item2 => $key) {
if ($count > 0) {
$TheTextToReturn .= ", ";
}
$TheTextToReturn .= $item . "_ne_st_ed_" . $item2 . ": '" . $item . " : " . $item2 . "'";
$count = $count + 1;
}
} else {
if ($count > 0) {
$TheTextToReturn .= ", ";
}
$TheTextToReturn .= $item . ": '" . $item . "'";
$count = $count + 1;
}
}
}
$TheTextToReturn .= "}";
return $TheTextToReturn;
}
开发者ID:hyrmedia,项目名称:modules,代码行数:30,代码来源:class.rssimport.php
示例8: do_corefeed_html
function do_corefeed_html()
{
$url = "http://www.nagios.org/backend/feeds/corepromo";
$rss = fetch_rss($url);
$x = 0;
//build content string
if ($rss) {
$html = " \n\t\t<ul>";
foreach ($rss->items as $item) {
$x++;
if ($x > 3) {
break;
}
//$href = $item['link'];
//$title = $item['title'];
$desc = $item['description'];
$html .= "<li>{$item['description']}</li>";
}
$html .= "</ul>";
print $html;
} else {
$html = "\n\t\tAn error occurred while trying to fetch the Nagios Core feed. Stay on top of what's happening by visiting <a href='http://www.nagios.org/' target='_blank'>http://www.nagios.org/</a>.\n\t\t";
print $html;
}
}
开发者ID:Mrhjx2,项目名称:nagios,代码行数:25,代码来源:rss-corefeed.php
示例9: display
public function display()
{
$disp = Display::current();
require_once 'packages/magpierss/rss_fetch.inc';
$rss = fetch_rss('http://shortsoup.net.au/?feed=rss2&p=11');
$disp->setValue('comments', $rss->items);
$disp->setValue('add_comment', $rss->channel['link']);
print_r($rss->items);
// Include the javascript for the page
JsRegister::current()->registerScript('home');
// if(Application::current()->user()->authorise('SeeingsystemSetup'))
$disp->setValue('logged_in', true);
// else
// {
// $disp->setValue('login_error',$this->login_error);
// $login_form = Form::load('seeingsystem.views.Login');
// $disp->addForm($login_form);
// }
$disp->setTitle('SeeingSystem - A Flickr Slideshow of Ordinary Beautiful Things');
$disp->addView('page_content', 'seeingsystem.views.Home');
/*
echo "<br />DEBUG: Home::display()<br />\n";
exit;
*/
$disp->displaySiteTemplate();
}
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:26,代码来源:home.class.php
示例10: do_newsfeed_html
function do_newsfeed_html()
{
$url = "http://www.nagios.org/backend/feeds/frontpage/";
$rss = fetch_rss($url);
if ($rss) {
$x = 0;
$html = "\n\t\t<ul>\n";
foreach ($rss->items as $item) {
$x++;
if ($x > 3) {
break;
}
$href = $item['link'];
$title = $item['title'];
$html .= "<li><a href='{$href}' target='_blank'>{$title}</a></li>";
}
$html .= '
<li><a href="http://www.nagios.org/news" target="_blank">More news...</a></li>
</ul>';
print $html;
} else {
$html = "\n\t\tAn error occurred while trying to fetch the latest Nagios news. Stay on top of what's happening by visiting <a href='http://www.nagios.org/news' target='_blank'>http://www.nagios.org/news</a>.\n\t\t";
print $html;
}
}
开发者ID:Mrhjx2,项目名称:nagios,代码行数:25,代码来源:rss-newsfeed.php
示例11: widget_flickr
function widget_flickr($args) {
require_once(ABSPATH . WPINC . '/rss.php');
extract($args);
$options = get_option('widget_flickr');
$url = 'http://flickr.com/services/feeds/photos_public.gne?id=' . $options['account'] . '&format=rss_200';
$rss = fetch_rss($url);
if (!empty($rss->items)) {
$data = array_slice($rss->items, 0, $options['display']);
foreach ($data as $item) {
preg_match_all('/src=["\']([^"\']+)/si', $item['description'], $src);
$src = str_replace('_m.jpg', '_s.jpg', $src[1][0]);
$items = $items . '<li><a href="' . $item['link']. '"><img src="' . $src . '" alt="' . $item['title'] . '" /></a></li>';
}
echo
$before_widget,
$before_title . $options['title'] . $after_title,
'<ul>',
$items,
'</ul>',
$after_widget;
}
}
开发者ID:nunomorgadinho,项目名称:RebelTheme,代码行数:29,代码来源:widget-flickr.php
示例12: get_rss
function get_rss($url, $inputch, $outputch, $limit)
{
if ($url) {
$rss = fetch_rss($url);
// Generating HTML Code
$rsscontent = '<b class="rss-channel">' . $rss->channel['title'] . '</b><p>';
$rsscontent .= "<ul>";
$counter = 1;
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
$rsscontent .= "<li><a href={$href}>{$title}</a></li>";
if ($counter >= $limit) {
break;
} else {
$counter++;
}
}
$rsscontent .= "</ul>";
// Charset Conversion
$conv = new convertor();
$conv->convertor($inputch, $outputch, $rsscontent);
$rssconv = $conv->pull();
}
return $rssconv;
}
开发者ID:BackupTheBerlios,项目名称:loquacity-svn,代码行数:26,代码来源:rss.php
示例13: getRss
public function getRss($feed)
{
if (!strlen($feed)) {
// Always use http protocol
$feed = '';
}
/*
Array
(
[title] =>
[description] =>
[link] =>
[guid] =>
[pubdate] =>
[summary] =>
[date_timestamp] =>
)
*/
$this->items = array();
$numberOfItems = 10;
$rssFeed = fetch_rss($feed);
if (sizeof($rssFeed->items)) {
$this->items = array_slice($rssFeed->items, 0, $numberOfItems);
}
}
开发者ID:newga,项目名称:newga,代码行数:25,代码来源:Rss.php
示例14: widget_untappd
function widget_untappd()
{
require_once ABSPATH . 'wp-includes/rss-functions.php';
$wp_untappd_rss = get_option('untappd_rss');
$wp_untappd_title = get_option('untappd_title') == '' ? "Beers I'm Drinking" : get_option('untappd_title');
$wp_untappd_userid = get_option('untappd_userid');
echo wptexturize('<div id="widget_untappd">');
echo wptexturize('<div id="widget_untappd_header">' . $wp_untappd_title . '</div>');
echo wptexturize('<div id="widget_untappd_beer_list">');
if ($wp_untappd_rss != '') {
$rss = fetch_rss($wp_untappd_rss);
if (count($rss->items) != 0) {
$limit = 5;
foreach ($rss->items as $item) {
if ($limit == 0) {
break;
}
echo wptexturize('<div class="widget_untappd_beer"><a target="_blank" href="' . $item['link'] . '">' . $item['title'] . '</a></div>');
$limit++;
}
} else {
echo wptexturize('<div class="widget_untappd_beer">What?!? No beers yet?!?<br /><br /></div>');
}
} else {
echo wptexturize('<div class="widget_untappd_beer">Widget not setup yet<br /><br /></div>');
}
echo wptexturize('</div>');
if ($wp_untappd_userid != '') {
echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/user/' . $wp_untappd_userid . '">Follow me on Untappd!</a></div>');
} else {
echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/">Drink Socially at Untappd!</a></div>');
}
echo wptexturize('</div>');
echo wptexturize('<div id="widget_untappd_logo"><a target="_blank" href="http://untappd.com"><span></span></a></div>');
}
开发者ID:jfaustin,项目名称:Untappd-WP-Widget,代码行数:35,代码来源:untappd.php
示例15: do_newsfeed_html
function do_newsfeed_html()
{
$html = '';
$rss = fetch_rss('https://www.nagios.org/backend/feeds/frontpage');
// Output an unordered list of the first n items if any were returned.
if ($rss && $rss->items) {
$html = '<ul>';
$x = 0;
foreach ($rss->items as $item) {
if (++$x > 3) {
break;
}
// Only 3 items.
$href = $item['link'];
$title = $item['title'];
$html .= "<li><a href='{$href}' target='_blank'>{$title}</a></li>";
}
$html .= '
<li><a href="https://www.nagios.org/news" target="_blank">More news...</a></li>
</ul>';
} else {
$html = "Unable to fetch the latest Nagios news. Stay on top of what's happening by visiting <a href='https://www.nagios.org/news' target='_blank'>https://www.nagios.org/news</a>.";
}
print $html;
}
开发者ID:PKDSP,项目名称:Sources,代码行数:25,代码来源:rss-newsfeed.php
示例16: populate
function populate()
{
require_once LIB_ROOT . 'magpie/rss_fetch.inc';
$rss = fetch_rss($this->source);
$this->contents = $rss->items;
parent::populate();
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:RSSFeedEGlet.php
示例17: show_wcp
function show_wcp($items = 20, $style = "full")
{
include_once ABSPATH . WPINC . '/rss.php';
$wcp_rss = fetch_rss('http://feed.feedsky.com/WordPressChinesePlanet');
if (empty($wcp_rss)) {
return -1;
}
if (empty($wcp_rss->items)) {
return -1;
}
$wcp_items = array_slice($wcp_rss->items, 0, $items);
$output = '';
if ($style == "full") {
foreach ($wcp_items as $wcp_item) {
$output .= '<div class="wcp">';
$output .= '<h3><a href="' . $wcp_item['link'] . '" title="' . $wcp_item['title'] . '">' . $wcp_item['title'] . '</a></h3>';
$output .= '<p>' . $wcp_item['description'] . ' <br /><a href="' . $wcp_item['link'] . '" class="more-link"><span class="moretext"> 查看全文... </span></a></p>';
$output .= '<p class="info"><em class="date">' . date('F jS, Y - h:ia', strtotime($wcp_item["pubdate"])) . '</em><em class="author">' . $wcp_item['author'] . '</em></p>';
$output .= '</div>';
}
} else {
$output .= '<ul class="wcp">';
foreach ($wcp_items as $wcp_item) {
$output .= '<li><a href="' . $wcp_item['link'] . '" title="' . $wcp_item['title'] . '">' . $wcp_item['title'] . '</a></li>';
}
$output .= '</ul>';
}
echo $output;
}
开发者ID:enlamp,项目名称:enlamp.cn,代码行数:29,代码来源:dashboard_chinese.php
示例18: syndicate
function syndicate($content)
{
//gets data from an rss- or atom-feed and builds an unordered list
//This is based on MagPieRSS and a nice php-script by Richard Eriksson
$att = getattributes($content);
if (isset($att['number'])) {
$number = $att['number'];
} else {
$number = 10;
}
if (isset($att['url'])) {
$return = "<ul>";
require_once "loudblog/inc/magpierss/rss_fetch.inc";
$yummy = fetch_rss($att['url']);
$yummyitems = array_slice($yummy->items, 0, $number);
foreach ($yummyitems as $yummyitem) {
$return .= '<li>';
$return .= '<a href="';
$return .= $yummyitem['link'];
$return .= '">';
$return .= $yummyitem['title'];
$return .= '</a>';
$return .= '</li>';
}
$return .= "</ul>";
}
return $return;
}
开发者ID:kldeepak,项目名称:swara,代码行数:28,代码来源:syndicate.php
示例19: parse_rss
function parse_rss()
{
$months = array("Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", "May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08", "Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12");
require_once './magpierss/rss_fetch.inc';
$url = 'http://developer.berlios.de/export/rss20_bsnews.php?group_id=4806';
$rss = fetch_rss($url);
if ($rss and !$rss->ERROR) {
$num_items = 10;
$items = array_slice($rss->items, 0, $num_items);
$ret = '<dl typeof="rss:channel" about="http://swaml.berlios.de/rss/news">';
foreach ($items as $item) {
$title = $item[title];
$parted = explode('=', $item[link]);
$id = $parted[1];
$link = 'http://swaml.berlios.de/news/' . $id;
$description = $item[description];
$description = $this->acronyms_replace($description);
$description = $this->make_clickable($description);
$pubDate = $item[pubdate];
$date = explode(" ", $pubDate);
$ret .= '<dt>[' . $date[1] . '-' . $months[$date[2]] . '-' . $date[3] . '] ';
$ret .= '<a href="' . $link . '"><strong>' . $title . '</strong></a></dt>';
$ret .= '<dd>' . $description . '</dd>';
}
$ret .= '</dl>';
} else {
$ret = 'Error: ' . $rss->ERROR;
}
return $ret;
}
开发者ID:BackupTheBerlios,项目名称:swaml-svn,代码行数:30,代码来源:functions.php
示例20: perform
/**
* Perform on the action call
*
* @param mixed $data Data passed to this action
*/
public function perform($data = FALSE)
{
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
if (isset($data['encoding'])) {
define('MAGPIE_OUTPUT_ENCODING', $data['encoding']);
}
}
if (isset($data['cache_time'])) {
define('MAGPIE_CACHE_ON', TRUE);
define('MAGPIE_CACHE_AGE', (int) $data['cache_time']);
define('MAGPIE_CACHE_DIR', SMART_BASE_DIR . 'data/common/rss_cache');
}
if (!($rss = fetch_rss($data['url']))) {
trigger_error('Rss feed not available: ' . magpie_error(), E_USER_WARNING);
$data['result']['items'] = array();
$data['result']['channel'] = array();
$data['result']['image'] = array();
$data['result']['textinput'] = array();
return;
}
$data['result']['items'] = $rss->items;
$data['result']['channel'] = $rss->channel;
$data['result']['image'] = $rss->image;
$data['result']['textinput'] = $rss->textinput;
}
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:30,代码来源:ActionCommonRssFetch.php
注:本文中的fetch_rss函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论