@@ -5,7 +5,7 @@ A PHP-Based RSS and Atom Feed Framework
55Takes the hard work out of managing a complete RSS/Atom solution.
66
77Version: "Lemon Meringue"
8- Updated: 11 September 2006
8+ Updated: 15 September 2006
99Copyright: 2004-2006 Ryan Parman, Geoffrey Sneddon
1010http://simplepie.org
1111
@@ -26,7 +26,7 @@ class SimplePie
2626 // SimplePie Info
2727 var $ name = 'SimplePie ' ;
2828 var $ version = 'Lemon Meringue ' ;
29- var $ build = '20060911 ' ;
29+ var $ build = '20060915 ' ;
3030 var $ url = 'http://simplepie.org/ ' ;
3131 var $ useragent ;
3232 var $ linkback ;
@@ -37,6 +37,7 @@ class SimplePie
3737 // Options
3838 var $ rss_url ;
3939 var $ file ;
40+ var $ timeout ;
4041 var $ xml_dump = false ;
4142 var $ enable_cache = true ;
4243 var $ max_minutes = 60 ;
@@ -98,6 +99,11 @@ class SimplePie
9899 }
99100 }
100101
102+ function set_timeout ($ timeout = 10 )
103+ {
104+ $ this ->timeout = (int ) $ timeout ;
105+ }
106+
101107 function enable_xmldump ($ enable = false )
102108 {
103109 $ this ->xml_dump = (bool ) $ enable ;
270276 {
271277 $ headers ['if-none-match ' ] = $ this ->data ['etag ' ];
272278 }
273- $ file = new SimplePie_File ($ this ->rss_url , 1 , 5 , $ headers , $ this ->useragent );
279+ $ file = new SimplePie_File ($ this ->rss_url , $ this -> timeout / 10 , 5 , $ headers , $ this ->useragent );
274280 if ($ file ->success )
275281 {
276282 $ headers = $ file ->headers ();
306312 }
307313 else
308314 {
309- $ file = new SimplePie_File ($ this ->rss_url , 10 , 5 , null , $ this ->useragent );
315+ $ file = new SimplePie_File ($ this ->rss_url , $ this -> timeout , 5 , null , $ this ->useragent );
310316 }
311317 }
312318 if (!$ file ->success )
317323
318324 if (!SimplePie_Locator::is_feed ($ file ))
319325 {
320- $ locate = new SimplePie_Locator ($ file );
326+ $ locate = new SimplePie_Locator ($ file, $ this -> timeout , $ this -> useragent );
321327 $ feed = $ locate ->find ();
322328 if ($ feed )
323329 {
511517
512518 if ($ check )
513519 {
514- $ file = new SimplePie_File ($ favicon );
520+ $ file = new SimplePie_File ($ favicon, $ this -> timeout / 10 , 5 , null , $ this -> useragent );
515521 $ headers = $ file ->headers ();
516522 $ file ->close ();
517523
@@ -2037,7 +2043,7 @@ class SimplePie_File
20372043 $ out = "GET $ get HTTP/1.0 \r\n" ;
20382044 $ out .= "Host: $ url_parts [host]\r\n" ;
20392045 $ out .= "User-Agent: $ useragent \r\n" ;
2040- if (extension_loaded ( ' zlib ' ) && function_exists ('gzinflate ' ))
2046+ if (function_exists ('gzinflate ' ))
20412047 {
20422048 $ out .= "Accept-Encoding: gzip,deflate \r\n" ;
20432049 }
@@ -3362,20 +3368,23 @@ class SimplePie_Misc
33623368class SimplePie_Locator
33633369{
33643370 var $ useragent ;
3371+ var $ timeout ;
33653372 var $ file ;
33663373 var $ local ;
33673374 var $ elsewhere ;
33683375
3369- function SimplePie_Locator (&$ file )
3376+ function SimplePie_Locator (&$ file, $ timeout = 10 , $ useragent = null )
33703377 {
33713378 if (!is_a ($ file , 'SimplePie_File ' ))
33723379 {
3373- $ this ->file = new SimplePie_File ($ file );
3380+ $ this ->file = new SimplePie_File ($ file, $ timeout , $ useragent );
33743381 }
33753382 else
33763383 {
33773384 $ this ->file =& $ file ;
33783385 }
3386+ $ this ->useragent = $ useragent ;
3387+ $ this ->timeout = $ timeout ;
33793388 }
33803389
33813390
@@ -3386,8 +3395,6 @@ class SimplePie_Locator
33863395 return $ this ->file ->url ;
33873396 }
33883397
3389- $ this ->useragent = $ this ->file ->useragent ;
3390-
33913398 $ autodiscovery = $ this ->autodiscovery ($ this ->file );
33923399 if ($ autodiscovery )
33933400 {
@@ -3433,7 +3440,14 @@ class SimplePie_Locator
34333440 {
34343441 if (!is_a ($ file , 'SimplePie_File ' ))
34353442 {
3436- $ file2 = new SimplePie_File ($ file , 1 , 5 , null , $ this ->useragent );
3443+ if (isset ($ this ))
3444+ {
3445+ $ file2 = new SimplePie_File ($ file , $ this ->timeout , 5 , null , $ this ->useragent );
3446+ }
3447+ else
3448+ {
3449+ $ file2 = new SimplePie_File ($ file );
3450+ }
34373451 $ file2 ->body ();
34383452 $ file2 ->close ();
34393453 }
0 commit comments