Make WordPress Core


Ignore:
Timestamp:
09/30/2024 10:48:16 PM (21 months ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update the SimplePie library to version 1.8.0.

The most notable change in this update is that all code is now namespaced and uses PSR-4 classes, though there is a compatibility layer available for extenders using the older class names, so plugin or theme authors directly using SimplePie can decide for themselves when they want to change to using the namespaced names for SimplePie classes.

Note: This commit includes additional fixes for PHP 8.4 compatibility (PR 875, PR 888) from the one-dot-eight branch of SimplePie, which is expected to be released as SimplePie 1.8.1 soon.

References:

Follow-up to [47733], [49176], [52393], [52413].

Props jrf, peterwilsoncc, chaion07, cu121, markparnell, audrasjb, costdev, Presskopp, desrosj, faisal03, mukesh27, SergeyBiryukov.
See #55604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-feed-cache-transient.php

    r54133 r59141  
    1212 *
    1313 * @since 2.8.0
     14 * @since 6.7.0 Now properly implements the SimplePie\Cache\Base interface.
    1415 */
    1516#[AllowDynamicProperties]
    16 class WP_Feed_Cache_Transient {
     17class WP_Feed_Cache_Transient implements SimplePie\Cache\Base {
    1718
    1819    /**
     
    4344
    4445    /**
    45      * Constructor.
     46     * Creates a new (transient) cache object.
    4647     *
    4748     * @since 2.8.0
    4849     * @since 3.2.0 Updated to use a PHP5 constructor.
     50     * @since 6.7.0 Parameter names have been updated to be in line with the `SimplePie\Cache\Base` interface.
    4951     *
    50      * @param string $location  URL location (scheme is used to determine handler).
    51      * @param string $filename  Unique identifier for cache object.
    52      * @param string $extension 'spi' or 'spc'.
     52     * @param string                           $location URL location (scheme is used to determine handler).
     53     * @param string                           $name     Unique identifier for cache object.
     54     * @param Base::TYPE_FEED|Base::TYPE_IMAGE $type     Either `TYPE_FEED` ('spc') for SimplePie data,
     55     *                                                   or `TYPE_IMAGE` ('spi') for image data.
    5356     */
    54     public function __construct( $location, $filename, $extension ) {
    55         $this->name     = 'feed_' . $filename;
    56         $this->mod_name = 'feed_mod_' . $filename;
     57    public function __construct( $location, $name, $type ) {
     58        $this->name     = 'feed_' . $name;
     59        $this->mod_name = 'feed_mod_' . $name;
    5760
    5861        $lifetime = $this->lifetime;
     
    6366         *
    6467         * @param int    $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours).
    65          * @param string $filename Unique identifier for the cache object.
     68         * @param string $name    Unique identifier for the cache object.
    6669         */
    67         $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename );
     70        $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $name );
    6871    }
    6972
    7073    /**
    71      * Sets the transient.
     74     * Saves data to the transient.
    7275     *
    7376     * @since 2.8.0
    7477     *
    75      * @param SimplePie $data Data to save.
     78     * @param array|SimplePie\SimplePie $data Data to save. If passed a SimplePie object,
     79     *                                        only cache the `$data` property.
    7680     * @return true Always true.
    7781     */
    7882    public function save( $data ) {
    79         if ( $data instanceof SimplePie ) {
     83        if ( $data instanceof SimplePie\SimplePie ) {
    8084            $data = $data->data;
    8185        }
     
    8791
    8892    /**
    89      * Gets the transient.
     93     * Retrieves the data saved in the transient.
    9094     *
    9195     * @since 2.8.0
    9296     *
    93      * @return mixed Transient value.
     97     * @return array Data for `SimplePie::$data`.
    9498     */
    9599    public function load() {
     
    102106     * @since 2.8.0
    103107     *
    104      * @return mixed Transient value.
     108     * @return int Timestamp.
    105109     */
    106110    public function mtime() {
Note: See TracChangeset for help on using the changeset viewer.