mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Stabilize how WordPress hooks into SimplePie to implement transient caching.
Since a plugin can load a previous (< 1.3) version of SimplePie before we do, we need to be compatible with our old method of overriding SimplePie_Cache::create(). SimplePie_Cache::create() was converted to static in 1.3 (as it was called), requiring that we create two different definitions of WP_Feed_Cache (extends SimplePie_Cache). Instead, we can use 1.3's new object registry, and leave the old WP_Feed_Cache to SimplePie 1.2 versions. see #21183. git-svn-id: https://develop.svn.wordpress.org/trunk@21652 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+10
-2
@@ -532,9 +532,17 @@ function fetch_feed($url) {
|
||||
require_once (ABSPATH . WPINC . '/class-feed.php');
|
||||
|
||||
$feed = new SimplePie();
|
||||
|
||||
if ( version_compare( SIMPLEPIE_VERSION, '1.3-dev', '>' ) ) {
|
||||
$feed->set_cache_location( 'wp-transient' );
|
||||
$feed->registry->register( 'Cache', 'WP_Feed_Cache_Transient' );
|
||||
$feed->registry->register( 'File', 'WP_SimplePie_File' );
|
||||
} else {
|
||||
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||
$feed->set_file_class( 'WP_SimplePie_File' );
|
||||
}
|
||||
|
||||
$feed->set_feed_url($url);
|
||||
$feed->set_cache_class('WP_Feed_Cache');
|
||||
$feed->set_file_class('WP_SimplePie_File');
|
||||
$feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url));
|
||||
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
|
||||
$feed->init();
|
||||
|
||||
Reference in New Issue
Block a user