From 9a16bf65bdd5858a2da8e850e9825b2a5498b044 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 27 Jan 2023 07:28:21 +0000 Subject: update simplepie --- vendor/composer/autoload_classmap.php | 6 + vendor/composer/autoload_static.php | 6 + vendor/composer/installed.json | 17 +- vendor/composer/installed.php | 10 +- vendor/simplepie/simplepie/.php-cs-fixer.dist.php | 8 +- vendor/simplepie/simplepie/CHANGELOG.md | 53 +- vendor/simplepie/simplepie/README.markdown | 17 +- vendor/simplepie/simplepie/composer.json | 3 +- vendor/simplepie/simplepie/library/SimplePie.php | 146 ++--- .../simplepie/library/SimplePie/Author.php | 6 +- .../simplepie/library/SimplePie/Cache.php | 6 +- .../simplepie/library/SimplePie/Cache/Base.php | 6 +- .../simplepie/library/SimplePie/Cache/DB.php | 6 +- .../simplepie/library/SimplePie/Cache/File.php | 6 +- .../simplepie/library/SimplePie/Cache/Memcache.php | 6 +- .../library/SimplePie/Cache/Memcached.php | 6 +- .../simplepie/library/SimplePie/Cache/MySQL.php | 6 +- .../simplepie/library/SimplePie/Cache/Redis.php | 6 +- .../simplepie/library/SimplePie/Caption.php | 6 +- .../simplepie/library/SimplePie/Category.php | 6 +- .../library/SimplePie/Content/Type/Sniffer.php | 6 +- .../simplepie/library/SimplePie/Copyright.php | 6 +- .../simplepie/simplepie/library/SimplePie/Core.php | 2 + .../simplepie/library/SimplePie/Credit.php | 6 +- .../library/SimplePie/Decode/HTML/Entities.php | 2 + .../simplepie/library/SimplePie/Enclosure.php | 6 +- .../simplepie/library/SimplePie/Exception.php | 6 +- .../simplepie/simplepie/library/SimplePie/File.php | 6 +- .../simplepie/library/SimplePie/HTTP/Parser.php | 6 +- .../simplepie/simplepie/library/SimplePie/IRI.php | 6 +- .../simplepie/simplepie/library/SimplePie/Item.php | 6 +- .../simplepie/library/SimplePie/Locator.php | 6 +- .../simplepie/simplepie/library/SimplePie/Misc.php | 6 +- .../simplepie/library/SimplePie/Net/IPv6.php | 6 +- .../simplepie/library/SimplePie/Parse/Date.php | 6 +- .../simplepie/library/SimplePie/Parser.php | 6 +- .../simplepie/library/SimplePie/Rating.php | 6 +- .../simplepie/library/SimplePie/Registry.php | 6 +- .../simplepie/library/SimplePie/Restriction.php | 6 +- .../simplepie/library/SimplePie/Sanitize.php | 6 +- .../simplepie/library/SimplePie/Source.php | 6 +- .../library/SimplePie/XML/Declaration/Parser.php | 6 +- .../simplepie/library/SimplePie/gzdecode.php | 6 +- vendor/simplepie/simplepie/src/Author.php | 2 + vendor/simplepie/simplepie/src/Cache.php | 16 +- vendor/simplepie/simplepie/src/Cache/Base.php | 11 +- .../simplepie/src/Cache/BaseDataCache.php | 159 +++++ .../simplepie/src/Cache/CallableNameFilter.php | 89 +++ vendor/simplepie/simplepie/src/Cache/DB.php | 5 +- vendor/simplepie/simplepie/src/Cache/DataCache.php | 120 ++++ vendor/simplepie/simplepie/src/Cache/File.php | 7 +- vendor/simplepie/simplepie/src/Cache/Memcache.php | 9 +- vendor/simplepie/simplepie/src/Cache/Memcached.php | 11 +- vendor/simplepie/simplepie/src/Cache/MySQL.php | 11 +- .../simplepie/simplepie/src/Cache/NameFilter.php | 76 +++ vendor/simplepie/simplepie/src/Cache/Psr16.php | 147 +++++ vendor/simplepie/simplepie/src/Cache/Redis.php | 14 +- vendor/simplepie/simplepie/src/Caption.php | 2 + vendor/simplepie/simplepie/src/Category.php | 2 + .../simplepie/src/Content/Type/Sniffer.php | 2 + vendor/simplepie/simplepie/src/Copyright.php | 2 + vendor/simplepie/simplepie/src/Credit.php | 2 + vendor/simplepie/simplepie/src/Enclosure.php | 5 +- vendor/simplepie/simplepie/src/Exception.php | 2 + vendor/simplepie/simplepie/src/File.php | 2 + vendor/simplepie/simplepie/src/Gzdecode.php | 4 + vendor/simplepie/simplepie/src/HTTP/Parser.php | 90 ++- vendor/simplepie/simplepie/src/IRI.php | 79 ++- vendor/simplepie/simplepie/src/Item.php | 162 +++--- vendor/simplepie/simplepie/src/Locator.php | 60 +- vendor/simplepie/simplepie/src/Misc.php | 33 +- vendor/simplepie/simplepie/src/Net/IPv6.php | 6 +- vendor/simplepie/simplepie/src/Parse/Date.php | 104 ++-- vendor/simplepie/simplepie/src/Parser.php | 22 +- vendor/simplepie/simplepie/src/Rating.php | 2 + vendor/simplepie/simplepie/src/Registry.php | 144 +++-- vendor/simplepie/simplepie/src/RegistryAware.php | 65 +++ vendor/simplepie/simplepie/src/Restriction.php | 2 + vendor/simplepie/simplepie/src/Sanitize.php | 90 ++- vendor/simplepie/simplepie/src/SimplePie.php | 637 ++++++++++++++------- vendor/simplepie/simplepie/src/Source.php | 42 +- .../simplepie/src/XML/Declaration/Parser.php | 73 +-- 82 files changed, 1989 insertions(+), 784 deletions(-) create mode 100644 vendor/simplepie/simplepie/src/Cache/BaseDataCache.php create mode 100644 vendor/simplepie/simplepie/src/Cache/CallableNameFilter.php create mode 100644 vendor/simplepie/simplepie/src/Cache/DataCache.php create mode 100644 vendor/simplepie/simplepie/src/Cache/NameFilter.php create mode 100644 vendor/simplepie/simplepie/src/Cache/Psr16.php create mode 100644 vendor/simplepie/simplepie/src/RegistryAware.php (limited to 'vendor') diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 896daae0b..d383f28cf 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -883,11 +883,16 @@ return array( 'SimplePie\\Author' => $vendorDir . '/simplepie/simplepie/src/Author.php', 'SimplePie\\Cache' => $vendorDir . '/simplepie/simplepie/src/Cache.php', 'SimplePie\\Cache\\Base' => $vendorDir . '/simplepie/simplepie/src/Cache/Base.php', + 'SimplePie\\Cache\\BaseDataCache' => $vendorDir . '/simplepie/simplepie/src/Cache/BaseDataCache.php', + 'SimplePie\\Cache\\CallableNameFilter' => $vendorDir . '/simplepie/simplepie/src/Cache/CallableNameFilter.php', 'SimplePie\\Cache\\DB' => $vendorDir . '/simplepie/simplepie/src/Cache/DB.php', + 'SimplePie\\Cache\\DataCache' => $vendorDir . '/simplepie/simplepie/src/Cache/DataCache.php', 'SimplePie\\Cache\\File' => $vendorDir . '/simplepie/simplepie/src/Cache/File.php', 'SimplePie\\Cache\\Memcache' => $vendorDir . '/simplepie/simplepie/src/Cache/Memcache.php', 'SimplePie\\Cache\\Memcached' => $vendorDir . '/simplepie/simplepie/src/Cache/Memcached.php', 'SimplePie\\Cache\\MySQL' => $vendorDir . '/simplepie/simplepie/src/Cache/MySQL.php', + 'SimplePie\\Cache\\NameFilter' => $vendorDir . '/simplepie/simplepie/src/Cache/NameFilter.php', + 'SimplePie\\Cache\\Psr16' => $vendorDir . '/simplepie/simplepie/src/Cache/Psr16.php', 'SimplePie\\Cache\\Redis' => $vendorDir . '/simplepie/simplepie/src/Cache/Redis.php', 'SimplePie\\Caption' => $vendorDir . '/simplepie/simplepie/src/Caption.php', 'SimplePie\\Category' => $vendorDir . '/simplepie/simplepie/src/Category.php', @@ -908,6 +913,7 @@ return array( 'SimplePie\\Parser' => $vendorDir . '/simplepie/simplepie/src/Parser.php', 'SimplePie\\Rating' => $vendorDir . '/simplepie/simplepie/src/Rating.php', 'SimplePie\\Registry' => $vendorDir . '/simplepie/simplepie/src/Registry.php', + 'SimplePie\\RegistryAware' => $vendorDir . '/simplepie/simplepie/src/RegistryAware.php', 'SimplePie\\Restriction' => $vendorDir . '/simplepie/simplepie/src/Restriction.php', 'SimplePie\\Sanitize' => $vendorDir . '/simplepie/simplepie/src/Sanitize.php', 'SimplePie\\SimplePie' => $vendorDir . '/simplepie/simplepie/src/SimplePie.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 1a3ed33e7..6eb5d4ca6 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1094,11 +1094,16 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d 'SimplePie\\Author' => __DIR__ . '/..' . '/simplepie/simplepie/src/Author.php', 'SimplePie\\Cache' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache.php', 'SimplePie\\Cache\\Base' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/Base.php', + 'SimplePie\\Cache\\BaseDataCache' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/BaseDataCache.php', + 'SimplePie\\Cache\\CallableNameFilter' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/CallableNameFilter.php', 'SimplePie\\Cache\\DB' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/DB.php', + 'SimplePie\\Cache\\DataCache' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/DataCache.php', 'SimplePie\\Cache\\File' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/File.php', 'SimplePie\\Cache\\Memcache' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/Memcache.php', 'SimplePie\\Cache\\Memcached' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/Memcached.php', 'SimplePie\\Cache\\MySQL' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/MySQL.php', + 'SimplePie\\Cache\\NameFilter' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/NameFilter.php', + 'SimplePie\\Cache\\Psr16' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/Psr16.php', 'SimplePie\\Cache\\Redis' => __DIR__ . '/..' . '/simplepie/simplepie/src/Cache/Redis.php', 'SimplePie\\Caption' => __DIR__ . '/..' . '/simplepie/simplepie/src/Caption.php', 'SimplePie\\Category' => __DIR__ . '/..' . '/simplepie/simplepie/src/Category.php', @@ -1119,6 +1124,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d 'SimplePie\\Parser' => __DIR__ . '/..' . '/simplepie/simplepie/src/Parser.php', 'SimplePie\\Rating' => __DIR__ . '/..' . '/simplepie/simplepie/src/Rating.php', 'SimplePie\\Registry' => __DIR__ . '/..' . '/simplepie/simplepie/src/Registry.php', + 'SimplePie\\RegistryAware' => __DIR__ . '/..' . '/simplepie/simplepie/src/RegistryAware.php', 'SimplePie\\Restriction' => __DIR__ . '/..' . '/simplepie/simplepie/src/Restriction.php', 'SimplePie\\Sanitize' => __DIR__ . '/..' . '/simplepie/simplepie/src/Sanitize.php', 'SimplePie\\SimplePie' => __DIR__ . '/..' . '/simplepie/simplepie/src/SimplePie.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ae627ff6a..0a9f11410 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1478,27 +1478,28 @@ }, { "name": "simplepie/simplepie", - "version": "1.7.0", - "version_normalized": "1.7.0.0", + "version": "1.8.0", + "version_normalized": "1.8.0.0", "source": { "type": "git", "url": "https://github.com/simplepie/simplepie.git", - "reference": "9e9add3428ce86aede874bcf9a59c78e272f8dc1" + "reference": "65b095d87bc00898d8fa7737bdbcda93a3fbcc55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplepie/simplepie/zipball/9e9add3428ce86aede874bcf9a59c78e272f8dc1", - "reference": "9e9add3428ce86aede874bcf9a59c78e272f8dc1", + "url": "https://api.github.com/repos/simplepie/simplepie/zipball/65b095d87bc00898d8fa7737bdbcda93a3fbcc55", + "reference": "65b095d87bc00898d8fa7737bdbcda93a3fbcc55", "shasum": "" }, "require": { "ext-pcre": "*", "ext-xml": "*", "ext-xmlreader": "*", - "php": ">=5.6.0" + "php": ">=7.2.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.19 || ^3.8", + "psr/simple-cache": "^1 || ^2 || ^3", "yoast/phpunit-polyfills": "^1.0.1" }, "suggest": { @@ -1508,7 +1509,7 @@ "ext-mbstring": "", "mf2/mf2": "Microformat module that allows for parsing HTML for microformats" }, - "time": "2022-09-30T06:49:48+00:00", + "time": "2023-01-20T08:37:35+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1559,7 +1560,7 @@ "rss" ], "support": { - "source": "https://github.com/simplepie/simplepie/tree/1.7.0", + "source": "https://github.com/simplepie/simplepie/tree/1.8.0", "issues": "https://github.com/simplepie/simplepie/issues" }, "install-path": "../simplepie/simplepie" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 640c54dff..f0c95b248 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'zotlabs/hubzilla', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '94b26e1e66113d1936aa6f1b944a3161b99e8750', + 'reference' => 'c3d3dc9d92d14dbcfbaf39c4cc9ad4c120812a3d', 'type' => 'application', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -206,9 +206,9 @@ 'dev_requirement' => false, ), 'simplepie/simplepie' => array( - 'pretty_version' => '1.7.0', - 'version' => '1.7.0.0', - 'reference' => '9e9add3428ce86aede874bcf9a59c78e272f8dc1', + 'pretty_version' => '1.8.0', + 'version' => '1.8.0.0', + 'reference' => '65b095d87bc00898d8fa7737bdbcda93a3fbcc55', 'type' => 'library', 'install_path' => __DIR__ . '/../simplepie/simplepie', 'aliases' => array(), @@ -268,7 +268,7 @@ 'zotlabs/hubzilla' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '94b26e1e66113d1936aa6f1b944a3161b99e8750', + 'reference' => 'c3d3dc9d92d14dbcfbaf39c4cc9ad4c120812a3d', 'type' => 'application', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/simplepie/simplepie/.php-cs-fixer.dist.php b/vendor/simplepie/simplepie/.php-cs-fixer.dist.php index 97d39cbcd..d26f7c6c6 100644 --- a/vendor/simplepie/simplepie/.php-cs-fixer.dist.php +++ b/vendor/simplepie/simplepie/.php-cs-fixer.dist.php @@ -2,7 +2,6 @@ $finder = (new PhpCsFixer\Finder()) ->in('build') - ->in('demo') ->in('library') ->in('src') ->in('tests') @@ -11,9 +10,10 @@ $finder = (new PhpCsFixer\Finder()) return (new PhpCsFixer\Config()) ->setRules([ '@PSR12' => true, - '@PHP54Migration' => true, - // TODO: Allow `const` after bump requirements to PHP >=7.1 - 'visibility_required' => ['elements' => ['property', 'method', /* 'const' */]], + '@PHP71Migration' => true, + '@PHP71Migration:risky' => true, + 'void_return' => false, + '@PHPUnit84Migration:risky' => true, ]) ->setFinder($finder) ; diff --git a/vendor/simplepie/simplepie/CHANGELOG.md b/vendor/simplepie/simplepie/CHANGELOG.md index 18d8c3f1f..dba92bbf7 100644 --- a/vendor/simplepie/simplepie/CHANGELOG.md +++ b/vendor/simplepie/simplepie/CHANGELOG.md @@ -5,7 +5,58 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/simplepie/simplepie/compare/1.7.0...master) +## [Unreleased](https://github.com/simplepie/simplepie/compare/1.8.0...master) + +## [1.8.0](https://github.com/simplepie/simplepie/compare/1.7.0...1.8.0) - 2023-01-20 + +### Added + +- New method `SimplePie\SimplePie::set_cache()` for providing a PSR-16 cache implementation by @Art4 in [#742](https://github.com/simplepie/simplepie/pull/742) +- New method `SimplePie\SimplePie::set_cache_namefilter()` for customize the cache key in [#762](https://github.com/simplepie/simplepie/pull/762) +- New class `SimplePie\Cache\CallableNameFilter` to provide a `callable` to customize the cache key in [#762](https://github.com/simplepie/simplepie/pull/762) +- New interface `SimplePie\RegistryAware` to inject the `Registry` instance into classes created by `Registry` by @Art4 in [#760](https://github.com/simplepie/simplepie/pull/760) +- update PHP versions in GH Actions workflows by @jrfnl in [#767](https://github.com/simplepie/simplepie/pull/767) +- Registry: Allow using class-strings instead of magic strings by @jtojnar and @Art4 in [#766](https://github.com/simplepie/simplepie/pull/766) + +### Changed + +- Clarify branching strategy by @Art4 in [#751](https://github.com/simplepie/simplepie/pull/751) +- Use native array_replace_recursive() by @Alkarex in [#749](https://github.com/simplepie/simplepie/pull/749) +- PHP 7.2 or newer is now required by @Art4 in [#743](https://github.com/simplepie/simplepie/pull/743) +- Parse\Date: Clean up regex structure by @jtojnar in [#765](https://github.com/simplepie/simplepie/pull/765) +- Declare strict_types=1 in every file by @Art4 in [#763](https://github.com/simplepie/simplepie/pull/763) + +### Fixed + +- Item::get_date(): fix return type on unparsable date by @jtojnar in [#753](https://github.com/simplepie/simplepie/pull/753) +- Fix error handling for PHP 8.1 by @cedric-anne in [#747](https://github.com/simplepie/simplepie/pull/747) +- The method `SimplePie\SimplePie::get_image_height()` returns the pixel number as `int` instead of `float` by @Art4 in [#763](https://github.com/simplepie/simplepie/pull/763) +- The method `SimplePie\SimplePie::get_image_width()` returns the pixel number as `int` instead of `float` by @Art4 in [#763](https://github.com/simplepie/simplepie/pull/763) +- No URL Decode for enclosure links by @Alkarex in [#768](https://github.com/simplepie/simplepie/pull/768) +- Sanitize thumbnail URL by @Alkarex in [#770](https://github.com/simplepie/simplepie/pull/770) +- Fix case of multiple RSS2.0 enclosures by @Alkarex in [#769](https://github.com/simplepie/simplepie/pull/769) +- Fix broken phpdoc references by @jtojnar in [#771](https://github.com/simplepie/simplepie/pull/771) + +### Deprecated + +- The method `SimplePie\Misc::array_merge_recursive()` is deprecated, use native `array_replace_recursive()` instead +- The method `SimplePie\SimplePie::set_cache_name_function()` is deprecated, use `SimplePie\SimplePie::set_cache_namefilter()` instead +- The method `SimplePie\SimplePie::set_cache_location()` is deprecated, use `SimplePie\SimplePie::set_cache()` instead +- The method `SimplePie\SimplePie::force_cache_fallback()` is deprecated, expired cache will not be used anymore +- The class `SimplePie\Cache` is deprecated, use implementation of `SimplePie\SimplePie::set_cache()` instead +- The class `SimplePie\Cache\DB` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The class `SimplePie\Cache\File` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The class `SimplePie\Cache\Memcache` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The class `SimplePie\Cache\Memcached` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The class `SimplePie\Cache\MySQL` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The class `SimplePie\Cache\Redis` is deprecated, use implementation of `Psr\SimpleCache\CacheInterface` instead +- The interface `SimplePie\Cache\Base` is deprecated, use interface `Psr\SimpleCache\CacheInterface` instead + +### Removed + +- ROADMAP.md removed by @Art4 in [#748](https://github.com/simplepie/simplepie/pull/748) +- remove check for E_USER_DEPRECATED definition by @Art4 in [#750](https://github.com/simplepie/simplepie/pull/750) +- remove broken BC code in Registry by @Art4 in [#764](https://github.com/simplepie/simplepie/pull/764) ## [1.7.0](https://github.com/simplepie/simplepie/compare/1.6.0...1.7.0) - 2022-09-30 diff --git a/vendor/simplepie/simplepie/README.markdown b/vendor/simplepie/simplepie/README.markdown index ca982cabe..5500f03c2 100644 --- a/vendor/simplepie/simplepie/README.markdown +++ b/vendor/simplepie/simplepie/README.markdown @@ -11,7 +11,7 @@ compatibility and standards compliance][what_is]. Requirements ------------ -* PHP 5.6+ (Required since SimplePie 1.5.3) +* PHP 7.2+ (Required since SimplePie 1.8.0) * libxml2 (certain 2.7.x releases are too buggy for words, and will crash) * One of iconv, mbstring or intl extensions * cURL or fsockopen() @@ -75,9 +75,20 @@ to be prioritized. If you'd like to contribute to SimplePie, the best way to get started is to fork the project on GitHub and send pull requests for patches. When doing so, please -be aware of our [coding standards][]. +be aware of our [coding standards](http://simplepie.org/wiki/misc/coding_standards). -[coding standards]: http://simplepie.org/wiki/misc/coding_standards +The main development for the next minor release happens in `master` branch. +Please create your pull requests primarily against this branch. + +We do not actively provide bug fixes or security fixes for older versions. Nevertheless, +you are welcome to create backport PRs if you still need support for older PHP versions. +Please open your PR against the appropriate branch. + +| branch | requires | +|----------------------------------------------------------------------------|-------------| +| [master](https://github.com/simplepie/simplepie/tree/master) | PHP 7.2.0+ | +| [one-dot-seven](https://github.com/simplepie/simplepie/tree/one-dot-seven) | PHP 5.6.0+ | +| [one-dot-three](https://github.com/simplepie/simplepie/tree/one-dot-three) | PHP 5.2.0+ | Authors and contributors diff --git a/vendor/simplepie/simplepie/composer.json b/vendor/simplepie/simplepie/composer.json index 71267ce0c..cfede2b53 100644 --- a/vendor/simplepie/simplepie/composer.json +++ b/vendor/simplepie/simplepie/composer.json @@ -24,13 +24,14 @@ } ], "require": { - "php": ">=5.6.0", + "php": ">=7.2.0", "ext-pcre": "*", "ext-xml": "*", "ext-xmlreader": "*" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.19 || ^3.8", + "psr/simple-cache": "^1 || ^2 || ^3", "yoast/phpunit-polyfills": "^1.0.1" }, "suggest": { diff --git a/vendor/simplepie/simplepie/library/SimplePie.php b/vendor/simplepie/simplepie/library/SimplePie.php index 76c1c2213..8a2b334e1 100755 --- a/vendor/simplepie/simplepie/library/SimplePie.php +++ b/vendor/simplepie/simplepie/library/SimplePie.php @@ -1,4 +1,6 @@ $class Name of handler class. Must implement Base */ public static function register($type, $class) { diff --git a/vendor/simplepie/simplepie/src/Cache/Base.php b/vendor/simplepie/simplepie/src/Cache/Base.php index 08304648b..134d097fc 100644 --- a/vendor/simplepie/simplepie/src/Cache/Base.php +++ b/vendor/simplepie/simplepie/src/Cache/Base.php @@ -1,4 +1,6 @@ cache = $cache; + } + + /** + * Fetches a value from the cache. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::get() + * + * public function get(string $key, mixed $default = null): mixed; + * + * + * @param string $key The unique key of this item in the cache. + * @param mixed $default Default value to return if the key does not exist. + * + * @return array|mixed The value of the item from the cache, or $default in case of cache miss. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function get_data(string $key, $default = null) + { + $data = $this->cache->load(); + + if (! is_array($data)) { + return $default; + } + + // ignore data if internal cache expiration time is not set + if (! array_key_exists('__cache_expiration_time', $data)) { + return $default; + } + + // ignore data if internal cache expiration time is expired + if ($data['__cache_expiration_time'] < time()) { + return $default; + } + + // remove internal cache expiration time + unset($data['__cache_expiration_time']); + + return $data; + } + + /** + * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::set() + * + * public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool; + * + * + * @param string $key The key of the item to store. + * @param array $value The value of the item to store, must be serializable. + * @param null|int $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * + * @return bool True on success and false on failure. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function set_data(string $key, array $value, ?int $ttl = null): bool + { + if ($ttl === null) { + $ttl = 3600; + } + + // place internal cache expiration time + $value['__cache_expiration_time'] = time() + $ttl; + + return $this->cache->save($value); + } + + /** + * Delete an item from the cache by its unique key. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::delete() + * + * public function delete(string $key): bool; + * + * + * @param string $key The unique cache key of the item to delete. + * + * @return bool True if the item was successfully removed. False if there was an error. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function delete_data(string $key): bool + { + return $this->cache->unlink(); + } +} diff --git a/vendor/simplepie/simplepie/src/Cache/CallableNameFilter.php b/vendor/simplepie/simplepie/src/Cache/CallableNameFilter.php new file mode 100644 index 000000000..0583d0d9b --- /dev/null +++ b/vendor/simplepie/simplepie/src/Cache/CallableNameFilter.php @@ -0,0 +1,89 @@ +callable = $callable; + } + + /** + * Method to create cache filename with. + * + * The returning name MUST follow the rules for keys in PSR-16. + * + * @link https://www.php-fig.org/psr/psr-16/ + * + * The returning name MUST be a string of at least one character + * that uniquely identifies a cached item, MUST only contain the + * characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding + * and MUST not longer then 64 characters. The following characters + * are reserved for future extensions and MUST NOT be used: {}()/\@: + * + * A provided implementing library MAY support additional characters + * and encodings or longer lengths, but MUST support at least that + * minimum. + * + * @param string $name The name for the cache will be most likly an url with query string + * + * @return string the new cache name + */ + public function filter(string $name): string + { + return call_user_func($this->callable, $name); + } +} diff --git a/vendor/simplepie/simplepie/src/Cache/DB.php b/vendor/simplepie/simplepie/src/Cache/DB.php index 6bb37d283..7994e3210 100644 --- a/vendor/simplepie/simplepie/src/Cache/DB.php +++ b/vendor/simplepie/simplepie/src/Cache/DB.php @@ -1,4 +1,6 @@ + * public function get(string $key, mixed $default = null): mixed; + * + * + * @param string $key The unique key of this item in the cache. + * @param mixed $default Default value to return if the key does not exist. + * + * @return array|mixed The value of the item from the cache, or $default in case of cache miss. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function get_data(string $key, $default = null); + + /** + * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::set() + * + * public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool; + * + * + * @param string $key The key of the item to store. + * @param array $value The value of the item to store, must be serializable. + * @param null|int $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * + * @return bool True on success and false on failure. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function set_data(string $key, array $value, ?int $ttl = null): bool; + + /** + * Delete an item from the cache by its unique key. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::delete() + * + * public function delete(string $key): bool; + * + * + * @param string $key The unique cache key of the item to delete. + * + * @return bool True if the item was successfully removed. False if there was an error. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function delete_data(string $key): bool; +} diff --git a/vendor/simplepie/simplepie/src/Cache/File.php b/vendor/simplepie/simplepie/src/Cache/File.php index b4076ba0a..248d41a8a 100644 --- a/vendor/simplepie/simplepie/src/Cache/File.php +++ b/vendor/simplepie/simplepie/src/Cache/File.php @@ -1,4 +1,6 @@ 'simplepie_', ], ]; - $this->options = \SimplePie\Misc::array_merge_recursive($this->options, \SimplePie\Cache::parse_URL($location)); + $this->options = array_replace_recursive($this->options, \SimplePie\Cache::parse_URL($location)); $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); @@ -109,7 +112,7 @@ class Memcache implements Base /** * Save data to the cache * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property * @return bool Successfulness */ public function save($data) diff --git a/vendor/simplepie/simplepie/src/Cache/Memcached.php b/vendor/simplepie/simplepie/src/Cache/Memcached.php index db58ddc02..4aa3701b5 100644 --- a/vendor/simplepie/simplepie/src/Cache/Memcached.php +++ b/vendor/simplepie/simplepie/src/Cache/Memcached.php @@ -1,4 +1,6 @@ 'simplepie_', ], ]; - $this->options = \SimplePie\Misc::array_merge_recursive($this->options, \SimplePie\Cache::parse_URL($location)); + $this->options = array_replace_recursive($this->options, \SimplePie\Cache::parse_URL($location)); $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); @@ -105,7 +108,7 @@ class Memcached implements Base /** * Save data to the cache - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property * @return bool Successfulness */ public function save($data) diff --git a/vendor/simplepie/simplepie/src/Cache/MySQL.php b/vendor/simplepie/simplepie/src/Cache/MySQL.php index 7d645b277..62abb12cd 100644 --- a/vendor/simplepie/simplepie/src/Cache/MySQL.php +++ b/vendor/simplepie/simplepie/src/Cache/MySQL.php @@ -1,4 +1,6 @@ options = \SimplePie\Misc::array_merge_recursive($this->options, \SimplePie\Cache::parse_URL($location)); + $this->options = array_replace_recursive($this->options, \SimplePie\Cache::parse_URL($location)); // Path is prefixed with a "/" $this->options['dbname'] = substr($this->options['path'], 1); @@ -145,7 +148,7 @@ class MySQL extends DB /** * Save data to the cache * - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @param array|\SimplePie\SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property * @return bool Successfulness */ public function save($data) diff --git a/vendor/simplepie/simplepie/src/Cache/NameFilter.php b/vendor/simplepie/simplepie/src/Cache/NameFilter.php new file mode 100644 index 000000000..19ce7b0a2 --- /dev/null +++ b/vendor/simplepie/simplepie/src/Cache/NameFilter.php @@ -0,0 +1,76 @@ +cache = $cache; + } + + /** + * Fetches a value from the cache. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::get() + * + * public function get(string $key, mixed $default = null): mixed; + * + * + * @param string $key The unique key of this item in the cache. + * @param mixed $default Default value to return if the key does not exist. + * + * @return array|mixed The value of the item from the cache, or $default in case of cache miss. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function get_data(string $key, $default = null) + { + $data = $this->cache->get($key, $default); + + if (! is_array($data) || $data === $default) { + return $default; + } + + return $data; + } + + /** + * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::set() + * + * public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool; + * + * + * @param string $key The key of the item to store. + * @param array $value The value of the item to store, must be serializable. + * @param null|int $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * + * @return bool True on success and false on failure. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function set_data(string $key, array $value, ?int $ttl = null): bool + { + return $this->cache->set($key, $value, $ttl); + } + + /** + * Delete an item from the cache by its unique key. + * + * Equivalent to \Psr\SimpleCache\CacheInterface::delete() + * + * public function delete(string $key): bool; + * + * + * @param string $key The unique cache key of the item to delete. + * + * @return bool True if the item was successfully removed. False if there was an error. + * + * @throws InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function delete_data(string $key): bool + { + return $this->cache->delete($key); + } +} diff --git a/vendor/simplepie/simplepie/src/Cache/Redis.php b/vendor/simplepie/simplepie/src/Cache/Redis.php index 96f47f658..0effccadb 100644 --- a/vendor/simplepie/simplepie/src/Cache/Redis.php +++ b/vendor/simplepie/simplepie/src/Cache/Redis.php @@ -1,4 +1,6 @@ link !== null) { - return urldecode($this->link); + return $this->link; } return null; @@ -875,6 +877,7 @@ class Enclosure $widescreen = false; $handler = $this->get_handler(); $type = $this->get_real_type(); + $placeholder = ''; // Process options and reassign values as necessary if (is_array($options)) { diff --git a/vendor/simplepie/simplepie/src/Exception.php b/vendor/simplepie/simplepie/src/Exception.php index 5c34c3483..a20681f55 100644 --- a/vendor/simplepie/simplepie/src/Exception.php +++ b/vendor/simplepie/simplepie/src/Exception.php @@ -1,4 +1,6 @@ compressed_size >= $this->min_compressed_size) { + $len = 0; + // Check ID1, ID2, and CM if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") { return false; diff --git a/vendor/simplepie/simplepie/src/HTTP/Parser.php b/vendor/simplepie/simplepie/src/HTTP/Parser.php index a36c32f4f..15c46ebe8 100644 --- a/vendor/simplepie/simplepie/src/HTTP/Parser.php +++ b/vendor/simplepie/simplepie/src/HTTP/Parser.php @@ -1,4 +1,6 @@ state = self::STATE_EMIT; $this->body = $decoded; diff --git a/vendor/simplepie/simplepie/src/IRI.php b/vendor/simplepie/simplepie/src/IRI.php index 09e8488f5..ce4c2c211 100644 --- a/vendor/simplepie/simplepie/src/IRI.php +++ b/vendor/simplepie/simplepie/src/IRI.php @@ -1,4 +1,6 @@ = 0xFDD0 && $character <= 0xFDEF || ( // Everything else not in ucschar - $character > 0xD7FF && $character < 0xF900 + $character > 0xD7FF && $character < 0xF900 || $character < 0xA0 || $character > 0xEFFFD ) && ( // Everything not in iprivate, if it applies - !$iprivate + !$iprivate || $character < 0xE000 || $character > 0x10FFFD ) @@ -538,6 +541,12 @@ class IRI $string = ''; $remaining = 0; + // these variables will be initialized in the loop but PHPStan is not able to detect it currently + $start = 0; + $character = 0; + $length = 0; + $valid = true; + // Loop over each and every byte, and set $value to its value for ($i = 1, $len = count($bytes); $i < $len; $i++) { $value = hexdec($bytes[$i]); @@ -717,14 +726,17 @@ class IRI if ($iri === null) { return true; } elseif (isset($cache[$iri])) { - list($this->scheme, - $this->iuserinfo, - $this->ihost, - $this->port, - $this->ipath, - $this->iquery, - $this->ifragment, - $return) = $cache[$iri]; + [ + $this->scheme, + $this->iuserinfo, + $this->ihost, + $this->port, + $this->ipath, + $this->iquery, + $this->ifragment, + $return + ] = $cache[$iri]; + return $return; } @@ -739,14 +751,17 @@ class IRI && $this->set_query($parsed['query']) && $this->set_fragment($parsed['fragment']); - $cache[$iri] = [$this->scheme, - $this->iuserinfo, - $this->ihost, - $this->port, - $this->ipath, - $this->iquery, - $this->ifragment, - $return]; + $cache[$iri] = [ + $this->scheme, + $this->iuserinfo, + $this->ihost, + $this->port, + $this->ipath, + $this->iquery, + $this->ifragment, + $return + ]; + return $return; } @@ -794,10 +809,12 @@ class IRI $this->port = null; return true; } elseif (isset($cache[$authority])) { - list($this->iuserinfo, - $this->ihost, - $this->port, - $return) = $cache[$authority]; + [ + $this->iuserinfo, + $this->ihost, + $this->port, + $return + ] = $cache[$authority]; return $return; } @@ -809,7 +826,7 @@ class IRI } else { $iuserinfo = null; } - if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) { + if (($port_start = strpos($remaining, ':', intval(strpos($remaining, ']')))) !== false) { if (($port = substr($remaining, $port_start + 1)) === false) { $port = null; } @@ -822,10 +839,12 @@ class IRI $this->set_host($remaining) && $this->set_port($port); - $cache[$authority] = [$this->iuserinfo, - $this->ihost, - $this->port, - $return]; + $cache[$authority] = [ + $this->iuserinfo, + $this->ihost, + $this->port, + $return + ]; return $return; } diff --git a/vendor/simplepie/simplepie/src/Item.php b/vendor/simplepie/simplepie/src/Item.php index 61fd35fa0..f25b50d04 100644 --- a/vendor/simplepie/simplepie/src/Item.php +++ b/vendor/simplepie/simplepie/src/Item.php @@ -1,4 +1,6 @@ registry = $registry; } @@ -253,9 +255,9 @@ class Item { if (!isset($this->data['title'])) { if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'title')) { - $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'title')) { - $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10, 'title')) { $this->data['title'] = $this->sanitize($return[0]['data'], \SimplePie\SimplePie::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_090, 'title')) { @@ -291,10 +293,10 @@ class Item public function get_description($description_only = false) { if (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'summary')) && - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { + ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { return $return; } elseif (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'summary')) && - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { + ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { return $return; } elseif (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10, 'description')) && ($return = $this->sanitize($tags[0]['data'], \SimplePie\SimplePie::CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) { @@ -341,10 +343,10 @@ class Item public function get_content($content_only = false) { if (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'content')) && - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { + ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_10_content_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { return $return; } elseif (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'content')) && - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { + ($return = $this->sanitize($tags[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$tags[0]['attribs']]), $this->get_base($tags[0])))) { return $return; } elseif (($tags = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) && ($return = $this->sanitize($tags[0]['data'], \SimplePie\SimplePie::CONSTRUCT_HTML, $this->get_base($tags[0])))) { @@ -368,7 +370,13 @@ class Item { if (!isset($this->data['thumbnail'])) { if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'thumbnail')) { - $this->data['thumbnail'] = $return[0]['attribs']['']; + $thumbnail = $return[0]['attribs']['']; + if (empty($thumbnail['url'])) { + $this->data['thumbnail'] = null; + } else { + $thumbnail['url'] = $this->sanitize($thumbnail['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($return[0])); + $this->data['thumbnail'] = $thumbnail; + } } else { $this->data['thumbnail'] = null; } @@ -419,7 +427,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label, $type]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label, $type]); } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, $type) as $category) { // This is really the label, but keep this as the term also for BC. @@ -430,15 +438,15 @@ class Item } else { $scheme = null; } - $categories[] = $this->registry->create('Category', [$term, $scheme, null, $type]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, null, $type]); } $type = 'subject'; foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, $type) as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null, $type]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null, $type]); } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_10, $type) as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null, $type]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null, $type]); } if (!empty($categories)) { @@ -507,7 +515,7 @@ class Item $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] = $this->registry->create('Author', [$name, $uri, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'contributor') as $contributor) { @@ -524,7 +532,7 @@ class Item $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $contributors[] = $this->registry->create('Author', [$name, $url, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } @@ -560,7 +568,7 @@ class Item $email = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $authors[] = $this->registry->create('Author', [$name, $uri, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } if ($author = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'author')) { @@ -577,20 +585,20 @@ class Item $email = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $authors[] = $this->registry->create('Author', [$name, $url, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } if ($author = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'author')) { - $authors[] = $this->registry->create('Author', [null, null, $this->sanitize($author[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT)]); + $authors[] = $this->registry->create(Author::class, [null, null, $this->sanitize($author[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT)]); } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_10, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'author') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } if (!empty($authors)) { @@ -615,7 +623,7 @@ class Item public function get_copyright() { if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'rights')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, 'rights')) { return $this->sanitize($return[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } elseif ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_DC_10, 'rights')) { @@ -661,8 +669,8 @@ class Item } if (!empty($this->data['date']['raw'])) { - $parser = $this->registry->call('Parse_Date', 'get'); - $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); + $parser = $this->registry->call(Parse\Date::class, 'get'); + $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']) ?: null; } else { $this->data['date'] = null; } @@ -703,8 +711,8 @@ class Item } if (!empty($this->data['updated']['raw'])) { - $parser = $this->registry->call('Parse_Date', 'get'); - $this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']); + $parser = $this->registry->call(Parse\Date::class, 'get'); + $this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']) ?: null; } else { $this->data['updated'] = null; } @@ -867,7 +875,7 @@ class Item $keys = array_keys($this->data['links']); foreach ($keys as $key) { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', [$key])) { + if ($this->registry->call(Misc::class, 'is_isegment_nz_nc', [$key])) { if (isset($this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key]; @@ -967,7 +975,7 @@ class Item if (isset($caption['data'])) { $caption_text = $this->sanitize($caption['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $captions_parent[] = $this->registry->create('Caption', [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); + $captions_parent[] = $this->registry->create(Caption::class, [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); } } elseif ($captions = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'text')) { foreach ($captions as $caption) { @@ -991,7 +999,7 @@ class Item if (isset($caption['data'])) { $caption_text = $this->sanitize($caption['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $captions_parent[] = $this->registry->create('Caption', [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); + $captions_parent[] = $this->registry->create(Caption::class, [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); } } if (is_array($captions_parent)) { @@ -1014,7 +1022,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories_parent[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories_parent[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } foreach ((array) $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'category') as $category) { $term = null; @@ -1031,7 +1039,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories_parent[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories_parent[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } foreach ((array) $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'category') as $category) { $term = null; @@ -1040,14 +1048,14 @@ class Item if (isset($category['attribs']['']['text'])) { $label = $this->sanitize($category['attribs']['']['text'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories_parent[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories_parent[] = $this->registry->create(Category::class, [$term, $scheme, $label]); if (isset($category['child'][\SimplePie\SimplePie::NAMESPACE_ITUNES]['category'])) { foreach ((array) $category['child'][\SimplePie\SimplePie::NAMESPACE_ITUNES]['category'] as $subcategory) { if (isset($subcategory['attribs']['']['text'])) { $label = $this->sanitize($subcategory['attribs']['']['text'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories_parent[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories_parent[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } } } @@ -1065,7 +1073,7 @@ class Item if (isset($copyright[0]['data'])) { $copyright_label = $this->sanitize($copyright[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $copyrights_parent = $this->registry->create('Copyright', [$copyright_url, $copyright_label]); + $copyrights_parent = $this->registry->create(Copyright::class, [$copyright_url, $copyright_label]); } elseif ($copyright = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'copyright')) { $copyright_url = null; $copyright_label = null; @@ -1075,7 +1083,7 @@ class Item if (isset($copyright[0]['data'])) { $copyright_label = $this->sanitize($copyright[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $copyrights_parent = $this->registry->create('Copyright', [$copyright_url, $copyright_label]); + $copyrights_parent = $this->registry->create(Copyright::class, [$copyright_url, $copyright_label]); } // CREDITS @@ -1095,7 +1103,7 @@ class Item if (isset($credit['data'])) { $credit_name = $this->sanitize($credit['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $credits_parent[] = $this->registry->create('Credit', [$credit_role, $credit_scheme, $credit_name]); + $credits_parent[] = $this->registry->create(Credit::class, [$credit_role, $credit_scheme, $credit_name]); } } elseif ($credits = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'credit')) { foreach ($credits as $credit) { @@ -1113,7 +1121,7 @@ class Item if (isset($credit['data'])) { $credit_name = $this->sanitize($credit['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $credits_parent[] = $this->registry->create('Credit', [$credit_role, $credit_scheme, $credit_name]); + $credits_parent[] = $this->registry->create(Credit::class, [$credit_role, $credit_scheme, $credit_name]); } } if (is_array($credits_parent)) { @@ -1250,7 +1258,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings_parent[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings_parent[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } } elseif ($ratings = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'explicit')) { foreach ($ratings as $rating) { @@ -1259,7 +1267,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings_parent[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings_parent[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } } elseif ($ratings = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'rating')) { foreach ($ratings as $rating) { @@ -1273,7 +1281,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings_parent[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings_parent[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } } elseif ($ratings = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'explicit')) { foreach ($ratings as $rating) { @@ -1282,7 +1290,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings_parent[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings_parent[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } } if (is_array($ratings_parent)) { @@ -1304,7 +1312,7 @@ class Item if (isset($restriction['data'])) { $restriction_value = $this->sanitize($restriction['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $restrictions_parent[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } } elseif ($restrictions = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'block')) { foreach ($restrictions as $restriction) { @@ -1314,7 +1322,7 @@ class Item if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') { $restriction_relationship = 'deny'; } - $restrictions_parent[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } } elseif ($restrictions = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'restriction')) { foreach ($restrictions as $restriction) { @@ -1330,7 +1338,7 @@ class Item if (isset($restriction['data'])) { $restriction_value = $this->sanitize($restriction['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $restrictions_parent[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } } elseif ($restrictions = $parent->get_channel_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'block')) { foreach ($restrictions as $restriction) { @@ -1340,7 +1348,7 @@ class Item if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') { $restriction_relationship = 'deny'; } - $restrictions_parent[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions_parent[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } } if (is_array($restrictions_parent)) { @@ -1510,7 +1518,7 @@ class Item if (isset($caption['data'])) { $caption_text = $this->sanitize($caption['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $captions[] = $this->registry->create('Caption', [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); + $captions[] = $this->registry->create(Caption::class, [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); } if (is_array($captions)) { $captions = array_values(array_unique($captions)); @@ -1537,7 +1545,7 @@ class Item if (isset($caption['data'])) { $caption_text = $this->sanitize($caption['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $captions[] = $this->registry->create('Caption', [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); + $captions[] = $this->registry->create(Caption::class, [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); } if (is_array($captions)) { $captions = array_values(array_unique($captions)); @@ -1563,7 +1571,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } } if (isset($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['category'])) { @@ -1582,7 +1590,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } } if (is_array($categories) && is_array($categories_parent)) { @@ -1603,7 +1611,7 @@ class Item if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { $copyright_label = $this->sanitize($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $copyrights = $this->registry->create('Copyright', [$copyright_url, $copyright_label]); + $copyrights = $this->registry->create(Copyright::class, [$copyright_url, $copyright_label]); } elseif (isset($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'])) { $copyright_url = null; $copyright_label = null; @@ -1613,7 +1621,7 @@ class Item if (isset($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { $copyright_label = $this->sanitize($group['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $copyrights = $this->registry->create('Copyright', [$copyright_url, $copyright_label]); + $copyrights = $this->registry->create(Copyright::class, [$copyright_url, $copyright_label]); } else { $copyrights = $copyrights_parent; } @@ -1635,7 +1643,7 @@ class Item if (isset($credit['data'])) { $credit_name = $this->sanitize($credit['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $credits[] = $this->registry->create('Credit', [$credit_role, $credit_scheme, $credit_name]); + $credits[] = $this->registry->create(Credit::class, [$credit_role, $credit_scheme, $credit_name]); } if (is_array($credits)) { $credits = array_values(array_unique($credits)); @@ -1656,7 +1664,7 @@ class Item if (isset($credit['data'])) { $credit_name = $this->sanitize($credit['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $credits[] = $this->registry->create('Credit', [$credit_role, $credit_scheme, $credit_name]); + $credits[] = $this->registry->create(Credit::class, [$credit_role, $credit_scheme, $credit_name]); } if (is_array($credits)) { $credits = array_values(array_unique($credits)); @@ -1762,7 +1770,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } if (is_array($ratings)) { $ratings = array_values(array_unique($ratings)); @@ -1779,7 +1787,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } if (is_array($ratings)) { $ratings = array_values(array_unique($ratings)); @@ -1803,7 +1811,7 @@ class Item if (isset($restriction['data'])) { $restriction_value = $this->sanitize($restriction['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $restrictions[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } if (is_array($restrictions)) { $restrictions = array_values(array_unique($restrictions)); @@ -1822,7 +1830,7 @@ class Item if (isset($restriction['data'])) { $restriction_value = $this->sanitize($restriction['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $restrictions[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } if (is_array($restrictions)) { $restrictions = array_values(array_unique($restrictions)); @@ -1859,7 +1867,7 @@ class Item $title = $title_parent; } - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width]); } } } @@ -1966,7 +1974,7 @@ class Item if (isset($caption['data'])) { $caption_text = $this->sanitize($caption['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $captions[] = $this->registry->create('Caption', [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); + $captions[] = $this->registry->create(Caption::class, [$caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text]); } if (is_array($captions)) { $captions = array_values(array_unique($captions)); @@ -1992,7 +2000,7 @@ class Item if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } } if (is_array($categories) && is_array($categories_parent)) { @@ -2015,7 +2023,7 @@ class Item if (isset($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { $copyright_label = $this->sanitize($content['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['copyright'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $copyrights = $this->registry->create('Copyright', [$copyright_url, $copyright_label]); + $copyrights = $this->registry->create(Copyright::class, [$copyright_url, $copyright_label]); } else { $copyrights = $copyrights_parent; } @@ -2037,7 +2045,7 @@ class Item if (isset($credit['data'])) { $credit_name = $this->sanitize($credit['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $credits[] = $this->registry->create('Credit', [$credit_role, $credit_scheme, $credit_name]); + $credits[] = $this->registry->create(Credit::class, [$credit_role, $credit_scheme, $credit_name]); } if (is_array($credits)) { $credits = array_values(array_unique($credits)); @@ -2113,7 +2121,7 @@ class Item if (isset($rating['data'])) { $rating_value = $this->sanitize($rating['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $ratings[] = $this->registry->create('Rating', [$rating_scheme, $rating_value]); + $ratings[] = $this->registry->create(Rating::class, [$rating_scheme, $rating_value]); } if (is_array($ratings)) { $ratings = array_values(array_unique($ratings)); @@ -2137,7 +2145,7 @@ class Item if (isset($restriction['data'])) { $restriction_value = $this->sanitize($restriction['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $restrictions[] = $this->registry->create('Restriction', [$restriction_relationship, $restriction_type, $restriction_value]); + $restrictions[] = $this->registry->create(Restriction::class, [$restriction_relationship, $restriction_type, $restriction_value]); } if (is_array($restrictions)) { $restrictions = array_values(array_unique($restrictions)); @@ -2167,7 +2175,7 @@ class Item $title = $title_parent; } - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width]); } } } @@ -2204,7 +2212,7 @@ class Item } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title, $width]); } } @@ -2235,12 +2243,12 @@ class Item } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); } } - if ($enclosure = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'enclosure')) { - if (isset($enclosure[0]['attribs']['']['url'])) { + foreach ($this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'enclosure') ?? [] as $enclosure) { + if (isset($enclosure['attribs']['']['url'])) { // Attributes $bitrate = null; $channels = null; @@ -2257,23 +2265,23 @@ class Item $url = null; $width = null; - $url = $this->sanitize($enclosure[0]['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($enclosure[0])); + $url = $this->sanitize($enclosure['attribs']['']['url'], \SimplePie\SimplePie::CONSTRUCT_IRI, $this->get_base($enclosure)); $url = $this->feed->sanitize->https_url($url); - if (isset($enclosure[0]['attribs']['']['type'])) { - $type = $this->sanitize($enclosure[0]['attribs']['']['type'], \SimplePie\SimplePie::CONSTRUCT_TEXT); + if (isset($enclosure['attribs']['']['type'])) { + $type = $this->sanitize($enclosure['attribs']['']['type'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - if (isset($enclosure[0]['attribs']['']['length'])) { - $length = intval($enclosure[0]['attribs']['']['length']); + if (isset($enclosure['attribs']['']['length'])) { + $length = intval($enclosure['attribs']['']['length']); } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); } } if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) { // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $this->data['enclosures'][] = $this->registry->create('Enclosure', [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); + $this->data['enclosures'][] = $this->registry->create(Enclosure::class, [$url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width]); } $this->data['enclosures'] = array_values(array_unique($this->data['enclosures'])); @@ -2342,7 +2350,7 @@ class Item public function get_source() { if ($return = $this->get_item_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'source')) { - return $this->registry->create('Source', [$this, $return[0]]); + return $this->registry->create(Source::class, [$this, $return[0]]); } return null; diff --git a/vendor/simplepie/simplepie/src/Locator.php b/vendor/simplepie/simplepie/src/Locator.php index 2eebf10df..1dc005b47 100644 --- a/vendor/simplepie/simplepie/src/Locator.php +++ b/vendor/simplepie/simplepie/src/Locator.php @@ -1,4 +1,6 @@ registry = $registry; } @@ -105,7 +107,7 @@ class Locator } if ($this->file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE) { - $sniffer = $this->registry->create('Content_Type_Sniffer', [$this->file]); + $sniffer = $this->registry->create(Content\Type\Sniffer::class, [$this->file]); if ($sniffer->get_type() !== 'text/html') { return null; } @@ -142,7 +144,7 @@ class Locator public function is_feed($file, $check_html = false) { if ($file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE) { - $sniffer = $this->registry->create('Content_Type_Sniffer', [$file]); + $sniffer = $this->registry->create(Content\Type\Sniffer::class, [$file]); $sniffed = $sniffer->get_type(); $mime_types = ['application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', @@ -169,7 +171,7 @@ class Locator $elements = $this->dom->getElementsByTagName('base'); foreach ($elements as $element) { if ($element->hasAttribute('href')) { - $base = $this->registry->call('Misc', 'absolutize_url', [trim($element->getAttribute('href')), $this->http_base]); + $base = $this->registry->call(Misc::class, 'absolutize_url', [trim($element->getAttribute('href')), $this->http_base]); if ($base === false) { continue; } @@ -207,24 +209,24 @@ class Locator break; } if ($link->hasAttribute('href') && $link->hasAttribute('rel')) { - $rel = array_unique($this->registry->call('Misc', 'space_separated_tokens', [strtolower($link->getAttribute('rel'))])); + $rel = array_unique($this->registry->call(Misc::class, 'space_separated_tokens', [strtolower($link->getAttribute('rel'))])); $line = method_exists($link, 'getLineNo') ? $link->getLineNo() : 1; if ($this->base_location < $line) { - $href = $this->registry->call('Misc', 'absolutize_url', [trim($link->getAttribute('href')), $this->base]); + $href = $this->registry->call(Misc::class, 'absolutize_url', [trim($link->getAttribute('href')), $this->base]); } else { - $href = $this->registry->call('Misc', 'absolutize_url', [trim($link->getAttribute('href')), $this->http_base]); + $href = $this->registry->call(Misc::class, 'absolutize_url', [trim($link->getAttribute('href')), $this->http_base]); } if ($href === false) { continue; } - if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', [$link->getAttribute('type')])), ['text/html', 'application/rss+xml', 'application/atom+xml'])) && !isset($feeds[$href])) { + if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call(Misc::class, 'parse_mime', [$link->getAttribute('type')])), ['text/html', 'application/rss+xml', 'application/atom+xml'])) && !isset($feeds[$href])) { $this->checked_feeds++; $headers = [ 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ]; - $feed = $this->registry->create('File', [$href, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); + $feed = $this->registry->create(File::class, [$href, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true)) { $feeds[$href] = $feed; } @@ -246,18 +248,18 @@ class Locator foreach ($links as $link) { if ($link->hasAttribute('href')) { $href = trim($link->getAttribute('href')); - $parsed = $this->registry->call('Misc', 'parse_url', [$href]); + $parsed = $this->registry->call(Misc::class, 'parse_url', [$href]); if ($parsed['scheme'] === '' || preg_match('/^(https?|feed)?$/i', $parsed['scheme'])) { if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo()) { - $href = $this->registry->call('Misc', 'absolutize_url', [trim($link->getAttribute('href')), $this->base]); + $href = $this->registry->call(Misc::class, 'absolutize_url', [trim($link->getAttribute('href')), $this->base]); } else { - $href = $this->registry->call('Misc', 'absolutize_url', [trim($link->getAttribute('href')), $this->http_base]); + $href = $this->registry->call(Misc::class, 'absolutize_url', [trim($link->getAttribute('href')), $this->http_base]); } if ($href === false) { continue; } - $current = $this->registry->call('Misc', 'parse_url', [$this->file->url]); + $current = $this->registry->call(Misc::class, 'parse_url', [$this->file->url]); if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) { $this->local[] = $href; @@ -290,26 +292,22 @@ class Locator $query = '//a[@rel and @href] | //link[@rel and @href]'; foreach ($xpath->query($query) as $link) { $href = trim($link->getAttribute('href')); - $parsed = $this->registry->call('Misc', 'parse_url', [$href]); + $parsed = $this->registry->call(Misc::class, 'parse_url', [$href]); if ($parsed['scheme'] === '' || preg_match('/^https?$/i', $parsed['scheme'])) { if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo()) { - $href = - $this->registry->call( - 'Misc', - 'absolutize_url', - [trim($link->getAttribute('href')), - $this->base] - ); + $href = $this->registry->call( + Misc::class, + 'absolutize_url', + [trim($link->getAttribute('href')), $this->base] + ); } else { - $href = - $this->registry->call( - 'Misc', - 'absolutize_url', - [trim($link->getAttribute('href')), - $this->http_base] - ); + $href = $this->registry->call( + Misc::class, + 'absolutize_url', + [trim($link->getAttribute('href')), $this->http_base] + ); } if ($href === false) { return null; @@ -335,7 +333,7 @@ class Locator $headers = [ 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ]; - $feed = $this->registry->create('File', [$value, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); + $feed = $this->registry->create(File::class, [$value, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) { return [$feed]; } else { @@ -357,7 +355,7 @@ class Locator $headers = [ 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ]; - $feed = $this->registry->create('File', [$value, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->curl_options]); + $feed = $this->registry->create(File::class, [$value, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->curl_options]); if ($feed->success && ($feed->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) { return [$feed]; } else { diff --git a/vendor/simplepie/simplepie/src/Misc.php b/vendor/simplepie/simplepie/src/Misc.php index b40a1b8ef..87d7f6e2c 100644 --- a/vendor/simplepie/simplepie/src/Misc.php +++ b/vendor/simplepie/simplepie/src/Misc.php @@ -1,4 +1,6 @@ 0) { + if ((error_reporting() & $level) > 0) { switch ($level) { case E_USER_ERROR: $note = 'PHP Error'; @@ -199,6 +203,9 @@ class Misc return $url; } + /** + * @deprecated since SimplePie 1.8.0, use PHP native array_replace_recursive() instead. + */ public static function array_merge_recursive($array1, $array2) { foreach ($array2 as $key => $value) { @@ -1724,13 +1731,13 @@ class Misc /** * Decode HTML entities * - * @deprecated Use DOMDocument instead + * @deprecated since SimplePie 1.3, use DOMDocument instead * @param string $data Input data * @return string Output data */ public static function entities_decode($data) { - // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.7, use "DOMDocument" instead.'), \E_USER_DEPRECATED); + // trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.3, use "DOMDocument" instead.'), \E_USER_DEPRECATED); $decoder = new \SimplePie_Decode_HTML_Entities($data); return $decoder->parse(); @@ -1796,7 +1803,7 @@ class Misc public static function atom_03_construct_type($attribs) { - if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) { + if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode'])) === 'base64') { $mode = \SimplePie\SimplePie::CONSTRUCT_BASE64; } else { $mode = \SimplePie\SimplePie::CONSTRUCT_NONE; @@ -1933,7 +1940,7 @@ class Misc foreach ($str as $section) { if (strpos($section, '=') !== false) { - list($name, $value) = explode('=', $section, 2); + [$name, $value] = explode('=', $section, 2); $return[urldecode($name)][] = urldecode($value); } else { $return[urldecode($section)][] = null; @@ -1976,7 +1983,7 @@ class Misc // UTF-32 Big Endian Without BOM elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") { if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) { - $parser = $registry->create('XML_Declaration_Parser', [Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')]); + $parser = $registry->create(Parser::class, [Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')]); if ($parser->parse()) { $encoding[] = $parser->encoding; } @@ -1986,7 +1993,7 @@ class Misc // UTF-32 Little Endian Without BOM elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") { if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) { - $parser = $registry->create('XML_Declaration_Parser', [Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')]); + $parser = $registry->create(Parser::class, [Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')]); if ($parser->parse()) { $encoding[] = $parser->encoding; } @@ -1996,7 +2003,7 @@ class Misc // UTF-16 Big Endian Without BOM elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") { if ($pos = strpos($data, "\x00\x3F\x00\x3E")) { - $parser = $registry->create('XML_Declaration_Parser', [Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')]); + $parser = $registry->create(Parser::class, [Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')]); if ($parser->parse()) { $encoding[] = $parser->encoding; } @@ -2006,7 +2013,7 @@ class Misc // UTF-16 Little Endian Without BOM elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") { if ($pos = strpos($data, "\x3F\x00\x3E\x00")) { - $parser = $registry->create('XML_Declaration_Parser', [Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')]); + $parser = $registry->create(Parser::class, [Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')]); if ($parser->parse()) { $encoding[] = $parser->encoding; } @@ -2016,7 +2023,7 @@ class Misc // US-ASCII (or superset) elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") { if ($pos = strpos($data, "\x3F\x3E")) { - $parser = $registry->create('XML_Declaration_Parser', [substr($data, 5, $pos - 5)]); + $parser = $registry->create(Parser::class, [substr($data, 5, $pos - 5)]); if ($parser->parse()) { $encoding[] = $parser->encoding; } @@ -2076,7 +2083,7 @@ END; return static::$SIMPLEPIE_BUILD; } - $root = dirname(dirname(__FILE__)); + $root = dirname(__FILE__, 2); if (file_exists($root . '/.git/index')) { static::$SIMPLEPIE_BUILD = filemtime($root . '/.git/index'); diff --git a/vendor/simplepie/simplepie/src/Net/IPv6.php b/vendor/simplepie/simplepie/src/Net/IPv6.php index 8f192cbfb..da25f8353 100644 --- a/vendor/simplepie/simplepie/src/Net/IPv6.php +++ b/vendor/simplepie/simplepie/src/Net/IPv6.php @@ -1,4 +1,6 @@ [0-9]{4}) + (?: + -? + (?P[0-9]{2}) + (?: + -? + (?P[0-9]{2}) + (?: + [Tt\x09\x20]+ + (?P[0-9]{2}) + (?: + :? + (?P[0-9]{2}) + (?: + :? + (?P[0-9]{2}) + (?: + . + (?P[0-9]*) + )? + )? + )? + (?: + (?PZ) + | (?P[+\-]) + (?P[0-9]{1,2}) + :? + (?P[0-9]{1,2}) + ) + )? + )? + )? + $ + /x +PCRE; if (preg_match($pcre, $date, $match)) { - /* - Capturing subpatterns: - 1: Year - 2: Month - 3: Day - 4: Hour - 5: Minute - 6: Second - 7: Decimal fraction of a second - 8: Zulu - 9: Timezone ± - 10: Timezone hours - 11: Timezone minutes - */ - - // Fill in empty matches - for ($i = count($match); $i <= 3; $i++) { - $match[$i] = '1'; - } - - for ($i = count($match); $i <= 7; $i++) { - $match[$i] = '0'; - } + // Fill in empty matches and convert to proper types. + $year = (int) $match['year']; + $month = isset($match['month']) ? (int) $match['month'] : 1; + $day = isset($match['day']) ? (int) $match['day'] : 1; + $hour = isset($match['hour']) ? (int) $match['hour'] : 0; + $minute = isset($match['minute']) ? (int) $match['minute'] : 0; + $second = isset($match['second']) ? (int) $match['second'] : 0; + $second_fraction = isset($match['second_fraction']) ? ((int) $match['second_fraction']) / (10 ** strlen($match['second_fraction'])) : 0; + $tz_sign = ($match['tz_sign'] ?? '') === '-' ? -1 : 1; + $tz_hour = isset($match['tz_hour']) ? (int) $match['tz_hour'] : 0; + $tz_minute = isset($match['tz_minute']) ? (int) $match['tz_minute'] : 0; // Numeric timezone - if (isset($match[9]) && $match[9] !== '') { - $timezone = $match[10] * 3600; - $timezone += $match[11] * 60; - if ($match[9] === '-') { - $timezone = 0 - $timezone; - } - } else { - $timezone = 0; - } + $timezone = $tz_hour * 3600; + $timezone += $tz_minute * 60; + $timezone *= $tz_sign; // Convert the number of seconds to an integer, taking decimals into account - $second = round((int)$match[6] + (int)$match[7] / (10 ** strlen($match[7]))); + $second = (int) round($second + $second_fraction); - return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone; + return gmmktime($hour, $minute, $second, $month, $day, $year) - $timezone; } return false; @@ -855,7 +869,7 @@ class Date $second = 0; } - return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone; + return gmmktime(intval($match[5]), intval($match[6]), intval($second), intval($month), intval($match[2]), intval($match[4])) - $timezone; } return false; @@ -949,7 +963,7 @@ class Date */ $month = $this->month[strtolower($match[2])]; - return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]); + return gmmktime((int) $match[4], (int) $match[5], (int) $match[6], $month, (int) $match[3], (int) $match[7]); } return false; diff --git a/vendor/simplepie/simplepie/src/Parser.php b/vendor/simplepie/simplepie/src/Parser.php index 25c379ef6..4987825e6 100644 --- a/vendor/simplepie/simplepie/src/Parser.php +++ b/vendor/simplepie/simplepie/src/Parser.php @@ -1,4 +1,6 @@ registry = $registry; } @@ -122,7 +126,7 @@ class Parser } if (substr($data, 0, 5) === '')) !== false) { - $declaration = $this->registry->create('XML_Declaration_Parser', [substr($data, 5, $pos - 5)]); + $declaration = $this->registry->create(DeclarationParser::class, [substr($data, 5, $pos - 5)]); if ($declaration->parse()) { $data = substr($data, $pos + 2); $data = 'version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' ."\n". $this->declare_html_entities() . $data; @@ -183,7 +187,6 @@ class Parser $xml->xml($data); while (@$xml->read()) { switch ($xml->nodeType) { - case constant('XMLReader::END_ELEMENT'): if ($xml->namespaceURI !== '') { $tagName = $xml->namespaceURI . $this->separator . $xml->localName; @@ -263,16 +266,16 @@ class Parser public function tag_open($parser, $tag, $attributes) { - list($this->namespace[], $this->element[]) = $this->split_ns($tag); + [$this->namespace[], $this->element[]] = $this->split_ns($tag); $attribs = []; foreach ($attributes as $name => $value) { - list($attrib_namespace, $attribute) = $this->split_ns($name); + [$attrib_namespace, $attribute] = $this->split_ns($name); $attribs[$attrib_namespace][$attribute] = $value; } if (isset($attribs[\SimplePie\SimplePie::NAMESPACE_XML]['base'])) { - $base = $this->registry->call('Misc', 'absolutize_url', [$attribs[\SimplePie\SimplePie::NAMESPACE_XML]['base'], end($this->xml_base)]); + $base = $this->registry->call(Misc::class, 'absolutize_url', [$attribs[\SimplePie\SimplePie::NAMESPACE_XML]['base'], end($this->xml_base)]); if ($base !== false) { $this->xml_base[] = $base; $this->xml_base_explicit[] = true; @@ -394,7 +397,7 @@ class Parser return ''.$person_tag.$name.''; } } - return isset($data['value']) ? $data['value'] : ''; + return $data['value'] ?? ''; } private function parse_microformats(&$data, $url) @@ -477,8 +480,7 @@ class Parser // author is a special case, it can be plain text or an h-card array. // If it's plain text it can also be a url that should be followed to // get the actual h-card. - $author = isset($entry['properties']['author'][0]) ? - $entry['properties']['author'][0] : $feed_author; + $author = $entry['properties']['author'][0] ?? $feed_author; if (!is_string($author)) { $author = $this->parse_hcard($author); } elseif (strpos($author, 'http') === 0) { diff --git a/vendor/simplepie/simplepie/src/Rating.php b/vendor/simplepie/simplepie/src/Rating.php index 70e018ad7..f4f303d99 100644 --- a/vendor/simplepie/simplepie/src/Rating.php +++ b/vendor/simplepie/simplepie/src/Rating.php @@ -1,4 +1,6 @@ */ protected $default = [ + Cache::class => Cache::class, + Locator::class => Locator::class, + Parser::class => Parser::class, + File::class => File::class, + Sanitize::class => Sanitize::class, + Item::class => Item::class, + Author::class => Author::class, + Category::class => Category::class, + Enclosure::class => Enclosure::class, + Caption::class => Caption::class, + Copyright::class => Copyright::class, + Credit::class => Credit::class, + Rating::class => Rating::class, + Restriction::class => Restriction::class, + Sniffer::class => Sniffer::class, + Source::class => Source::class, + Misc::class => Misc::class, + DeclarationParser::class => DeclarationParser::class, + Date::class => Date::class, + ]; + + /** + * Class mapping + * + * @see register() + * @var array + */ + protected $classes = []; + + /** + * Legacy classes + * + * @see register() + * @var array + */ + protected $legacy = []; + + /** + * Legacy types + * + * @see register() + * @var array + */ + private $legacyTypes = [ 'Cache' => Cache::class, 'Locator' => Locator::class, 'Parser' => Parser::class, @@ -74,29 +124,13 @@ class Registry 'Credit' => Credit::class, 'Rating' => Rating::class, 'Restriction' => Restriction::class, - 'Content_Type_Sniffer' => Content\Type\Sniffer::class, + 'Content_Type_Sniffer' => Sniffer::class, 'Source' => Source::class, 'Misc' => Misc::class, - 'XML_Declaration_Parser' => XML\Declaration\Parser::class, - 'Parse_Date' => Parse\Date::class, + 'XML_Declaration_Parser' => DeclarationParser::class, + 'Parse_Date' => Date::class, ]; - /** - * Class mapping - * - * @see register() - * @var array - */ - protected $classes = []; - - /** - * Legacy classes - * - * @see register() - * @var array - */ - protected $legacy = []; - /** * Constructor * @@ -110,13 +144,30 @@ class Registry * Register a class * * @param string $type See {@see $default} for names - * @param string $class Class name, must subclass the corresponding default + * @param class-string $class Class name, must subclass the corresponding default * @param bool $legacy Whether to enable legacy support for this class * @return bool Successfulness */ public function register($type, $class, $legacy = false) { - if (!@is_subclass_of($class, $this->default[$type])) { + if (array_key_exists($type, $this->legacyTypes)) { + // trigger_error(sprintf('"%s"(): Using argument #1 ($type) with value "%s" is deprecated since SimplePie 1.8.0, use class-string "%s" instead.', __METHOD__, $type, $this->legacyTypes[$type]), \E_USER_DEPRECATED); + + $type = $this->legacyTypes[$type]; + } + + if (! array_key_exists($type, $this->default)) { + return false; + } + + if (!class_exists($class)) { + return false; + } + + /** @var string */ + $base_class = $this->default[$type]; + + if (!is_subclass_of($class, $base_class)) { return false; } @@ -134,43 +185,43 @@ class Registry * * Where possible, use {@see create()} or {@see call()} instead * - * @param string $type - * @return string|null + * @template T + * @param class-string $type + * @return class-string|null */ public function get_class($type) { - if (!empty($this->classes[$type])) { - return $this->classes[$type]; + if (array_key_exists($type, $this->legacyTypes)) { + // trigger_error(sprintf('"%s"(): Using argument #1 ($type) with value "%s" is deprecated since SimplePie 1.8.0, use class-string "%s" instead.', __METHOD__, $type, $this->legacyTypes[$type]), \E_USER_DEPRECATED); + + $type = $this->legacyTypes[$type]; } - if (!empty($this->default[$type])) { - return $this->default[$type]; + + if (! array_key_exists($type, $this->default)) { + return null; + } + + $class = $this->default[$type]; + + if (array_key_exists($type, $this->classes)) { + $class = $this->classes[$type]; } - return null; + return $class; } /** * Create a new instance of a given type * - * @param string $type + * @template T class-string $type + * @param class-string $type * @param array $parameters Parameters to pass to the constructor - * @return object Instance of class + * @return T Instance of class */ public function &create($type, $parameters = []) { $class = $this->get_class($type); - if (in_array($class, $this->legacy)) { - switch ($type) { - case 'locator': - // Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class - // Specified: file, timeout, useragent, max_checked_feeds - $replacement = [$this->get_class('file'), $parameters[3], $this->get_class('content_type_sniffer')]; - array_splice($parameters, 3, 1, $replacement); - break; - } - } - if (!method_exists($class, '__construct')) { $instance = new $class(); } else { @@ -178,7 +229,10 @@ class Registry $instance = $reflector->newInstanceArgs($parameters); } - if (method_exists($instance, 'set_registry')) { + if ($instance instanceof RegistryAware) { + $instance->set_registry($this); + } elseif (method_exists($instance, 'set_registry')) { + trigger_error(sprintf('Using the method "set_registry()" without implementing "%s" is deprecated since SimplePie 1.8.0, implement "%s" in "%s".', RegistryAware::class, RegistryAware::class, $class), \E_USER_DEPRECATED); $instance->set_registry($this); } return $instance; @@ -187,7 +241,7 @@ class Registry /** * Call a static method for a type * - * @param string $type + * @param class-string $type * @param string $method * @param array $parameters * @return mixed @@ -198,7 +252,7 @@ class Registry if (in_array($class, $this->legacy)) { switch ($type) { - case 'Cache': + case Cache::class: // For backwards compatibility with old non-static // Cache::create() methods in PHP < 8.0. // No longer supported as of PHP 8.0. diff --git a/vendor/simplepie/simplepie/src/RegistryAware.php b/vendor/simplepie/simplepie/src/RegistryAware.php new file mode 100644 index 000000000..9d60bdd0f --- /dev/null +++ b/vendor/simplepie/simplepie/src/RegistryAware.php @@ -0,0 +1,65 @@ +registry = $registry; } - public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache') + public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', DataCache $cache = null) { if (isset($enable_cache)) { $this->enable_cache = (bool) $enable_cache; @@ -119,8 +143,26 @@ class Sanitize $this->cache_location = (string) $cache_location; } - if ($cache_name_function) { + if (! is_string($cache_name_function) && ! is_object($cache_name_function) && ! $cache_name_function instanceof NameFilter) { + throw new InvalidArgumentException(sprintf( + '%s(): Argument #3 ($cache_name_function) must be of type %s', + __METHOD__, + NameFilter::class + ), 1); + } + + // BC: $cache_name_function could be a callable as string + if (is_string($cache_name_function)) { + // trigger_error(sprintf('Providing $cache_name_function as string in "%s()" is deprecated since SimplePie 1.8.0, provide as "%s" instead.', __METHOD__, NameFilter::class), \E_USER_DEPRECATED); $this->cache_name_function = (string) $cache_name_function; + + $cache_name_function = new CallableNameFilter($cache_name_function); + } + + $this->cache_namefilter = $cache_name_function; + + if ($cache !== null) { + $this->cache = $cache; } } @@ -374,19 +416,20 @@ class Sanitize // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags. if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache) { $images = $document->getElementsByTagName('img'); + foreach ($images as $img) { if ($img->hasAttribute('src')) { - $image_url = call_user_func($this->cache_name_function, $img->getAttribute('src')); - $cache = $this->registry->call('Cache', 'get_handler', [$this->cache_location, $image_url, 'spi']); + $image_url = $this->cache_namefilter->filter($img->getAttribute('src')); + $cache = $this->get_cache($image_url); - if ($cache->load()) { + if ($cache->get_data($image_url, false)) { $img->setAttribute('src', $this->image_handler . $image_url); } else { - $file = $this->registry->create('File', [$img->getAttribute('src'), $this->timeout, 5, ['X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']], $this->useragent, $this->force_fsockopen]); + $file = $this->registry->create(File::class, [$img->getAttribute('src'), $this->timeout, 5, ['X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']], $this->useragent, $this->force_fsockopen]); $headers = $file->headers; if ($file->success && ($file->method & \SimplePie\SimplePie::FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) { - if ($cache->save(['headers' => $file->headers, 'body' => $file->body])) { + if ($cache->set_data($image_url, ['headers' => $file->headers, 'body' => $file->body], $this->cache_duration)) { $img->setAttribute('src', $this->image_handler . $image_url); } else { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); @@ -413,7 +456,7 @@ class Sanitize } if ($type & \SimplePie\SimplePie::CONSTRUCT_IRI) { - $absolute = $this->registry->call('Misc', 'absolutize_url', [$data, $base]); + $absolute = $this->registry->call(Misc::class, 'absolutize_url', [$data, $base]); if ($absolute !== false) { $data = $absolute; } @@ -424,7 +467,7 @@ class Sanitize } if ($this->output_encoding !== 'UTF-8') { - $data = $this->registry->call('Misc', 'change_encoding', [$data, 'UTF-8', $this->output_encoding]); + $data = $this->registry->call(Misc::class, 'change_encoding', [$data, 'UTF-8', $this->output_encoding]); } } return $data; @@ -462,7 +505,7 @@ class Sanitize foreach ($elements as $element) { foreach ($attributes as $attribute) { if ($element->hasAttribute($attribute)) { - $value = $this->registry->call('Misc', 'absolutize_url', [$element->getAttribute($attribute), $this->base]); + $value = $this->registry->call(Misc::class, 'absolutize_url', [$element->getAttribute($attribute), $this->base]); if ($value !== false) { $value = $this->https_url($value); $element->setAttribute($attribute, $value); @@ -586,6 +629,29 @@ class Sanitize } } } + + /** + * Get a DataCache + * + * @param string $image_url Only needed for BC, can be removed in SimplePie 2.0.0 + * + * @return DataCache + */ + private function get_cache($image_url = '') + { + if ($this->cache === null) { + // @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED); + $cache = $this->registry->call(Cache::class, 'get_handler', [ + $this->cache_location, + $image_url, + Base::TYPE_IMAGE + ]); + + return new BaseDataCache($cache); + } + + return $this->cache; + } } class_alias('SimplePie\Sanitize', 'SimplePie_Sanitize'); diff --git a/vendor/simplepie/simplepie/src/SimplePie.php b/vendor/simplepie/simplepie/src/SimplePie.php index 22daa17aa..1dfa39fad 100644 --- a/vendor/simplepie/simplepie/src/SimplePie.php +++ b/vendor/simplepie/simplepie/src/SimplePie.php @@ -1,4 +1,6 @@ ' . self::NAME . ''; + public const LINKBACK = '' . self::NAME . ''; /** * No Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_NONE = 0; + public const LOCATOR_NONE = 0; /** * Feed Link Element Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_AUTODISCOVERY = 1; + public const LOCATOR_AUTODISCOVERY = 1; /** * Local Feed Extension Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_LOCAL_EXTENSION = 2; + public const LOCATOR_LOCAL_EXTENSION = 2; /** * Local Feed Body Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_LOCAL_BODY = 4; + public const LOCATOR_LOCAL_BODY = 4; /** * Remote Feed Extension Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_REMOTE_EXTENSION = 8; + public const LOCATOR_REMOTE_EXTENSION = 8; /** * Remote Feed Body Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_REMOTE_BODY = 16; + public const LOCATOR_REMOTE_BODY = 16; /** * All Feed Autodiscovery * @see SimplePie::set_autodiscovery_level() */ - const LOCATOR_ALL = 31; + public const LOCATOR_ALL = 31; /** * No known feed type */ - const TYPE_NONE = 0; + public const TYPE_NONE = 0; /** * RSS 0.90 */ - const TYPE_RSS_090 = 1; + public const TYPE_RSS_090 = 1; /** * RSS 0.91 (Netscape) */ - const TYPE_RSS_091_NETSCAPE = 2; + public const TYPE_RSS_091_NETSCAPE = 2; /** * RSS 0.91 (Userland) */ - const TYPE_RSS_091_USERLAND = 4; + public const TYPE_RSS_091_USERLAND = 4; /** * RSS 0.91 (both Netscape and Userland) */ - const TYPE_RSS_091 = 6; + public const TYPE_RSS_091 = 6; /** * RSS 0.92 */ - const TYPE_RSS_092 = 8; + public const TYPE_RSS_092 = 8; /** * RSS 0.93 */ - const TYPE_RSS_093 = 16; + public const TYPE_RSS_093 = 16; /** * RSS 0.94 */ - const TYPE_RSS_094 = 32; + public const TYPE_RSS_094 = 32; /** * RSS 1.0 */ - const TYPE_RSS_10 = 64; + public const TYPE_RSS_10 = 64; /** * RSS 2.0 */ - const TYPE_RSS_20 = 128; + public const TYPE_RSS_20 = 128; /** * RDF-based RSS */ - const TYPE_RSS_RDF = 65; + public const TYPE_RSS_RDF = 65; /** * Non-RDF-based RSS (truly intended as syndication format) */ - const TYPE_RSS_SYNDICATION = 190; + public const TYPE_RSS_SYNDICATION = 190; /** * All RSS */ - const TYPE_RSS_ALL = 255; + public const TYPE_RSS_ALL = 255; /** * Atom 0.3 */ - const TYPE_ATOM_03 = 256; + public const TYPE_ATOM_03 = 256; /** * Atom 1.0 */ - const TYPE_ATOM_10 = 512; + public const TYPE_ATOM_10 = 512; /** * All Atom */ - const TYPE_ATOM_ALL = 768; + public const TYPE_ATOM_ALL = 768; /** * All feed types */ - const TYPE_ALL = 1023; + public const TYPE_ALL = 1023; /** * No construct */ - const CONSTRUCT_NONE = 0; + public const CONSTRUCT_NONE = 0; /** * Text construct */ - const CONSTRUCT_TEXT = 1; + public const CONSTRUCT_TEXT = 1; /** * HTML construct */ - const CONSTRUCT_HTML = 2; + public const CONSTRUCT_HTML = 2; /** * XHTML construct */ - const CONSTRUCT_XHTML = 4; + public const CONSTRUCT_XHTML = 4; /** * base64-encoded construct */ - const CONSTRUCT_BASE64 = 8; + public const CONSTRUCT_BASE64 = 8; /** * IRI construct */ - const CONSTRUCT_IRI = 16; + public const CONSTRUCT_IRI = 16; /** * A construct that might be HTML */ - const CONSTRUCT_MAYBE_HTML = 32; + public const CONSTRUCT_MAYBE_HTML = 32; /** * All constructs */ - const CONSTRUCT_ALL = 63; + public const CONSTRUCT_ALL = 63; /** * Don't change case */ - const SAME_CASE = 1; + public const SAME_CASE = 1; /** * Change to lowercase */ - const LOWERCASE = 2; + public const LOWERCASE = 2; /** * Change to uppercase */ - const UPPERCASE = 4; + public const UPPERCASE = 4; /** * PCRE for HTML attributes */ - const 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]*'; + public const 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]*'; /** * PCRE for XML attributes */ - const PCRE_XML_ATTRIBUTE = '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'; + public const PCRE_XML_ATTRIBUTE = '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*'; /** * XML Namespace */ - const NAMESPACE_XML = 'http://www.w3.org/XML/1998/namespace'; + public const NAMESPACE_XML = 'http://www.w3.org/XML/1998/namespace'; /** * Atom 1.0 Namespace */ - const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom'; + public const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom'; /** * Atom 0.3 Namespace */ - const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#'; + public const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#'; /** * RDF Namespace */ - const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; + public const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; /** * RSS 0.90 Namespace */ - const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/'; + public const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/'; /** * RSS 1.0 Namespace */ - const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/'; + public const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/'; /** * RSS 1.0 Content Module Namespace */ - const NAMESPACE_RSS_10_MODULES_CONTENT = 'http://purl.org/rss/1.0/modules/content/'; + public const NAMESPACE_RSS_10_MODULES_CONTENT = 'http://purl.org/rss/1.0/modules/content/'; /** * RSS 2.0 Namespace * (Stupid, I know, but I'm certain it will confuse people less with support.) */ - const NAMESPACE_RSS_20 = ''; + public const NAMESPACE_RSS_20 = ''; /** * DC 1.0 Namespace */ - const NAMESPACE_DC_10 = 'http://purl.org/dc/elements/1.0/'; + public const NAMESPACE_DC_10 = 'http://purl.org/dc/elements/1.0/'; /** * DC 1.1 Namespace */ - const NAMESPACE_DC_11 = 'http://purl.org/dc/elements/1.1/'; + public const NAMESPACE_DC_11 = 'http://purl.org/dc/elements/1.1/'; /** * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace */ - const NAMESPACE_W3C_BASIC_GEO = 'http://www.w3.org/2003/01/geo/wgs84_pos#'; + public const NAMESPACE_W3C_BASIC_GEO = 'http://www.w3.org/2003/01/geo/wgs84_pos#'; /** * GeoRSS Namespace */ - const NAMESPACE_GEORSS = 'http://www.georss.org/georss'; + public const NAMESPACE_GEORSS = 'http://www.georss.org/georss'; /** * Media RSS Namespace */ - const NAMESPACE_MEDIARSS = 'http://search.yahoo.com/mrss/'; + public const NAMESPACE_MEDIARSS = 'http://search.yahoo.com/mrss/'; /** * Wrong Media RSS Namespace. Caused by a long-standing typo in the spec. */ - const NAMESPACE_MEDIARSS_WRONG = 'http://search.yahoo.com/mrss'; + public const NAMESPACE_MEDIARSS_WRONG = 'http://search.yahoo.com/mrss'; /** * Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5. */ - const NAMESPACE_MEDIARSS_WRONG2 = 'http://video.search.yahoo.com/mrss'; + public const NAMESPACE_MEDIARSS_WRONG2 = 'http://video.search.yahoo.com/mrss'; /** * Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace. */ - const NAMESPACE_MEDIARSS_WRONG3 = 'http://video.search.yahoo.com/mrss/'; + public const NAMESPACE_MEDIARSS_WRONG3 = 'http://video.search.yahoo.com/mrss/'; /** * Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace. */ - const NAMESPACE_MEDIARSS_WRONG4 = 'http://www.rssboard.org/media-rss'; + public const NAMESPACE_MEDIARSS_WRONG4 = 'http://www.rssboard.org/media-rss'; /** * Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL. */ - const NAMESPACE_MEDIARSS_WRONG5 = 'http://www.rssboard.org/media-rss/'; + public const NAMESPACE_MEDIARSS_WRONG5 = 'http://www.rssboard.org/media-rss/'; /** * iTunes RSS Namespace */ - const NAMESPACE_ITUNES = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; + public const NAMESPACE_ITUNES = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; /** * XHTML Namespace */ - const NAMESPACE_XHTML = 'http://www.w3.org/1999/xhtml'; + public const NAMESPACE_XHTML = 'http://www.w3.org/1999/xhtml'; /** * IANA Link Relations Registry */ - const IANA_LINK_RELATIONS_REGISTRY = 'http://www.iana.org/assignments/relation/'; + public const IANA_LINK_RELATIONS_REGISTRY = 'http://www.iana.org/assignments/relation/'; /** * No file source */ - const FILE_SOURCE_NONE = 0; + public const FILE_SOURCE_NONE = 0; /** * Remote file source */ - const FILE_SOURCE_REMOTE = 1; + public const FILE_SOURCE_REMOTE = 1; /** * Local file source */ - const FILE_SOURCE_LOCAL = 2; + public const FILE_SOURCE_LOCAL = 2; /** * fsockopen() file source */ - const FILE_SOURCE_FSOCKOPEN = 4; + public const FILE_SOURCE_FSOCKOPEN = 4; /** * cURL file source */ - const FILE_SOURCE_CURL = 8; + public const FILE_SOURCE_CURL = 8; /** * file_get_contents() file source */ - const FILE_SOURCE_FILE_GET_CONTENTS = 16; + public const FILE_SOURCE_FILE_GET_CONTENTS = 16; /** * @var array Raw data @@ -495,7 +507,19 @@ class SimplePie * @see SimplePie::enable_cache() * @access private */ - public $cache = true; + private $enable_cache = true; + + /** + * @var DataCache|null + * @see SimplePie::set_cache() + */ + private $cache = null; + + /** + * @var NameFilter + * @see SimplePie::set_cache_namefilter() + */ + private $cache_namefilter; /** * @var bool Force SimplePie to fallback to expired cache, if enabled, @@ -666,20 +690,21 @@ class SimplePie */ public function __construct() { - if (version_compare(PHP_VERSION, '5.6', '<')) { - trigger_error('Please upgrade to PHP 5.6 or newer.'); + if (version_compare(PHP_VERSION, '7.2', '<')) { + trigger_error('Please upgrade to PHP 7.2 or newer.'); die(); } $this->set_useragent(); + $this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function)); + // Other objects, instances created here so we can set options on them $this->sanitize = new \SimplePie\Sanitize(); $this->registry = new \SimplePie\Registry(); if (func_num_args() > 0) { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - 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); + trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', \E_USER_DEPRECATED); $args = func_get_args(); switch (count($args)) { @@ -759,10 +784,10 @@ class SimplePie $this->multifeed_url = []; if (is_array($url)) { foreach ($url as $value) { - $this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', [$value, 1]); + $this->multifeed_url[] = $this->registry->call(Misc::class, 'fix_protocol', [$value, 1]); } } else { - $this->feed_url = $this->registry->call('Misc', 'fix_protocol', [$url, 1]); + $this->feed_url = $this->registry->call(Misc::class, 'fix_protocol', [$url, 1]); $this->permanent_url = $this->feed_url; } } @@ -851,7 +876,19 @@ class SimplePie */ public function enable_cache($enable = true) { - $this->cache = (bool) $enable; + $this->enable_cache = (bool) $enable; + } + + /** + * Set a PSR-16 implementation as cache + * + * @param CacheInterface $psr16cache The PSR-16 cache implementation + * + * @return void + */ + public function set_cache(CacheInterface $cache) + { + $this->cache = new Psr16($cache); } /** @@ -861,12 +898,15 @@ class SimplePie * This tells SimplePie to ignore any file errors and fall back to cache * instead. This only works if caching is enabled and cached content * still exists. - + * + * @deprecated since SimplePie 1.8.0, expired cache will not be used anymore. + * * @param bool $enable Force use of cache on fail. */ public function force_cache_fallback($enable = false) { - $this->force_cache_fallback= (bool) $enable; + // @trigger_error(sprintf('SimplePie\SimplePie::force_cache_fallback() is deprecated since SimplePie 1.8.0, expired cache will not be used anymore.'), \E_USER_DEPRECATED); + $this->force_cache_fallback = (bool) $enable; } /** @@ -894,15 +934,19 @@ class SimplePie /** * Set the file system location where the cached files should be stored * + * @deprecated since SimplePie 1.8.0, use \SimplePie\SimplePie::set_cache() instead. + * * @param string $location The file system location. */ public function set_cache_location($location = './cache') { + // @trigger_error(sprintf('SimplePie\SimplePie::set_cache_location() is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()" instead.'), \E_USER_DEPRECATED); $this->cache_location = (string) $location; } /** * Return the filename (i.e. hash, without path and without extension) of the file to cache a given URL. + * * @param string $url The URL of the feed to be cached. * @return string A filename (i.e. hash, without path and without extension). */ @@ -926,7 +970,8 @@ class SimplePie ksort($options); $url .= '#' . urlencode(var_export($options, true)); } - return call_user_func($this->cache_name_function, $url); + + return $this->cache_namefilter->filter($url); } /** @@ -978,149 +1023,269 @@ class SimplePie * * Use this to override SimplePie's default classes * @see \SimplePie\Registry - * @return \SimplePie\Registry + * + * @return Registry */ public function &get_registry() { return $this->registry; } - /**#@+ - * Useful when you are overloading or extending SimplePie's default classes. + /** + * Set which class SimplePie uses for caching + * + * @deprecated since SimplePie 1.3, use {@see set_cache()} instead * - * @deprecated Use {@see get_registry()} instead - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation * @param string $class Name of custom class + * * @return boolean True on success, false otherwise */ - /** - * Set which class SimplePie uses for caching - */ - public function set_cache_class($class = 'SimplePie\Cache') + public function set_cache_class($class = Cache::class) { - return $this->registry->register('Cache', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::set_cache()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Cache::class, $class, true); } /** * Set which class SimplePie uses for auto-discovery + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_locator_class($class = 'SimplePie\Locator') + public function set_locator_class($class = Locator::class) { - return $this->registry->register('Locator', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Locator::class, $class, true); } /** * Set which class SimplePie uses for XML parsing + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_parser_class($class = 'SimplePie\Parser') + public function set_parser_class($class = Parser::class) { - return $this->registry->register('Parser', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Parser::class, $class, true); } /** * Set which class SimplePie uses for remote file fetching + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_file_class($class = 'SimplePie\File') + public function set_file_class($class = File::class) { - return $this->registry->register('File', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(File::class, $class, true); } /** * Set which class SimplePie uses for data sanitization + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_sanitize_class($class = 'SimplePie\Sanitize') + public function set_sanitize_class($class = Sanitize::class) { - return $this->registry->register('Sanitize', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Sanitize::class, $class, true); } /** * Set which class SimplePie uses for handling feed items + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_item_class($class = 'SimplePie\Item') + public function set_item_class($class = Item::class) { - return $this->registry->register('Item', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Item::class, $class, true); } /** * Set which class SimplePie uses for handling author data + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_author_class($class = 'SimplePie\Author') + public function set_author_class($class = Author::class) { - return $this->registry->register('Author', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Author::class, $class, true); } /** * Set which class SimplePie uses for handling category data + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_category_class($class = 'SimplePie\Category') + public function set_category_class($class = Category::class) { - return $this->registry->register('Category', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Category::class, $class, true); } /** * Set which class SimplePie uses for feed enclosures + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_enclosure_class($class = 'SimplePie\Enclosure') + public function set_enclosure_class($class = Enclosure::class) { - return $this->registry->register('Enclosure', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Enclosure::class, $class, true); } /** * Set which class SimplePie uses for `` captions + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_caption_class($class = 'SimplePie\Caption') + public function set_caption_class($class = Caption::class) { - return $this->registry->register('Caption', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Caption::class, $class, true); } /** * Set which class SimplePie uses for `` + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_copyright_class($class = 'SimplePie\Copyright') + public function set_copyright_class($class = Copyright::class) { - return $this->registry->register('Copyright', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Copyright::class, $class, true); } /** * Set which class SimplePie uses for `` + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_credit_class($class = 'SimplePie\Credit') + public function set_credit_class($class = Credit::class) { - return $this->registry->register('Credit', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Credit::class, $class, true); } /** * Set which class SimplePie uses for `` + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_rating_class($class = 'SimplePie\Rating') + public function set_rating_class($class = Rating::class) { - return $this->registry->register('Rating', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Rating::class, $class, true); } /** * Set which class SimplePie uses for `` + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_restriction_class($class = 'SimplePie\Restriction') + public function set_restriction_class($class = Restriction::class) { - return $this->registry->register('Restriction', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Restriction::class, $class, true); } /** * Set which class SimplePie uses for content-type sniffing + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_content_type_sniffer_class($class = 'SimplePie\Content\Type\Sniffer') + public function set_content_type_sniffer_class($class = Sniffer::class) { - return $this->registry->register('Content_Type_Sniffer', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Sniffer::class, $class, true); } /** * Set which class SimplePie uses item sources + * + * @deprecated since SimplePie 1.3, use {@see get_registry()} instead + * + * @param string $class Name of custom class + * + * @return boolean True on success, false otherwise */ - public function set_source_class($class = 'SimplePie\Source') + public function set_source_class($class = Source::class) { - return $this->registry->register('Source', $class, true); + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED); + + return $this->registry->register(Source::class, $class, true); } - /**#@-*/ /** * Set the user agent string @@ -1136,15 +1301,33 @@ class SimplePie $this->useragent = (string) $ua; } + /** + * Set a namefilter to modify the cache filename with + * + * @param NameFilter $filter + * + * @return void + */ + public function set_cache_namefilter(NameFilter $filter): void + { + $this->cache_namefilter = $filter; + } + /** * Set callback function to create cache filename with * + * @deprecated since SimplePie 1.8.0, use {@see set_cache_namefilter()} instead + * * @param mixed $function Callback function */ public function set_cache_name_function($function = 'md5') { + // trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache_namefilter()" instead.', __METHOD__), \E_USER_DEPRECATED); + if (is_callable($function)) { $this->cache_name_function = $function; + + $this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function)); } } @@ -1352,8 +1535,8 @@ class SimplePie // The default sanitize class gets set in the constructor, check if it has // changed. - if ($this->registry->get_class('Sanitize') !== 'SimplePie\Sanitize') { - $this->sanitize = $this->registry->create('Sanitize'); + if ($this->registry->get_class(Sanitize::class) !== 'SimplePie\Sanitize') { + $this->sanitize = $this->registry->create(Sanitize::class); } if (method_exists($this->sanitize, 'set_registry')) { $this->sanitize->set_registry($this->registry); @@ -1361,8 +1544,14 @@ class SimplePie // Pass whatever was set with config options over to the sanitizer. // Pass the classes in for legacy support; new classes should use the registry instead - $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache')); - $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); + $this->sanitize->pass_cache_data( + $this->enable_cache, + $this->cache_location, + $this->cache_namefilter, + $this->registry->get_class(Cache::class), + $this->cache + ); + $this->sanitize->pass_file_data($this->registry->get_class(File::class), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options); if (!empty($this->multifeed_url)) { $i = 0; @@ -1391,12 +1580,11 @@ class SimplePie $cache = false; if ($this->feed_url !== null) { - $parsed_feed_url = $this->registry->call('Misc', 'parse_url', [$this->feed_url]); + $parsed_feed_url = $this->registry->call(Misc::class, 'parse_url', [$this->feed_url]); // Decide whether to enable caching - if ($this->cache && $parsed_feed_url['scheme'] !== '') { - $filename = $this->get_cache_filename($this->feed_url); - $cache = $this->registry->call('Cache', 'get_handler', [$this->cache_location, $filename, 'spc']); + if ($this->enable_cache && $parsed_feed_url['scheme'] !== '') { + $cache = $this->get_cache($this->feed_url); } // Fetch the data via \SimplePie\File into $this->raw_data @@ -1406,13 +1594,13 @@ class SimplePie return false; } - list($headers, $sniffed) = $fetched; + [$headers, $sniffed] = $fetched; } // Empty response check if (empty($this->raw_data)) { $this->error = "A feed could not be found at `$this->feed_url`. Empty body."; - $this->registry->call('Misc', 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); return false; } @@ -1433,7 +1621,7 @@ class SimplePie if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { $encodings[] = strtoupper($charset[1]); } - $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', [$this->raw_data, &$this->registry])); + $encodings = array_merge($encodings, $this->registry->call(Misc::class, 'xml_encoding', [$this->raw_data, &$this->registry])); $encodings[] = 'UTF-8'; } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) { @@ -1448,7 +1636,7 @@ class SimplePie } // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1 - $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', [$this->raw_data, &$this->registry])); + $encodings = array_merge($encodings, $this->registry->call(Misc::class, 'xml_encoding', [$this->raw_data, &$this->registry])); $encodings[] = 'UTF-8'; $encodings[] = 'ISO-8859-1'; @@ -1458,16 +1646,16 @@ class SimplePie // Loop through each possible encoding, till we return something, or run out of possibilities foreach ($encodings as $encoding) { // Change the encoding to UTF-8 (as we always use UTF-8 internally) - if ($utf8_data = $this->registry->call('Misc', 'change_encoding', [$this->raw_data, $encoding, 'UTF-8'])) { + if ($utf8_data = $this->registry->call(Misc::class, 'change_encoding', [$this->raw_data, $encoding, 'UTF-8'])) { // Create new parser - $parser = $this->registry->create('Parser'); + $parser = $this->registry->create(Parser::class); // If it's parsed fine if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url)) { $this->data = $parser->get_data(); if (!($this->get_type() & ~self::TYPE_NONE)) { $this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed."; - $this->registry->call('Misc', 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); return false; } @@ -1477,7 +1665,8 @@ class SimplePie $this->data['build'] = \SimplePie\Misc::get_build(); // Cache the file if caching is enabled - if ($cache && !$cache->save($this)) { + $this->data['cache_expiration_time'] = $this->cache_duration + time(); + if ($cache && ! $cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->cache_duration)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } return true; @@ -1508,7 +1697,7 @@ class SimplePie } } - $this->registry->call('Misc', 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); return false; } @@ -1517,19 +1706,35 @@ class SimplePie * Fetch the data via \SimplePie\File * * If the data is already cached, attempt to fetch it from there instead - * @param \SimplePie\Cache\Base|false $cache Cache handler, or false to not load from the cache + * @param Base|DataCache|false $cache Cache handler, or false to not load from the cache * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type */ protected function fetch_data(&$cache) { + if (is_object($cache) && $cache instanceof Base) { + // @trigger_error(sprintf('Providing $cache as "\SimplePie\Cache\Base" in %s() is deprecated since SimplePie 1.8.0, please provide "\SimplePie\Cache\DataCache" implementation instead.', __METHOD__), \E_USER_DEPRECATED); + $cache = new BaseDataCache($cache); + } + + if ($cache !== false && ! $cache instanceof DataCache) { + throw new InvalidArgumentException(sprintf( + '%s(): Argument #1 ($cache) must be of type %s|false', + __METHOD__, + DataCache::class + ), 1); + } + + $cacheKey = $this->get_cache_filename($this->feed_url); + // If it's enabled, use the cache if ($cache) { // Load the Cache - $this->data = $cache->load(); + $this->data = $cache->get_data($cacheKey, []); + if (!empty($this->data)) { // If the cache is for an outdated build of SimplePie if (!isset($this->data['build']) || $this->data['build'] !== \SimplePie\Misc::get_build()) { - $cache->unlink(); + $cache->delete_data($cacheKey); $this->data = []; } // If we've hit a collision just rerun it with caching disabled @@ -1539,20 +1744,21 @@ class SimplePie } // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. elseif (isset($this->data['feed_url'])) { - // If the autodiscovery cache is still valid use it. - if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) { - // Do not need to do feed autodiscovery yet. - if ($this->data['feed_url'] !== $this->data['url']) { - $this->set_feed_url($this->data['feed_url']); - return $this->init(); - } + // Do not need to do feed autodiscovery yet. + if ($this->data['feed_url'] !== $this->data['url']) { + $this->set_feed_url($this->data['feed_url']); + $this->data['url'] = $this->data['feed_url']; + + $cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->autodiscovery_cache_duration); - $cache->unlink(); - $this->data = []; + return $this->init(); } + + $cache->delete_data($this->get_cache_filename($this->feed_url)); + $this->data = []; } // Check if the cache has been updated - elseif ($cache->mtime() + $this->cache_duration < time()) { + elseif (isset($this->data['cache_expiration_time']) && $this->data['cache_expiration_time'] > time()) { // Want to know if we tried to send last-modified and/or etag headers // when requesting this file. (Note that it's up to the file to // support this, but we don't always send the headers either.) @@ -1568,7 +1774,7 @@ class SimplePie $headers['if-none-match'] = $this->data['headers']['etag']; } - $file = $this->registry->create('File', [$this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); + $file = $this->registry->create(File::class, [$this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); $this->status_code = $file->status_code; if ($file->success) { @@ -1576,13 +1782,13 @@ class SimplePie // Set raw_data to false here too, to signify that the cache // is still valid. $this->raw_data = false; - $cache->touch(); + $cache->set_data($cacheKey, $this->data, $this->cache_duration); return true; } } else { $this->check_modified = false; if ($this->force_cache_fallback) { - $cache->touch(); + $cache->set_data($cacheKey, $this->data, $this->cache_duration); return true; } @@ -1596,12 +1802,12 @@ class SimplePie return true; } } - // If the cache is empty, delete it + // If the cache is empty else { - $cache->unlink(); $this->data = []; } } + // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it. if (!isset($file)) { if ($this->file instanceof \SimplePie\File && $this->file->url === $this->feed_url) { @@ -1610,7 +1816,7 @@ class SimplePie $headers = [ 'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1', ]; - $file = $this->registry->create('File', [$this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); + $file = $this->registry->create(File::class, [$this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options]); } } $this->status_code = $file->status_code; @@ -1623,7 +1829,7 @@ class SimplePie if (!$this->force_feed) { // Check if the supplied URL is a feed, if it isn't, look for it. - $locate = $this->registry->create('Locator', [&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options]); + $locate = $this->registry->create(Locator::class, [&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options]); if (!$locate->is_feed($file)) { $copyStatusCode = $file->status_code; @@ -1665,7 +1871,7 @@ class SimplePie // been called that object is untouched unset($file); $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; - $this->registry->call('Misc', 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]); return false; } } @@ -1674,15 +1880,21 @@ class SimplePie unset($file); // This is usually because DOMDocument doesn't exist $this->error = $e->getMessage(); - $this->registry->call('Misc', 'error', [$this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()]); return false; } + if ($cache) { - $this->data = ['url' => $this->feed_url, 'feed_url' => $file->url, 'build' => \SimplePie\Misc::get_build()]; - if (!$cache->save($this)) { + $this->data = [ + 'url' => $this->feed_url, + 'feed_url' => $file->url, + 'build' => \SimplePie\Misc::get_build(), + 'cache_expiration_time' => $this->cache_duration + time(), + ]; + + if (!$cache->set_data($cacheKey, $this->data, $this->cache_duration)) { trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } - $cache = $this->registry->call('Cache', 'get_handler', [$this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc']); } } $this->feed_url = $file->url; @@ -1692,7 +1904,7 @@ class SimplePie $this->raw_data = $file->body; $this->permanent_url = $file->permanent_url; $headers = $file->headers; - $sniffer = $this->registry->create('Content_Type_Sniffer', [&$file]); + $sniffer = $this->registry->create(Sniffer::class, [&$file]); $sniffed = $sniffer->get_type(); return [$headers, $sniffed]; @@ -2096,7 +2308,7 @@ class SimplePie } catch (\SimplePie\Exception $e) { if (!$this->enable_exceptions) { $this->error = $e->getMessage(); - $this->registry->call('Misc', 'error', [$this->error, E_USER_WARNING, $e->getFile(), $e->getLine()]); + $this->registry->call(Misc::class, 'error', [$this->error, E_USER_WARNING, $e->getFile(), $e->getLine()]); return ''; } @@ -2115,9 +2327,9 @@ class SimplePie public function get_title() { if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'title')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'title')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_090, 'title')) { @@ -2175,7 +2387,7 @@ class SimplePie if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], self::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } foreach ((array) $this->get_channel_tags(self::NAMESPACE_RSS_20, 'category') as $category) { // This is really the label, but keep this as the term also for BC. @@ -2186,13 +2398,13 @@ class SimplePie } else { $scheme = null; } - $categories[] = $this->registry->create('Category', [$term, $scheme, null]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, null]); } foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_11, 'subject') as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_10, 'subject') as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]); } if (!empty($categories)) { @@ -2244,7 +2456,7 @@ class SimplePie $email = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $authors[] = $this->registry->create('Author', [$name, $uri, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } if ($author = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'author')) { @@ -2261,17 +2473,17 @@ class SimplePie $email = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $authors[] = $this->registry->create('Author', [$name, $url, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_11, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_10, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_channel_tags(self::NAMESPACE_ITUNES, 'author') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]); } if (!empty($authors)) { @@ -2323,7 +2535,7 @@ class SimplePie $email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] = $this->registry->create('Author', [$name, $uri, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } foreach ((array) $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'contributor') as $contributor) { @@ -2340,7 +2552,7 @@ class SimplePie $email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $contributors[] = $this->registry->create('Author', [$name, $url, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } @@ -2426,7 +2638,7 @@ class SimplePie $keys = array_keys($this->data['links']); foreach ($keys as $key) { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', [$key])) { + if ($this->registry->call(Misc::class, 'is_isegment_nz_nc', [$key])) { if (isset($this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key]; @@ -2476,9 +2688,9 @@ class SimplePie public function get_description() { if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'subtitle')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'tagline')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_10, 'description')) { return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_090, 'description')) { @@ -2509,9 +2721,9 @@ class SimplePie public function get_copyright() { if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'rights')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'copyright')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'copyright')) { return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT); } elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_11, 'rights')) { @@ -2686,17 +2898,17 @@ class SimplePie * * RSS 2.0 feeds are allowed to have a "feed logo" width. * - * Uses `` or defaults to 88.0 if no width is specified and + * Uses `` or defaults to 88 if no width is specified and * the feed is an RSS 2.0 feed. * - * @return int|float|null + * @return int|null */ public function get_image_width() { if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'width')) { - return round($return[0]['data']); + return intval($return[0]['data']); } elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) { - return 88.0; + return 88; } return null; @@ -2707,17 +2919,17 @@ class SimplePie * * RSS 2.0 feeds are allowed to have a "feed logo" height. * - * Uses `` or defaults to 31.0 if no height is specified and + * Uses `` or defaults to 31 if no height is specified and * the feed is an RSS 2.0 feed. * - * @return int|float|null + * @return int|null */ public function get_image_height() { if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'height')) { - return round($return[0]['data']); + return intval($return[0]['data']); } elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) { - return 31.0; + return 31; } return null; @@ -2792,31 +3004,31 @@ class SimplePie if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_10, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] = $this->registry->create('Item', [$this, $items[$key]]); + $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]); } } if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_03, 'entry')) { $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] = $this->registry->create('Item', [$this, $items[$key]]); + $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]); } } if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] = $this->registry->create('Item', [$this, $items[$key]]); + $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]); } } if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] = $this->registry->create('Item', [$this, $items[$key]]); + $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]); } } if ($items = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'item')) { $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] = $this->registry->create('Item', [$this, $items[$key]]); + $this->data['items'][] = $this->registry->create(Item::class, [$this, $items[$key]]); } } } @@ -2849,8 +3061,7 @@ class SimplePie */ public function set_favicon_handler($page = false, $qs = 'i') { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('Favicon handling has been removed, please use your own handling', $level); + trigger_error('Favicon handling has been removed, please use your own handling', \E_USER_DEPRECATED); return false; } @@ -2861,8 +3072,7 @@ class SimplePie */ public function get_favicon() { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('Favicon handling has been removed, please use your own handling', $level); + trigger_error('Favicon handling has been removed, please use your own handling', \E_USER_DEPRECATED); if (($url = $this->get_link()) !== null) { return 'https://www.google.com/s2/favicons?domain=' . urlencode($url); @@ -2881,13 +3091,11 @@ class SimplePie public function __call($method, $args) { if (strpos($method, 'subscribe_') === 0) { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level); + trigger_error('subscribe_*() has been deprecated, implement the callback yourself', \E_USER_DEPRECATED); return ''; } if ($method === 'enable_xml_dump') { - $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; - trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level); + trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', \E_USER_DEPRECATED); return false; } @@ -2992,6 +3200,29 @@ class SimplePie } } } + + /** + * Get a DataCache + * + * @param string $feed_url Only needed for BC, can be removed in SimplePie 2.0.0 + * + * @return DataCache + */ + private function get_cache($feed_url = '') + { + if ($this->cache === null) { + // @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED); + $cache = $this->registry->call(Cache::class, 'get_handler', [ + $this->cache_location, + $this->get_cache_filename($feed_url), + Base::TYPE_FEED + ]); + + return new BaseDataCache($cache); + } + + return $this->cache; + } } class_alias('SimplePie\SimplePie', 'SimplePie'); diff --git a/vendor/simplepie/simplepie/src/Source.php b/vendor/simplepie/simplepie/src/Source.php index d4e50bc4d..c7ed11600 100644 --- a/vendor/simplepie/simplepie/src/Source.php +++ b/vendor/simplepie/simplepie/src/Source.php @@ -1,4 +1,6 @@ data = $data; } - public function set_registry(\SimplePie\Registry $registry) + public function set_registry(\SimplePie\Registry $registry)/* : void */ { $this->registry = $registry; } @@ -102,9 +104,9 @@ class Source public function get_title() { if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'title')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'title')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10, 'title')) { return $this->sanitize($return[0]['data'], \SimplePie\SimplePie::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_090, 'title')) { @@ -147,7 +149,7 @@ class Source if (isset($category['attribs']['']['label'])) { $label = $this->sanitize($category['attribs']['']['label'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } - $categories[] = $this->registry->create('Category', [$term, $scheme, $label]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]); } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'category') as $category) { // This is really the label, but keep this as the term also for BC. @@ -158,13 +160,13 @@ class Source } else { $scheme = null; } - $categories[] = $this->registry->create('Category', [$term, $scheme, null]); + $categories[] = $this->registry->create(Category::class, [$term, $scheme, null]); } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, 'subject') as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_DC_10, 'subject') as $category) { - $categories[] = $this->registry->create('Category', [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } if (!empty($categories)) { @@ -201,7 +203,7 @@ class Source $email = $this->sanitize($author['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $authors[] = $this->registry->create('Author', [$name, $uri, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } if ($author = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'author')) { @@ -218,17 +220,17 @@ class Source $email = $this->sanitize($author[0]['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $authors[] = $this->registry->create('Author', [$name, $url, $email]); + $authors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_DC_10, 'creator') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ITUNES, 'author') as $author) { - $authors[] = $this->registry->create('Author', [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); + $authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT), null, null]); } if (!empty($authors)) { @@ -265,7 +267,7 @@ class Source $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_10]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] = $this->registry->create('Author', [$name, $uri, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $uri, $email]); } } foreach ((array) $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'contributor') as $contributor) { @@ -282,7 +284,7 @@ class Source $email = $this->sanitize($contributor['child'][\SimplePie\SimplePie::NAMESPACE_ATOM_03]['email'][0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } if ($name !== null || $email !== null || $url !== null) { - $contributors[] = $this->registry->create('Author', [$name, $url, $email]); + $contributors[] = $this->registry->create(Author::class, [$name, $url, $email]); } } @@ -343,7 +345,7 @@ class Source $keys = array_keys($this->data['links']); foreach ($keys as $key) { - if ($this->registry->call('Misc', 'is_isegment_nz_nc', [$key])) { + if ($this->registry->call(Misc::class, 'is_isegment_nz_nc', [$key])) { if (isset($this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key])) { $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key]); $this->data['links'][$key] =& $this->data['links'][\SimplePie\SimplePie::IANA_LINK_RELATIONS_REGISTRY . $key]; @@ -367,9 +369,9 @@ class Source public function get_description() { if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'subtitle')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'tagline')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_10, 'description')) { return $this->sanitize($return[0]['data'], \SimplePie\SimplePie::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_090, 'description')) { @@ -392,9 +394,9 @@ class Source public function get_copyright() { if ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_10, 'rights')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_ATOM_03, 'copyright')) { - return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); + return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0])); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_RSS_20, 'copyright')) { return $this->sanitize($return[0]['data'], \SimplePie\SimplePie::CONSTRUCT_TEXT); } elseif ($return = $this->get_source_tags(\SimplePie\SimplePie::NAMESPACE_DC_11, 'rights')) { diff --git a/vendor/simplepie/simplepie/src/XML/Declaration/Parser.php b/vendor/simplepie/simplepie/src/XML/Declaration/Parser.php index 44d9416d2..5062e683f 100644 --- a/vendor/simplepie/simplepie/src/XML/Declaration/Parser.php +++ b/vendor/simplepie/simplepie/src/XML/Declaration/Parser.php @@ -1,4 +1,6 @@