Make WordPress Core


Ignore:
Timestamp:
09/30/2024 10:48:16 PM (2 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.

Location:
trunk/src/wp-includes/SimplePie/src
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/SimplePie/src/Caption.php

    r59140 r59141  
    11<?php
     2
    23/**
    34 * SimplePie
     
    67 * Takes the hard work out of managing a complete RSS/Atom solution.
    78 *
    8  * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
     9 * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
    910 * All rights reserved.
    1011 *
     
    4243 */
    4344
     45namespace SimplePie;
    4446
    4547/**
    4648 * Handles `<media:text>` captions as defined in Media RSS.
    4749 *
    48  * Used by {@see SimplePie_Enclosure::get_caption()} and {@see SimplePie_Enclosure::get_captions()}
     50 * Used by {@see \SimplePie\Enclosure::get_caption()} and {@see \SimplePie\Enclosure::get_captions()}
    4951 *
    50  * This class can be overloaded with {@see SimplePie::set_caption_class()}
     52 * This class can be overloaded with {@see \SimplePie\SimplePie::set_caption_class()}
    5153 *
    5254 * @package SimplePie
    5355 * @subpackage API
    5456 */
    55 class SimplePie_Caption
     57class Caption
    5658{
    57     /**
    58     * Content type
    59     *
    60     * @var string
    61     * @see get_type()
    62     */
    63     var $type;
     59    /**
     60    * Content type
     61    *
     62    * @var string
     63    * @see get_type()
     64    */
     65    public $type;
    6466
    65     /**
    66     * Language
    67     *
    68     * @var string
    69     * @see get_language()
    70     */
    71     var $lang;
     67    /**
     68    * Language
     69    *
     70    * @var string
     71    * @see get_language()
     72    */
     73    public $lang;
    7274
    73     /**
    74     * Start time
    75     *
    76     * @var string
    77     * @see get_starttime()
    78     */
    79     var $startTime;
     75    /**
     76    * Start time
     77    *
     78    * @var string
     79    * @see get_starttime()
     80    */
     81    public $startTime;
    8082
    81     /**
    82     * End time
    83     *
    84     * @var string
    85     * @see get_endtime()
    86     */
    87     var $endTime;
     83    /**
     84    * End time
     85    *
     86    * @var string
     87    * @see get_endtime()
     88    */
     89    public $endTime;
    8890
    89     /**
    90     * Caption text
    91     *
    92     * @var string
    93     * @see get_text()
    94     */
    95     var $text;
     91    /**
     92    * Caption text
     93    *
     94    * @var string
     95    * @see get_text()
     96    */
     97    public $text;
    9698
    97     /**
    98     * Constructor, used to input the data
    99     *
    100     * For documentation on all the parameters, see the corresponding
    101     * properties and their accessors
    102     */
    103     public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
    104     {
    105         $this->type = $type;
    106         $this->lang = $lang;
    107         $this->startTime = $startTime;
    108         $this->endTime = $endTime;
    109         $this->text = $text;
    110     }
     99    /**
     100    * Constructor, used to input the data
     101    *
     102    * For documentation on all the parameters, see the corresponding
     103    * properties and their accessors
     104    */
     105    public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
     106    {
     107        $this->type = $type;
     108        $this->lang = $lang;
     109        $this->startTime = $startTime;
     110        $this->endTime = $endTime;
     111        $this->text = $text;
     112    }
    111113
    112     /**
    113     * String-ified version
    114     *
    115     * @return string
    116     */
    117     public function __toString()
    118     {
    119         // There is no $this->data here
    120         return md5(serialize($this));
    121     }
     114    /**
     115    * String-ified version
     116    *
     117    * @return string
     118    */
     119    public function __toString()
     120    {
     121        // There is no $this->data here
     122        return md5(serialize($this));
     123    }
    122124
    123     /**
    124      * Get the end time
    125      *
    126      * @return string|null Time in the format 'hh:mm:ss.SSS'
    127      */
    128     public function get_endtime()
    129     {
    130         if ($this->endTime !== null)
    131         {
    132             return $this->endTime;
    133         }
     125    /**
     126     * Get the end time
     127     *
     128     * @return string|null Time in the format 'hh:mm:ss.SSS'
     129     */
     130    public function get_endtime()
     131    {
     132        if ($this->endTime !== null) {
     133            return $this->endTime;
     134        }
    134135
    135         return null;
    136     }
     136        return null;
     137    }
    137138
    138     /**
    139      * Get the language
    140      *
    141      * @link http://tools.ietf.org/html/rfc3066
    142      * @return string|null Language code as per RFC 3066
    143      */
    144     public function get_language()
    145     {
    146         if ($this->lang !== null)
    147         {
    148             return $this->lang;
    149         }
     139    /**
     140     * Get the language
     141     *
     142     * @link http://tools.ietf.org/html/rfc3066
     143     * @return string|null Language code as per RFC 3066
     144     */
     145    public function get_language()
     146    {
     147        if ($this->lang !== null) {
     148            return $this->lang;
     149        }
    150150
    151         return null;
    152     }
     151        return null;
     152    }
    153153
    154     /**
    155      * Get the start time
    156      *
    157      * @return string|null Time in the format 'hh:mm:ss.SSS'
    158      */
    159     public function get_starttime()
    160     {
    161         if ($this->startTime !== null)
    162         {
    163             return $this->startTime;
    164         }
     154    /**
     155     * Get the start time
     156     *
     157     * @return string|null Time in the format 'hh:mm:ss.SSS'
     158     */
     159    public function get_starttime()
     160    {
     161        if ($this->startTime !== null) {
     162            return $this->startTime;
     163        }
    165164
    166         return null;
    167     }
     165        return null;
     166    }
    168167
    169     /**
    170      * Get the text of the caption
    171      *
    172      * @return string|null
    173      */
    174     public function get_text()
    175     {
    176         if ($this->text !== null)
    177         {
    178             return $this->text;
    179         }
     168    /**
     169     * Get the text of the caption
     170     *
     171     * @return string|null
     172     */
     173    public function get_text()
     174    {
     175        if ($this->text !== null) {
     176            return $this->text;
     177        }
    180178
    181         return null;
    182     }
     179        return null;
     180    }
    183181
    184     /**
    185      * Get the content type (not MIME type)
    186      *
    187      * @return string|null Either 'text' or 'html'
    188      */
    189     public function get_type()
    190     {
    191         if ($this->type !== null)
    192         {
    193             return $this->type;
    194         }
     182    /**
     183     * Get the content type (not MIME type)
     184     *
     185     * @return string|null Either 'text' or 'html'
     186     */
     187    public function get_type()
     188    {
     189        if ($this->type !== null) {
     190            return $this->type;
     191        }
    195192
    196         return null;
    197     }
     193        return null;
     194    }
    198195}
     196
     197class_alias('SimplePie\Caption', 'SimplePie_Caption');
Note: See TracChangeset for help on using the changeset viewer.