Ticket #36295: 36295.2.diff
File 36295.2.diff, 4.6 KB (added by , 7 years ago) |
---|
-
src/wp-includes/class-feed.php
3 3 if ( ! class_exists( 'SimplePie', false ) ) 4 4 require_once( ABSPATH . WPINC . '/class-simplepie.php' ); 5 5 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 */ 6 14 class WP_Feed_Cache extends SimplePie_Cache { 15 7 16 /** 8 17 * Create a new SimplePie_Cache object 9 18 * 10 * @static 11 * @access public 19 * @since 2.8.0 12 20 * 13 21 * @param string $location URL location (scheme is used to determine handler). 14 22 * @param string $filename Unique identifier for cache object. … … 20 28 } 21 29 } 22 30 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 */ 23 39 class WP_Feed_Cache_Transient { 40 41 /** 42 * Holds the transient name. 43 * 44 * @since 2.8.0 45 * @access public 46 * @var string 47 */ 24 48 public $name; 49 50 /** 51 * Holds the transient mod name. 52 * 53 * @since 2.8.0 54 * @access public 55 * @var string 56 */ 25 57 public $mod_name; 26 public $lifetime = 43200; //Default lifetime in cache of 12 hours27 58 28 59 /** 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 * 31 75 * @param string $location URL location (scheme is used to determine handler). 32 76 * @param string $filename Unique identifier for cache object. 33 77 * @param string $extension 'spi' or 'spc'. … … 49 93 } 50 94 51 95 /** 52 * @access public96 * Set transient. 53 97 * 98 * @since 2.8.0 99 * 54 100 * @param SimplePie $data Data to save. 55 101 * @return true Always true. 56 102 */ … … 65 111 } 66 112 67 113 /** 68 * @access public 114 * Get transient. 115 * 116 * @since 2.8.0 117 * @return mixed Transient value. 69 118 */ 70 119 public function load() { 71 120 return get_transient($this->name); … … 72 121 } 73 122 74 123 /** 75 * @access public 124 * Get mod transient. 125 * 126 * @since 2.8.0 127 * @return mixed Transient value. 76 128 */ 77 129 public function mtime() { 78 130 return get_transient($this->mod_name); … … 79 131 } 80 132 81 133 /** 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. 83 138 */ 84 139 public function touch() { 85 140 return set_transient($this->mod_name, time(), $this->lifetime); … … 86 141 } 87 142 88 143 /** 89 * @access public 144 * Delete transients. 145 * 146 * @since 2.8.0 147 * @return true Always true. 90 148 */ 91 149 public function unlink() { 92 150 delete_transient($this->name); … … 95 153 } 96 154 } 97 155 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 */ 98 164 class WP_SimplePie_File extends SimplePie_File { 99 165 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 */ 100 180 public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { 101 181 $this->url = $url; 102 182 $this->timeout = $timeout; … … 145 225 * @since 3.5.0 146 226 */ 147 227 class 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 */ 148 241 public function sanitize( $data, $type, $base = '' ) { 149 242 $data = trim( $data ); 150 243 if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) {