本文整理汇总了PHP中fetch_rss函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_rss函数的具体用法?PHP fetch_rss怎么用?PHP fetch_rss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_rss函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>';
}
}
示例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;
}
}
示例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>';
}
}
示例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;
}
示例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";
}
}
}
}
示例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']);
}
}
}
}
示例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;
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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>');
}
示例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;
}