Make WordPress Core

Ticket #36295: 36295.2.diff

File 36295.2.diff, 4.6 KB (added by stevenkword, 7 years ago)
  • src/wp-includes/class-feed.php

     
    33if ( ! class_exists( 'SimplePie', false ) )
    44        require_once( ABSPATH . WPINC . '/class-simplepie.php' );
    55
     6/**
     7 * WordPress Feed Cache Class
     8 *
     9 * Used to cache feeds using SimplePie_Cache.
     10 *
     11 * @package WordPress
     12 * @since 2.8.0
     13 */
    614class WP_Feed_Cache extends SimplePie_Cache {
     15
    716        /**
    817         * Create a new SimplePie_Cache object
    918         *
    10          * @static
    11          * @access public
     19         * @since 2.8.0
    1220         *
    1321         * @param string $location  URL location (scheme is used to determine handler).
    1422         * @param string $filename  Unique identifier for cache object.
     
    2028        }
    2129}
    2230
     31/**
     32 * WordPress Feed Cache Transient Class
     33 *
     34 * Used to cache feeds using SimplePie_Cache.
     35 *
     36 * @package WordPress
     37 * @since 2.8.0
     38 */
    2339class WP_Feed_Cache_Transient {
     40
     41        /**
     42         * Holds the transient name.
     43         *
     44         * @since 2.8.0
     45         * @access public
     46         * @var string
     47         */
    2448        public $name;
     49
     50        /**
     51         * Holds the transient mod name.
     52         *
     53         * @since 2.8.0
     54         * @access public
     55         * @var string
     56         */
    2557        public $mod_name;
    26         public $lifetime = 43200; //Default lifetime in cache of 12 hours
    2758
    2859        /**
    29          * Class instantiator.
    30          *
     60         * Cache duration in seconds.
     61         * Default is 43200 seconds (12 hours).
     62         *
     63         * @since 2.8.0
     64         * @access public
     65         * @var int
     66         */
     67        public $lifetime = 43200;
     68
     69        /**
     70         * Constructor.
     71         *
     72         * @since 2.8.0
     73         * @since 3.2.0 Update to PHP5 constructor
     74         *
    3175         * @param string $location  URL location (scheme is used to determine handler).
    3276         * @param string $filename  Unique identifier for cache object.
    3377         * @param string $extension 'spi' or 'spc'.
     
    4993        }
    5094
    5195        /**
    52          * @access public
     96         * Set transient.
    5397         *
     98         * @since 2.8.0
     99         *
    54100         * @param SimplePie $data Data to save.
    55101         * @return true Always true.
    56102         */
     
    65111        }
    66112
    67113        /**
    68          * @access public
     114         * Get transient.
     115         *
     116         * @since 2.8.0
     117         * @return mixed Transient value.
    69118         */
    70119        public function load() {
    71120                return get_transient($this->name);
     
    72121        }
    73122
    74123        /**
    75          * @access public
     124         * Get mod transient.
     125         *
     126         * @since 2.8.0
     127         * @return mixed Transient value.
    76128         */
    77129        public function mtime() {
    78130                return get_transient($this->mod_name);
     
    79131        }
    80132
    81133        /**
    82          * @access public
     134         * Set mod transient.
     135         *
     136         * @since 2.8.0
     137         * @return bool False if value was not set and true if value was set.
    83138         */
    84139        public function touch() {
    85140                return set_transient($this->mod_name, time(), $this->lifetime);
     
    86141        }
    87142
    88143        /**
    89          * @access public
     144         * Delete transients.
     145         *
     146         * @since 2.8.0
     147         * @return true Always true.
    90148         */
    91149        public function unlink() {
    92150                delete_transient($this->name);
     
    95153        }
    96154}
    97155
     156/**
     157 * WordPress SimplePie File Class
     158 *
     159 * Used for fetching remote files and reading local files.
     160 *
     161 * @package WordPress
     162 * @since 2.8.0
     163 */
    98164class WP_SimplePie_File extends SimplePie_File {
    99165
     166        /**
     167         * Constructor.
     168         *
     169         * @since 2.8.0
     170         * @since 3.2.0 Update to PHP5 constructor
     171         *
     172         * @param string       $url             Remote file URL.
     173         * @param integer      $timeout         How long the connection should stay open in seconds. Default: 10.
     174         * @param integer      $redirects       The number of allowed redirects. Default: 5.
     175         * @param string|array $headers         Array or string of headers to send with the request. Default: null.
     176         * @param string       $useragent       User-agent value sent. Default: null.
     177         * @param boolean      $force_fsockopen Whether to force opening internet or unix domain socket connection
     178         *                                      or not. Default: false.
     179         */
    100180        public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
    101181                $this->url = $url;
    102182                $this->timeout = $timeout;
     
    145225 * @since 3.5.0
    146226 */
    147227class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize {
     228
     229        /**
     230         * WordPress SimplePie sanitization using KSES.
     231         *
     232         * Sanitizes the incoming data, to ensure that it matches the type of data expected, using KSES.
     233         *
     234         * @since 3.5.0
     235         *
     236         * @param mixed   $data The data that needs to be sanitized.
     237         * @param integer $type The type of data that it's supposed to be.
     238         * @param string  $base The `xml:base` value to use when converting relative URLs to absolute ones.
     239         * @return mixed Sanitized data.
     240         */
    148241        public function sanitize( $data, $type, $base = '' ) {
    149242                $data = trim( $data );
    150243                if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) {