#43357 closed enhancement (duplicate)
SimplePie deprecated calls modified
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Feeds | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
Since SimplePie has introduced SimplePie_Registry, some methods calling have been deprecated
Attachments (6)
Change History (18)
#3
in reply to:
↑ 2
@
7 years ago
Replying to SergeyBiryukov:
Related: #29204
hello, fyi
#43357 new enhancement (simplepie doc says there are deprecated functions)
#29204 reviewing defect (bug) (never had this bug in my DashPress plugin) and btw a 4 year old ticket !
regards
#6
follow-up:
↓ 7
@
5 years ago
- Keywords needs-unit-tests added
- Milestone changed from Awaiting Review to Future Release
Hi @arena,
Thanks for reporting this! My apologies it took a while for someone to get around to it.
It appears that the documentation linked above is out of date, but the initial premise of the ticket is still correct.
Updating the SimplePie library is being tackled in #36669, hopefully for 5.5. I am going to wait for that to be completed before making these changes so they can be verified and tested against the latest version in WordPress.
There also should be unit tests to ensure the WordPress specific classes are correctly registered in SimplePie using the new registry. If you are able to write those, that would help move this along.
#7
in reply to:
↑ 6
@
5 years ago
I am using simplepie within wordpress several times a day with my plugin dashpress.
Current version is 4.1, but since 3.9 (hereunder extract of readme.txt)
3.9 2018/02/19 several improvements * new thumbnail search with extended SimplePie Item class * changing deprecated calls of SimplePie extended classes
and here is my code in plugin :
<?php if ( !class_exists( 'SimplePie', false ) ) 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' ); $feed = new SimplePie(); $feed->set_cache_duration( $options['caching'] ?? 43200 ); $feed->registry->register( 'Cache', 'WP_Feed_Cache', true ); $feed->registry->register( 'File', 'WP_SimplePie_File', true ); // this one is specific to plugin $feed->registry->register( 'Item', 'DBP_SimplePie_Item', true );
and finally, there is a patch attached to this ticket
Replying to desrosj:
Hi @arena,
Thanks for reporting this! My apologies it took a while for someone to get around to it.
It appears that the documentation linked above is out of date, but the initial premise of the ticket is still correct.
Updating the SimplePie library is being tackled in #36669, hopefully for 5.5. I am going to wait for that to be completed before making these changes so they can be verified and tested against the latest version in WordPress.
There also should be unit tests to ensure the WordPress specific classes are correctly registered in SimplePie using the new registry. If you are able to write those, that would help move this along.
#8
@
5 years ago
@desroj
i digged into the SimplePie doc,
the method described above is not the good one.
Hereattached is a new patch that needs to be tested.
#9
@
5 years ago
So last patch (#43357-4 2020-04-30.patch) might be the more conventional way to do it
Adding to WP_Feed_Cache :
- setting handler 'wordpress' ($handlers)
- get_handlers() function
- create() function is annonced to be deprecated in 1.3.1 but when removed the code do not work as intended.
Adding to WP_Feed_Cache_Transient :
- implements SimplePie_Cache_Base (required by SimplePie)
- adding a function to parse $location (same as SimplePie/Cache.php)
- $lifetime is a parameter of $location
Changing wp-includes/feed.php
- Only one apply_filters 'wp_feed_cache_transient_lifetime' now
- registering classes the new way
- setting cache_location with defined handler
#10
@
5 years ago
oops ! WP_Feed_Cache instead of WP_SimplePie_Cache
$feed->registry->register( 'Cache', 'WP_Feed_Cache', true );
(may be we should change that as well !)
fix