Browse Source

https://github.com/ldleman/tightpipe/issues/1 - Des erreurs subsitent avec php 5.5.3...

idleman 7 years ago
parent
commit
dda1fde6b4
1 changed files with 6 additions and 5 deletions
  1. 6 5
      tightpipe.php

+ 6 - 5
tightpipe.php

@@ -170,7 +170,7 @@ if(!file_exists(CACHE_RSS) || (time()-filemtime(CACHE_RSS))>REFRESH_TIME ){
 		$feedManager->enable_cache(true);
 		$feedManager->force_feed(true);
 		$feedManager->set_feed_url($feed['url']);
-		$feedManager->set_useragent('Mozilla/4.0 PHPipe (PHP FEED PIPE) '.VERSION_NAME.' by idleman http://projet.idleman.fr/PHPipe');
+		$feedManager->set_useragent('Mozilla/4.0 Tightpipe (PHP FEED PIPE) '.VERSION_NAME.' by idleman https://github.com/ldleman/tightpipe');
 		if (!$feedManager->init()) var_dump($feedManager->error);
 		$feedManager->handle_content_type(); 
 		$parsedFeed->name = $feedManager->get_title();
@@ -184,7 +184,8 @@ if(!file_exists(CACHE_RSS) || (time()-filemtime(CACHE_RSS))>REFRESH_TIME ){
 			// Ne retient que les 100 premiers
 			if ($iEvents++>=100) break;
 			$event = (object) array();
-			foreach($item->get_categories() as $cat){
+			$categories = is_array($item->get_categories())?$item->get_categories() : array());
+			foreach($categories as $cat){
 				$event->category[] = $cat->term;
 			}
 			$event->guid = $item->get_id();
@@ -208,11 +209,11 @@ if(!file_exists(CACHE_RSS) || (time()-filemtime(CACHE_RSS))>REFRESH_TIME ){
 		$mixed[] = $parsedFeed;
 	}
 
-	$link = 'http://projet.idleman.fr/PHPipe';
+	$link = 'http://projet.idleman.fr/Tightpipe';
 	$rss = '<?xml version="1.0" encoding="UTF-8"?>
 	<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
 		<channel>
-					<title>PHPipe</title>
+					<title>Tightpipe</title>
 					<atom:link href="'.$link.'" rel="self" type="application/rss+xml"/>
 					<link>'.$link.'</link>
 					<description>Aggrégation des flux</description>
@@ -222,7 +223,7 @@ if(!file_exists(CACHE_RSS) || (time()-filemtime(CACHE_RSS))>REFRESH_TIME ){
 					<lastBuildDate>'.date('r', gmstrftime(time())) .'</lastBuildDate>
 					<sy:updatePeriod>hourly</sy:updatePeriod>
 					<sy:updateFrequency>1</sy:updateFrequency>
-					<generator>PHPipe (PHP Feed Pipe)</generator>';
+					<generator>Tightpipe (PHP Feed Pipe)</generator>';
 
 			usort($parsedEvents, 'rss_item_compare');