Project

General

Profile

« Previous | Next » 

Revision 67bc28c9

Added by Jim Pingle over 8 years ago

Update simplepie (RSS Parsing library) to 1.4.3

View differences:

src/etc/inc/simplepie/simplepie.inc
5 5
 * A PHP-Based RSS and Atom Feed Framework.
6 6
 * Takes the hard work out of managing a complete RSS/Atom solution.
7 7
 *
8
 * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
8
 * Please note: This file is automatically generated by a build script. The
9
 * full original source is always available from http://simplepie.org/
10
 *
11
 * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
9 12
 * All rights reserved.
10 13
 *
11 14
 * Redistribution and use in source and binary forms, with or without modification, are
......
33 36
 * POSSIBILITY OF SUCH DAMAGE.
34 37
 *
35 38
 * @package SimplePie
36
 * @version 1.1.3
37
 * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
39
 * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue
38 40
 * @author Ryan Parman
39 41
 * @author Geoffrey Sneddon
42
 * @author Ryan McCue
40 43
 * @link http://simplepie.org/ SimplePie
41
 * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums
42 44
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43
 * @todo phpDoc comments
44 45
 */
45 46

  
46 47
/**
......
51 52
/**
52 53
 * SimplePie Version
53 54
 */
54
define('SIMPLEPIE_VERSION', '1.1.3');
55
define('SIMPLEPIE_VERSION', '1.4.3');
55 56

  
56 57
/**
57 58
 * SimplePie Build
59
 * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::get_build() only every load of simplepie.inc)
58 60
 */
59
define('SIMPLEPIE_BUILD', 20081219);
61
define('SIMPLEPIE_BUILD', '20161209182444');
60 62

  
61 63
/**
62 64
 * SimplePie Website URL
......
241 243
 */
242 244
define('SIMPLEPIE_CONSTRUCT_ALL', 63);
243 245

  
246
/**
247
 * Don't change case
248
 */
249
define('SIMPLEPIE_SAME_CASE', 1);
250

  
251
/**
252
 * Change to lowercase
253
 */
254
define('SIMPLEPIE_LOWERCASE', 2);
255

  
256
/**
257
 * Change to uppercase
258
 */
259
define('SIMPLEPIE_UPPERCASE', 4);
260

  
244 261
/**
245 262
 * PCRE for HTML attributes
246 263
 */
......
318 335
define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
319 336

  
320 337
/**
321
 * Wrong Media RSS Namespace
338
 * Wrong Media RSS Namespace. Caused by a long-standing typo in the spec.
322 339
 */
323 340
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
324 341

  
342
/**
343
 * Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5.
344
 */
345
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss');
346

  
347
/**
348
 * Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace.
349
 */
350
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/');
351

  
352
/**
353
 * Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace.
354
 */
355
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss');
356

  
357
/**
358
 * Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL.
359
 */
360
define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/');
361

  
325 362
/**
326 363
 * iTunes RSS Namespace
327 364
 */
......
337 374
 */
338 375
define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/');
339 376

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

  
345 377
/**
346 378
 * No file source
347 379
 */
......
376 408
 * SimplePie
377 409
 *
378 410
 * @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.)
411
 * @subpackage API
384 412
 */
385 413
class SimplePie
386 414
{
......
388 416
	 * @var array Raw data
389 417
	 * @access private
390 418
	 */
391
	var $data = array();
419
	public $data = array();
392 420

  
393 421
	/**
394 422
	 * @var mixed Error string
395 423
	 * @access private
396 424
	 */
397
	var $error;
425
	public $error;
398 426

  
399 427
	/**
400 428
	 * @var object Instance of SimplePie_Sanitize (or other class)
401 429
	 * @see SimplePie::set_sanitize_class()
402 430
	 * @access private
403 431
	 */
404
	var $sanitize;
432
	public $sanitize;
405 433

  
406 434
	/**
407 435
	 * @var string SimplePie Useragent
408 436
	 * @see SimplePie::set_useragent()
409 437
	 * @access private
410 438
	 */
411
	var $useragent = SIMPLEPIE_USERAGENT;
439
	public $useragent = SIMPLEPIE_USERAGENT;
412 440

  
413 441
	/**
414 442
	 * @var string Feed URL
415 443
	 * @see SimplePie::set_feed_url()
416 444
	 * @access private
417 445
	 */
418
	var $feed_url;
446
	public $feed_url;
447

  
448
	/**
449
	 * @var string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently
450
	 * @see SimplePie::subscribe_url()
451
	 * @access private
452
	 */
453
	public $permanent_url = null;
419 454

  
420 455
	/**
421 456
	 * @var object Instance of SimplePie_File to use as a feed
422 457
	 * @see SimplePie::set_file()
423 458
	 * @access private
424 459
	 */
425
	var $file;
460
	public $file;
426 461

  
427 462
	/**
428 463
	 * @var string Raw feed data
429 464
	 * @see SimplePie::set_raw_data()
430 465
	 * @access private
431 466
	 */
432
	var $raw_data;
467
	public $raw_data;
433 468

  
434 469
	/**
435 470
	 * @var int Timeout for fetching remote files
436 471
	 * @see SimplePie::set_timeout()
437 472
	 * @access private
438 473
	 */
439
	var $timeout = 10;
474
	public $timeout = 10;
475

  
476
	/**
477
	 * @var array Custom curl options
478
	 * @see SimplePie::set_curl_options()
479
	 * @access private
480
	 */
481
	public $curl_options = array();
440 482

  
441 483
	/**
442 484
	 * @var bool Forces fsockopen() to be used for remote files instead
......
444 486
	 * @see SimplePie::force_fsockopen()
445 487
	 * @access private
446 488
	 */
447
	var $force_fsockopen = false;
489
	public $force_fsockopen = false;
448 490

  
449 491
	/**
450 492
	 * @var bool Force the given data/URL to be treated as a feed no matter what
......
452 494
	 * @see SimplePie::force_feed()
453 495
	 * @access private
454 496
	 */
455
	var $force_feed = false;
497
	public $force_feed = false;
456 498

  
457 499
	/**
458
	 * @var bool Enable/Disable XML dump
459
	 * @see SimplePie::enable_xml_dump()
500
	 * @var bool Enable/Disable Caching
501
	 * @see SimplePie::enable_cache()
460 502
	 * @access private
461 503
	 */
462
	var $xml_dump = false;
504
	public $cache = true;
463 505

  
464 506
	/**
465
	 * @var bool Enable/Disable Caching
466
	 * @see SimplePie::enable_cache()
507
	 * @var bool Force SimplePie to fallback to expired cache, if enabled,
508
	 * when feed is unavailable.
509
	 * @see SimplePie::force_cache_fallback()
467 510
	 * @access private
468 511
	 */
469
	var $cache = true;
512
	public $force_cache_fallback = false;
470 513

  
471 514
	/**
472 515
	 * @var int Cache duration (in seconds)
473 516
	 * @see SimplePie::set_cache_duration()
474 517
	 * @access private
475 518
	 */
476
	var $cache_duration = 3600;
519
	public $cache_duration = 3600;
477 520

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

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

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

  
499 542
	/**
500 543
	 * @var bool Reorder feed by date descending
501 544
	 * @see SimplePie::enable_order_by_date()
502 545
	 * @access private
503 546
	 */
504
	var $order_by_date = true;
547
	public $order_by_date = true;
505 548

  
506 549
	/**
507 550
	 * @var mixed Force input encoding to be set to the follow value
......
509 552
	 * @see SimplePie::set_input_encoding()
510 553
	 * @access private
511 554
	 */
512
	var $input_encoding = false;
555
	public $input_encoding = false;
513 556

  
514 557
	/**
515 558
	 * @var int Feed Autodiscovery Level
516 559
	 * @see SimplePie::set_autodiscovery_level()
517 560
	 * @access private
518 561
	 */
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';
562
	public $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
625 563

  
626 564
	/**
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
565
	 * Class registry object
566
	 *
567
	 * @var SimplePie_Registry
631 568
	 */
632
	var $javascript = 'js';
569
	public $registry;
633 570

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

  
641 578
	/**
642
	 * @var string Web-accessible path to the handler_favicon.php file.
643
	 * @see SimplePie::set_favicon_handler()
579
	 * @var array All the feeds found during the autodiscovery process
580
	 * @see SimplePie::get_all_discovered_feeds()
644 581
	 * @access private
645 582
	 */
646
	var $favicon_handler = '';
583
	public $all_discovered_feeds = array();
647 584

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

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

  
662 599
	/**
663 600
	 * @var array Stores SimplePie objects when multiple feeds initialized.
664 601
	 * @access private
665 602
	 */
666
	var $multifeed_objects = array();
603
	public $multifeed_objects = array();
667 604

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

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

  
619
	/**
620
	 * @var bool Stores if last-modified and/or etag headers were sent with the
621
	 * request when checking a feed.
622
	 */
623
	public $check_modified = false;
681 624

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

  
632
	/**
633
	 * @var array Stores the default attributes to add to different tags by add_attributes().
634
	 * @see SimplePie::add_attributes()
635
	 * @access private
636
	 */
637
	public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none'));
688 638

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

  
696 646
	/**
697 647
	 * The SimplePie class contains feed level data and options
698 648
	 *
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
649
	 * To use SimplePie, create the SimplePie object with no parameters. You can
650
	 * then set configuration options using the provided methods. After setting
707 651
	 * 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.
652
	 * object's methods and properties will be available to you.
653
	 *
654
	 * Previously, it was possible to pass in the feed URL along with cache
655
	 * options directly into the constructor. This has been removed as of 1.3 as
656
	 * it caused a lot of confusion.
710 657
	 *
711
	 * @access public
712 658
	 * @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 659
	 */
717
	function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
660
	public function __construct()
718 661
	{
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)
662
		if (version_compare(PHP_VERSION, '5.3', '<'))
724 663
		{
725
			$this->set_cache_location($cache_location);
664
			trigger_error('Please upgrade to PHP 5.3 or newer.');
665
			die();
726 666
		}
727 667

  
728
		if ($cache_duration !== null)
729
		{
730
			$this->set_cache_duration($cache_duration);
731
		}
668
		// Other objects, instances created here so we can set options on them
669
		$this->sanitize = new SimplePie_Sanitize();
670
		$this->registry = new SimplePie_Registry();
732 671

  
733
		// Only init the script if we're passed a feed URL
734
		if ($feed_url !== null)
672
		if (func_num_args() > 0)
735 673
		{
736
			$this->set_feed_url($feed_url);
737
			$this->init();
674
			$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
675
			trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', $level);
676

  
677
			$args = func_get_args();
678
			switch (count($args)) {
679
				case 3:
680
					$this->set_cache_duration($args[2]);
681
				case 2:
682
					$this->set_cache_location($args[1]);
683
				case 1:
684
					$this->set_feed_url($args[0]);
685
					$this->init();
686
			}
738 687
		}
739 688
	}
740 689

  
741 690
	/**
742 691
	 * Used for converting object to a string
743 692
	 */
744
	function __toString()
693
	public function __toString()
745 694
	{
746 695
		return md5(serialize($this->data));
747 696
	}
......
749 698
	/**
750 699
	 * Remove items that link back to this before destroying this object
751 700
	 */
752
	function __destruct()
701
	public function __destruct()
753 702
	{
754
		if (!empty($this->data['items']))
703
		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
755 704
		{
756
			foreach ($this->data['items'] as $item)
705
			if (!empty($this->data['items']))
757 706
			{
758
				$item->__destruct();
707
				foreach ($this->data['items'] as $item)
708
				{
709
					$item->__destruct();
710
				}
711
				unset($item, $this->data['items']);
759 712
			}
760
			unset($this->data['items']);
761
		}
762
		if (!empty($this->data['ordered_items']))
763
		{
764
			foreach ($this->data['ordered_items'] as $item)
713
			if (!empty($this->data['ordered_items']))
765 714
			{
766
				$item->__destruct();
715
				foreach ($this->data['ordered_items'] as $item)
716
				{
717
					$item->__destruct();
718
				}
719
				unset($item, $this->data['ordered_items']);
767 720
			}
768
			unset($this->data['ordered_items']);
769 721
		}
770 722
	}
771 723

  
772 724
	/**
773
	 * Force the given data/URL to be treated as a feed no matter what it
774
	 * appears like
725
	 * Force the given data/URL to be treated as a feed
726
	 *
727
	 * This tells SimplePie to ignore the content-type provided by the server.
728
	 * Be careful when using this option, as it will also disable autodiscovery.
775 729
	 *
776
	 * @access public
777 730
	 * @since 1.1
778 731
	 * @param bool $enable Force the given data/URL to be treated as a feed
779 732
	 */
780
	function force_feed($enable = false)
733
	public function force_feed($enable = false)
781 734
	{
782 735
		$this->force_feed = (bool) $enable;
783 736
	}
784 737

  
785 738
	/**
786
	 * This is the URL of the feed you want to parse.
739
	 * Set the URL of the feed you want to parse
787 740
	 *
788 741
	 * This allows you to enter the URL of the feed you want to parse, or the
789 742
	 * website you want to try to use auto-discovery on. This takes priority
......
793 746
	 * of a string for the $url. Remember that with each additional feed comes
794 747
	 * additional processing and resources.
795 748
	 *
796
	 * @access public
797 749
	 * @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()
750
	 * @see set_raw_data()
751
	 * @param string|array $url This is the URL (or array of URLs) that you want to parse.
800 752
	 */
801
	function set_feed_url($url)
753
	public function set_feed_url($url)
802 754
	{
755
		$this->multifeed_url = array();
803 756
		if (is_array($url))
804 757
		{
805
			$this->multifeed_url = array();
806 758
			foreach ($url as $value)
807 759
			{
808
				$this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
760
				$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
809 761
			}
810 762
		}
811 763
		else
812 764
		{
813
			$this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
765
			$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
766
			$this->permanent_url = $this->feed_url;
814 767
		}
815 768
	}
816 769

  
817 770
	/**
818
	 * Provides an instance of SimplePie_File to use as a feed
771
	 * Set an instance of {@see SimplePie_File} to use as a feed
819 772
	 *
820
	 * @access public
821
	 * @param object &$file Instance of SimplePie_File (or subclass)
773
	 * @param SimplePie_File &$file
822 774
	 * @return bool True on success, false on failure
823 775
	 */
824
	function set_file(&$file)
776
	public function set_file(&$file)
825 777
	{
826
		if (is_a($file, 'SimplePie_File'))
778
		if ($file instanceof SimplePie_File)
827 779
		{
828 780
			$this->feed_url = $file->url;
781
			$this->permanent_url = $this->feed_url;
829 782
			$this->file =& $file;
830 783
			return true;
831 784
		}
......
833 786
	}
834 787

  
835 788
	/**
789
	 * Set the raw XML data to parse
790
	 *
836 791
	 * Allows you to use a string of RSS/Atom data instead of a remote feed.
837 792
	 *
838 793
	 * If you have a feed available as a string in PHP, you can tell SimplePie
839 794
	 * to parse that data string instead of a remote feed. Any set feed URL
840 795
	 * takes precedence.
841 796
	 *
842
	 * @access public
843 797
	 * @since 1.0 Beta 3
844 798
	 * @param string $data RSS or Atom data as a string.
845
	 * @see SimplePie::set_feed_url()
799
	 * @see set_feed_url()
846 800
	 */
847
	function set_raw_data($data)
801
	public function set_raw_data($data)
848 802
	{
849 803
		$this->raw_data = $data;
850 804
	}
851 805

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

  
867 820
	/**
868
	 * Forces SimplePie to use fsockopen() instead of the preferred cURL
869
	 * functions.
821
	 * Set custom curl options
822
	 *
823
	 * This allows you to change default curl options
870 824
	 *
871
	 * @access public
872 825
	 * @since 1.0 Beta 3
873
	 * @param bool $enable Force fsockopen() to be used
826
	 * @param array $curl_options Curl options to add to default settings
874 827
	 */
875
	function force_fsockopen($enable = false)
828
	public function set_curl_options(array $curl_options = array())
876 829
	{
877
		$this->force_fsockopen = (bool) $enable;
830
		$this->curl_options = $curl_options;
878 831
	}
879 832

  
880 833
	/**
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.
834
	 * Force SimplePie to use fsockopen() instead of cURL
890 835
	 *
891
	 * @access public
892
	 * @since 1.0 Preview Release
893
	 * @param bool $enable Enable XML dump
836
	 * @since 1.0 Beta 3
837
	 * @param bool $enable Force fsockopen() to be used
894 838
	 */
895
	function enable_xml_dump($enable = false)
839
	public function force_fsockopen($enable = false)
896 840
	{
897
		$this->xml_dump = (bool) $enable;
841
		$this->force_fsockopen = (bool) $enable;
898 842
	}
899 843

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

  
915 858
	/**
916
	 * Set the length of time (in seconds) that the contents of a feed
917
	 * will be cached.
859
	 * SimplePie to continue to fall back to expired cache, if enabled, when
860
	 * feed is unavailable.
918 861
	 *
919
	 * @access public
920
	 * @param int $seconds The feed content cache duration.
862
	 * This tells SimplePie to ignore any file errors and fall back to cache
863
	 * instead. This only works if caching is enabled and cached content
864
	 * still exists.
865

  
866
	 * @param bool $enable Force use of cache on fail.
867
	 */
868
	public function force_cache_fallback($enable = false)
869
	{
870
		$this->force_cache_fallback= (bool) $enable;
871
	}
872

  
873
	/**
874
	 * Set the length of time (in seconds) that the contents of a feed will be
875
	 * cached
876
	 *
877
	 * @param int $seconds The feed content cache duration
921 878
	 */
922
	function set_cache_duration($seconds = 3600)
879
	public function set_cache_duration($seconds = 3600)
923 880
	{
924 881
		$this->cache_duration = (int) $seconds;
925 882
	}
926 883

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

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

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

  
961 915
	/**
962
	 * Allows you to override the character encoding reported by the feed.
916
	 * Set the character encoding used to parse the feed
963 917
	 *
964
	 * @access public
965
	 * @param string $encoding Character encoding.
918
	 * This overrides the encoding reported by the feed, however it will fall
919
	 * back to the normal encoding detection if the override fails
920
	 *
921
	 * @param string $encoding Character encoding
966 922
	 */
967
	function set_input_encoding($encoding = false)
923
	public function set_input_encoding($encoding = false)
968 924
	{
969 925
		if ($encoding)
970 926
		{
......
979 935
	/**
980 936
	 * Set how much feed autodiscovery to do
981 937
	 *
982
	 * @access public
983 938
	 * @see SIMPLEPIE_LOCATOR_NONE
984 939
	 * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY
985 940
	 * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
......
987 942
	 * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
988 943
	 * @see SIMPLEPIE_LOCATOR_REMOTE_BODY
989 944
	 * @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)
945
	 * @param int $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
992 946
	 */
993
	function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
947
	public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
994 948
	{
995 949
		$this->autodiscovery = (int) $level;
996 950
	}
997 951

  
998 952
	/**
999
	 * Allows you to change which class SimplePie uses for caching.
1000
	 * Useful when you are overloading or extending SimplePie's default classes.
953
	 * Get the class registry
1001 954
	 *
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
955
	 * Use this to override SimplePie's default classes
956
	 * @see SimplePie_Registry
957
	 * @return SimplePie_Registry
1006 958
	 */
1007
	function set_cache_class($class = 'SimplePie_Cache')
959
	public function &get_registry()
1008 960
	{
1009
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache'))
1010
		{
1011
			$this->cache_class = $class;
1012
			return true;
1013
		}
1014
		return false;
961
		return $this->registry;
1015 962
	}
1016 963

  
1017
	/**
1018
	 * Allows you to change which class SimplePie uses for auto-discovery.
964
	/**#@+
1019 965
	 * Useful when you are overloading or extending SimplePie's default classes.
1020 966
	 *
1021
	 * @access public
1022
	 * @param string $class Name of custom class.
1023
	 * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
967
	 * @deprecated Use {@see get_registry()} instead
1024 968
	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
969
	 * @param string $class Name of custom class
970
	 * @return boolean True on success, false otherwise
971
	 */
972
	/**
973
	 * Set which class SimplePie uses for caching
1025 974
	 */
1026
	function set_locator_class($class = 'SimplePie_Locator')
975
	public function set_cache_class($class = 'SimplePie_Cache')
1027 976
	{
1028
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator'))
1029
		{
1030
			$this->locator_class = $class;
1031
			return true;
1032
		}
1033
		return false;
977
		return $this->registry->register('Cache', $class, true);
1034 978
	}
1035 979

  
1036 980
	/**
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
981
	 * Set which class SimplePie uses for auto-discovery
1044 982
	 */
1045
	function set_parser_class($class = 'SimplePie_Parser')
983
	public function set_locator_class($class = 'SimplePie_Locator')
1046 984
	{
1047
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser'))
1048
		{
1049
			$this->parser_class = $class;
1050
			return true;
1051
		}
1052
		return false;
985
		return $this->registry->register('Locator', $class, true);
1053 986
	}
1054 987

  
1055 988
	/**
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
989
	 * Set which class SimplePie uses for XML parsing
1063 990
	 */
1064
	function set_file_class($class = 'SimplePie_File')
991
	public function set_parser_class($class = 'SimplePie_Parser')
1065 992
	{
1066
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File'))
1067
		{
1068
			$this->file_class = $class;
1069
			return true;
1070
		}
1071
		return false;
993
		return $this->registry->register('Parser', $class, true);
1072 994
	}
1073 995

  
1074 996
	/**
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
997
	 * Set which class SimplePie uses for remote file fetching
1082 998
	 */
1083
	function set_sanitize_class($class = 'SimplePie_Sanitize')
999
	public function set_file_class($class = 'SimplePie_File')
1084 1000
	{
1085
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
1086
		{
1087
			$this->sanitize =& new $class;
1088
			return true;
1089
		}
1090
		return false;
1001
		return $this->registry->register('File', $class, true);
1091 1002
	}
1092 1003

  
1093 1004
	/**
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
1005
	 * Set which class SimplePie uses for data sanitization
1101 1006
	 */
1102
	function set_item_class($class = 'SimplePie_Item')
1007
	public function set_sanitize_class($class = 'SimplePie_Sanitize')
1103 1008
	{
1104
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item'))
1105
		{
1106
			$this->item_class = $class;
1107
			return true;
1108
		}
1109
		return false;
1009
		return $this->registry->register('Sanitize', $class, true);
1110 1010
	}
1111 1011

  
1112 1012
	/**
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
1013
	 * Set which class SimplePie uses for handling feed items
1120 1014
	 */
1121
	function set_author_class($class = 'SimplePie_Author')
1015
	public function set_item_class($class = 'SimplePie_Item')
1122 1016
	{
1123
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author'))
1124
		{
1125
			$this->author_class = $class;
1126
			return true;
1127
		}
1128
		return false;
1017
		return $this->registry->register('Item', $class, true);
1129 1018
	}
1130 1019

  
1131 1020
	/**
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
1021
	 * Set which class SimplePie uses for handling author data
1139 1022
	 */
1140
	function set_category_class($class = 'SimplePie_Category')
1023
	public function set_author_class($class = 'SimplePie_Author')
1141 1024
	{
1142
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category'))
1143
		{
1144
			$this->category_class = $class;
1145
			return true;
1146
		}
1147
		return false;
1025
		return $this->registry->register('Author', $class, true);
1148 1026
	}
1149 1027

  
1150 1028
	/**
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
1029
	 * Set which class SimplePie uses for handling category data
1158 1030
	 */
1159
	function set_enclosure_class($class = 'SimplePie_Enclosure')
1031
	public function set_category_class($class = 'SimplePie_Category')
1160 1032
	{
1161
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure'))
1162
		{
1163
			$this->enclosure_class = $class;
1164
			return true;
1165
		}
1166
		return false;
1033
		return $this->registry->register('Category', $class, true);
1167 1034
	}
1168 1035

  
1169 1036
	/**
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
1037
	 * Set which class SimplePie uses for feed enclosures
1177 1038
	 */
1178
	function set_caption_class($class = 'SimplePie_Caption')
1039
	public function set_enclosure_class($class = 'SimplePie_Enclosure')
1179 1040
	{
1180
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption'))
1181
		{
1182
			$this->caption_class = $class;
1183
			return true;
1184
		}
1185
		return false;
1041
		return $this->registry->register('Enclosure', $class, true);
1186 1042
	}
1187 1043

  
1188 1044
	/**
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
1045
	 * Set which class SimplePie uses for `<media:text>` captions
1196 1046
	 */
1197
	function set_copyright_class($class = 'SimplePie_Copyright')
1047
	public function set_caption_class($class = 'SimplePie_Caption')
1198 1048
	{
1199
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright'))
1200
		{
1201
			$this->copyright_class = $class;
1202
			return true;
1203
		}
1204
		return false;
1049
		return $this->registry->register('Caption', $class, true);
1205 1050
	}
1206 1051

  
1207 1052
	/**
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
1053
	 * Set which class SimplePie uses for `<media:copyright>`
1215 1054
	 */
1216
	function set_credit_class($class = 'SimplePie_Credit')
1055
	public function set_copyright_class($class = 'SimplePie_Copyright')
1217 1056
	{
1218
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit'))
1219
		{
1220
			$this->credit_class = $class;
1221
			return true;
1222
		}
1223
		return false;
1057
		return $this->registry->register('Copyright', $class, true);
1224 1058
	}
1225 1059

  
1226 1060
	/**
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
1061
	 * Set which class SimplePie uses for `<media:credit>`
1234 1062
	 */
1235
	function set_rating_class($class = 'SimplePie_Rating')
1063
	public function set_credit_class($class = 'SimplePie_Credit')
1236 1064
	{
1237
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating'))
1238
		{
1239
			$this->rating_class = $class;
1240
			return true;
1241
		}
1242
		return false;
1065
		return $this->registry->register('Credit', $class, true);
1243 1066
	}
1244 1067

  
1245 1068
	/**
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
1069
	 * Set which class SimplePie uses for `<media:rating>`
1253 1070
	 */
1254
	function set_restriction_class($class = 'SimplePie_Restriction')
1071
	public function set_rating_class($class = 'SimplePie_Rating')
1255 1072
	{
1256
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction'))
1257
		{
1258
			$this->restriction_class = $class;
1259
			return true;
1260
		}
1261
		return false;
1073
		return $this->registry->register('Rating', $class, true);
1262 1074
	}
1263 1075

  
1264 1076
	/**
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
1077
	 * Set which class SimplePie uses for `<media:restriction>`
1272 1078
	 */
1273
	function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
1079
	public function set_restriction_class($class = 'SimplePie_Restriction')
1274 1080
	{
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;
1081
		return $this->registry->register('Restriction', $class, true);
1281 1082
	}
1282 1083

  
1283 1084
	/**
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
1085
	 * Set which class SimplePie uses for content-type sniffing
1291 1086
	 */
1292
	function set_source_class($class = 'SimplePie_Source')
1087
	public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
1293 1088
	{
1294
		if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
1295
		{
1296
			$this->source_class = $class;
1297
			return true;
1298
		}
1299
		return false;
1089
		return $this->registry->register('Content_Type_Sniffer', $class, true);
1090
	}
1091

  
1092
	/**
1093
	 * Set which class SimplePie uses item sources
1094
	 */
1095
	public function set_source_class($class = 'SimplePie_Source')
1096
	{
1097
		return $this->registry->register('Source', $class, true);
1300 1098
	}
1099
	/**#@-*/
1301 1100

  
1302 1101
	/**
1303
	 * Allows you to override the default user agent string.
1102
	 * Set the user agent string
1304 1103
	 *
1305
	 * @access public
1306 1104
	 * @param string $ua New user agent string.
1307 1105
	 */
1308
	function set_useragent($ua = SIMPLEPIE_USERAGENT)
1106
	public function set_useragent($ua = SIMPLEPIE_USERAGENT)
1309 1107
	{
1310 1108
		$this->useragent = (string) $ua;
1311 1109
	}
......
1313 1111
	/**
1314 1112
	 * Set callback function to create cache filename with
1315 1113
	 *
1316
	 * @access public
1317 1114
	 * @param mixed $function Callback function
1318 1115
	 */
1319
	function set_cache_name_function($function = 'md5')
1116
	public function set_cache_name_function($function = 'md5')
1320 1117
	{
1321 1118
		if (is_callable($function))
1322 1119
		{
......
1325 1122
	}
1326 1123

  
1327 1124
	/**
1328
	 * Set javascript query string parameter
1125
	 * Set options to make SP as fast as possible
1329 1126
	 *
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.
1127
	 * Forgoes a substantial amount of data sanitization in favor of speed. This
1128
	 * turns SimplePie into a dumb parser of feeds.
1348 1129
	 *
1349
	 * @access public
1350 1130
	 * @param bool $set Whether to set them or not
1351 1131
	 */
1352
	function set_stupidly_fast($set = false)
1132
	public function set_stupidly_fast($set = false)
1353 1133
	{
1354 1134
		if ($set)
1355 1135
		{
......
1358 1138
			$this->strip_comments(false);
1359 1139
			$this->strip_htmltags(false);
1360 1140
			$this->strip_attributes(false);
1141
			$this->add_attributes(false);
1361 1142
			$this->set_image_handler(false);
1362 1143
		}
1363 1144
	}
......
1365 1146
	/**
1366 1147
	 * Set maximum number of feeds to check with autodiscovery
1367 1148
	 *
1368
	 * @access public
1369 1149
	 * @param int $max Maximum number of feeds to check
1370 1150
	 */
1371
	function set_max_checked_feeds($max = 10)
1151
	public function set_max_checked_feeds($max = 10)
1372 1152
	{
1373 1153
		$this->max_checked_feeds = (int) $max;
1374 1154
	}
1375 1155

  
1376
	function remove_div($enable = true)
1156
	public function remove_div($enable = true)
1377 1157
	{
1378 1158
		$this->sanitize->remove_div($enable);
1379 1159
	}
1380 1160

  
1381
	function strip_htmltags($tags = '', $encode = null)
1161
	public function strip_htmltags($tags = '', $encode = null)
1382 1162
	{
1383 1163
		if ($tags === '')
1384 1164
		{
......
1391 1171
		}
1392 1172
	}
1393 1173

  
1394
	function encode_instead_of_strip($enable = true)
1174
	public function encode_instead_of_strip($enable = true)
1395 1175
	{
1396 1176
		$this->sanitize->encode_instead_of_strip($enable);
1397 1177
	}
1398 1178

  
1399
	function strip_attributes($attribs = '')
1179
	public function strip_attributes($attribs = '')
1400 1180
	{
1401 1181
		if ($attribs === '')
1402 1182
		{
......
1405 1185
		$this->sanitize->strip_attributes($attribs);
1406 1186
	}
1407 1187

  
1408
	function set_output_encoding($encoding = 'UTF-8')
1188
	public function add_attributes($attribs = '')
1189
	{
1190
		if ($attribs === '')
1191
		{
1192
			$attribs = $this->add_attributes;
1193
		}
1194
		$this->sanitize->add_attributes($attribs);
1195
	}
1196

  
1197
	/**
1198
	 * Set the output encoding
1199
	 *
1200
	 * Allows you to override SimplePie's output to match that of your webpage.
1201
	 * This is useful for times when your webpages are not being served as
1202
	 * UTF-8. This setting will be obeyed by {@see handle_content_type()}, and
1203
	 * is similar to {@see set_input_encoding()}.
1204
	 *
1205
	 * It should be noted, however, that not all character encodings can support
1206
	 * all characters. If your page is being served as ISO-8859-1 and you try
1207
	 * to display a Japanese feed, you'll likely see garbled characters.
1208
	 * Because of this, it is highly recommended to ensure that your webpages
1209
	 * are served as UTF-8.
1210
	 *
1211
	 * The number of supported character encodings depends on whether your web
1212
	 * host supports {@link http://php.net/mbstring mbstring},
1213
	 * {@link http://php.net/iconv iconv}, or both. See
1214
	 * {@link http://simplepie.org/wiki/faq/Supported_Character_Encodings} for
1215
	 * more information.
1216
	 *
1217
	 * @param string $encoding
1218
	 */
1219
	public function set_output_encoding($encoding = 'UTF-8')
1409 1220
	{
1410 1221
		$this->sanitize->set_output_encoding($encoding);
1411 1222
	}
1412 1223

  
1413
	function strip_comments($strip = false)
1224
	public function strip_comments($strip = false)
1414 1225
	{
1415 1226
		$this->sanitize->strip_comments($strip);
1416 1227
	}
......
1419 1230
	 * Set element/attribute key/value pairs of HTML attributes
1420 1231
	 * containing URLs that need to be resolved relative to the feed
1421 1232
	 *
1422
	 * @access public
1233
	 * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite,
1234
	 * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite,
1235
	 * |q|@cite
1236
	 *
1423 1237
	 * @since 1.0
1424
	 * @param array $element_attribute Element/attribute key/value pairs
1238
	 * @param array|null $element_attribute Element/attribute key/value pairs, null for default
1425 1239
	 */
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'))
1240
	public function set_url_replacements($element_attribute = null)
1427 1241
	{
1428 1242
		$this->sanitize->set_url_replacements($element_attribute);
1429 1243
	}
1430 1244

  
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 1245
	/**
1451 1246
	 * Set the handler to enable the display of cached images.
1452 1247
	 *
1453
	 * @access public
1454 1248
	 * @param str $page Web-accessible path to the handler_image.php file.
1455 1249
	 * @param str $qs The query string that the value should be passed to.
1456 1250
	 */
1457
	function set_image_handler($page = false, $qs = 'i')
1251
	public function set_image_handler($page = false, $qs = 'i')
1458 1252
	{
1459
		if ($page != false)
1253
		if ($page !== false)
1460 1254
		{
1461 1255
			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
1462 1256
		}
......
1467 1261
	}
1468 1262

  
1469 1263
	/**
1470
	 * Set the limit for items returned per-feed with multifeeds.
1264
	 * Set the limit for items returned per-feed with multifeeds
1471 1265
	 *
1472
	 * @access public
1473 1266
	 * @param integer $limit The maximum number of items to return.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff