by Vojtech Semecky, webmaster @ webdot . cz Latest version, features, manual and examples: http://lastrss.webdot.cz/ http://lastrss.oslab.net/ ---------------------------------------------------------------------- LICENSE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. To read the license please visit http://www.gnu.org/copyleft/gpl.html ====================================================================== Переделка (с) MAX, http://maxsite.org/
Exemple #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;
    }
}
Exemple #2
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;
 }
 function rss()
 {
     $url = f('url');
     if (!$url) {
         $url = 'http://java5000.blogspot.com/feeds/posts/default?alt=rss';
     }
     require ROOT . 'lib/rss/lastRSS.php';
     $rss = new lastRSS();
     $str = $this->url2str($url, 1);
     if (!$str) {
         $data = $this->fmodel('rss')->peek(array('url' => $url));
         $data['valid'] = 2;
         $this->fmodel('rss')->save($data);
         $str = "";
     } else {
         cacheme($url, $str);
     }
     $result = $rss->ParseStr($str);
     if ($result["encoding"] && strcasecmp($result["encoding"], "utf-8") != 0) {
         $result = $rss->ParseStr(mb_convert_encoding($str, "UTF-8", $result["encoding"]));
     }
     foreach ($result["items"] as &$i) {
         $i["description"] = html_entity_decode($i["description"]);
         $i["description"] = preg_replace('/< *br *[\\/]?>/', "\n", $i["description"]);
         $i["description"] = preg_replace('|href=("?)|i', 'target=_blank href=${1}/self/out/rd?url=', $i["description"]);
         $i["link"] = preg_replace('/>$/', "", $i["link"]);
         if (!preg_match('/^https?\\:/', $i["link"])) {
             $i["link"] = "http://www.google.com/search?q=" . urlencode($i["title"]);
         }
     }
     $this->sv("rssresult", $result);
     $rsslist = $this->fmodel('rss')->peeks(array('valid' => 1));
     $this->sv("rssfeed", array_reverse($rsslist));
 }
Exemple #4
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;
	}
}
Exemple #5
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;
}
Exemple #6
0
function mod_rss($module_id, $cfg)
{
    cmsCore::includeFile('includes/rss/lastRSS.php');
    $rss = new lastRSS();
    $rss->cache_dir = PATH . '/cache';
    $rss->cache_time = (int) @$cfg['cachetime'] * 3600;
    $rss->cp = 'UTF-8';
    $rss->items_limit = $cfg['itemslimit'];
    $rs = $rss->Get($cfg['rssurl']);
    if (!$rs) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_rss')->assign('rs', $rs)->assign('cfg', $cfg)->display('mod_rss.tpl');
    return true;
}
 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;
 }
Exemple #8
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;
 }
Exemple #9
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";
}
}
// Just to be safe ;o)
if (!defined("ENT_COMPAT")) {
    define("ENT_COMPAT", 2);
}
if (!defined("ENT_NOQUOTES")) {
    define("ENT_NOQUOTES", 0);
}
if (!defined("ENT_QUOTES")) {
    define("ENT_QUOTES", 3);
}
DisplayHead("RSS Torrents");
// Get RSS feeds from Database
$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
Exemple #11
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$rss_cfg = rcms_parse_ini_file(CONFIG_PATH . 'rss_aggregator.ini', true);
$rss = new lastRSS();
$rss->cache_time = $rss_cfg['config']['cache_time'];
$rss->cache_dir = DATA_PATH . 'rss_cache';
$rss->items_limit = $system->config['num_of_latest'];
if (function_exists('iconv')) {
    $rss->default_cp = $system->config['encoding'];
    $rss->cp = $system->config['encoding'];
}
$rss->stripHTML = true;
if (!empty($rss_cfg['feeds'])) {
    foreach ($rss_cfg['feeds'] as $feed_url) {
        if ($feed = $rss->Get($feed_url)) {
            $i = 2;
            $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
            foreach ($feed['items'] as $id => $item) {
                if (empty($item['title'])) {
                    $item['title'] = $item['description'];
                }
                $item['title'] = mb_substr($item['title'], 0, $rss_cfg['config']['max_title_length']) . (mb_strlen($item['title']) > $rss_cfg['config']['max_title_length'] ? '...' : '');
                $item['description'] = mb_substr($item['description'], 0, $rss_cfg['config']['max_desc_length']) . (mb_strlen($item['description']) > $rss_cfg['config']['max_desc_length'] ? '...' : '');
                if (!empty($item['link'])) {
                    $result .= '<tr><td class="row' . $i . '"><a href="' . $rss->unhtmlentities($item['link']) . '"><abbr title="' . $item['description'] . '">' . $item['title'] . '</abbr></a></td></tr>';
                }
Exemple #12
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;
}
Exemple #13
0
</td>
<td rowspan='2' valign='top'>

<table width='100%'><thead><tr>
<th width=''>".
__("Addons & Themes", $text_domain).
"</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'> ".
Exemple #14
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;
}
Exemple #15
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>';
}
Exemple #16
0
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
require_once 'lastRSS.php';
require_once 'iCalcreator.class.php';
$lr = new lastRSS();
$data = $lr->Get("http://feeds.feedburner.com/danaevents");
/*print_r($data);
exit;*/
$v = new vcalendar();
// create a new calendar instance
$v->setConfig('unique_id', $data['link']);
// set your unique id
$v->setProperty('method', 'PUBLISH');
// required of some calendar software
$v->setConfig('filename', "danaevents-" . $v->getConfig('filename'));
$v->setXprop("X-WR-CALNAME", $data['title']);
$v->setXprop("X-WR-CALDESC", $data['description']);
foreach ($data['items'] as $item) {
    $lines = explode("\n", $item['description']);
    //<p>28/05/2008, 19:00 - 20:30</p>
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;
    }
}
Exemple #18
0
    
    
                  
 <div class="box box-warning collapsed-box">
                  <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>
Exemple #19
0
} else {
    echo <<<TWITTERWIDGET
\t\t<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
\t\t<h1 class="text-center">News</h1>
\t\t<article class="panel panel-default tweets col-md-4 col-md-push-8">
\t\t\t<header class="panel-heading">
\t\t\t\t<h3 class="panel-title">Tweets</h3>
\t\t\t</header>
\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
// require
require_once "inc/classes/lastRSS.php";
// Just to be safe ;o)
if (!defined("ENT_COMPAT")) {
    define("ENT_COMPAT", 2);
}
if (!defined("ENT_NOQUOTES")) {
    define("ENT_NOQUOTES", 0);
}
if (!defined("ENT_QUOTES")) {
    define("ENT_QUOTES", 3);
}
// Get RSS feeds from Database
$arURL = GetRSSLinks();
// create lastRSS object
$rss = new lastRSS();
// setup transparent cache
$cacheDir = $cfg['path'] . ".rsscache";
if (!checkDirectory($cacheDir, 0777)) {
    @error("Error with rss-cache-dir", "index.php?iid=index", "", array($cacheDir));
}
$rss->cache_dir = $cacheDir;
$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
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.readrss.tmpl");
// set vars
// Loop through each RSS feed
$rss_list = array();
Exemple #21
0
            <li' . ($action == 'thread' ? ' class="active"' : '') . '><a href="?action=thread" data-hash="true">最新帖子</a></li>
            <li' . ($action == 'comment' ? ' class="active"' : '') . '><a href="?action=comment" data-hash="true">最新评论</a></li>
        </ul>		
		';
?>
    
    	<div id="feed">

        	<?php 
//日志RSS地址
$xml = $nav[$action];
if ($xml) {
    //创建缓存目录
    $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") {
global $context_item;
/*
======================================================================
LastRSS bridge script- By Dynamic Drive (http://www.dynamicdrive.com)
Communicates between LastRSS.php to Advanced Ajax ticker script using Ajax. Returns RSS feed in XML format
Created: Feb 9th, 2006. Updated: Feb 9th, 2006
======================================================================
*/

header('Content-type: text/xml');

// include lastRSS
include_once('htdocs/javascript/jQuery/rsstickerajax/lastrss/lastRSS.php'); //path to lastRSS.php on your server from this script ("bridge.php")

// Create lastRSS object
$rss = new lastRSS();

// proxy support
$proxy_ip = $environment->getConfiguration('c_proxy_ip');
if ( !empty($proxy_ip) ) {
   $rss->setProxyIP($proxy_ip);
}
$proxy_port = $environment->getConfiguration('c_proxy_port');
if ( !empty($proxy_port) ) {
   $rss->setProxyPort($proxy_port);
}

$rss->cache_dir = 'cache'; //path to cache directory on your server from this script. Chmod 777!
$rss->date_format = 'M d, Y g:i:s A'; //date format of RSS item. See PHP date() function for possible input.

// List of RSS URLs
Exemple #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>';
}
                <div class="row">
                    <div class="col-md-6">
                        <div class="card ">
                            <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>
Exemple #25
0
======================================================================
lastRSS usage DEMO 2
----------------------------------------------------------------------
This example shows, how to
    - create lastRSS object
    - set transparent cache
    - 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)
Exemple #26
0
    $irc->async(function ($irc) {
        $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);
# http://podcastgen.sourceforge.net
#
# This is Free Software released under the GNU/GPL License.
############################################################
########### Security code, avoids cross-site scripting (Register Globals ON)
if (isset($_REQUEST['GLOBALS']) or isset($_REQUEST['absoluteurl']) or isset($_REQUEST['amilogged']) or isset($_REQUEST['theme_path'])) {
    exit;
}
########### 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 />
<?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'];
        ?>
Exemple #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);
Exemple #30
0
 /**
  * ADD News by cron
  * */
 public function CronNewsAction()
 {
     ini_set('max_execution_time', 0);
     $newsModel = new NewsModel();
     $sec_to_delete_news_from_feeds = $this->getParam("SEC_TO_DELETE_NEWS_FROM_FEEDS");
     $newsModel->deleteOldNews(date("Y-m-d H:i:s", time() - $sec_to_delete_news_from_feeds));
     $lastRSS = new lastRSS();
     $lastRSS->cache_dir = './rss_cache';
     $lastRSS->cache_time = 3600;
     // one hour
     $aNewsTreeFeeds = $newsModel->getAllNewsTreeFeeds("", true, true, true);
     foreach ($aNewsTreeFeeds as $newsTreeFeeds) {
         echo $newsTreeFeeds['url'];
         echo "<br>";
         $aFeeds = $lastRSS->Get($newsTreeFeeds['url']);
         echo "<pre>";
         //print_r($aFeeds);
         //print_r($newsTreeFeeds);
         //echo $newsTreeFeeds['last_parse_date']."<br>";
         $n = 0;
         if (is_array($aFeeds) && count($aFeeds) > 0 && is_array($aFeeds['items'])) {
             foreach ($aFeeds['items'] as $item) {
                 //print_r($item); echo "<hr>";
                 $pubDate = isset($item['pubDate']) ? $item['pubDate'] : date("Y-m-d H:i:s");
                 $title = isset($item['title']) ? $item['title'] : "";
                 $link = isset($item['link']) ? $item['link'] : "";
                 $description = isset($item['description']) ? $item['description'] : "";
                 $category = isset($item['category']) ? $item['category'] : "";
                 $enclosure = isset($item['enclosure']) ? $item['enclosure'] : "";
                 $enclosure_type = isset($item['enclosure_type']) ? $item['enclosure_type'] : "";
                 if (strtoupper($aFeeds['encoding']) != 'UTF-8') {
                     $title = iconv(strtoupper($aFeeds['encoding']), 'UTF-8', $title);
                     $description = iconv(strtoupper($aFeeds['encoding']), 'UTF-8', $description);
                     $category = iconv(strtoupper($aFeeds['encoding']), 'UTF-8', $category);
                     $enclosure = iconv(strtoupper($aFeeds['encoding']), 'UTF-8', $enclosure);
                 }
                 $short_text = $newsModel->getNWordsFromText($description, 40);
                 $pub_date = date("Y-m-d H:i:s", strtotime($pubDate));
                 if (!$newsTreeFeeds['category_tag'] || strtoupper($newsTreeFeeds['category_tag']) == strtoupper($category)) {
                     // if RSS-feeds have different categories => it should be same as in item
                     $pub_date_in_sec = strtotime($pub_date);
                     if ((!$newsTreeFeeds['last_parse_date'] || $newsTreeFeeds['last_parse_date'] < $pub_date) && time() - $sec_to_delete_news_from_feeds < $pub_date_in_sec) {
                         // not parsed yet
                         $n++;
                         $newsModel->addNews($newsTreeFeeds['id'], $title, $link, $short_text, $description, $category, $pub_date, $enclosure, $enclosure_type, 0, 0, 0, $newsTreeFeeds['text_parse_type']);
                         $newsModel->setParseDate($newsTreeFeeds['feed_id'], date("Y-m-d H:i:s"));
                     }
                 }
             }
         }
         echo "Added " . $n . " News";
         echo "</pre>";
         echo "<hr>";
     }
 }