Ejemplo n.º 1
0
function make_cache_file($feed_id)
{
    static $rss;
    if (!isset($rss)) {
        require_once AT_INCLUDE_PATH . '../mods/_standard/rss_feeds/classes/lastRSS.php';
        $rss = new lastRSS();
        $rss->cache_dir = AT_CONTENT_DIR . 'feeds/';
        $rss->num_results = AT_FEED_NUM_RESULTS;
        $rss->description = AT_FEED_SHOW_DESCRIPTION;
    }
    $sql = "SELECT url, feed_id FROM %sfeeds WHERE feed_id=%d";
    $row_feeds = queryDB($sql, array(TABLE_PREFIX, $feed_id), TRUE);
    if (count($row_feeds) > 0) {
        $output = $rss->get($row['url'], $row['feed_id']);
        $cache_file = AT_CONTENT_DIR . 'feeds/' . $feed_id . '_rss.cache';
        if ($f = @fopen($cache_file, 'w')) {
            fwrite($f, $output, strlen($output));
            fclose($f);
        }
        return 0;
    } else {
        $output = $rss->get($_POST['url'], 0);
        return $output;
    }
}
Ejemplo n.º 2
0
function make_cache_file($feed_id) {
	global $db;
	static $rss;

	if (!isset($rss)) {  
		require_once(AT_INCLUDE_PATH.'../mods/_standard/rss_feeds/classes/lastRSS.php');
		$rss = new lastRSS; 
		$rss->cache_dir = AT_CONTENT_DIR.'feeds/'; 
		$rss->num_results = AT_FEED_NUM_RESULTS;
		$rss->description = AT_FEED_SHOW_DESCRIPTION;
	} 

	$sql	= "SELECT url, feed_id FROM ".TABLE_PREFIX."feeds WHERE feed_id=".intval($feed_id);
	$result = mysql_query($sql, $db);

	if ($row = mysql_fetch_assoc($result)) {
		$output = $rss->get($row['url'], $row['feed_id']);

		$cache_file = AT_CONTENT_DIR.'feeds/'.$feed_id.'_rss.cache';
		if ($f = @fopen($cache_file, 'w')) {
			fwrite ($f, $output, strlen($output));
			fclose($f);
		}
		return 0;
	} else {
		$output = $rss->get($_POST['url'], 0);
		return $output;
	}
}
Ejemplo n.º 3
0
 public function getResourcesForTag($tag)
 {
     global $PluginConf;
     $tagValue = $tag->getLabel();
     $Bundle = array();
     $Cachedir = $PluginConf[$this->_UNIQUE_NUMBER]['cachedir'];
     //We are using the lastRSS library to to the job
     $rss = new lastRSS();
     $rss->cache_dir = $Cachedir;
     $rss->cache_time = 360;
     // 3 minutes
     $rss->items_limit = 10;
     //Loading RSS
     if ($Feed = $rss->get($PluginConf[$this->_UNIQUE_NUMBER]['rssurl'] . $tagValue)) {
         foreach ($Feed['items'] as $Result) {
             $Res = new Result();
             $Res->setTitle(html_entity_decode($Result['title']));
             $Res->setDescription(html_entity_decode($Result['description']));
             $Res->setUrl($Result['link']);
             $Res->setShownContent($Result['link']);
             $Res->setTagSearched($tag);
             $Res->setContentType(2);
             $Bundle[] = $Res;
         }
     } else {
         die('Error: RSS file not found...');
     }
     return $Bundle;
 }
Ejemplo n.º 4
0
function rss($feed,$n = 5) {
	$rss = new lastRSS;
	$rss->cache_dir = './cache';
	$rss->cache_time = 3600; // one hour
	$rs = $rss->get($feed);
	foreach ($rs['items'] as $item) {
		$date = explode(" ",$item[pubDate]);
     		$out = $out .  "<p> <a href=" . $item[enclosure][url] ."> $date[2] $date[1]</a>: " .
                                 preg_replace('/....div.*/','',$item[description] ) ;

		$n   = $n - 1;
		if ($n == 0) {break; }; 
	}
	return $out;
}
Ejemplo n.º 5
0
 function getOutput()
 {
     if (!class_exists('lastRSS')) {
         include DIR_WS_CLASSES . 'rss.php';
     }
     $rss = new lastRSS();
     $rss->items_limit = 5;
     $rss->cache_dir = DIR_FS_CACHE;
     $rss->cache_time = 86400;
     $feed = $rss->get('http://feeds.feedburner.com/osCommerce_Contributions');
     $output = '<table border="0" width="100%" cellspacing="0" cellpadding="4">' . '  <tr class="dataTableHeadingRow">' . '    <td class="dataTableHeadingContent">' . MODULE_ADMIN_DASHBOARD_LATEST_ADDONS_TITLE . '</td>' . '    <td class="dataTableHeadingContent" align="right">' . MODULE_ADMIN_DASHBOARD_LATEST_ADDONS_DATE . '</td>' . '  </tr>';
     if (is_array($feed) && !empty($feed)) {
         foreach ($feed['items'] as $item) {
             $output .= '  <tr class="dataTableRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . '    <td class="dataTableContent"><a href="' . $item['link'] . '" target="_blank">' . $item['title'] . '</a></td>' . '    <td class="dataTableContent" align="right" style="white-space: nowrap;">' . date("F j, Y", strtotime($item['pubDate'])) . '</td>' . '  </tr>';
         }
     } else {
         $output .= '  <tr class="dataTableRow">' . '    <td class="dataTableContent" colspan="2">' . MODULE_ADMIN_DASHBOARD_LATEST_ADDONS_FEED_ERROR . '</td>' . '  </tr>';
     }
     $output .= '  <tr class="dataTableRow">' . '    <td class="dataTableContent" align="right" colspan="2"><a href="http://feeds.feedburner.com/osCommerce_Contributions" target="_blank">' . tep_image(DIR_WS_IMAGES . 'icon_rss.png', MODULE_ADMIN_DASHBOARD_LATEST_ADDONS_ICON_RSS) . '</a></td>' . '  </tr>' . '</table>';
     return $output;
 }
 function getOutput()
 {
     if (!class_exists('lastRSS')) {
         include 'includes/classes/rss.php';
     }
     $rss = new lastRSS();
     $rss->items_limit = 5;
     $rss->cache_dir = DIR_FS_CACHE;
     $rss->cache_time = 86400;
     $feed = $rss->get('http://feeds.feedburner.com/osCommerceNewsAndBlogs');
     $output = '<table border="0" width="100%" cellspacing="0" cellpadding="4">' . '  <tr class="dataTableHeadingRow">' . '    <td class="dataTableHeadingContent">' . MODULE_ADMIN_DASHBOARD_LATEST_NEWS_TITLE . '</td>' . '    <td class="dataTableHeadingContent" align="right">' . MODULE_ADMIN_DASHBOARD_LATEST_NEWS_DATE . '</td>' . '  </tr>';
     if (is_array($feed) && !empty($feed)) {
         foreach ($feed['items'] as $item) {
             $output .= '  <tr class="dataTableRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . '    <td class="dataTableContent"><a href="' . $item['link'] . '" target="_blank">' . $item['title'] . '</a></td>' . '    <td class="dataTableContent" align="right" style="white-space: nowrap;">' . date("F j, Y", strtotime($item['pubDate'])) . '</td>' . '  </tr>';
         }
     } else {
         $output .= '  <tr class="dataTableRow">' . '    <td class="dataTableContent" colspan="2">' . MODULE_ADMIN_DASHBOARD_LATEST_NEWS_FEED_ERROR . '</td>' . '  </tr>';
     }
     $output .= '  <tr class="dataTableRow">' . '    <td class="dataTableContent" align="right" colspan="2"><a href="http://www.oscommerce.com/Us&News" target="_blank">' . tep_image('images/icon_oscommerce.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_NEWS) . '</a>&nbsp;<a href="http://www.oscommerce.com/newsletter/subscribe" target="_blank">' . tep_image('images/icon_newsletter.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_NEWSLETTER) . '</a>&nbsp;<a href="http://plus.google.com/+osCommerce" target="_blank">' . tep_image('images/icon_google_plus.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_GOOGLE_PLUS) . '</a>&nbsp;<a href="http://www.facebook.com/pages/osCommerce/33387373079" target="_blank">' . tep_image('images/icon_facebook.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_FACEBOOK) . '</a>&nbsp;<a href="http://twitter.com/osCommerce" target="_blank">' . tep_image('images/icon_twitter.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_TWITTER) . '</a>&nbsp;<a href="http://feeds.feedburner.com/osCommerceNewsAndBlogs" target="_blank">' . tep_image('images/icon_rss.png', MODULE_ADMIN_DASHBOARD_LATEST_NEWS_ICON_RSS) . '</a></td>' . '  </tr>' . '</table>';
     return $output;
 }
Ejemplo n.º 7
0
$arURL = GetRSSLinks();
// create lastRSS object
$rss = new lastRSS();
// setup transparent cache
$rss->cache_dir = $cfg["torrent_file_path"];
$rss->cache_time = $cfg["rss_cache_min"] * 60;
// 1200 = 20 min.  3600 = 1 hour
$rss->strip_html = false;
// don't remove HTML from the description
echo "<a name=\"top\"></a><div align=\"center\">";
echo "<table border=1 cellspacing=0 width=\"760\" cellpadding=5><tr>";
echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\">RSS Feeds (jump list):";
echo "<ul>";
// Loop through each RSS feed
foreach ($arURL as $rid => $url) {
    if ($rs = @$rss->get($url)) {
        if (!empty($rs["items"])) {
            // Cache rss feed so we don't have to call it again
            $rssfeed[] = $rs;
            echo "<li><a href=\"#" . $rid . "\">" . $rs["title"] . "</a></li>\n";
        } else {
            $rssfeed[] = "";
            echo "<li>* RSS timed out * (<a href=\"#" . $rid . "\">" . $url . "</a>)</li>\n";
        }
    } else {
        // Unable to grab RSS feed, must of timed out
        $rssfeed[] = "";
        echo "<li>* RSS timed out * (<a href=\"#" . $rid . "\">" . $url . "</a>)</li>\n";
    }
}
echo "</ul>* Click on Torrent Links below to add them to the Torrent Download List</td>";
Ejemplo n.º 8
0
<?php

include 'lastrss.php';
$orss = new lastRSS();
// setup transparent cache
// $rss->cache_dir = './cache';
$orss->cache_time = 3600;
// one hour
// load some RSS file
if ($ars = $orss->get('http://bdg.bedeng.com/category/news/feed/')) {
    // here we can work with RSS fields
    ?>
<table class="table_admin2">
<tr>
	<td><h1>News</h1></td>
</tr>
<?php 
    for ($ii = 0; $ii < $ars['items_count']; $ii++) {
        ?>
	<tr>
		<td align="left">
		<?php 
        echo $ars['items'][$ii]['pubDate'];
        ?>
<br>
		<font size="+1"><b><a href="<?php 
        echo $ars['items'][$ii]['link'];
        ?>
" target="_blank" style="text-decoration: none;"><?php 
        echo $ars['items'][$ii]['title'];
        ?>
Ejemplo n.º 9
0
}
########### End
## Here we read Podcast Generator RSS news feed to display in the admin section the latest news about the script
// Try to load and parse podcastgen RSS news file
$rssurl = 'http://feeds.podcastgenerator.net/podcastgenerator';
// include lastRSS
include "{$absoluteurl}" . "components/lastRSS/lastRSS.php";
// Create lastRSS object
$rss = new lastRSS();
// Set cache dir and cache time limit (1200 seconds)
// (don't forget to chmod cache dir to 777 to allow writing)
### In podcastgen I set the ROOT directory as RSS cache dir, as it should already haver writing permissions:
$rss->cache_dir = $absoluteurl;
$rss->cache_time = 43200;
// 12 hours cache time between each update of podcastgen news
if ($rs = $rss->get($rssurl)) {
    // I could use also ['author']['guid']['link']
    $RSSnews_title = $rs['items']['0']['title'];
    $RSSnews_date = $rs['items']['0']['pubDate'];
    $RSSnews_description = html_entity_decode($rs['items']['0']['description']);
    // I use html_entity_decode to enable html tags
    //output RSS last item
    $PG_mainbody .= '<p><b>' . $RSSnews_title . '</b><br /><span class ="admin_hints">
		' . $RSSnews_date . '</span><br /><br />
		' . $RSSnews_description . '
		</p>';
} else {
    $PG_mainbody .= _("Error: It's not possible to get Podcast Generator news feed. News will be automatically disabled.");
    //DISABLE news display if the server doesn't allow
    $enablepgnewsinadmin = "no";
    include "{$absoluteurl}" . "core/admin/createconfig.php";
Ejemplo n.º 10
0
            // The following line loads up the product views file, which adds the small product view icons under the main product image
            require_once 'include/productviews.php';
        }
    }
}
// PRODUCT RECOMMENDATIONS
if ($showRecommendations) {
    $tagRecs = explode(",", $tags);
    // Get product data
    $recRss = new lastRSS();
    $recRss->CDATA = 'content';
    $recRss->items_limit = 0;
    $randomTag = rand(0, count($tagRecs) - 1);
    $queryString = str_replace(" ", ",", trim($tagRecs[$randomTag]));
    $recommendations = "<div id=\"productRecommendationsShell\">{$recommendationsTitle} (" . str_replace(",", "+", $queryString) . ")<div id=\"productRecommendationsCenter\">";
    if ($recRs = $recRss->get('http://feed.' . $zazzleURLBase . '/feed?st=popularity&at=' . $associateId . '&isz=98&bg=' . $gridCellBgColor . '&pg=1&src=zstore&ps=' . $numRecs . '&ft=gb&opensearch=true&qs=' . $queryString)) {
        foreach ($recRs as $recFeedkey => $recFeedval) {
            if ($recFeedkey == "items") {
                foreach ($recFeedval as $thisrec) {
                    if ($thisrec['g:id'] != $productId) {
                        $recSpecificProductType = htmlentities(str_replace("\"", "", $thisrec['g:product_type']));
                        $recProductId = $thisrec['g:id'];
                        $recTitle = urldecode($thisrec['title']);
                        $recTitle = preg_replace("/<[^>]+>/", '', $recTitle);
                        $recUrlTitle = str_replace('...', '_', $recTitle);
                        $recUrlTitle = str_replace(array('!', '\'', '.', ',', ';', ':', '"', '&quot', '?', '_', '(', ')', '`', '~', '@', '#', '$', '^', '&', '*', '+', '=', '[', ']', '{', '}', '|', '<', '>'), '', $recTitle);
                        $recUrlTitle = str_replace(" ", "_", $recUrlTitle);
                        $recUrlTitle = str_replace("___", "_", $recUrlTitle);
                        $recUrlTitle = str_replace("__", "_", $recUrlTitle);
                        $recUrlTitle = strtolower($recUrlTitle);
                        $recUrlTitle = str_replace("_bumper_sticker", "", $recUrlTitle);
Ejemplo n.º 11
0
"</th></tr></thead>
<tr>
<td><div style='overflow:scroll; height:715px; padding:7px;'>";
?>
<?php

// include lastRSS library
include_once ("lastRSS.php");
// create lastRSS object
$rss = new lastRSS; 
// setup transparent cache
$rss->cache_dir = './cache'; 
$rss->cache_time = 3600; // one hour

// load some RSS file
if ($rs = $rss->get('http://www.viadat.com/index.php?rss=true&action=product_list&category_id=7')) {
	//var_dump($rs);
$c=1;
foreach ($rs[items] as $value) {

if ($c<=100) {
	print "<li><A href=\"$value[link]\" target='_blank' class='home_rss' style='font-size:12px'>
	<b>$value[title]</b></a></li>
	<!--br-->
	<span class='home_rss'> ".
	str_replace("]]>","",str_replace("</p>", "", html_entity_decode(nl2br($value[description])))).
	"</span><br><br>";
}
else {
	if ($c<=4)
	print "<li style='font-size:10px; color:black; position:relative; left:10px'><A href=\"$value[link]\" target='_blank' class='home_rss' style='font-size:11px'>$value[title]</a></li>";
Ejemplo n.º 12
0
<?php

//get RSS feed from forum
/////////////////////////
$rss = new lastRSS();
$rss->cache_dir = '';
$rss->cache_time = 3600;
// one hour
$rs = $rss->get('http://phpmotion.com/forum/index.php?board=2.0&type=rss;action=.xml;limit=3');
$rss_output = '';
foreach ($rs['items'] as $item) {
    $rss_output1 = '
	<li><a href="' . $item[link] . '"><b>' . $item['title'] . '
	</b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Published: ' . $item['pubDate'] . ')
	</li>
	<li>&nbsp;</li>
	<li>' . $item['description'] . '</li>
	<li><p align="center">---------------------------------------------------------------------------------------------------------------------</li>';
    $rss_output = $rss_output . $rss_output1;
}
Ejemplo n.º 13
0
<?php

//twitter
if (($twitter = $parlamentario->getTwitter()) != null) {
    echo '<h3 class="tit">Twitter</h3>';
    $twitter_url = 'http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=' . $twitter . '&count=3';
    $rss = new lastRSS();
    $rs = $rss->get($twitter_url);
    echo '<div class="list"><div class="yoo-tweet"><ul id="twitter_update_list" class="list">';
    foreach ($rs['items'] as $i => $item) {
        echo '<li class="';
        echo fmod($i, 2) ? 'even' : 'odd';
        echo '">';
        echo '<p class="text">' . eregi_replace($twitter . ': ', '', $item['title']) . '</p>';
        echo '<p class="meta">' . link_to(date('jS F \\a\\t h:i a', strtotime($item['pubDate'])), $item['link'], 'title=' . $item['title']);
        echo '</p></li>';
    }
    echo '</ul></div></div>';
}
Ejemplo n.º 14
0
\t\t\t<div class="panel-body" id="twitter-here">
\t\t\t\t\t<span class="follow"><a href="https://twitter.com/SteamLUG" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @SteamLUG</a></span>
\t\t\t\t\t<a class="twitter-timeline" href="https://twitter.com/SteamLUG" data-widget-id="558698447109636097" data-link-color="#ebebeb" data-chrome="nofooter noheader transparent noborders" data-tweet-limit="3" lang="EN">Tweets by @SteamLUG</a>
\t\t\t</div>
\t\t</article>
TWITTERWIDGET;
}
$rss = new lastRSS();
$rss->cache_dir = $eventXMLPath . '/steamlug/temp';
$rss->cache_time = 1200;
$rss->CDATA = 'content';
$rss->date_format = 'd M o H:i:s e';
$rss->items_limit = 6;
$rssString = "";
$firstItem = true;
if ($rs = $rss->get($eventXMLPath . '/steamlug/rss.xml')) {
    $youtubePatterns = array("/www.youtube.com\\/watch\\?v=([0-9A-Za-z_-]*)/", "/youtu.be\\/([0-9A-Za-z_-]*)/");
    if (true) {
        include_once 'includes/functions_youtube.php';
        $youtubeIDs = array();
        foreach ($rs['items'] as $item) {
            // preview content to grab youtube data?
            // XXX this will be replaced once our db stuff is in
            if (!preg_match("/steamlug\\/events\\//", $item['link'])) {
                foreach ($youtubePatterns as $pattern) {
                    if (preg_match_all($pattern, $item['description'], $vid)) {
                        $youtubeIDs = array_merge($youtubeIDs, $vid[1]);
                    }
                }
            }
        }
Ejemplo n.º 15
0
<?php

require 'lastRSS.php';
$rss = new lastRSS();
$feed = $rss->get('http://www.buy.com/ct/rss/digitalcameras.xml');
?>
 
<h1><?php 
echo $feed['title'];
?>
</h1>
<ul>
<?php 
foreach ($feed['items'] as $item) {
    ?>
    <li>
			<a href="<?php 
    echo $item['link'];
    ?>
"><?php 
    echo $item['title'];
    ?>
</a>
			<div><?php 
    echo $item['enclosure'];
    ?>
</div>
		</li>
<?php 
}
?>
Ejemplo n.º 16
0
        $bash = @file_get_contents('http://bash.org/?random1');
        if (preg_match('/<p class="qt">(.*?)<\\/p>/s', $bash, $results)) {
            $irc->send($irc->last, html_entity_decode(str_replace('<br />', '', $results[1])));
        }
    });
});
$irc->msg('/^!feed (.*)/', function ($irc, $nick, $channel, $feed) {
    $irc->async(function ($irc) use($feed) {
        if (!file_exists('lastRSS.php')) {
            $irc->send($irc->last, 'Please place lastRSS.php in the ProtoIRC directory to use', 'red');
            return;
        }
        $irc->send($irc->last, "Fetching {$feed}, won't be a moment");
        include 'lastRSS.php';
        $rss = new lastRSS();
        $rss->cache_dir = 'temp';
        $rss->cache_time = 1200;
        $rss->items_limit = 3;
        $rs = $rss->get($feed);
        if (!$rs) {
            $irc->send($irc->last, "Error fetching {$feed}, sorry", 'red');
        } else {
            foreach ($rs['items'] as $item) {
                $irc->send($irc->last, "{$irc->yellow}{$item['title']}{$irc->default} ({$item['link']})");
            }
        }
    });
});
/*$irc->in('/^:(.*)!.* PRIVMSG (.*) :(.*)(?#msg)/', function ($irc, $nick, $channel, $args) {
        $irc->msg($args, $nick, $channel);
});*/
Ejemplo n.º 17
0
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/
if (!class_exists('lastRSS')) {
    include DIR_WS_CLASSES . 'rss.php';
}
$rss = new lastRSS();
$rss->items_limit = 5;
$rss->cache_dir = DIR_FS_CACHE;
$rss->cache_time = 86400;
$feed = $rss->get('http://www.oscommerce.com/rss/news_and_blogs.rss');
?>

<table border="0" width="100%" cellspacing="0" cellpadding="4">
  <tr class="dataTableHeadingRow">
    <td class="dataTableHeadingContent"><?php 
echo ADMIN_INDEX_NEWS_TITLE;
?>
</td>
    <td class="dataTableHeadingContent" align="right"><?php 
echo ADMIN_INDEX_NEWS_DATE;
?>
</td>
  </tr>
<?php 
if (is_array($feed) && !empty($feed)) {
Ejemplo n.º 18
0
//----------------------------------
// prepare rss reader
//----------------------------------
// url where the reader will have to get the rss feed
$urlNewsClaroline = 'http://www.claroline.net/rss.php';
$rss = new lastRSS();
// where the cached file will be written
$rss->cache_dir = get_path('rootSys') . '/tmp/cache/';
// how long without refresh the cache
$rss->cache_time = 1200;
//----------------------------------
// DISPLAY
//----------------------------------
// title variable
$out = '';
$out .= claro_html_tool_title($nameTools);
if (false !== ($rs = $rss->get($urlNewsClaroline))) {
    foreach ($rs['items'] as $item) {
        $href = $item['link'];
        $title = $item['title'];
        $summary = $rss->unhtmlentities($item['description']);
        $date = strtotime($item['pubDate']);
        $out .= '<div class="claroBlock">' . "\n" . '<h3 class="blockHeader">' . "\n" . '<a href="' . $href . '">' . $title . '</a>' . "\n" . '<small> - ' . claro_html_localised_date(get_locale('dateFormatLong'), $date) . '</small>' . "\n" . '</h3>' . "\n" . '<div class="claroBlockContent">' . "\n" . $summary . "\n" . '</div>' . "\n" . '</div>' . "\n\n";
    }
} else {
    $dialogBox = new dialogBox();
    $dialogBox->error(get_lang('Error : cannot read RSS feed (Check feed url and if php setting "allow_url_fopen" is turned on).'));
    $out .= $dialogBox->render();
}
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Ejemplo n.º 19
0
function feedShows($venues, $datesystem, $cachetime)
{
    echo "      <ul>\n";
    // check if necessary values were passed
    if ($venues != false) {
        $rss = new lastRSS();
        // set cache dir
        $rss->cache_dir = "../cache";
        // set cache time to user supplied value
        if ($cachetime != false && is_int($cachtime)) {
            $rss->cache_time = $cachetime;
        } else {
            // no value or proper value supplied, default to 10800 seconds
            $rss->cache_time = 10800;
        }
        $rss_shows_merged = array();
        $rss_shows_sorted = array();
        // process each venue feed and merge into one array
        foreach ($venues as $url) {
            $rss_temp = $rss->get($url);
            $rss_shows_merged = array_merge_recursive($rss_shows_merged, $rss_temp);
        }
        // check if we could retrieve the source feeds
        if ($rss_shows_merged != false) {
            // perform formatting manipulation on merged array and then add
            // entries into a new, cleaner array
            foreach ($rss_shows_merged["items"] as $item) {
                // remove the show date at end of title, since we will later
                // print it separately
                $item[title] = preg_replace("' \\((January|February|March|April|May|June|July|August|September|October|November|December)(.*?)[0-9]{4}\\)'si", "", $item[title]);
                // if the show has been cancelled, make it very apparent
                $item[title] = str_replace("(CANCELLED)", "(<span class=\"error\">CANCELLED</span>)", $item[title]);
                // stylize the venue names themselves, and shorten specific ones
                // if we wish
                $item[title] = str_replace("Doug Fir Lounge", "<em>Doug Fir Lounge</em>", $item[title]);
                $item[title] = str_replace("Mississippi Studios", "<em>Mississippi Studios</em>", $item[title]);
                $item[title] = str_replace("Wonder Ballroom", "<em>Wonder Ballroom</em>", $item[title]);
                $item[title] = str_replace("Hawthorne Theatre", "<em>Hawthorne Theatre</em>", $item[title]);
                $item[title] = str_replace("McMenamin's Crystal Ballroom", "<em>Crystal Ballroom</em>", $item[title]);
                $item[title] = str_replace("Roseland Theater", "<em>Roseland Theater</em>", $item[title]);
                $item[title] = str_replace("Branx", "<em>Branx</em>", $item[title]);
                // add to dat new array
                $rss_shows_sorted[$item[pubDate]] = "<a href=\"{$item['link']}\" class=\"table-cell\">{$item['title']}</a>";
            }
            // sort new array, via leading timestamp keys
            ksort($rss_shows_sorted);
            // format timestamps to readable formats then print shows
            foreach ($rss_shows_sorted as $key => $item) {
                $shortdate = strtolower(date("M d", $key));
                // format our dates depending on date format preference
                if ($datesystem == "DMY") {
                    $shortdate = strtolower(date("d M", $key));
                    $longdate = date("D, j M Y", $key);
                } else {
                    if ($datesystem == "YMD") {
                        $shortdate = strtolower(date("M d", $key));
                        $longdate = date("Y M j, D", $key);
                    } else {
                        $shortdate = strtolower(date("M d", $key));
                        $longdate = date("D, M j, Y", $key);
                    }
                }
                echo "        <li class=\"table-row\"><div title=\"{$longdate}\" alt=\"{$longdate}\" class=\"table-cell\"><strong>{$shortdate}</strong></div>{$item}</li>\n";
            }
        } else {
            // couldn't load source feed, return error
            echo "        <script>feedError('error loading shows feed','please check your internet connection and/or configuration');</script>\n";
            // LastRSS caches every connection attempt, even ones that didn't successfully
            // load real data, and below is a workaround I found, to expire the cached
            // files created, so that when we do have a connection, fresh RSS data
            // is downloaded
            $rss->cache_time = 1;
            foreach ($venues as $url) {
                $rss_trash = $rss->get($url);
            }
        }
    } else {
        // a necessary value was missing, return error
        echo "        <script>feedError('error loading shows feed','no venues were provided in configuration');</script>\n";
    }
    echo "      </ul>\n";
}
Ejemplo n.º 20
0
                  <div class="box-header with-border">
                    <h3 class="box-title">Noticias</h3>
                    <p class="category">Diario financiero RSS</p>
                    <div class="box-tools pull-right">
                      <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-level-down text-light-blue"></i></button>
                    </div><!-- /.box-tools -->
                  </div><!-- /.box-header -->
                  <div class="box-body">
                    <div class="container-fluid"  style="height:300px; overflow-x: hidden;">
                    <?php 
        include "structure/rss/lastRSS.php";
        $rss = new lastRSS();
        $rss->cache_dir = './temp';
        $rss->cache_time = 1200;
        // cargar archivo RSS
        $rs = $rss->get('http://www.cooperativa.cl/noticias/site/tax/port/all/rss_3_87__1.xml');
        // Muestra titulo y enlace
        echo "<dl>\n";
        foreach ($rs['items'] as $item) {
            ?>
                                    <dt><a target="_blank" href='<?php 
            echo $item['link'];
            ?>
 '><?php 
            echo $item['title'];
            ?>
 </a>
                                        <p><?php 
            echo $item['description'];
            ?>
</p>
Ejemplo n.º 21
0
    //创建缓存目录
    $dir = create_dir(VI_ROOT . 'cache/rss/');
    // on crée un objet lastRSS
    $rss = new lastRSS();
    // options lastRSS
    $rss->cache_dir = $dir;
    // dossier pour le cache
    $rss->cache_time = 3600;
    // fréquence de mise à jour du cache (en secondes)
    $rss->date_format = 'd/m';
    // format de la date (voir fonction date() pour syntaxe)
    $rss->CDATA = 'content';
    // on retire les tags CDATA en conservant leur contenu
    //data
    $data = '';
    if ($rs = $rss->get($xml)) {
        for ($i = 0; $i < count($rs['items']); $i++) {
            //转编码
            if ($_G['product']['charset'] == "utf-8") {
                $rs['items'][$i]['title'] = iconv("gbk", $_G['product']['charset'], $rs['items'][$i]['title']);
                $rs['items'][$i]['category'] = iconv("gbk", $_G['product']['charset'], $rs['items'][$i]['category']);
                $rs['items'][$i]['description'] = iconv("gbk", $_G['product']['charset'], $rs['items'][$i]['description']);
                $rs['items'][$i]['author'] = iconv("gbk", $_G['product']['charset'], $rs['items'][$i]['author']);
            }
            $data .= '<div class="feed">
							<h2 class="title"><a href="' . $rs['items'][$i]['link'] . '">' . ClearHtml($rs['items'][$i]['title']) . '</a></h2>
							<p class="meta">
								<em>
								发布于:' . $rs['items'][$i]['pubDate'] . ' 作者:<a href="search.php?q=uid:' . $rs['items'][$i]['author'] . '" target="_blank">' . $rs['items'][$i]['author'] . '</a>
								分类:<a href="search.php?cat=' . $rs['items'][$i]['category'] . '" target="_blank">' . $rs['items'][$i]['category'] . '</a>
								</em>
Ejemplo n.º 22
0
function parse_one_rss($feed, $update = NULL)
{
    global $config_values;
    $rss = new lastRSS();
    $rss->stripHTML = True;
    $rss->CDATA = 'content';
    if (isset($config_values['Settings']['Cache Time']) && (int) $config_values['Settings']['Cache Time']) {
        $rss->cache_time = (int) $config_values['Settings']['Cache Time'];
    } else {
        if (!isset($update)) {
            $rss->cache_time = 86400;
        } else {
            $rss->cache_time = 15 * 60 - 20;
        }
    }
    $rss->date_format = 'M d, H:i';
    if (isset($config_values['Settings']['Cache Dir'])) {
        $rss->cache_dir = $config_values['Settings']['Cache Dir'];
    }
    if (!($config_values['Global']['Feeds'][$feed['Link']] = $rss->get($feed['Link']))) {
        _debug("Error creating rss parser for " . $feed['Link'] . "\n", -1);
    } else {
        if ($config_values['Global']['Feeds'][$feed['Link']]['items_count'] == 0) {
            unset($config_values['Global']['Feeds'][$feed['Link']]);
            return False;
        }
        $config_values['Global']['Feeds'][$feed['Link']]['URL'] = $feed['Link'];
        $config_values['Global']['Feeds'][$feed['Link']]['Feed Type'] = 'RSS';
    }
    return;
}
Ejemplo n.º 23
0
<?php

//google news
$apellidos = explode(" ", $parlamentario->getApellidos());
$news_url = 'http://news.google.cl/news?pz=1&cf=all&ned=es_cl&hl=es&q=%22' . $parlamentario->getNombre() . '+' . $apellidos[0] . '%22+source:%22Emol,+La+Tercera,+La+Segunda,+La+Nacion,+Terra,+LUN,+El+Mostrador,+El+mercurio+de+Valparaiso,+DIARIOS+CIUDADANOS,+Politicastereo,+Pol%C3%ADtica+Rock,+Cooperativa.cl,+El+Ciudadano,+El+Periodista,+Tendencia+Pol%C3%ADtica,+Ciperchile%22&cf=all&output=rss';
$news = new lastRSS();
$new = $news->get($news_url);
echo '<div class="list"><div class="yoo-tweet"><ul id="news_update_list" class="list">';
if ($new != null) {
    echo '<h3 class="tit">Noticias</h3>';
    foreach ($new['items'] as $i => $item) {
        echo '<li class="';
        echo fmod($i, 2) ? 'even' : 'odd';
        echo '">';
        //echo eregi_replace('USERNAME: '******'', $item['title']).'<br />';
        echo '<p class="text">' . $item['title'] . '</p>';
        echo '<p class="meta">' . link_to(date('jS F \\a\\t h:i a', strtotime($item['pubDate'])), $item['link'], 'title=' . $item['title']);
        echo '</p></li>';
    }
    echo '</ul></div></div>';
}
Ejemplo n.º 24
0
            } else {
                if (strpos($keywords, " ")) {
                    $keywords = str_replace(" ", ",or,", $keywords);
                }
            }
        }
    }
}
// Custom feed support
if (!empty($customFeedUrl)) {
    $feedUrl = $customFeedUrl;
} else {
    $feedUrl = $dataURLBase . '?' . $sortMethod . '&at=' . $associateId . '&isz=' . $gridCellSize . '&bg=' . $gridCellBgColor . '&src=zstore&pg=' . $startPage . $cg . '&ps=' . $showHowMany . '&ft=gb&opensearch=true&qs=' . $keywords . '&pt=' . $productType;
}
// Get our RSS data
if ($rs = $rss->get($feedUrl)) {
    // Get the total number of results from the opensearch: namespace in RSS
    $totalNum = isset($rs['opensearch:totalResults']) ? $rs['opensearch:totalResults'] : "";
    if ($showingEnd > $totalNum) {
        $showingEnd = $totalNum;
        // can't show more results than we have
    }
    $pagination = '';
    $paginationText = '';
    $paginationText2 = '';
    // Figure out how many pages we have for pagination, use this to generate pagination control html
    if ($rs['items_count'] > 0) {
        $totalPages = ceil($totalNum / $showHowMany);
        if ($totalPages > 1) {
            $pagination = $paginationText;
        }
Ejemplo n.º 25
0
    - get RSS file from URL
    - access and show fields of the result
======================================================================
*/
$_99 = $_GET['_99'];
require "./rss_indice.inc.php";
// include lastRSS
include "./lastRSS.php";
// Create lastRSS object
$rss = new lastRSS();
// Set cache dir and cache time limit (1200 seconds)
// (don't forget to chmod cahce dir to 777 to allow writing)
$rss->cache_dir = './temp';
$rss->cache_time = 1200;
// Try to load and parse RSS file
if ($rs = $rss->get($rssurl[$_99][1])) {
    // Show website logo (if presented)
    if ($rs[image_url] != '') {
        echo "<a href=\"{$rs['image_link']}\"><img src=\"{$rs['image_url']}\" alt=\"{$rs['image_title']}\" vspace=\"1\" border=\"0\" /></a><br />\n";
    }
    // Show clickable website title
    echo "<big><b><a href=\"{$rs['link']}\">{$rs['title']}</a></b></big><br />\n";
    // Show website description
    echo "{$rs['description']}<br />\n";
    // Show last published articles (title, link, description)
    echo "<ul>\n";
    foreach ($rs['items'] as $item) {
        echo "\t<li><a href=\"{$item['link']}\">" . $item['title'] . "</a><br />" . $item['description'] . "</li>\n";
    }
    echo "</ul>\n";
} else {
Ejemplo n.º 26
0
<?php

include "./lastRSS.php";
$rss = new lastRSS();
$rss->cache_dir = './temp';
$rss->cache_time = 1200;
$rss->date_format = 'd/m/Y';
if ($rs = $rss->get('http://feeds.feedburner.com/jkanime')) {
    // here we can work with RSS fields
} else {
    die('Error: RSS file not found...');
}
// Muestra titulo, enlace, fecha/hora y descripcion
echo "<div class='rss02'><ul>\n";
foreach ($rs['items'] as $item) {
    echo "\t<li><a href=\"{$item['link']}\">" . $item['title'] . "</a><br><div class='fecha'>" . $item['pubDate'] . "</div>" . $item['description'] . "</li>\n";
}
echo "</ul>\n";
echo "</div>";
function ShowRSSnodesc($url)
{
    global $rss, $phpbb_root_path, $user;
    // portal globals/cache
    global $k_config;
    // Create lastRSS object
    $rss = new lastRSS();
    if ($rs = $rss->get($url)) {
        $msg = "<br />";
        // check if fopen or curl is installed
        if (function_exists('curl_init') == false && $rss->type == 'curl') {
            $msg .= '<li class="gensmall">' . $user->lang['NO_CURL'] . '</li>';
        }
        if (ini_get('allow_url_fopen') == false && $rss->type == 'fopen') {
            //fopen not installed. throw error
            $msg .= '<li class="gensmall">' . $user->lang['NO_FOPEN'] . '</li>';
        }
        if (ini_get('allow_url_fopen') == '1' && $rss->type == 'fopen' or function_exists('curl_init') && $rss->type == 'curl') {
            if ($rs['items_count'] <= 0) {
                $msg .= '<li class="gensmall">' . $user->lang['RSS_CACHE_ERROR'] . '</li>';
                $msg .= '<li class="gensmall">' . $user->lang['RSS_FEED_ERROR'] . '</li>';
            } else {
                foreach ($rs['items'] as $item) {
                    $msg .= '<span class="gensmall"><img src="' . $phpbb_root_path . 'images/rss.png" title="" alt="" /> <a href="' . $item['link'] . '" rel="external">' . $item['title'] . '</a></span><br />';
                }
            }
            $msg .= "<br />";
        }
        return $msg;
    }
}
Ejemplo n.º 28
0
 function readCustomRss($feed_url)
 {
     require_once _base_ . "/addons/feeds/read/lastRSS.php";
     $rss = new lastRSS();
     $rss->cache_dir = "";
     $rss_array = $rss->get($feed_url);
     if (isset($rss_array["image_url"])) {
         $image = $rss_array["image_url"];
     } else {
         $image = "";
     }
     return $rss_array;
 }
Ejemplo n.º 29
0
/* 
RSS to Twitter v0.1
by paul stamatiou 
of http://paulstamatiou.com
based on code from
http://morethanseven.net/posts/posting-to-twitter-using-php
*/
include 'parse.php';
$uname = '';
//example "blah" for twitter.com/blah, or your email address
$pwd = '';
$twitter_url = 'http://twitter.com/statuses/update.xml';
$feed = "";
//the feed you want to micro-syndicate
$rss = new lastRSS();
if ($rs = $rss->get($feed)) {
    $title = $rs[items][0][title];
    $url = $rs[items][0][link];
} else {
    die('Error: RSS file not found, dude.');
}
$tiny_url = file_get_contents("http://tinyurl.com/api-create.php?url=" . $url);
$status = $title . " " . $tiny_url;
echo $status;
//just for status if you are directly viewing the script
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "{$twitter_url}");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status={$status}");
Ejemplo n.º 30
0
                            <div class="header">
                                <h4 class="title">Noticias</h4>
                                <p class="category">Diario financiero RSS</p>

<!--<script>
ajaxinclude("structure/rss/rss.php"); //Ruta al archivo con las noticias
</script>-->
                            </div>
                            <div class="container-fluid" style="height:300px; overflow-x: hidden;">
                                <?php 
include "structure/rss/lastRSS.php";
$rss = new lastRSS();
$rss->cache_dir = './temp';
$rss->cache_time = 1200;
// cargar archivo RSS
$rs = $rss->get('https://www.df.cl/noticias/site/list/port/rss.xml');
// Muestra titulo y enlace
echo "<dl>\n";
foreach ($rs['items'] as $item) {
    ?>
                                    <dt><a href='<?php 
    echo $item['link'];
    ?>
 '><?php 
    echo $item['title'];
    ?>
 </a>
                                        <p><?php 
    echo $item['description'];
    ?>
</p>