增加对空间支持的判断,获取feed方法更强大

This commit is contained in:
2012-10-18 13:51:08 +08:00
parent 510e6adcc6
commit 5849e9cdd0
4 changed files with 365 additions and 335 deletions

View File

@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Rss订阅
Version: 1.3.2
Version: 1.3.3
Plugin URL: http://xiaosong.org/tech/the-official-releas-of-rss-subscribe-plugin
Description: 订阅朋友的博客feed显示在自己博客~
Author: 小松
@@ -13,7 +13,7 @@ require_once(EMLOG_ROOT.'/content/plugins/lastRSS/lastRSS_config.php');
require_once(EMLOG_ROOT.'/content/plugins/lastRSS/lastRSS_class.php');
$rssparser = new lastRSS;
$rssparser->cache_dir = EMLOG_ROOT.'/content/cache/';
$rssparser->cache_time = $lastRSS_cache_time;
$rssparser->cache_time = $lastRSS_cache_time;
$rssparser->items_limit = $lastRSS_item_num > 3 ? 3 : $lastRSS_item_num;
$rssparser->CDATA = 'content';
$rssparser->cp = 'UTF-8';
@@ -93,25 +93,26 @@ function updateFeed($id, $url, $title){
}
function getTitle($rss_url){
global $rssparser;
$rss = $rssparser->get($rss_url);
$rss = $rssparser->Get($rss_url);
return $rss['title'];
}
function updateLogs(){
global $rssparser, $DB, $lastRSS_is_urlshort, $lastRSS_is_blank;
$feeds = getRssFeeds();
while ($item = $DB->fetch_array($feeds)) {
$rss = $rssparser->get($item['url']);
if(!empty($rss['items']))
foreach ($rss['items'] as $key => $data) {
$rssid = $item['id'];
$hash = md5($data['title']);
$checklog = isLogExists($rssid, $hash);
if ($checklog == 0) {
if (trim($data['title']) != '') {
$link = $lastRSS_is_urlshort ? urlShort($data['link']) : $data['link'];
$target = $lastRSS_is_blank ? ' target="_blank"' : '';
$log = '<a href="'.$link.'"'.$target.'>'.strip_tags($data['title']).'</a>';
insertLog($rssid, $log ,$hash);
$rss = $rssparser->Get($item['url']);
if(!empty($rss['items'])) {
foreach ($rss['items'] as $key => $data) {
$rssid = $item['id'];
$hash = md5($data['title']);
$checklog = isLogExists($rssid, $hash);
if ($checklog == 0) {
if (trim($data['title']) != '') {
$link = $lastRSS_is_urlshort ? urlShort($data['link']) : $data['link'];
$target = $lastRSS_is_blank ? ' target="_blank"' : '';
$log = '<a href="'.$link.'"'.$target.'>'.strip_tags($data['title']).'</a>';
insertLog($rssid, $log ,$hash);
}
}
}
}