mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Feeds: Register transient feed cache handler using the recommended method for SimplePie 1.3 or later.
This fixes a "Non-static method cannot be called statically" fatal error when calling `fetch_feed()` on PHP 8. Follow-up to [21644], [21652], [22366], [22599]. Props dd32, afragen, Senning, markoheijnen, ComputerGuru, useStrict, Ipstenu, nacin, l3rady, HoaSi, NathanAtmoz, fabifott, jfoulquier, thefarlilacfield, subscriptiongroup, rogerlos, Mte90, mopsyd, dossy, stulab, MadtownLems, roikles, justlevine, joostdevalk, OptimizingMatters, hellofromTonya, bph, ayeshrajans, SergeyBiryukov. Fixes #29204. git-svn-id: https://develop.svn.wordpress.org/trunk@49565 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ea136a3af6
commit
e8e031d2dd
@ -5,8 +5,16 @@
|
||||
* @package WordPress
|
||||
* @subpackage Feed
|
||||
* @since 4.7.0
|
||||
* @deprecated 5.6.0
|
||||
*/
|
||||
|
||||
_deprecated_file(
|
||||
basename( __FILE__ ),
|
||||
'5.6.0',
|
||||
'',
|
||||
__( 'This file is only loaded for backward compatibility with SimplePie 1.2.x. Please consider switching to a recent SimplePie version.' )
|
||||
);
|
||||
|
||||
/**
|
||||
* Core class used to implement a feed cache.
|
||||
*
|
||||
|
||||
@ -789,7 +789,6 @@ function fetch_feed( $url ) {
|
||||
require_once ABSPATH . WPINC . '/class-simplepie.php';
|
||||
}
|
||||
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
|
||||
@ -801,7 +800,16 @@ function fetch_feed( $url ) {
|
||||
// constructor sets it before we have a chance to set the sanitization class.
|
||||
$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
|
||||
|
||||
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||
// Register the cache handler using the recommended method for SimplePie 1.3 or later.
|
||||
if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
|
||||
SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
|
||||
$feed->set_cache_location( 'wp_transient' );
|
||||
} else {
|
||||
// Back-compat for SimplePie 1.2.x.
|
||||
require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
|
||||
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||
}
|
||||
|
||||
$feed->set_file_class( 'WP_SimplePie_File' );
|
||||
|
||||
$feed->set_feed_url( $url );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user