Project

General

Profile

« Previous | Next » 

Revision b2e02eef

Added by Scott Ullrich over 16 years ago

Adding simplepie RSS system

View differences:

etc/inc/simplepie/LICENSE.txt
1
Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon.
2
All rights reserved.
3

  
4
Redistribution and use in source and binary forms, with or without modification, are 
5
permitted provided that the following conditions are met:
6

  
7
	* Redistributions of source code must retain the above copyright notice, this list of 
8
	  conditions and the following disclaimer.
9

  
10
	* Redistributions in binary form must reproduce the above copyright notice, this list 
11
	  of conditions and the following disclaimer in the documentation and/or other materials 
12
	  provided with the distribution.
13

  
14
	* Neither the name of the SimplePie Team nor the names of its contributors may be used 
15
	  to endorse or promote products derived from this software without specific prior 
16
	  written permission.
17

  
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS 
19
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
20
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 
21
AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
22
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
23
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
24
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
25
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
26
POSSIBILITY OF SUCH DAMAGE.
etc/inc/simplepie/simplepie.inc
1
<?php
2
/**
3
 * SimplePie
4
 *
5
 * A PHP-Based RSS and Atom Feed Framework.
6
 * Takes the hard work out of managing a complete RSS/Atom solution.
7
 *
8
 * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
9
 * All rights reserved.
10
 *
11
 * Redistribution and use in source and binary forms, with or without modification, are
12
 * permitted provided that the following conditions are met:
13
 *
14
 * 	* Redistributions of source code must retain the above copyright notice, this list of
15
 * 	  conditions and the following disclaimer.
16
 *
17
 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
18
 * 	  of conditions and the following disclaimer in the documentation and/or other materials
19
 * 	  provided with the distribution.
20
 *
21
 * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
22
 * 	  to endorse or promote products derived from this software without specific prior
23
 * 	  written permission.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
26
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
28
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
 * POSSIBILITY OF SUCH DAMAGE.
34
 *
35
 * @package SimplePie
36
 * @version 1.1.3
37
 * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
38
 * @author Ryan Parman
39
 * @author Geoffrey Sneddon
40
 * @link http://simplepie.org/ SimplePie
41
 * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums
42
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43
 * @todo phpDoc comments
44
 */
45

  
46
/**
47
 * SimplePie Name
48
 */
49
define('SIMPLEPIE_NAME', 'SimplePie');
50

  
51
/**
52
 * SimplePie Version
53
 */
54
define('SIMPLEPIE_VERSION', '1.1.3');
55

  
56
/**
57
 * SimplePie Build
58
 */
59
define('SIMPLEPIE_BUILD', 20081219);
60

  
61
/**
62
 * SimplePie Website URL
63
 */
64
define('SIMPLEPIE_URL', 'http://simplepie.org');
65

  
66
/**
67
 * SimplePie Useragent
68
 * @see SimplePie::set_useragent()
69
 */
70
define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
71

  
72
/**
73
 * SimplePie Linkback
74
 */
75
define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
76

  
77
/**
78
 * No Autodiscovery
79
 * @see SimplePie::set_autodiscovery_level()
80
 */
81
define('SIMPLEPIE_LOCATOR_NONE', 0);
82

  
83
/**
84
 * Feed Link Element Autodiscovery
85
 * @see SimplePie::set_autodiscovery_level()
86
 */
87
define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
88

  
89
/**
90
 * Local Feed Extension Autodiscovery
91
 * @see SimplePie::set_autodiscovery_level()
92
 */
93
define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
94

  
95
/**
96
 * Local Feed Body Autodiscovery
97
 * @see SimplePie::set_autodiscovery_level()
98
 */
99
define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
100

  
101
/**
102
 * Remote Feed Extension Autodiscovery
103
 * @see SimplePie::set_autodiscovery_level()
104
 */
105
define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
106

  
107
/**
108
 * Remote Feed Body Autodiscovery
109
 * @see SimplePie::set_autodiscovery_level()
110
 */
111
define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
112

  
113
/**
114
 * All Feed Autodiscovery
115
 * @see SimplePie::set_autodiscovery_level()
116
 */
117
define('SIMPLEPIE_LOCATOR_ALL', 31);
118

  
119
/**
120
 * No known feed type
121
 */
122
define('SIMPLEPIE_TYPE_NONE', 0);
123

  
124
/**
125
 * RSS 0.90
126
 */
127
define('SIMPLEPIE_TYPE_RSS_090', 1);
128

  
129
/**
130
 * RSS 0.91 (Netscape)
131
 */
132
define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
133

  
134
/**
135
 * RSS 0.91 (Userland)
136
 */
137
define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
138

  
139
/**
140
 * RSS 0.91 (both Netscape and Userland)
141
 */
142
define('SIMPLEPIE_TYPE_RSS_091', 6);
143

  
144
/**
145
 * RSS 0.92
146
 */
147
define('SIMPLEPIE_TYPE_RSS_092', 8);
148

  
149
/**
150
 * RSS 0.93
151
 */
152
define('SIMPLEPIE_TYPE_RSS_093', 16);
153

  
154
/**
155
 * RSS 0.94
156
 */
157
define('SIMPLEPIE_TYPE_RSS_094', 32);
158

  
159
/**
160
 * RSS 1.0
161
 */
162
define('SIMPLEPIE_TYPE_RSS_10', 64);
163

  
164
/**
165
 * RSS 2.0
166
 */
167
define('SIMPLEPIE_TYPE_RSS_20', 128);
168

  
169
/**
170
 * RDF-based RSS
171
 */
172
define('SIMPLEPIE_TYPE_RSS_RDF', 65);
173

  
174
/**
175
 * Non-RDF-based RSS (truly intended as syndication format)
176
 */
177
define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
178

  
179
/**
180
 * All RSS
181
 */
182
define('SIMPLEPIE_TYPE_RSS_ALL', 255);
183

  
184
/**
185
 * Atom 0.3
186
 */
187
define('SIMPLEPIE_TYPE_ATOM_03', 256);
188

  
189
/**
190
 * Atom 1.0
191
 */
192
define('SIMPLEPIE_TYPE_ATOM_10', 512);
193

  
194
/**
195
 * All Atom
196
 */
197
define('SIMPLEPIE_TYPE_ATOM_ALL', 768);
198

  
199
/**
200
 * All feed types
201
 */
202
define('SIMPLEPIE_TYPE_ALL', 1023);
203

  
204
/**
205
 * No construct
206
 */
207
define('SIMPLEPIE_CONSTRUCT_NONE', 0);
208

  
209
/**
210
 * Text construct
211
 */
212
define('SIMPLEPIE_CONSTRUCT_TEXT', 1);
213

  
214
/**
215
 * HTML construct
216
 */
217
define('SIMPLEPIE_CONSTRUCT_HTML', 2);
218

  
219
/**
220
 * XHTML construct
221
 */
222
define('SIMPLEPIE_CONSTRUCT_XHTML', 4);
223

  
224
/**
225
 * base64-encoded construct
226
 */
227
define('SIMPLEPIE_CONSTRUCT_BASE64', 8);
228

  
229
/**
230
 * IRI construct
231
 */
232
define('SIMPLEPIE_CONSTRUCT_IRI', 16);
233

  
234
/**
235
 * A construct that might be HTML
236
 */
237
define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
238

  
239
/**
240
 * All constructs
241
 */
242
define('SIMPLEPIE_CONSTRUCT_ALL', 63);
243

  
244
/**
245
 * PCRE for HTML attributes
246
 */
247
define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
248

  
249
/**
250
 * PCRE for XML attributes
251
 */
252
define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
253

  
254
/**
255
 * XML Namespace
256
 */
257
define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace');
258

  
259
/**
260
 * Atom 1.0 Namespace
261
 */
262
define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom');
263

  
264
/**
265
 * Atom 0.3 Namespace
266
 */
267
define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#');
268

  
269
/**
270
 * RDF Namespace
271
 */
272
define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
273

  
274
/**
275
 * RSS 0.90 Namespace
276
 */
277
define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/');
278

  
279
/**
280
 * RSS 1.0 Namespace
281
 */
282
define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/');
283

  
284
/**
285
 * RSS 1.0 Content Module Namespace
286
 */
287
define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
288

  
289
/**
290
 * RSS 2.0 Namespace
291
 * (Stupid, I know, but I'm certain it will confuse people less with support.)
292
 */
293
define('SIMPLEPIE_NAMESPACE_RSS_20', '');
294

  
295
/**
296
 * DC 1.0 Namespace
297
 */
298
define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/');
299

  
300
/**
301
 * DC 1.1 Namespace
302
 */
303
define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/');
304

  
305
/**
306
 * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace
307
 */
308
define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#');
309

  
310
/**
311
 * GeoRSS Namespace
312
 */
313
define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss');
314

  
315
/**
316
 * Media RSS Namespace
317
 */
318
define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
319

  
320
/**
321
 * Wrong Media RSS Namespace
322
 */
323
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
324

  
325
/**
326
 * iTunes RSS Namespace
327
 */
328
define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
329

  
330
/**
331
 * XHTML Namespace
332
 */
333
define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml');
334

  
335
/**
336
 * IANA Link Relations Registry
337
 */
338
define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/');
339

  
340
/**
341
 * Whether we're running on PHP5
342
 */
343
define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
344

  
345
/**
346
 * No file source
347
 */
348
define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
349

  
350
/**
351
 * Remote file source
352
 */
353
define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
354

  
355
/**
356
 * Local file source
357
 */
358
define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
359

  
360
/**
361
 * fsockopen() file source
362
 */
363
define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
364

  
365
/**
366
 * cURL file source
367
 */
368
define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
369

  
370
/**
371
 * file_get_contents() file source
372
 */
373
define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
374

  
375
/**
376
 * SimplePie
377
 *
378
 * @package SimplePie
379
 * @version "Razzleberry"
380
 * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
381
 * @author Ryan Parman
382
 * @author Geoffrey Sneddon
383
 * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
384
 */
385
class SimplePie
386
{
387
	/**
388
	 * @var array Raw data
389
	 * @access private
390
	 */
391
	var $data = array();
392

  
393
	/**
394
	 * @var mixed Error string
395
	 * @access private
396
	 */
397
	var $error;
398

  
399
	/**
400
	 * @var object Instance of SimplePie_Sanitize (or other class)
401
	 * @see SimplePie::set_sanitize_class()
402
	 * @access private
403
	 */
404
	var $sanitize;
405

  
406
	/**
407
	 * @var string SimplePie Useragent
408
	 * @see SimplePie::set_useragent()
409
	 * @access private
410
	 */
411
	var $useragent = SIMPLEPIE_USERAGENT;
412

  
413
	/**
414
	 * @var string Feed URL
415
	 * @see SimplePie::set_feed_url()
416
	 * @access private
417
	 */
418
	var $feed_url;
419

  
420
	/**
421
	 * @var object Instance of SimplePie_File to use as a feed
422
	 * @see SimplePie::set_file()
423
	 * @access private
424
	 */
425
	var $file;
426

  
427
	/**
428
	 * @var string Raw feed data
429
	 * @see SimplePie::set_raw_data()
430
	 * @access private
431
	 */
432
	var $raw_data;
433

  
434
	/**
435
	 * @var int Timeout for fetching remote files
436
	 * @see SimplePie::set_timeout()
437
	 * @access private
438
	 */
439
	var $timeout = 10;
440

  
441
	/**
442
	 * @var bool Forces fsockopen() to be used for remote files instead
443
	 * of cURL, even if a new enough version is installed
444
	 * @see SimplePie::force_fsockopen()
445
	 * @access private
446
	 */
447
	var $force_fsockopen = false;
448

  
449
	/**
450
	 * @var bool Force the given data/URL to be treated as a feed no matter what
451
	 * it appears like
452
	 * @see SimplePie::force_feed()
453
	 * @access private
454
	 */
455
	var $force_feed = false;
456

  
457
	/**
458
	 * @var bool Enable/Disable XML dump
459
	 * @see SimplePie::enable_xml_dump()
460
	 * @access private
461
	 */
462
	var $xml_dump = false;
463

  
464
	/**
465
	 * @var bool Enable/Disable Caching
466
	 * @see SimplePie::enable_cache()
467
	 * @access private
468
	 */
469
	var $cache = true;
470

  
471
	/**
472
	 * @var int Cache duration (in seconds)
473
	 * @see SimplePie::set_cache_duration()
474
	 * @access private
475
	 */
476
	var $cache_duration = 3600;
477

  
478
	/**
479
	 * @var int Auto-discovery cache duration (in seconds)
480
	 * @see SimplePie::set_autodiscovery_cache_duration()
481
	 * @access private
482
	 */
483
	var $autodiscovery_cache_duration = 604800; // 7 Days.
484

  
485
	/**
486
	 * @var string Cache location (relative to executing script)
487
	 * @see SimplePie::set_cache_location()
488
	 * @access private
489
	 */
490
	var $cache_location = './cache';
491

  
492
	/**
493
	 * @var string Function that creates the cache filename
494
	 * @see SimplePie::set_cache_name_function()
495
	 * @access private
496
	 */
497
	var $cache_name_function = 'md5';
498

  
499
	/**
500
	 * @var bool Reorder feed by date descending
501
	 * @see SimplePie::enable_order_by_date()
502
	 * @access private
503
	 */
504
	var $order_by_date = true;
505

  
506
	/**
507
	 * @var mixed Force input encoding to be set to the follow value
508
	 * (false, or anything type-cast to false, disables this feature)
509
	 * @see SimplePie::set_input_encoding()
510
	 * @access private
511
	 */
512
	var $input_encoding = false;
513

  
514
	/**
515
	 * @var int Feed Autodiscovery Level
516
	 * @see SimplePie::set_autodiscovery_level()
517
	 * @access private
518
	 */
519
	var $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
520

  
521
	/**
522
	 * @var string Class used for caching feeds
523
	 * @see SimplePie::set_cache_class()
524
	 * @access private
525
	 */
526
	var $cache_class = 'SimplePie_Cache';
527

  
528
	/**
529
	 * @var string Class used for locating feeds
530
	 * @see SimplePie::set_locator_class()
531
	 * @access private
532
	 */
533
	var $locator_class = 'SimplePie_Locator';
534

  
535
	/**
536
	 * @var string Class used for parsing feeds
537
	 * @see SimplePie::set_parser_class()
538
	 * @access private
539
	 */
540
	var $parser_class = 'SimplePie_Parser';
541

  
542
	/**
543
	 * @var string Class used for fetching feeds
544
	 * @see SimplePie::set_file_class()
545
	 * @access private
546
	 */
547
	var $file_class = 'SimplePie_File';
548

  
549
	/**
550
	 * @var string Class used for items
551
	 * @see SimplePie::set_item_class()
552
	 * @access private
553
	 */
554
	var $item_class = 'SimplePie_Item';
555

  
556
	/**
557
	 * @var string Class used for authors
558
	 * @see SimplePie::set_author_class()
559
	 * @access private
560
	 */
561
	var $author_class = 'SimplePie_Author';
562

  
563
	/**
564
	 * @var string Class used for categories
565
	 * @see SimplePie::set_category_class()
566
	 * @access private
567
	 */
568
	var $category_class = 'SimplePie_Category';
569

  
570
	/**
571
	 * @var string Class used for enclosures
572
	 * @see SimplePie::set_enclosures_class()
573
	 * @access private
574
	 */
575
	var $enclosure_class = 'SimplePie_Enclosure';
576

  
577
	/**
578
	 * @var string Class used for Media RSS <media:text> captions
579
	 * @see SimplePie::set_caption_class()
580
	 * @access private
581
	 */
582
	var $caption_class = 'SimplePie_Caption';
583

  
584
	/**
585
	 * @var string Class used for Media RSS <media:copyright>
586
	 * @see SimplePie::set_copyright_class()
587
	 * @access private
588
	 */
589
	var $copyright_class = 'SimplePie_Copyright';
590

  
591
	/**
592
	 * @var string Class used for Media RSS <media:credit>
593
	 * @see SimplePie::set_credit_class()
594
	 * @access private
595
	 */
596
	var $credit_class = 'SimplePie_Credit';
597

  
598
	/**
599
	 * @var string Class used for Media RSS <media:rating>
600
	 * @see SimplePie::set_rating_class()
601
	 * @access private
602
	 */
603
	var $rating_class = 'SimplePie_Rating';
604

  
605
	/**
606
	 * @var string Class used for Media RSS <media:restriction>
607
	 * @see SimplePie::set_restriction_class()
608
	 * @access private
609
	 */
610
	var $restriction_class = 'SimplePie_Restriction';
611

  
612
	/**
613
	 * @var string Class used for content-type sniffing
614
	 * @see SimplePie::set_content_type_sniffer_class()
615
	 * @access private
616
	 */
617
	var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
618

  
619
	/**
620
	 * @var string Class used for item sources.
621
	 * @see SimplePie::set_source_class()
622
	 * @access private
623
	 */
624
	var $source_class = 'SimplePie_Source';
625

  
626
	/**
627
	 * @var mixed Set javascript query string parameter (false, or
628
	 * anything type-cast to false, disables this feature)
629
	 * @see SimplePie::set_javascript()
630
	 * @access private
631
	 */
632
	var $javascript = 'js';
633

  
634
	/**
635
	 * @var int Maximum number of feeds to check with autodiscovery
636
	 * @see SimplePie::set_max_checked_feeds()
637
	 * @access private
638
	 */
639
	var $max_checked_feeds = 10;
640

  
641
	/**
642
	 * @var string Web-accessible path to the handler_favicon.php file.
643
	 * @see SimplePie::set_favicon_handler()
644
	 * @access private
645
	 */
646
	var $favicon_handler = '';
647

  
648
	/**
649
	 * @var string Web-accessible path to the handler_image.php file.
650
	 * @see SimplePie::set_image_handler()
651
	 * @access private
652
	 */
653
	var $image_handler = '';
654

  
655
	/**
656
	 * @var array Stores the URLs when multiple feeds are being initialized.
657
	 * @see SimplePie::set_feed_url()
658
	 * @access private
659
	 */
660
	var $multifeed_url = array();
661

  
662
	/**
663
	 * @var array Stores SimplePie objects when multiple feeds initialized.
664
	 * @access private
665
	 */
666
	var $multifeed_objects = array();
667

  
668
	/**
669
	 * @var array Stores the get_object_vars() array for use with multifeeds.
670
	 * @see SimplePie::set_feed_url()
671
	 * @access private
672
	 */
673
	var $config_settings = null;
674

  
675
	/**
676
	 * @var integer Stores the number of items to return per-feed with multifeeds.
677
	 * @see SimplePie::set_item_limit()
678
	 * @access private
679
	 */
680
	var $item_limit = 0;
681

  
682
	/**
683
	 * @var array Stores the default attributes to be stripped by strip_attributes().
684
	 * @see SimplePie::strip_attributes()
685
	 * @access private
686
	 */
687
	var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
688

  
689
	/**
690
	 * @var array Stores the default tags to be stripped by strip_htmltags().
691
	 * @see SimplePie::strip_htmltags()
692
	 * @access private
693
	 */
694
	var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
695

  
696
	/**
697
	 * The SimplePie class contains feed level data and options
698
	 *
699
	 * There are two ways that you can create a new SimplePie object. The first
700
	 * is by passing a feed URL as a parameter to the SimplePie constructor
701
	 * (as well as optionally setting the cache location and cache expiry). This
702
	 * will initialise the whole feed with all of the default settings, and you
703
	 * can begin accessing methods and properties immediately.
704
	 *
705
	 * The second way is to create the SimplePie object with no parameters
706
	 * at all. This will enable you to set configuration options. After setting
707
	 * them, you must initialise the feed using $feed->init(). At that point the
708
	 * object's methods and properties will be available to you. This format is
709
	 * what is used throughout this documentation.
710
	 *
711
	 * @access public
712
	 * @since 1.0 Preview Release
713
	 * @param string $feed_url This is the URL you want to parse.
714
	 * @param string $cache_location This is where you want the cache to be stored.
715
	 * @param int $cache_duration This is the number of seconds that you want to store the cache file for.
716
	 */
717
	function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
718
	{
719
		// Other objects, instances created here so we can set options on them
720
		$this->sanitize =& new SimplePie_Sanitize;
721

  
722
		// Set options if they're passed to the constructor
723
		if ($cache_location !== null)
724
		{
725
			$this->set_cache_location($cache_location);
726
		}
727

  
728
		if ($cache_duration !== null)
729
		{
730
			$this->set_cache_duration($cache_duration);
731
		}
732

  
733
		// Only init the script if we're passed a feed URL
734
		if ($feed_url !== null)
735
		{
736
			$this->set_feed_url($feed_url);
737
			$this->init();
738
		}
739
	}
740

  
741
	/**
742
	 * Used for converting object to a string
743
	 */
744
	function __toString()
745
	{
746
		return md5(serialize($this->data));
747
	}
748

  
749
	/**
750
	 * Remove items that link back to this before destroying this object
751
	 */
752
	function __destruct()
753
	{
754
		if (!empty($this->data['items']))
755
		{
756
			foreach ($this->data['items'] as $item)
757
			{
758
				$item->__destruct();
759
			}
760
			unset($this->data['items']);
761
		}
762
		if (!empty($this->data['ordered_items']))
763
		{
764
			foreach ($this->data['ordered_items'] as $item)
765
			{
766
				$item->__destruct();
767
			}
768
			unset($this->data['ordered_items']);
769
		}
770
	}
771

  
772
	/**
773
	 * Force the given data/URL to be treated as a feed no matter what it
774
	 * appears like
775
	 *
776
	 * @access public
777
	 * @since 1.1
778
	 * @param bool $enable Force the given data/URL to be treated as a feed
779
	 */
780
	function force_feed($enable = false)
781
	{
782
		$this->force_feed = (bool) $enable;
783
	}
784

  
785
	/**
786
	 * This is the URL of the feed you want to parse.
787
	 *
788
	 * This allows you to enter the URL of the feed you want to parse, or the
789
	 * website you want to try to use auto-discovery on. This takes priority
790
	 * over any set raw data.
791
	 *
792
	 * You can set multiple feeds to mash together by passing an array instead
793
	 * of a string for the $url. Remember that with each additional feed comes
794
	 * additional processing and resources.
795
	 *
796
	 * @access public
797
	 * @since 1.0 Preview Release
798
	 * @param mixed $url This is the URL (or array of URLs) that you want to parse.
799
	 * @see SimplePie::set_raw_data()
800
	 */
801
	function set_feed_url($url)
802
	{
803
		if (is_array($url))
804
		{
805
			$this->multifeed_url = array();
806
			foreach ($url as $value)
807
			{
808
				$this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
809
			}
810
		}
811
		else
812
		{
813
			$this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
814
		}
815
	}
816

  
817
	/**
818
	 * Provides an instance of SimplePie_File to use as a feed
819
	 *
820
	 * @access public
821
	 * @param object &$file Instance of SimplePie_File (or subclass)
822
	 * @return bool True on success, false on failure
823
	 */
824
	function set_file(&$file)
825
	{
826
		if (is_a($file, 'SimplePie_File'))
827
		{
828
			$this->feed_url = $file->url;
829
			$this->file =& $file;
830
			return true;
831
		}
832
		return false;
833
	}
834

  
835
	/**
836
	 * Allows you to use a string of RSS/Atom data instead of a remote feed.
837
	 *
838
	 * If you have a feed available as a string in PHP, you can tell SimplePie
839
	 * to parse that data string instead of a remote feed. Any set feed URL
840
	 * takes precedence.
841
	 *
842
	 * @access public
843
	 * @since 1.0 Beta 3
844
	 * @param string $data RSS or Atom data as a string.
845
	 * @see SimplePie::set_feed_url()
846
	 */
847
	function set_raw_data($data)
848
	{
849
		$this->raw_data = $data;
850
	}
851

  
852
	/**
853
	 * Allows you to override the default timeout for fetching remote feeds.
854
	 *
855
	 * This allows you to change the maximum time the feed's server to respond
856
	 * and send the feed back.
857
	 *
858
	 * @access public
859
	 * @since 1.0 Beta 3
860
	 * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
861
	 */
862
	function set_timeout($timeout = 10)
863
	{
864
		$this->timeout = (int) $timeout;
865
	}
866

  
867
	/**
868
	 * Forces SimplePie to use fsockopen() instead of the preferred cURL
869
	 * functions.
870
	 *
871
	 * @access public
872
	 * @since 1.0 Beta 3
873
	 * @param bool $enable Force fsockopen() to be used
874
	 */
875
	function force_fsockopen($enable = false)
876
	{
877
		$this->force_fsockopen = (bool) $enable;
878
	}
879

  
880
	/**
881
	 * Outputs the raw XML content of the feed, after it has gone through
882
	 * SimplePie's filters.
883
	 *
884
	 * Used only for debugging, this function will output the XML content as
885
	 * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up
886
	 * before trying to parse it. Many parts of the feed are re-written in
887
	 * memory, and in the end, you have a parsable feed. XML dump shows you the
888
	 * actual XML that SimplePie tries to parse, which may or may not be very
889
	 * different from the original feed.
890
	 *
891
	 * @access public
892
	 * @since 1.0 Preview Release
893
	 * @param bool $enable Enable XML dump
894
	 */
895
	function enable_xml_dump($enable = false)
896
	{
897
		$this->xml_dump = (bool) $enable;
898
	}
899

  
900
	/**
901
	 * Enables/disables caching in SimplePie.
902
	 *
903
	 * This option allows you to disable caching all-together in SimplePie.
904
	 * However, disabling the cache can lead to longer load times.
905
	 *
906
	 * @access public
907
	 * @since 1.0 Preview Release
908
	 * @param bool $enable Enable caching
909
	 */
910
	function enable_cache($enable = true)
911
	{
912
		$this->cache = (bool) $enable;
913
	}
914

  
915
	/**
916
	 * Set the length of time (in seconds) that the contents of a feed
917
	 * will be cached.
918
	 *
919
	 * @access public
920
	 * @param int $seconds The feed content cache duration.
921
	 */
922
	function set_cache_duration($seconds = 3600)
923
	{
924
		$this->cache_duration = (int) $seconds;
925
	}
926

  
927
	/**
928
	 * Set the length of time (in seconds) that the autodiscovered feed
929
	 * URL will be cached.
930
	 *
931
	 * @access public
932
	 * @param int $seconds The autodiscovered feed URL cache duration.
933
	 */
934
	function set_autodiscovery_cache_duration($seconds = 604800)
935
	{
936
		$this->autodiscovery_cache_duration = (int) $seconds;
937
	}
938

  
939
	/**
940
	 * Set the file system location where the cached files should be stored.
941
	 *
942
	 * @access public
943
	 * @param string $location The file system location.
944
	 */
945
	function set_cache_location($location = './cache')
946
	{
947
		$this->cache_location = (string) $location;
948
	}
949

  
950
	/**
951
	 * Determines whether feed items should be sorted into reverse chronological order.
952
	 *
953
	 * @access public
954
	 * @param bool $enable Sort as reverse chronological order.
955
	 */
956
	function enable_order_by_date($enable = true)
957
	{
958
		$this->order_by_date = (bool) $enable;
959
	}
960

  
961
	/**
962
	 * Allows you to override the character encoding reported by the feed.
963
	 *
964
	 * @access public
965
	 * @param string $encoding Character encoding.
966
	 */
967
	function set_input_encoding($encoding = false)
968
	{
969
		if ($encoding)
970
		{
971
			$this->input_encoding = (string) $encoding;
972
		}
973
		else
974
		{
975
			$this->input_encoding = false;
976
		}
977
	}
978

  
979
	/**
980
	 * Set how much feed autodiscovery to do
981
	 *
982
	 * @access public
983
	 * @see SIMPLEPIE_LOCATOR_NONE
984
	 * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY
985
	 * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
986
	 * @see SIMPLEPIE_LOCATOR_LOCAL_BODY
987
	 * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
988
	 * @see SIMPLEPIE_LOCATOR_REMOTE_BODY
989
	 * @see SIMPLEPIE_LOCATOR_ALL
990
	 * @param int $level Feed Autodiscovery Level (level can be a
991
	 * combination of the above constants, see bitwise OR operator)
992
	 */
993
	function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
994
	{
995
		$this->autodiscovery = (int) $level;
996
	}
997

  
998
	/**
999
	 * Allows you to change which class SimplePie uses for caching.
1000
	 * Useful when you are overloading or extending SimplePie's default classes.
1001
	 *
1002
	 * @access public
1003
	 * @param string $class Name of custom class.
1004
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1005
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1006
	 */
1007
	function set_cache_class($class = 'SimplePie_Cache')
1008
	{
1009
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache'))
1010
		{
1011
			$this->cache_class = $class;
1012
			return true;
1013
		}
1014
		return false;
1015
	}
1016

  
1017
	/**
1018
	 * Allows you to change which class SimplePie uses for auto-discovery.
1019
	 * Useful when you are overloading or extending SimplePie's default classes.
1020
	 *
1021
	 * @access public
1022
	 * @param string $class Name of custom class.
1023
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1024
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1025
	 */
1026
	function set_locator_class($class = 'SimplePie_Locator')
1027
	{
1028
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator'))
1029
		{
1030
			$this->locator_class = $class;
1031
			return true;
1032
		}
1033
		return false;
1034
	}
1035

  
1036
	/**
1037
	 * Allows you to change which class SimplePie uses for XML parsing.
1038
	 * Useful when you are overloading or extending SimplePie's default classes.
1039
	 *
1040
	 * @access public
1041
	 * @param string $class Name of custom class.
1042
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1043
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1044
	 */
1045
	function set_parser_class($class = 'SimplePie_Parser')
1046
	{
1047
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser'))
1048
		{
1049
			$this->parser_class = $class;
1050
			return true;
1051
		}
1052
		return false;
1053
	}
1054

  
1055
	/**
1056
	 * Allows you to change which class SimplePie uses for remote file fetching.
1057
	 * Useful when you are overloading or extending SimplePie's default classes.
1058
	 *
1059
	 * @access public
1060
	 * @param string $class Name of custom class.
1061
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1062
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1063
	 */
1064
	function set_file_class($class = 'SimplePie_File')
1065
	{
1066
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File'))
1067
		{
1068
			$this->file_class = $class;
1069
			return true;
1070
		}
1071
		return false;
1072
	}
1073

  
1074
	/**
1075
	 * Allows you to change which class SimplePie uses for data sanitization.
1076
	 * Useful when you are overloading or extending SimplePie's default classes.
1077
	 *
1078
	 * @access public
1079
	 * @param string $class Name of custom class.
1080
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1081
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1082
	 */
1083
	function set_sanitize_class($class = 'SimplePie_Sanitize')
1084
	{
1085
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
1086
		{
1087
			$this->sanitize =& new $class;
1088
			return true;
1089
		}
1090
		return false;
1091
	}
1092

  
1093
	/**
1094
	 * Allows you to change which class SimplePie uses for handling feed items.
1095
	 * Useful when you are overloading or extending SimplePie's default classes.
1096
	 *
1097
	 * @access public
1098
	 * @param string $class Name of custom class.
1099
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1100
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1101
	 */
1102
	function set_item_class($class = 'SimplePie_Item')
1103
	{
1104
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item'))
1105
		{
1106
			$this->item_class = $class;
1107
			return true;
1108
		}
1109
		return false;
1110
	}
1111

  
1112
	/**
1113
	 * Allows you to change which class SimplePie uses for handling author data.
1114
	 * Useful when you are overloading or extending SimplePie's default classes.
1115
	 *
1116
	 * @access public
1117
	 * @param string $class Name of custom class.
1118
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1119
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1120
	 */
1121
	function set_author_class($class = 'SimplePie_Author')
1122
	{
1123
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author'))
1124
		{
1125
			$this->author_class = $class;
1126
			return true;
1127
		}
1128
		return false;
1129
	}
1130

  
1131
	/**
1132
	 * Allows you to change which class SimplePie uses for handling category data.
1133
	 * Useful when you are overloading or extending SimplePie's default classes.
1134
	 *
1135
	 * @access public
1136
	 * @param string $class Name of custom class.
1137
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1138
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1139
	 */
1140
	function set_category_class($class = 'SimplePie_Category')
1141
	{
1142
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category'))
1143
		{
1144
			$this->category_class = $class;
1145
			return true;
1146
		}
1147
		return false;
1148
	}
1149

  
1150
	/**
1151
	 * Allows you to change which class SimplePie uses for feed enclosures.
1152
	 * Useful when you are overloading or extending SimplePie's default classes.
1153
	 *
1154
	 * @access public
1155
	 * @param string $class Name of custom class.
1156
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1157
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1158
	 */
1159
	function set_enclosure_class($class = 'SimplePie_Enclosure')
1160
	{
1161
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure'))
1162
		{
1163
			$this->enclosure_class = $class;
1164
			return true;
1165
		}
1166
		return false;
1167
	}
1168

  
1169
	/**
1170
	 * Allows you to change which class SimplePie uses for <media:text> captions
1171
	 * Useful when you are overloading or extending SimplePie's default classes.
1172
	 *
1173
	 * @access public
1174
	 * @param string $class Name of custom class.
1175
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1176
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1177
	 */
1178
	function set_caption_class($class = 'SimplePie_Caption')
1179
	{
1180
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption'))
1181
		{
1182
			$this->caption_class = $class;
1183
			return true;
1184
		}
1185
		return false;
1186
	}
1187

  
1188
	/**
1189
	 * Allows you to change which class SimplePie uses for <media:copyright>
1190
	 * Useful when you are overloading or extending SimplePie's default classes.
1191
	 *
1192
	 * @access public
1193
	 * @param string $class Name of custom class.
1194
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1195
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1196
	 */
1197
	function set_copyright_class($class = 'SimplePie_Copyright')
1198
	{
1199
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright'))
1200
		{
1201
			$this->copyright_class = $class;
1202
			return true;
1203
		}
1204
		return false;
1205
	}
1206

  
1207
	/**
1208
	 * Allows you to change which class SimplePie uses for <media:credit>
1209
	 * Useful when you are overloading or extending SimplePie's default classes.
1210
	 *
1211
	 * @access public
1212
	 * @param string $class Name of custom class.
1213
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1214
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1215
	 */
1216
	function set_credit_class($class = 'SimplePie_Credit')
1217
	{
1218
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit'))
1219
		{
1220
			$this->credit_class = $class;
1221
			return true;
1222
		}
1223
		return false;
1224
	}
1225

  
1226
	/**
1227
	 * Allows you to change which class SimplePie uses for <media:rating>
1228
	 * Useful when you are overloading or extending SimplePie's default classes.
1229
	 *
1230
	 * @access public
1231
	 * @param string $class Name of custom class.
1232
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1233
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1234
	 */
1235
	function set_rating_class($class = 'SimplePie_Rating')
1236
	{
1237
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating'))
1238
		{
1239
			$this->rating_class = $class;
1240
			return true;
1241
		}
1242
		return false;
1243
	}
1244

  
1245
	/**
1246
	 * Allows you to change which class SimplePie uses for <media:restriction>
1247
	 * Useful when you are overloading or extending SimplePie's default classes.
1248
	 *
1249
	 * @access public
1250
	 * @param string $class Name of custom class.
1251
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1252
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1253
	 */
1254
	function set_restriction_class($class = 'SimplePie_Restriction')
1255
	{
1256
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction'))
1257
		{
1258
			$this->restriction_class = $class;
1259
			return true;
1260
		}
1261
		return false;
1262
	}
1263

  
1264
	/**
1265
	 * Allows you to change which class SimplePie uses for content-type sniffing.
1266
	 * Useful when you are overloading or extending SimplePie's default classes.
1267
	 *
1268
	 * @access public
1269
	 * @param string $class Name of custom class.
1270
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1271
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1272
	 */
1273
	function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
1274
	{
1275
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
1276
		{
1277
			$this->content_type_sniffer_class = $class;
1278
			return true;
1279
		}
1280
		return false;
1281
	}
1282

  
1283
	/**
1284
	 * Allows you to change which class SimplePie uses item sources.
1285
	 * Useful when you are overloading or extending SimplePie's default classes.
1286
	 *
1287
	 * @access public
1288
	 * @param string $class Name of custom class.
1289
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1290
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1291
	 */
1292
	function set_source_class($class = 'SimplePie_Source')
1293
	{
1294
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
1295
		{
1296
			$this->source_class = $class;
1297
			return true;
1298
		}
1299
		return false;
1300
	}
1301

  
1302
	/**
1303
	 * Allows you to override the default user agent string.
1304
	 *
1305
	 * @access public
1306
	 * @param string $ua New user agent string.
1307
	 */
1308
	function set_useragent($ua = SIMPLEPIE_USERAGENT)
1309
	{
1310
		$this->useragent = (string) $ua;
1311
	}
1312

  
1313
	/**
1314
	 * Set callback function to create cache filename with
1315
	 *
1316
	 * @access public
1317
	 * @param mixed $function Callback function
1318
	 */
1319
	function set_cache_name_function($function = 'md5')
1320
	{
1321
		if (is_callable($function))
1322
		{
1323
			$this->cache_name_function = $function;
1324
		}
1325
	}
1326

  
1327
	/**
1328
	 * Set javascript query string parameter
1329
	 *
1330
	 * @access public
1331
	 * @param mixed $get Javascript query string parameter
1332
	 */
1333
	function set_javascript($get = 'js')
1334
	{
1335
		if ($get)
1336
		{
1337
			$this->javascript = (string) $get;
1338
		}
1339
		else
1340
		{
1341
			$this->javascript = false;
1342
		}
1343
	}
1344

  
1345
	/**
1346
	 * Set options to make SP as fast as possible.  Forgoes a
1347
	 * substantial amount of data sanitization in favor of speed.
1348
	 *
1349
	 * @access public
1350
	 * @param bool $set Whether to set them or not
1351
	 */
1352
	function set_stupidly_fast($set = false)
1353
	{
1354
		if ($set)
1355
		{
1356
			$this->enable_order_by_date(false);
1357
			$this->remove_div(false);
1358
			$this->strip_comments(false);
1359
			$this->strip_htmltags(false);
1360
			$this->strip_attributes(false);
1361
			$this->set_image_handler(false);
1362
		}
1363
	}
1364

  
1365
	/**
1366
	 * Set maximum number of feeds to check with autodiscovery
1367
	 *
1368
	 * @access public
1369
	 * @param int $max Maximum number of feeds to check
1370
	 */
1371
	function set_max_checked_feeds($max = 10)
1372
	{
1373
		$this->max_checked_feeds = (int) $max;
1374
	}
1375

  
1376
	function remove_div($enable = true)
1377
	{
1378
		$this->sanitize->remove_div($enable);
1379
	}
1380

  
1381
	function strip_htmltags($tags = '', $encode = null)
1382
	{
1383
		if ($tags === '')
1384
		{
1385
			$tags = $this->strip_htmltags;
1386
		}
1387
		$this->sanitize->strip_htmltags($tags);
1388
		if ($encode !== null)
1389
		{
1390
			$this->sanitize->encode_instead_of_strip($tags);
1391
		}
1392
	}
1393

  
1394
	function encode_instead_of_strip($enable = true)
1395
	{
1396
		$this->sanitize->encode_instead_of_strip($enable);
1397
	}
1398

  
1399
	function strip_attributes($attribs = '')
1400
	{
1401
		if ($attribs === '')
1402
		{
1403
			$attribs = $this->strip_attributes;
1404
		}
1405
		$this->sanitize->strip_attributes($attribs);
1406
	}
1407

  
1408
	function set_output_encoding($encoding = 'UTF-8')
1409
	{
1410
		$this->sanitize->set_output_encoding($encoding);
1411
	}
1412

  
1413
	function strip_comments($strip = false)
1414
	{
1415
		$this->sanitize->strip_comments($strip);
1416
	}
1417

  
1418
	/**
1419
	 * Set element/attribute key/value pairs of HTML attributes
1420
	 * containing URLs that need to be resolved relative to the feed
1421
	 *
1422
	 * @access public
1423
	 * @since 1.0
1424
	 * @param array $element_attribute Element/attribute key/value pairs
1425
	 */
1426
	function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite'))
1427
	{
1428
		$this->sanitize->set_url_replacements($element_attribute);
1429
	}
1430

  
1431
	/**
1432
	 * Set the handler to enable the display of cached favicons.
1433
	 *
1434
	 * @access public
1435
	 * @param str $page Web-accessible path to the handler_favicon.php file.
1436
	 * @param str $qs The query string that the value should be passed to.
1437
	 */
1438
	function set_favicon_handler($page = false, $qs = 'i')
1439
	{
1440
		if ($page != false)
1441
		{
1442
			$this->favicon_handler = $page . '?' . $qs . '=';
1443
		}
1444
		else
1445
		{
1446
			$this->favicon_handler = '';
1447
		}
1448
	}
1449

  
1450
	/**
1451
	 * Set the handler to enable the display of cached images.
1452
	 *
1453
	 * @access public
1454
	 * @param str $page Web-accessible path to the handler_image.php file.
1455
	 * @param str $qs The query string that the value should be passed to.
1456
	 */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff