git-svn-id: http://core.svn.wordpress.org/trunk@22599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1889d7de3b
commit
dfeced9fd1
|
@ -3,21 +3,17 @@
|
||||||
if ( !class_exists('SimplePie') )
|
if ( !class_exists('SimplePie') )
|
||||||
require_once (ABSPATH . WPINC . '/class-simplepie.php');
|
require_once (ABSPATH . WPINC . '/class-simplepie.php');
|
||||||
|
|
||||||
if ( version_compare( SIMPLEPIE_VERSION, '1.3-dev', '>' ) ) :
|
class WP_Feed_Cache extends SimplePie_Cache {
|
||||||
SimplePie_Cache::register( 'wp-transient', 'WP_Feed_Cache_Transient' );
|
/**
|
||||||
else :
|
* Create a new SimplePie_Cache object
|
||||||
class WP_Feed_Cache extends SimplePie_Cache {
|
*
|
||||||
/**
|
* @static
|
||||||
* Create a new SimplePie_Cache object
|
* @access public
|
||||||
*
|
*/
|
||||||
* @static
|
function create($location, $filename, $extension) {
|
||||||
* @access public
|
return new WP_Feed_Cache_Transient($location, $filename, $extension);
|
||||||
*/
|
|
||||||
function create($location, $filename, $extension) {
|
|
||||||
return new WP_Feed_Cache_Transient($location, $filename, $extension);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
class WP_Feed_Cache_Transient {
|
class WP_Feed_Cache_Transient {
|
||||||
var $name;
|
var $name;
|
||||||
|
|
|
@ -528,14 +528,8 @@ function fetch_feed($url) {
|
||||||
|
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
|
|
||||||
if ( version_compare( SIMPLEPIE_VERSION, '1.3-dev', '>' ) ) {
|
$feed->set_cache_class( 'WP_Feed_Cache' );
|
||||||
$feed->set_cache_location( 'wp-transient' );
|
$feed->set_file_class( 'WP_SimplePie_File' );
|
||||||
$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_feed_url($url);
|
||||||
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
|
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
|
||||||
|
|
Loading…
Reference in New Issue