| 1 |
<?php |
| 2 |
/** |
| 3 |
* Friends: SimplePie_File_Accept_Only_RSS class |
| 4 |
* |
| 5 |
* @package Friends |
| 6 |
* @since 1.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Friends; |
| 10 |
|
| 11 |
/** |
| 12 |
* Send an accept header that only allows for Atom or RSS. |
| 13 |
* |
| 14 |
* @see \WP_SimplePie_File |
| 15 |
*/ |
| 16 |
class SimplePie_File_Accept_Only_RSS extends \WP_SimplePie_File { |
| 17 |
|
| 18 |
/** |
| 19 |
* Constructor. |
| 20 |
* |
| 21 |
* @since 2.8.0 |
| 22 |
* @since 3.2.0 Updated to use a PHP5 constructor. |
| 23 |
* |
| 24 |
* @param string $url Remote file URL. |
| 25 |
* @param int $timeout Optional. How long the connection should stay open in seconds. |
| 26 |
* Default 10. |
| 27 |
* @param int $redirects Optional. The number of allowed redirects. Default 5. |
| 28 |
* @param string|array $headers Optional. Array or string of headers to send with the request. |
| 29 |
* Default null. |
| 30 |
* @param string $useragent Optional. User-agent value sent. Default null. |
| 31 |
* @param bool $force_fsockopen Optional. Whether to force opening internet or unix domain socket |
| 32 |
* connection or not. Default false. |
| 33 |
*/ |
| 34 |
public function __construct( $url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false ) { |
| 35 |
if ( ! is_array( $headers ) ) { |
| 36 |
$headers = array(); |
| 37 |
} |
| 38 |
$headers['Accept'] = 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9'; |
| 39 |
return parent::__construct( $url, $timeout, $redirects, $headers, $useragent, $force_fsockopen ); |
| 40 |
} |
| 41 |
} |
| 42 |
|