Make WordPress Core

Ticket #36295: class-feed.php.patch

File class-feed.php.patch, 4.4 KB (added by ramiy, 8 years ago)
  • 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 ?
     13 */
    614class WP_Feed_Cache extends SimplePie_Cache {
     15
    716        /**
    817         * Create a new SimplePie_Cache object
    918         *
    1019         * @static
     20         * @since ?
    1121         * @access public
    1222         *
    1323         * @param string $location  URL location (scheme is used to determine handler).
     
    2030        }
    2131}
    2232
     33/**
     34 * WordPress Feed Cache Transient Class
     35 *
     36 * Used to cache feeds using SimplePie_Cache
     37 *
     38 * @package WordPress
     39 * @since ?
     40 */
    2341class WP_Feed_Cache_Transient {
     42
     43        /**
     44         * Holds the transient name.
     45         *
     46         * @since ?
     47         * @access public
     48         * @var string
     49         */
    2450        public $name;
     51
     52        /**
     53         * Holds the transient mod name.
     54         *
     55         * @since ?
     56         * @access public
     57         * @var string
     58         */
    2559        public $mod_name;
    26         public $lifetime = 43200; //Default lifetime in cache of 12 hours
    2760
    2861        /**
    29          * Class instantiator.
     62         * Cache duration in seconds.
     63         * Default is 43200 seconds (12 hours).
     64         *
     65         * @since ?
     66         * @access public
     67         * @var integer
     68         */
     69        public $lifetime = 43200;
     70
     71        /**
     72         * Constructor.
     73         *
     74         * @since ?
     75         * @access public
    3076         *
    3177         * @param string $location  URL location (scheme is used to determine handler).
    3278         * @param string $filename  Unique identifier for cache object.
     
    4995        }
    5096
    5197        /**
     98         * Set transient.
     99         *
     100         * @since ?
    52101         * @access public
    53102         *
    54103         * @param SimplePie $data Data to save.
     
    65114        }
    66115
    67116        /**
     117         * Get transient.
     118         *
     119         * @since ?
    68120         * @access public
     121         * @return mixed Transient value.
    69122         */
    70123        public function load() {
    71124                return get_transient($this->name);
     
    72125        }
    73126
    74127        /**
     128         * Get mod transient.
     129         *
     130         * @since ?
    75131         * @access public
     132         * @return mixed Transient value.
    76133         */
    77134        public function mtime() {
    78135                return get_transient($this->mod_name);
     
    79136        }
    80137
    81138        /**
     139         * Set mod transient.
     140         *
     141         * @since ?
    82142         * @access public
     143         * @return bool False if value was not set and true if value was set.
    83144         */
    84145        public function touch() {
    85146                return set_transient($this->mod_name, time(), $this->lifetime);
     
    86147        }
    87148
    88149        /**
     150         * Delete transients.
     151         *
     152         * @since ?
    89153         * @access public
     154         * @return true Always true.
    90155         */
    91156        public function unlink() {
    92157                delete_transient($this->name);
     
    95160        }
    96161}
    97162
     163/**
     164 * WordPress SimplePie File Class
     165 *
     166 * Used for fetching remote files and reading local files.
     167 *
     168 * @package WordPress
     169 * @since ?
     170 */
    98171class WP_SimplePie_File extends SimplePie_File {
    99172
     173        /**
     174         * Constructor.
     175         *
     176         * @since ?
     177         * @access public
     178         *
     179         * @param string       $url             Remote file URL.
     180         * @param integer      $timeout         How long the connection should stay open in seconds. Default: 10.
     181         * @param integer      $redirects       The number of allowed redirects. Default: 5.
     182         * @param string|array $headers         Array or string of headers to send with the request. Default: null.
     183         * @param string       $useragent       User-agent value sent. Default: null.
     184         * @param boolean      $force_fsockopen Wheter to force oppening internet or unix domain socket connection
     185         *                                      or not. Default: false.
     186         */
    100187        public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
    101188                $this->url = $url;
    102189                $this->timeout = $timeout;
     
    145232 * @since 3.5.0
    146233 */
    147234class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize {
     235
     236        /**
     237         * WordPress SimplePie sanitization using KSES.
     238         *
     239         * Sanitizes the incoming data, to ensure that it matches the type of data expected, using KSES.
     240         *
     241         * @since 3.5.0
     242         * @access public
     243         *
     244         * @param mixed   $data The data that needs to be sanitized.
     245         * @param integer $type The type of data that it's supposed to be.
     246         * @param string  $base The `xml:base` value to use when converting relative URLs to absolute ones.
     247         * @return mixed Sanitized data.
     248         */
    148249        public function sanitize( $data, $type, $base = '' ) {
    149250                $data = trim( $data );
    150251                if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) {