Ticket #36295: 36295.3.diff
File 36295.3.diff, 4.9 KB (added by , 9 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 * Caches feeds using SimplePie_Cache. 10 * 11 * @since 2.8.0 12 */ 6 13 class WP_Feed_Cache extends SimplePie_Cache { 14 7 15 /** 8 * Create a new SimplePie_Cache object16 * Creates a new SimplePie_Cache object. 9 17 * 10 * @static 11 * @access public 18 * @since 2.8.0 12 19 * 13 20 * @param string $location URL location (scheme is used to determine handler). 14 21 * @param string $filename Unique identifier for cache object. … … 20 27 } 21 28 } 22 29 30 /** 31 * WordPress Feed Cache Transient Class. 32 * 33 * Caches feeds using SimplePie_Cache. 34 * 35 * @since 2.8.0 36 */ 23 37 class WP_Feed_Cache_Transient { 38 39 /** 40 * Holds the transient name. 41 * 42 * @since 2.8.0 43 * @access public 44 * @var string 45 */ 24 46 public $name; 47 48 /** 49 * Holds the transient mod name. 50 * 51 * @since 2.8.0 52 * @access public 53 * @var string 54 */ 25 55 public $mod_name; 26 public $lifetime = 43200; //Default lifetime in cache of 12 hours27 56 28 57 /** 29 * Class instantiator. 30 * 58 * Holds the cache duration in seconds. 59 * 60 * Defaults to 43200 seconds (12 hours). 61 * 62 * @since 2.8.0 63 * @access public 64 * @var int 65 */ 66 public $lifetime = 43200; 67 68 /** 69 * Constructor. 70 * 71 * @since 2.8.0 72 * @since 3.2.0 Update to PHP5 constructor 73 * 31 74 * @param string $location URL location (scheme is used to determine handler). 32 75 * @param string $filename Unique identifier for cache object. 33 76 * @param string $extension 'spi' or 'spc'. … … 49 92 } 50 93 51 94 /** 52 * @access public95 * Sets the transient. 53 96 * 97 * @since 2.8.0 98 * 54 99 * @param SimplePie $data Data to save. 55 100 * @return true Always true. 56 101 */ … … 65 110 } 66 111 67 112 /** 68 * @access public 113 * Gets the transient. 114 * 115 * @since 2.8.0 116 * @return mixed Transient value. 69 117 */ 70 118 public function load() { 71 119 return get_transient($this->name); … … 72 120 } 73 121 74 122 /** 75 * @access public 123 * Gets mod transient. 124 * 125 * @since 2.8.0 126 * @return mixed Transient value. 76 127 */ 77 128 public function mtime() { 78 129 return get_transient($this->mod_name); … … 79 130 } 80 131 81 132 /** 82 * @access public 133 * Sets mod transient. 134 * 135 * @since 2.8.0 136 * @return bool False if value was not set and true if value was set. 83 137 */ 84 138 public function touch() { 85 139 return set_transient($this->mod_name, time(), $this->lifetime); … … 86 140 } 87 141 88 142 /** 89 * @access public 143 * Deletes transients. 144 * 145 * @since 2.8.0 146 * @return true Always true. 90 147 */ 91 148 public function unlink() { 92 149 delete_transient($this->name); … … 95 152 } 96 153 } 97 154 155 /** 156 * WordPress SimplePie File Class. 157 * 158 * Fetches remote files and reads local files. 159 * 160 * @since 2.8.0 161 */ 98 162 class WP_SimplePie_File extends SimplePie_File { 99 163 164 /** 165 * Constructor. 166 * 167 * @since 2.8.0 168 * @since 3.2.0 Update to PHP5 constructor 169 * 170 * @param string $url Remote file URL. 171 * @param integer $timeout How long the connection should stay open in seconds. Default: 10. 172 * @param integer $redirects The number of allowed redirects. Default: 5. 173 * @param string|array $headers Array or string of headers to send with the request. Default: null. 174 * @param string $useragent User-agent value sent. Default: null. 175 * @param boolean $force_fsockopen Whether to force opening internet or unix domain socket connection 176 * or not. Default: false. 177 */ 100 178 public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { 101 179 $this->url = $url; 102 180 $this->timeout = $timeout; … … 136 214 } 137 215 138 216 /** 139 * WordPress SimplePie Sanitization Class 217 * WordPress SimplePie Sanitization Class. 140 218 * 141 * Exten sion ofthe SimplePie_Sanitize class to use KSES, because142 * we cannot universally count on DOMDocument being available 219 * Extends the SimplePie_Sanitize class to use KSES, because 220 * we cannot universally count on DOMDocument being available. 143 221 * 144 * @package WordPress145 222 * @since 3.5.0 146 223 */ 147 224 class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize { 225 226 /** 227 * WordPress SimplePie sanitization using KSES. 228 * 229 * Sanitizes the incoming data, to ensure that it matches the type of data expected, using KSES. 230 * 231 * @since 3.5.0 232 * 233 * @param mixed $data The data that needs to be sanitized. 234 * @param integer $type The type of data that it's supposed to be. 235 * @param string $base The `xml:base` value to use when converting relative URLs to absolute ones. 236 * @return mixed Sanitized data. 237 */ 148 238 public function sanitize( $data, $type, $base = '' ) { 149 239 $data = trim( $data ); 150 240 if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) {