X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be15bd505d66a91e2c80062190b13e315a04a9..8d3bb1a5dcfdea9857d3c88c3751f09593e34dc8:/wp-includes/class-feed.php diff --git a/wp-includes/class-feed.php b/wp-includes/class-feed.php index bdad84db..d525fe32 100644 --- a/wp-includes/class-feed.php +++ b/wp-includes/class-feed.php @@ -1,62 +1,193 @@ name = 'feed_' . $filename; $this->mod_name = 'feed_mod_' . $filename; - $this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $this->lifetime, $filename); + + $lifetime = $this->lifetime; + /** + * Filters the transient lifetime of the feed cache. + * + * @since 2.8.0 + * + * @param int $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours). + * @param string $filename Unique identifier for the cache object. + */ + $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename); } - function save($data) { - if ( is_a($data, 'SimplePie') ) + /** + * Sets the transient. + * + * @since 2.8.0 + * @access public + * + * @param SimplePie $data Data to save. + * @return true Always true. + */ + public function save($data) { + if ( $data instanceof SimplePie ) { $data = $data->data; + } set_transient($this->name, $data, $this->lifetime); set_transient($this->mod_name, time(), $this->lifetime); return true; } - function load() { + /** + * Gets the transient. + * + * @since 2.8.0 + * @access public + * + * @return mixed Transient value. + */ + public function load() { return get_transient($this->name); } - function mtime() { + /** + * Gets mod transient. + * + * @since 2.8.0 + * @access public + * + * @return mixed Transient value. + */ + public function mtime() { return get_transient($this->mod_name); } - function touch() { + /** + * Sets mod transient. + * + * @since 2.8.0 + * @access public + * + * @return bool False if value was not set and true if value was set. + */ + public function touch() { return set_transient($this->mod_name, time(), $this->lifetime); } - function unlink() { + /** + * Deletes transients. + * + * @since 2.8.0 + * @access public + * + * @return true Always true. + */ + public function unlink() { delete_transient($this->name); delete_transient($this->mod_name); return true; } } +/** + * Core class for fetching remote files and reading local files with SimplePie. + * + * @since 2.8.0 + * + * @see SimplePie_File + */ class WP_SimplePie_File extends SimplePie_File { - function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { + /** + * Constructor. + * + * @since 2.8.0 + * @since 3.2.0 Updated to use a PHP5 constructor. + * @access public + * + * @param string $url Remote file URL. + * @param integer $timeout Optional. How long the connection should stay open in seconds. + * Default 10. + * @param integer $redirects Optional. The number of allowed redirects. Default 5. + * @param string|array $headers Optional. Array or string of headers to send with the request. + * Default null. + * @param string $useragent Optional. User-agent value sent. Default null. + * @param boolean $force_fsockopen Optional. Whether to force opening internet or unix domain socket + * connection or not. Default false. + */ + public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { $this->url = $url; $this->timeout = $timeout; $this->redirects = $redirects; @@ -95,15 +226,31 @@ class WP_SimplePie_File extends SimplePie_File { } /** - * WordPress SimplePie Sanitization Class + * Core class used to implement SimpliePie feed sanitization. * - * Extension of the SimplePie_Sanitize class to use KSES, because - * we cannot universally count on DOMDocument being available + * Extends the SimplePie_Sanitize class to use KSES, because + * we cannot universally count on DOMDocument being available. * - * @package WordPress * @since 3.5.0 + * + * @see SimplePie_Sanitize */ class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize { + + /** + * WordPress SimplePie sanitization using KSES. + * + * Sanitizes the incoming data, to ensure that it matches the type of data expected, using KSES. + * + * @since 3.5.0 + * @access public + * + * @param mixed $data The data that needs to be sanitized. + * @param integer $type The type of data that it's supposed to be. + * @param string $base Optional. The `xml:base` value to use when converting relative + * URLs to absolute ones. Default empty. + * @return mixed Sanitized data. + */ public function sanitize( $data, $type, $base = '' ) { $data = trim( $data ); if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) {