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/Category.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;
     46
    4447/**
    4548 * Manages all category-related data
    4649 *
    47  * Used by {@see SimplePie_Item::get_category()} and {@see SimplePie_Item::get_categories()}
     50 * Used by {@see \SimplePie\Item::get_category()} and {@see \SimplePie\Item::get_categories()}
    4851 *
    49  * This class can be overloaded with {@see SimplePie::set_category_class()}
     52 * This class can be overloaded with {@see \SimplePie\SimplePie::set_category_class()}
    5053 *
    5154 * @package SimplePie
    5255 * @subpackage API
    5356 */
    54 class SimplePie_Category
     57class Category
    5558{
    56     /**
    57     * Category identifier
    58     *
    59     * @var string|null
    60     * @see get_term
    61     */
    62     var $term;
     59    /**
     60    * Category identifier
     61    *
     62    * @var string|null
     63    * @see get_term
     64    */
     65    public $term;
    6366
    64     /**
    65     * Categorization scheme identifier
    66     *
    67     * @var string|null
    68     * @see get_scheme()
    69     */
    70     var $scheme;
     67    /**
     68    * Categorization scheme identifier
     69    *
     70    * @var string|null
     71    * @see get_scheme()
     72    */
     73    public $scheme;
    7174
    72     /**
    73     * Human readable label
    74     *
    75     * @var string|null
    76     * @see get_label()
    77     */
    78     var $label;
     75    /**
     76    * Human readable label
     77    *
     78    * @var string|null
     79    * @see get_label()
     80    */
     81    public $label;
    7982
    80     /**
    81     * Category type
    82      *
    83     * category for <category>
    84     * subject for <dc:subject>
    85     *
    86     * @var string|null
    87     * @see get_type()
    88     */
    89     var $type;
     83    /**
     84    * Category type
     85     *
     86    * category for <category>
     87    * subject for <dc:subject>
     88    *
     89    * @var string|null
     90    * @see get_type()
     91    */
     92    public $type;
    9093
    91     /**
    92     * Constructor, used to input the data
    93     *
    94     * @param string|null $term
    95     * @param string|null $scheme
    96     * @param string|null $label
    97     * @param string|null $type
    98     */
    99     public function __construct($term = null, $scheme = null, $label = null, $type = null)
    100     {
    101         $this->term = $term;
    102         $this->scheme = $scheme;
    103         $this->label = $label;
    104         $this->type = $type;
    105     }
     94    /**
     95    * Constructor, used to input the data
     96    *
     97    * @param string|null $term
     98    * @param string|null $scheme
     99    * @param string|null $label
     100    * @param string|null $type
     101    */
     102    public function __construct($term = null, $scheme = null, $label = null, $type = null)
     103    {
     104        $this->term = $term;
     105        $this->scheme = $scheme;
     106        $this->label = $label;
     107        $this->type = $type;
     108    }
    106109
    107     /**
    108     * String-ified version
    109     *
    110     * @return string
    111     */
    112     public function __toString()
    113     {
    114         // There is no $this->data here
    115         return md5(serialize($this));
    116     }
     110    /**
     111    * String-ified version
     112    *
     113    * @return string
     114    */
     115    public function __toString()
     116    {
     117        // There is no $this->data here
     118        return md5(serialize($this));
     119    }
    117120
    118     /**
    119     * Get the category identifier
    120     *
    121     * @return string|null
    122     */
    123     public function get_term()
    124     {
    125         return $this->term;
    126     }
     121    /**
     122    * Get the category identifier
     123    *
     124    * @return string|null
     125    */
     126    public function get_term()
     127    {
     128        return $this->term;
     129    }
    127130
    128     /**
    129     * Get the categorization scheme identifier
    130     *
    131     * @return string|null
    132     */
    133     public function get_scheme()
    134     {
    135         return $this->scheme;
    136     }
     131    /**
     132    * Get the categorization scheme identifier
     133    *
     134    * @return string|null
     135    */
     136    public function get_scheme()
     137    {
     138        return $this->scheme;
     139    }
    137140
    138     /**
    139      * Get the human readable label
    140      *
    141      * @param bool $strict
    142      * @return string|null
    143      */
    144     public function get_label($strict = false)
    145     {
    146         if ($this->label === null && $strict !== true)
    147         {
    148             return $this->get_term();
    149         }
    150         return $this->label;
    151     }
     141    /**
     142     * Get the human readable label
     143     *
     144     * @param bool $strict
     145     * @return string|null
     146     */
     147    public function get_label($strict = false)
     148    {
     149        if ($this->label === null && $strict !== true) {
     150            return $this->get_term();
     151        }
     152        return $this->label;
     153    }
    152154
    153     /**
    154     * Get the category type
    155     *
    156     * @return string|null
    157     */
    158     public function get_type()
    159     {
    160         return $this->type;
    161     }
     155    /**
     156    * Get the category type
     157    *
     158    * @return string|null
     159    */
     160    public function get_type()
     161    {
     162        return $this->type;
     163    }
    162164}
    163165
     166class_alias('SimplePie\Category', 'SimplePie_Category');
Note: See TracChangeset for help on using the changeset viewer.