Changeset 61551 for trunk/src/wp-includes/feed.php
- Timestamp:
- 01/28/2026 10:42:10 PM (6 weeks ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/feed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/feed.php
r60771 r61551 833 833 $feed->get_registry()->register( SimplePie\File::class, 'WP_SimplePie_File', true ); 834 834 835 $feed->set_feed_url( $url );836 835 /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */ 837 836 $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); … … 847 846 do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); 848 847 848 if ( empty( $url ) ) { 849 /* 850 * @todo: Set $url to empty string once supported by SimplePie. 851 * 852 * The early return without proceeding is to work around a PHP 8.5 853 * deprecation issue resolved in https://github.com/simplepie/simplepie/pull/949 854 * 855 * To avoid the duplicate code, this block can be replaced with `$url = '';` once SimplePie 856 * is upgraded to a version that includes the fix. 857 */ 858 $feed->init(); 859 $feed->set_output_encoding( get_bloginfo( 'charset' ) ); 860 861 if ( $feed->error() ) { 862 return new WP_Error( 'simplepie-error', $feed->error() ); 863 } 864 865 return $feed; 866 } elseif ( is_array( $url ) && count( $url ) === 1 ) { 867 $url = array_shift( $url ); 868 } elseif ( is_array( $url ) ) { 869 $feeds = array(); 870 $simplepie_errors = array(); 871 foreach ( $url as $feed_url ) { 872 $simplepie_instance = clone $feed; 873 $simplepie_instance->set_feed_url( $feed_url ); 874 $simplepie_instance->init(); 875 $simplepie_instance->set_output_encoding( get_bloginfo( 'charset' ) ); 876 877 if ( $simplepie_instance->error() ) { 878 $simplepie_errors[] = sprintf( 879 /* translators: %1$s is the feed URL, %2$s is the error message. */ 880 __( 'Error fetching feed %1$s: %2$s' ), 881 esc_url( $feed_url ), 882 $simplepie_instance->error() 883 ); 884 unset( $simplepie_instance ); 885 continue; 886 } 887 888 $feeds[] = $simplepie_instance; 889 unset( $simplepie_instance ); 890 } 891 892 if ( ! empty( $simplepie_errors ) ) { 893 return new WP_Error( 'simplepie-error', $simplepie_errors ); 894 } 895 896 $feed->init(); 897 $feed->data['items'] = SimplePie\SimplePie::merge_items( $feeds ); 898 return $feed; 899 } 900 901 $feed->set_feed_url( $url ); 849 902 $feed->init(); 850 903 $feed->set_output_encoding( get_bloginfo( 'charset' ) );
Note: See TracChangeset
for help on using the changeset viewer.